@mastra/memory 1.39.1 → 1.40.0-alpha.1
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 +51 -12
- package/dist/docs/SKILL.md +1 -6
- package/dist/docs/assets/SOURCE_MAP.json +56 -56
- package/dist/docs/references/docs-agents-human-in-the-loop.md +26 -1
- package/dist/docs/references/docs-guides-context-engineering.md +2 -2
- package/dist/docs/references/docs-harness-background-tasks.md +85 -1
- package/dist/docs/references/docs-memory-memory-processors.md +49 -3
- package/dist/docs/references/docs-memory-observational-memory.md +27 -1
- package/dist/docs/references/docs-memory-semantic-recall.md +20 -20
- package/dist/docs/references/integrations-databases-libsql.md +1 -1
- package/dist/docs/references/integrations-databases-mongodb.md +1 -1
- package/dist/docs/references/integrations-databases-oracledb.md +1 -1
- package/dist/docs/references/integrations-databases-postgresql.md +31 -0
- package/dist/docs/references/reference-memory-memory-class.md +77 -0
- 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-DZnFu-zL.cjs} +671 -623
- package/dist/src-DZnFu-zL.cjs.map +1 -0
- package/dist/{src-CLQXrKvR.js → src-DhDMOGBn.js} +671 -623
- package/dist/src-DhDMOGBn.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 +4 -4
- 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
|
@@ -7,6 +7,7 @@ import { Agent, MessageList } from "@mastra/core/agent";
|
|
|
7
7
|
import { ErrorCategory, ErrorDomain, MastraError, classifyProviderError } from "@mastra/core/error";
|
|
8
8
|
import { coreFeatures } from "@mastra/core/features";
|
|
9
9
|
import { MastraMemory, getMemoryTokenBoundary, getThreadOMMetadata, isAfterMemoryTokenBoundary, isThreadTitlePinned, loadMessageHistory, normalizeMessageHistoryConfig, parseMemoryRequestContext, setThreadOMMetadata } from "@mastra/core/memory";
|
|
10
|
+
import * as coreObservability from "@mastra/core/observability";
|
|
10
11
|
import { EntityType, SpanType, createObservabilityContext, getOrCreateSpan } from "@mastra/core/observability";
|
|
11
12
|
import { MessageHistory, MessageHistory as MessageHistory$1, SemanticRecall, TokenLimiterProcessor, WorkingMemory } from "@mastra/core/processors";
|
|
12
13
|
import { generateEmptyFromSchema } from "@mastra/core/utils";
|
|
@@ -2163,7 +2164,7 @@ function logProxy$2(funcName, namespace, args) {
|
|
|
2163
2164
|
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
|
2164
2165
|
* compatibility/migration issues for any implementation that assume the numeric ordering.
|
|
2165
2166
|
*/
|
|
2166
|
-
var DiagLogLevel$
|
|
2167
|
+
var DiagLogLevel$1;
|
|
2167
2168
|
(function(DiagLogLevel) {
|
|
2168
2169
|
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
|
|
2169
2170
|
DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
|
|
@@ -2182,10 +2183,10 @@ var DiagLogLevel$2;
|
|
|
2182
2183
|
DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
|
|
2183
2184
|
/** Used to set the logging level to include all logging */
|
|
2184
2185
|
DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
|
|
2185
|
-
})(DiagLogLevel$
|
|
2186
|
+
})(DiagLogLevel$1 || (DiagLogLevel$1 = {}));
|
|
2186
2187
|
function createLogLevelDiagLogger$2(maxLevel, logger) {
|
|
2187
|
-
if (maxLevel < DiagLogLevel$
|
|
2188
|
-
else if (maxLevel > DiagLogLevel$
|
|
2188
|
+
if (maxLevel < DiagLogLevel$1.NONE) maxLevel = DiagLogLevel$1.NONE;
|
|
2189
|
+
else if (maxLevel > DiagLogLevel$1.ALL) maxLevel = DiagLogLevel$1.ALL;
|
|
2189
2190
|
logger = logger || {};
|
|
2190
2191
|
function _filterFunc(funcName, theLevel) {
|
|
2191
2192
|
var theFunc = logger[funcName];
|
|
@@ -2193,11 +2194,11 @@ function createLogLevelDiagLogger$2(maxLevel, logger) {
|
|
|
2193
2194
|
return function() {};
|
|
2194
2195
|
}
|
|
2195
2196
|
return {
|
|
2196
|
-
error: _filterFunc("error", DiagLogLevel$
|
|
2197
|
-
warn: _filterFunc("warn", DiagLogLevel$
|
|
2198
|
-
info: _filterFunc("info", DiagLogLevel$
|
|
2199
|
-
debug: _filterFunc("debug", DiagLogLevel$
|
|
2200
|
-
verbose: _filterFunc("verbose", DiagLogLevel$
|
|
2197
|
+
error: _filterFunc("error", DiagLogLevel$1.ERROR),
|
|
2198
|
+
warn: _filterFunc("warn", DiagLogLevel$1.WARN),
|
|
2199
|
+
info: _filterFunc("info", DiagLogLevel$1.INFO),
|
|
2200
|
+
debug: _filterFunc("debug", DiagLogLevel$1.DEBUG),
|
|
2201
|
+
verbose: _filterFunc("verbose", DiagLogLevel$1.VERBOSE)
|
|
2201
2202
|
};
|
|
2202
2203
|
}
|
|
2203
2204
|
var __read$2$1 = function(o, n) {
|
|
@@ -2249,7 +2250,7 @@ var DiagAPI$2 = function() {
|
|
|
2249
2250
|
var self = this;
|
|
2250
2251
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
2251
2252
|
var _a, _b, _c;
|
|
2252
|
-
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$
|
|
2253
|
+
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$1.INFO };
|
|
2253
2254
|
if (logger === self) {
|
|
2254
2255
|
var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
2255
2256
|
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
@@ -2257,7 +2258,7 @@ var DiagAPI$2 = function() {
|
|
|
2257
2258
|
}
|
|
2258
2259
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
2259
2260
|
var oldLogger = getGlobal$2("diag");
|
|
2260
|
-
var newLogger = createLogLevelDiagLogger$2((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$
|
|
2261
|
+
var newLogger = createLogLevelDiagLogger$2((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$1.INFO, logger);
|
|
2261
2262
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
2262
2263
|
var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
2263
2264
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
@@ -2452,17 +2453,17 @@ var ContextAPI$2 = function() {
|
|
|
2452
2453
|
};
|
|
2453
2454
|
return ContextAPI;
|
|
2454
2455
|
}();
|
|
2455
|
-
var TraceFlags$
|
|
2456
|
+
var TraceFlags$1;
|
|
2456
2457
|
(function(TraceFlags) {
|
|
2457
2458
|
/** Represents no flag set. */
|
|
2458
2459
|
TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
|
|
2459
2460
|
/** Bit to represent whether trace is sampled in trace flags. */
|
|
2460
2461
|
TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
|
|
2461
|
-
})(TraceFlags$
|
|
2462
|
+
})(TraceFlags$1 || (TraceFlags$1 = {}));
|
|
2462
2463
|
var INVALID_SPAN_CONTEXT$2 = {
|
|
2463
2464
|
traceId: "00000000000000000000000000000000",
|
|
2464
2465
|
spanId: "0000000000000000",
|
|
2465
|
-
traceFlags: TraceFlags$
|
|
2466
|
+
traceFlags: TraceFlags$1.NONE
|
|
2466
2467
|
};
|
|
2467
2468
|
/**
|
|
2468
2469
|
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
@@ -5676,7 +5677,7 @@ var { btoa: btoa$3, atob: atob$6 } = globalThis;
|
|
|
5676
5677
|
function withoutTrailingSlash$2(url) {
|
|
5677
5678
|
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
5678
5679
|
}
|
|
5679
|
-
// ../_vendored/ai_v5/dist/dist-
|
|
5680
|
+
// ../_vendored/ai_v5/dist/dist-q105Fieh.js
|
|
5680
5681
|
function getContext$2() {
|
|
5681
5682
|
return { headers: {} };
|
|
5682
5683
|
}
|
|
@@ -6655,7 +6656,7 @@ async function getVercelRequestId$2() {
|
|
|
6655
6656
|
var _a10;
|
|
6656
6657
|
return (_a10 = getContext$2().headers) == null ? void 0 : _a10["x-vercel-id"];
|
|
6657
6658
|
}
|
|
6658
|
-
var VERSION$7 = "2.0.
|
|
6659
|
+
var VERSION$7 = "2.0.173";
|
|
6659
6660
|
var AI_GATEWAY_PROTOCOL_VERSION$2 = "0.0.1";
|
|
6660
6661
|
function createGatewayProvider$1(options = {}) {
|
|
6661
6662
|
var _a10, _b10;
|
|
@@ -7000,7 +7001,7 @@ function logProxy$1(funcName, namespace, args) {
|
|
|
7000
7001
|
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
|
7001
7002
|
* compatibility/migration issues for any implementation that assume the numeric ordering.
|
|
7002
7003
|
*/
|
|
7003
|
-
var DiagLogLevel
|
|
7004
|
+
var DiagLogLevel;
|
|
7004
7005
|
(function(DiagLogLevel) {
|
|
7005
7006
|
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
|
|
7006
7007
|
DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
|
|
@@ -7019,10 +7020,10 @@ var DiagLogLevel$1;
|
|
|
7019
7020
|
DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
|
|
7020
7021
|
/** Used to set the logging level to include all logging */
|
|
7021
7022
|
DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
|
|
7022
|
-
})(DiagLogLevel
|
|
7023
|
+
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
7023
7024
|
function createLogLevelDiagLogger$1(maxLevel, logger) {
|
|
7024
|
-
if (maxLevel < DiagLogLevel
|
|
7025
|
-
else if (maxLevel > DiagLogLevel
|
|
7025
|
+
if (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;
|
|
7026
|
+
else if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;
|
|
7026
7027
|
logger = logger || {};
|
|
7027
7028
|
function _filterFunc(funcName, theLevel) {
|
|
7028
7029
|
var theFunc = logger[funcName];
|
|
@@ -7030,11 +7031,11 @@ function createLogLevelDiagLogger$1(maxLevel, logger) {
|
|
|
7030
7031
|
return function() {};
|
|
7031
7032
|
}
|
|
7032
7033
|
return {
|
|
7033
|
-
error: _filterFunc("error", DiagLogLevel
|
|
7034
|
-
warn: _filterFunc("warn", DiagLogLevel
|
|
7035
|
-
info: _filterFunc("info", DiagLogLevel
|
|
7036
|
-
debug: _filterFunc("debug", DiagLogLevel
|
|
7037
|
-
verbose: _filterFunc("verbose", DiagLogLevel
|
|
7034
|
+
error: _filterFunc("error", DiagLogLevel.ERROR),
|
|
7035
|
+
warn: _filterFunc("warn", DiagLogLevel.WARN),
|
|
7036
|
+
info: _filterFunc("info", DiagLogLevel.INFO),
|
|
7037
|
+
debug: _filterFunc("debug", DiagLogLevel.DEBUG),
|
|
7038
|
+
verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
|
|
7038
7039
|
};
|
|
7039
7040
|
}
|
|
7040
7041
|
var __read$2 = function(o, n) {
|
|
@@ -7086,7 +7087,7 @@ var DiagAPI$1 = function() {
|
|
|
7086
7087
|
var self = this;
|
|
7087
7088
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
7088
7089
|
var _a, _b, _c;
|
|
7089
|
-
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel
|
|
7090
|
+
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
7090
7091
|
if (logger === self) {
|
|
7091
7092
|
var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
7092
7093
|
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
@@ -7094,7 +7095,7 @@ var DiagAPI$1 = function() {
|
|
|
7094
7095
|
}
|
|
7095
7096
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
7096
7097
|
var oldLogger = getGlobal$1("diag");
|
|
7097
|
-
var newLogger = createLogLevelDiagLogger$1((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel
|
|
7098
|
+
var newLogger = createLogLevelDiagLogger$1((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
|
|
7098
7099
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
7099
7100
|
var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
7100
7101
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
@@ -7289,17 +7290,17 @@ var ContextAPI$1 = function() {
|
|
|
7289
7290
|
};
|
|
7290
7291
|
return ContextAPI;
|
|
7291
7292
|
}();
|
|
7292
|
-
var TraceFlags
|
|
7293
|
+
var TraceFlags;
|
|
7293
7294
|
(function(TraceFlags) {
|
|
7294
7295
|
/** Represents no flag set. */
|
|
7295
7296
|
TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
|
|
7296
7297
|
/** Bit to represent whether trace is sampled in trace flags. */
|
|
7297
7298
|
TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
|
|
7298
|
-
})(TraceFlags
|
|
7299
|
+
})(TraceFlags || (TraceFlags = {}));
|
|
7299
7300
|
var INVALID_SPAN_CONTEXT$1 = {
|
|
7300
7301
|
traceId: "00000000000000000000000000000000",
|
|
7301
7302
|
spanId: "0000000000000000",
|
|
7302
|
-
traceFlags: TraceFlags
|
|
7303
|
+
traceFlags: TraceFlags.NONE
|
|
7303
7304
|
};
|
|
7304
7305
|
/**
|
|
7305
7306
|
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
@@ -7690,7 +7691,7 @@ function getGlobalProvider$2() {
|
|
|
7690
7691
|
var _a17;
|
|
7691
7692
|
return (_a17 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a17 : gateway$2;
|
|
7692
7693
|
}
|
|
7693
|
-
var VERSION$6 = "5.0.
|
|
7694
|
+
var VERSION$6 = "5.0.282";
|
|
7694
7695
|
var dataContentSchema$1 = z$1.union([
|
|
7695
7696
|
z$1.string(),
|
|
7696
7697
|
z$1.instanceof(Uint8Array),
|
|
@@ -10928,7 +10929,7 @@ var createJsonResponseHandler$1 = (responseSchema) => async ({ response, url, re
|
|
|
10928
10929
|
function withoutTrailingSlash$1(url) {
|
|
10929
10930
|
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
10930
10931
|
}
|
|
10931
|
-
// ../_vendored/ai_v6/dist/dist-
|
|
10932
|
+
// ../_vendored/ai_v6/dist/dist-CFYPWO89.js
|
|
10932
10933
|
function getContext$1() {
|
|
10933
10934
|
return { headers: {} };
|
|
10934
10935
|
}
|
|
@@ -12848,7 +12849,7 @@ async function getVercelRequestId$1() {
|
|
|
12848
12849
|
var _a11;
|
|
12849
12850
|
return (_a11 = getContext$1().headers) == null ? void 0 : _a11["x-vercel-id"];
|
|
12850
12851
|
}
|
|
12851
|
-
var VERSION$4 = "3.0.
|
|
12852
|
+
var VERSION$4 = "3.0.223";
|
|
12852
12853
|
var AI_GATEWAY_PROTOCOL_VERSION$1 = "0.0.1";
|
|
12853
12854
|
function createGatewayProvider(options = {}) {
|
|
12854
12855
|
var _a11, _b11;
|
|
@@ -13052,7 +13053,7 @@ async function getGatewayAuthToken$1(options) {
|
|
|
13052
13053
|
};
|
|
13053
13054
|
}
|
|
13054
13055
|
// ../_vendored/ai_v6/dist/index.js
|
|
13055
|
-
const VERSION$1$1 = "1.
|
|
13056
|
+
const VERSION$1$1 = "1.10.0";
|
|
13056
13057
|
const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
13057
13058
|
/**
|
|
13058
13059
|
* Create a function to test an API version to see if it is compatible with the provided ownVersion.
|
|
@@ -13132,15 +13133,23 @@ const isCompatible = _makeCompatibilityCheck(VERSION$1$1);
|
|
|
13132
13133
|
const major = VERSION$1$1.split(".")[0];
|
|
13133
13134
|
const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
|
|
13134
13135
|
const _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
|
|
13136
|
+
function _makeGlobalApi() {
|
|
13137
|
+
return Object.defineProperty({}, "version", {
|
|
13138
|
+
value: VERSION$1$1,
|
|
13139
|
+
enumerable: true,
|
|
13140
|
+
writable: false,
|
|
13141
|
+
configurable: false
|
|
13142
|
+
});
|
|
13143
|
+
}
|
|
13135
13144
|
function registerGlobal(type, instance, diag, allowOverride = false) {
|
|
13136
|
-
var
|
|
13137
|
-
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (
|
|
13145
|
+
var _global$GLOBAL_OPENTE;
|
|
13146
|
+
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();
|
|
13138
13147
|
if (!allowOverride && api[type]) {
|
|
13139
13148
|
const err = /* @__PURE__ */ new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
|
|
13140
13149
|
diag.error(err.stack || err.message);
|
|
13141
13150
|
return false;
|
|
13142
13151
|
}
|
|
13143
|
-
if (api.version !== "1.
|
|
13152
|
+
if (api.version !== "1.10.0") {
|
|
13144
13153
|
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}`);
|
|
13145
13154
|
diag.error(err.stack || err.message);
|
|
13146
13155
|
return false;
|
|
@@ -13149,11 +13158,15 @@ function registerGlobal(type, instance, diag, allowOverride = false) {
|
|
|
13149
13158
|
diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION$1$1}.`);
|
|
13150
13159
|
return true;
|
|
13151
13160
|
}
|
|
13161
|
+
let _compatibleGlobalApi;
|
|
13152
13162
|
function getGlobal(type) {
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
if (
|
|
13156
|
-
|
|
13163
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
13164
|
+
if (api == null) return;
|
|
13165
|
+
if (api !== _compatibleGlobalApi) {
|
|
13166
|
+
if (!api.version || !isCompatible(api.version)) return;
|
|
13167
|
+
_compatibleGlobalApi = api;
|
|
13168
|
+
}
|
|
13169
|
+
return api[type];
|
|
13157
13170
|
}
|
|
13158
13171
|
function unregisterGlobal(type, diag) {
|
|
13159
13172
|
diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION$1$1}.`);
|
|
@@ -13194,34 +13207,9 @@ function logProxy(funcName, namespace, args) {
|
|
|
13194
13207
|
if (!logger) return;
|
|
13195
13208
|
return logger[funcName](namespace, ...args);
|
|
13196
13209
|
}
|
|
13197
|
-
/**
|
|
13198
|
-
* Defines the available internal logging levels for the diagnostic logger, the numeric values
|
|
13199
|
-
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
|
13200
|
-
* compatibility/migration issues for any implementation that assume the numeric ordering.
|
|
13201
|
-
*/
|
|
13202
|
-
var DiagLogLevel;
|
|
13203
|
-
(function(DiagLogLevel) {
|
|
13204
|
-
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
|
|
13205
|
-
DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
|
|
13206
|
-
/** Identifies an error scenario */
|
|
13207
|
-
DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR";
|
|
13208
|
-
/** Identifies a warning scenario */
|
|
13209
|
-
DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN";
|
|
13210
|
-
/** General informational log message */
|
|
13211
|
-
DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO";
|
|
13212
|
-
/** General debug log message */
|
|
13213
|
-
DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG";
|
|
13214
|
-
/**
|
|
13215
|
-
* Detailed trace level logging should only be used for development, should only be set
|
|
13216
|
-
* in a development environment.
|
|
13217
|
-
*/
|
|
13218
|
-
DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
|
|
13219
|
-
/** Used to set the logging level to include all logging */
|
|
13220
|
-
DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
|
|
13221
|
-
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
13222
13210
|
function createLogLevelDiagLogger(maxLevel, logger) {
|
|
13223
|
-
if (maxLevel <
|
|
13224
|
-
else if (maxLevel >
|
|
13211
|
+
if (maxLevel < 0) maxLevel = 0;
|
|
13212
|
+
else if (maxLevel > 9999) maxLevel = 9999;
|
|
13225
13213
|
logger = logger || {};
|
|
13226
13214
|
function _filterFunc(funcName, theLevel) {
|
|
13227
13215
|
const theFunc = logger[funcName];
|
|
@@ -13229,11 +13217,11 @@ function createLogLevelDiagLogger(maxLevel, logger) {
|
|
|
13229
13217
|
return function() {};
|
|
13230
13218
|
}
|
|
13231
13219
|
return {
|
|
13232
|
-
error: _filterFunc("error",
|
|
13233
|
-
warn: _filterFunc("warn",
|
|
13234
|
-
info: _filterFunc("info",
|
|
13235
|
-
debug: _filterFunc("debug",
|
|
13236
|
-
verbose: _filterFunc("verbose",
|
|
13220
|
+
error: _filterFunc("error", 30),
|
|
13221
|
+
warn: _filterFunc("warn", 50),
|
|
13222
|
+
info: _filterFunc("info", 60),
|
|
13223
|
+
debug: _filterFunc("debug", 70),
|
|
13224
|
+
verbose: _filterFunc("verbose", 80)
|
|
13237
13225
|
};
|
|
13238
13226
|
}
|
|
13239
13227
|
const API_NAME$2 = "diag";
|
|
@@ -13262,18 +13250,20 @@ var DiagAPI = class DiagAPI {
|
|
|
13262
13250
|
};
|
|
13263
13251
|
}
|
|
13264
13252
|
const self = this;
|
|
13265
|
-
const setLogger = (logger, optionsOrLogLevel = { logLevel:
|
|
13266
|
-
var
|
|
13253
|
+
const setLogger = (logger, optionsOrLogLevel = { logLevel: 60 }) => {
|
|
13254
|
+
var _optionsOrLogLevel$lo;
|
|
13267
13255
|
if (logger === self) {
|
|
13256
|
+
var _err$stack;
|
|
13268
13257
|
const err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
13269
|
-
self.error((
|
|
13258
|
+
self.error((_err$stack = err.stack) !== null && _err$stack !== void 0 ? _err$stack : err.message);
|
|
13270
13259
|
return false;
|
|
13271
13260
|
}
|
|
13272
13261
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
13273
13262
|
const oldLogger = getGlobal("diag");
|
|
13274
|
-
const newLogger = createLogLevelDiagLogger((
|
|
13263
|
+
const newLogger = createLogLevelDiagLogger((_optionsOrLogLevel$lo = optionsOrLogLevel.logLevel) !== null && _optionsOrLogLevel$lo !== void 0 ? _optionsOrLogLevel$lo : 60, logger);
|
|
13275
13264
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
13276
|
-
|
|
13265
|
+
var _Error$stack;
|
|
13266
|
+
const stack = (_Error$stack = (/* @__PURE__ */ new Error()).stack) !== null && _Error$stack !== void 0 ? _Error$stack : "<failed to generate stacktrace>";
|
|
13277
13267
|
oldLogger.warn(`Current logger will be overwritten from ${stack}`);
|
|
13278
13268
|
newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
|
|
13279
13269
|
}
|
|
@@ -13328,6 +13318,194 @@ const ROOT_CONTEXT = new class BaseContext {
|
|
|
13328
13318
|
};
|
|
13329
13319
|
}
|
|
13330
13320
|
}();
|
|
13321
|
+
/**
|
|
13322
|
+
* @since 1.0.0
|
|
13323
|
+
*/
|
|
13324
|
+
const INVALID_SPAN_CONTEXT = {
|
|
13325
|
+
traceId: "00000000000000000000000000000000",
|
|
13326
|
+
spanId: "0000000000000000",
|
|
13327
|
+
traceFlags: 0
|
|
13328
|
+
};
|
|
13329
|
+
/**
|
|
13330
|
+
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
13331
|
+
* implementation is available. All operations are no-op including context
|
|
13332
|
+
* propagation.
|
|
13333
|
+
*/
|
|
13334
|
+
var NonRecordingSpan = class {
|
|
13335
|
+
constructor(spanContext = INVALID_SPAN_CONTEXT) {
|
|
13336
|
+
this._spanContext = spanContext;
|
|
13337
|
+
}
|
|
13338
|
+
spanContext() {
|
|
13339
|
+
return this._spanContext;
|
|
13340
|
+
}
|
|
13341
|
+
setAttribute(_key, _value) {
|
|
13342
|
+
return this;
|
|
13343
|
+
}
|
|
13344
|
+
setAttributes(_attributes) {
|
|
13345
|
+
return this;
|
|
13346
|
+
}
|
|
13347
|
+
addEvent(_name, _attributes) {
|
|
13348
|
+
return this;
|
|
13349
|
+
}
|
|
13350
|
+
addLink(_link) {
|
|
13351
|
+
return this;
|
|
13352
|
+
}
|
|
13353
|
+
addLinks(_links) {
|
|
13354
|
+
return this;
|
|
13355
|
+
}
|
|
13356
|
+
setStatus(_status) {
|
|
13357
|
+
return this;
|
|
13358
|
+
}
|
|
13359
|
+
updateName(_name) {
|
|
13360
|
+
return this;
|
|
13361
|
+
}
|
|
13362
|
+
end(_endTime) {}
|
|
13363
|
+
isRecording() {
|
|
13364
|
+
return false;
|
|
13365
|
+
}
|
|
13366
|
+
recordException(_exception, _time) {}
|
|
13367
|
+
};
|
|
13368
|
+
const isHex = new Uint8Array([
|
|
13369
|
+
0,
|
|
13370
|
+
0,
|
|
13371
|
+
0,
|
|
13372
|
+
0,
|
|
13373
|
+
0,
|
|
13374
|
+
0,
|
|
13375
|
+
0,
|
|
13376
|
+
0,
|
|
13377
|
+
0,
|
|
13378
|
+
0,
|
|
13379
|
+
0,
|
|
13380
|
+
0,
|
|
13381
|
+
0,
|
|
13382
|
+
0,
|
|
13383
|
+
0,
|
|
13384
|
+
0,
|
|
13385
|
+
0,
|
|
13386
|
+
0,
|
|
13387
|
+
0,
|
|
13388
|
+
0,
|
|
13389
|
+
0,
|
|
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
|
+
1,
|
|
13418
|
+
1,
|
|
13419
|
+
1,
|
|
13420
|
+
1,
|
|
13421
|
+
1,
|
|
13422
|
+
1,
|
|
13423
|
+
1,
|
|
13424
|
+
1,
|
|
13425
|
+
1,
|
|
13426
|
+
1,
|
|
13427
|
+
0,
|
|
13428
|
+
0,
|
|
13429
|
+
0,
|
|
13430
|
+
0,
|
|
13431
|
+
0,
|
|
13432
|
+
0,
|
|
13433
|
+
0,
|
|
13434
|
+
1,
|
|
13435
|
+
1,
|
|
13436
|
+
1,
|
|
13437
|
+
1,
|
|
13438
|
+
1,
|
|
13439
|
+
1,
|
|
13440
|
+
0,
|
|
13441
|
+
0,
|
|
13442
|
+
0,
|
|
13443
|
+
0,
|
|
13444
|
+
0,
|
|
13445
|
+
0,
|
|
13446
|
+
0,
|
|
13447
|
+
0,
|
|
13448
|
+
0,
|
|
13449
|
+
0,
|
|
13450
|
+
0,
|
|
13451
|
+
0,
|
|
13452
|
+
0,
|
|
13453
|
+
0,
|
|
13454
|
+
0,
|
|
13455
|
+
0,
|
|
13456
|
+
0,
|
|
13457
|
+
0,
|
|
13458
|
+
0,
|
|
13459
|
+
0,
|
|
13460
|
+
0,
|
|
13461
|
+
0,
|
|
13462
|
+
0,
|
|
13463
|
+
0,
|
|
13464
|
+
0,
|
|
13465
|
+
0,
|
|
13466
|
+
1,
|
|
13467
|
+
1,
|
|
13468
|
+
1,
|
|
13469
|
+
1,
|
|
13470
|
+
1,
|
|
13471
|
+
1
|
|
13472
|
+
]);
|
|
13473
|
+
function isValidHex(id, length) {
|
|
13474
|
+
if (typeof id !== "string" || id.length !== length) return false;
|
|
13475
|
+
let r = 0;
|
|
13476
|
+
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);
|
|
13477
|
+
return r === length;
|
|
13478
|
+
}
|
|
13479
|
+
/**
|
|
13480
|
+
* @since 1.0.0
|
|
13481
|
+
*/
|
|
13482
|
+
function isValidTraceId(traceId) {
|
|
13483
|
+
return isValidHex(traceId, 32) && traceId !== "00000000000000000000000000000000";
|
|
13484
|
+
}
|
|
13485
|
+
/**
|
|
13486
|
+
* @since 1.0.0
|
|
13487
|
+
*/
|
|
13488
|
+
function isValidSpanId(spanId) {
|
|
13489
|
+
return isValidHex(spanId, 16) && spanId !== "0000000000000000";
|
|
13490
|
+
}
|
|
13491
|
+
/**
|
|
13492
|
+
* Returns true if this {@link SpanContext} is valid.
|
|
13493
|
+
* @return true if this {@link SpanContext} is valid.
|
|
13494
|
+
*
|
|
13495
|
+
* @since 1.0.0
|
|
13496
|
+
*/
|
|
13497
|
+
function isSpanContextValid(spanContext) {
|
|
13498
|
+
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
13499
|
+
}
|
|
13500
|
+
/**
|
|
13501
|
+
* Wrap the given {@link SpanContext} in a new non-recording {@link Span}
|
|
13502
|
+
*
|
|
13503
|
+
* @param spanContext span context to be wrapped
|
|
13504
|
+
* @returns a new non-recording {@link Span} with the provided context
|
|
13505
|
+
*/
|
|
13506
|
+
function wrapSpanContext(spanContext) {
|
|
13507
|
+
return new NonRecordingSpan(spanContext);
|
|
13508
|
+
}
|
|
13331
13509
|
var NoopContextManager = class {
|
|
13332
13510
|
active() {
|
|
13333
13511
|
return ROOT_CONTEXT;
|
|
@@ -13344,9 +13522,14 @@ var NoopContextManager = class {
|
|
|
13344
13522
|
disable() {
|
|
13345
13523
|
return this;
|
|
13346
13524
|
}
|
|
13525
|
+
/** @experimental This API is experimental and may change in minor releases without prior notice. */
|
|
13526
|
+
attach(_context) {
|
|
13527
|
+
return { dispose() {} };
|
|
13528
|
+
}
|
|
13347
13529
|
};
|
|
13348
13530
|
const API_NAME$1 = "context";
|
|
13349
13531
|
const NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
13532
|
+
const NOOP_TOKEN = Object.freeze({ dispose: () => {} });
|
|
13350
13533
|
/**
|
|
13351
13534
|
* Singleton object which represents the entry point to the OpenTelemetry Context API
|
|
13352
13535
|
*
|
|
@@ -13354,7 +13537,9 @@ const NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
|
13354
13537
|
*/
|
|
13355
13538
|
var ContextAPI = class ContextAPI {
|
|
13356
13539
|
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
13357
|
-
constructor() {
|
|
13540
|
+
constructor() {
|
|
13541
|
+
this._attachUnsupportedWarned = false;
|
|
13542
|
+
}
|
|
13358
13543
|
/** Get the singleton instance of the Context API */
|
|
13359
13544
|
static getInstance() {
|
|
13360
13545
|
if (!this._instance) this._instance = new ContextAPI();
|
|
@@ -13394,6 +13579,37 @@ var ContextAPI = class ContextAPI {
|
|
|
13394
13579
|
bind(context, target) {
|
|
13395
13580
|
return this._getContextManager().bind(context, target);
|
|
13396
13581
|
}
|
|
13582
|
+
/**
|
|
13583
|
+
* Imperatively sets `context` as active, returning a {@link ContextManagementToken} whose
|
|
13584
|
+
* {@link ContextManagementToken.dispose} restores the previous context.
|
|
13585
|
+
*
|
|
13586
|
+
* This is a delicate, low-level API - prefer {@link with}/{@link bind}, which
|
|
13587
|
+
* restore context automatically. Use `attach` only to bridge callback
|
|
13588
|
+
* boundaries that `with` cannot wrap. Call `token.dispose()` when the
|
|
13589
|
+
* operation is done.
|
|
13590
|
+
*
|
|
13591
|
+
* **Caveat for async functions:** If called inside an async function before
|
|
13592
|
+
* the first `await`, the context change may leak into the caller's context
|
|
13593
|
+
* and remain active there. Prefer {@link with} for async code.
|
|
13594
|
+
*
|
|
13595
|
+
* Support is best-effort and varies by the active ContextManager (see
|
|
13596
|
+
* {@link ContextManager.attach}); if it does not implement `attach`, this logs
|
|
13597
|
+
* a warning and returns a no-op token.
|
|
13598
|
+
*
|
|
13599
|
+
* @param context The Context to attach
|
|
13600
|
+
* @returns A {@link ContextManagementToken} whose dispose() restores the previous Context
|
|
13601
|
+
* @since 1.10.0
|
|
13602
|
+
* @experimental This API is experimental and may change in minor releases without prior notice.
|
|
13603
|
+
*/
|
|
13604
|
+
attach(context) {
|
|
13605
|
+
const contextManager = this._getContextManager();
|
|
13606
|
+
if (contextManager.attach) return contextManager.attach(context);
|
|
13607
|
+
if (!this._attachUnsupportedWarned) {
|
|
13608
|
+
this._attachUnsupportedWarned = true;
|
|
13609
|
+
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.");
|
|
13610
|
+
}
|
|
13611
|
+
return NOOP_TOKEN;
|
|
13612
|
+
}
|
|
13397
13613
|
_getContextManager() {
|
|
13398
13614
|
return getGlobal(API_NAME$1) || NOOP_CONTEXT_MANAGER;
|
|
13399
13615
|
}
|
|
@@ -13404,63 +13620,6 @@ var ContextAPI = class ContextAPI {
|
|
|
13404
13620
|
}
|
|
13405
13621
|
};
|
|
13406
13622
|
/**
|
|
13407
|
-
* @since 1.0.0
|
|
13408
|
-
*/
|
|
13409
|
-
var TraceFlags;
|
|
13410
|
-
(function(TraceFlags) {
|
|
13411
|
-
/** Represents no flag set. */
|
|
13412
|
-
TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
|
|
13413
|
-
/** Bit to represent whether trace is sampled in trace flags. */
|
|
13414
|
-
TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
|
|
13415
|
-
})(TraceFlags || (TraceFlags = {}));
|
|
13416
|
-
/**
|
|
13417
|
-
* @since 1.0.0
|
|
13418
|
-
*/
|
|
13419
|
-
const INVALID_SPAN_CONTEXT = {
|
|
13420
|
-
traceId: "00000000000000000000000000000000",
|
|
13421
|
-
spanId: "0000000000000000",
|
|
13422
|
-
traceFlags: TraceFlags.NONE
|
|
13423
|
-
};
|
|
13424
|
-
/**
|
|
13425
|
-
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
13426
|
-
* implementation is available. All operations are no-op including context
|
|
13427
|
-
* propagation.
|
|
13428
|
-
*/
|
|
13429
|
-
var NonRecordingSpan = class {
|
|
13430
|
-
constructor(spanContext = INVALID_SPAN_CONTEXT) {
|
|
13431
|
-
this._spanContext = spanContext;
|
|
13432
|
-
}
|
|
13433
|
-
spanContext() {
|
|
13434
|
-
return this._spanContext;
|
|
13435
|
-
}
|
|
13436
|
-
setAttribute(_key, _value) {
|
|
13437
|
-
return this;
|
|
13438
|
-
}
|
|
13439
|
-
setAttributes(_attributes) {
|
|
13440
|
-
return this;
|
|
13441
|
-
}
|
|
13442
|
-
addEvent(_name, _attributes) {
|
|
13443
|
-
return this;
|
|
13444
|
-
}
|
|
13445
|
-
addLink(_link) {
|
|
13446
|
-
return this;
|
|
13447
|
-
}
|
|
13448
|
-
addLinks(_links) {
|
|
13449
|
-
return this;
|
|
13450
|
-
}
|
|
13451
|
-
setStatus(_status) {
|
|
13452
|
-
return this;
|
|
13453
|
-
}
|
|
13454
|
-
updateName(_name) {
|
|
13455
|
-
return this;
|
|
13456
|
-
}
|
|
13457
|
-
end(_endTime) {}
|
|
13458
|
-
isRecording() {
|
|
13459
|
-
return false;
|
|
13460
|
-
}
|
|
13461
|
-
recordException(_exception, _time) {}
|
|
13462
|
-
};
|
|
13463
|
-
/**
|
|
13464
13623
|
* span key
|
|
13465
13624
|
*/
|
|
13466
13625
|
const SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
@@ -13511,149 +13670,8 @@ function setSpanContext(context, spanContext) {
|
|
|
13511
13670
|
* @param context context to get values from
|
|
13512
13671
|
*/
|
|
13513
13672
|
function getSpanContext(context) {
|
|
13514
|
-
var
|
|
13515
|
-
return (
|
|
13516
|
-
}
|
|
13517
|
-
const isHex = new Uint8Array([
|
|
13518
|
-
0,
|
|
13519
|
-
0,
|
|
13520
|
-
0,
|
|
13521
|
-
0,
|
|
13522
|
-
0,
|
|
13523
|
-
0,
|
|
13524
|
-
0,
|
|
13525
|
-
0,
|
|
13526
|
-
0,
|
|
13527
|
-
0,
|
|
13528
|
-
0,
|
|
13529
|
-
0,
|
|
13530
|
-
0,
|
|
13531
|
-
0,
|
|
13532
|
-
0,
|
|
13533
|
-
0,
|
|
13534
|
-
0,
|
|
13535
|
-
0,
|
|
13536
|
-
0,
|
|
13537
|
-
0,
|
|
13538
|
-
0,
|
|
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
|
-
1,
|
|
13567
|
-
1,
|
|
13568
|
-
1,
|
|
13569
|
-
1,
|
|
13570
|
-
1,
|
|
13571
|
-
1,
|
|
13572
|
-
1,
|
|
13573
|
-
1,
|
|
13574
|
-
1,
|
|
13575
|
-
1,
|
|
13576
|
-
0,
|
|
13577
|
-
0,
|
|
13578
|
-
0,
|
|
13579
|
-
0,
|
|
13580
|
-
0,
|
|
13581
|
-
0,
|
|
13582
|
-
0,
|
|
13583
|
-
1,
|
|
13584
|
-
1,
|
|
13585
|
-
1,
|
|
13586
|
-
1,
|
|
13587
|
-
1,
|
|
13588
|
-
1,
|
|
13589
|
-
0,
|
|
13590
|
-
0,
|
|
13591
|
-
0,
|
|
13592
|
-
0,
|
|
13593
|
-
0,
|
|
13594
|
-
0,
|
|
13595
|
-
0,
|
|
13596
|
-
0,
|
|
13597
|
-
0,
|
|
13598
|
-
0,
|
|
13599
|
-
0,
|
|
13600
|
-
0,
|
|
13601
|
-
0,
|
|
13602
|
-
0,
|
|
13603
|
-
0,
|
|
13604
|
-
0,
|
|
13605
|
-
0,
|
|
13606
|
-
0,
|
|
13607
|
-
0,
|
|
13608
|
-
0,
|
|
13609
|
-
0,
|
|
13610
|
-
0,
|
|
13611
|
-
0,
|
|
13612
|
-
0,
|
|
13613
|
-
0,
|
|
13614
|
-
0,
|
|
13615
|
-
1,
|
|
13616
|
-
1,
|
|
13617
|
-
1,
|
|
13618
|
-
1,
|
|
13619
|
-
1,
|
|
13620
|
-
1
|
|
13621
|
-
]);
|
|
13622
|
-
function isValidHex(id, length) {
|
|
13623
|
-
if (typeof id !== "string" || id.length !== length) return false;
|
|
13624
|
-
let r = 0;
|
|
13625
|
-
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);
|
|
13626
|
-
return r === length;
|
|
13627
|
-
}
|
|
13628
|
-
/**
|
|
13629
|
-
* @since 1.0.0
|
|
13630
|
-
*/
|
|
13631
|
-
function isValidTraceId(traceId) {
|
|
13632
|
-
return isValidHex(traceId, 32) && traceId !== "00000000000000000000000000000000";
|
|
13633
|
-
}
|
|
13634
|
-
/**
|
|
13635
|
-
* @since 1.0.0
|
|
13636
|
-
*/
|
|
13637
|
-
function isValidSpanId(spanId) {
|
|
13638
|
-
return isValidHex(spanId, 16) && spanId !== "0000000000000000";
|
|
13639
|
-
}
|
|
13640
|
-
/**
|
|
13641
|
-
* Returns true if this {@link SpanContext} is valid.
|
|
13642
|
-
* @return true if this {@link SpanContext} is valid.
|
|
13643
|
-
*
|
|
13644
|
-
* @since 1.0.0
|
|
13645
|
-
*/
|
|
13646
|
-
function isSpanContextValid(spanContext) {
|
|
13647
|
-
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
13648
|
-
}
|
|
13649
|
-
/**
|
|
13650
|
-
* Wrap the given {@link SpanContext} in a new non-recording {@link Span}
|
|
13651
|
-
*
|
|
13652
|
-
* @param spanContext span context to be wrapped
|
|
13653
|
-
* @returns a new non-recording {@link Span} with the provided context
|
|
13654
|
-
*/
|
|
13655
|
-
function wrapSpanContext(spanContext) {
|
|
13656
|
-
return new NonRecordingSpan(spanContext);
|
|
13673
|
+
var _getSpan;
|
|
13674
|
+
return (_getSpan = getSpan(context)) === null || _getSpan === void 0 ? void 0 : _getSpan.spanContext();
|
|
13657
13675
|
}
|
|
13658
13676
|
const contextApi = ContextAPI.getInstance();
|
|
13659
13677
|
/**
|
|
@@ -13667,6 +13685,7 @@ var NoopTracer = class {
|
|
|
13667
13685
|
else return new NonRecordingSpan();
|
|
13668
13686
|
}
|
|
13669
13687
|
startActiveSpan(name, arg2, arg3, arg4) {
|
|
13688
|
+
var _ctx;
|
|
13670
13689
|
let opts;
|
|
13671
13690
|
let ctx;
|
|
13672
13691
|
let fn;
|
|
@@ -13680,7 +13699,7 @@ var NoopTracer = class {
|
|
|
13680
13699
|
ctx = arg3;
|
|
13681
13700
|
fn = arg4;
|
|
13682
13701
|
}
|
|
13683
|
-
const parentContext = ctx !== null &&
|
|
13702
|
+
const parentContext = (_ctx = ctx) !== null && _ctx !== void 0 ? _ctx : contextApi.active();
|
|
13684
13703
|
const span = this.startSpan(name, opts, parentContext);
|
|
13685
13704
|
const contextWithSpanSet = setSpan(parentContext, span);
|
|
13686
13705
|
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
@@ -13722,6 +13741,27 @@ var ProxyTracer = class {
|
|
|
13722
13741
|
}
|
|
13723
13742
|
};
|
|
13724
13743
|
/**
|
|
13744
|
+
* An enumeration of status codes.
|
|
13745
|
+
*
|
|
13746
|
+
* @since 1.0.0
|
|
13747
|
+
*/
|
|
13748
|
+
let SpanStatusCode = /* @__PURE__ */ function(SpanStatusCode) {
|
|
13749
|
+
/**
|
|
13750
|
+
* The default status.
|
|
13751
|
+
*/
|
|
13752
|
+
SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
|
|
13753
|
+
/**
|
|
13754
|
+
* The operation has been validated by an Application developer or
|
|
13755
|
+
* Operator to have completed successfully.
|
|
13756
|
+
*/
|
|
13757
|
+
SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
|
|
13758
|
+
/**
|
|
13759
|
+
* The operation contains an error.
|
|
13760
|
+
*/
|
|
13761
|
+
SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
|
|
13762
|
+
return SpanStatusCode;
|
|
13763
|
+
}({});
|
|
13764
|
+
/**
|
|
13725
13765
|
* An implementation of the {@link TracerProvider} which returns an impotent
|
|
13726
13766
|
* Tracer for all calls to `getTracer`.
|
|
13727
13767
|
*
|
|
@@ -13749,12 +13789,12 @@ var ProxyTracerProvider = class {
|
|
|
13749
13789
|
* Get a {@link ProxyTracer}
|
|
13750
13790
|
*/
|
|
13751
13791
|
getTracer(name, version, options) {
|
|
13752
|
-
var
|
|
13753
|
-
return (
|
|
13792
|
+
var _this$getDelegateTrac;
|
|
13793
|
+
return (_this$getDelegateTrac = this.getDelegateTracer(name, version, options)) !== null && _this$getDelegateTrac !== void 0 ? _this$getDelegateTrac : new ProxyTracer(this, name, version, options);
|
|
13754
13794
|
}
|
|
13755
13795
|
getDelegate() {
|
|
13756
|
-
var
|
|
13757
|
-
return (
|
|
13796
|
+
var _this$_delegate;
|
|
13797
|
+
return (_this$_delegate = this._delegate) !== null && _this$_delegate !== void 0 ? _this$_delegate : NOOP_TRACER_PROVIDER;
|
|
13758
13798
|
}
|
|
13759
13799
|
/**
|
|
13760
13800
|
* Set the delegate tracer provider
|
|
@@ -13763,32 +13803,11 @@ var ProxyTracerProvider = class {
|
|
|
13763
13803
|
this._delegate = delegate;
|
|
13764
13804
|
}
|
|
13765
13805
|
getDelegateTracer(name, version, options) {
|
|
13766
|
-
var
|
|
13767
|
-
return (
|
|
13806
|
+
var _this$_delegate2;
|
|
13807
|
+
return (_this$_delegate2 = this._delegate) === null || _this$_delegate2 === void 0 ? void 0 : _this$_delegate2.getTracer(name, version, options);
|
|
13768
13808
|
}
|
|
13769
13809
|
};
|
|
13770
13810
|
/**
|
|
13771
|
-
* An enumeration of status codes.
|
|
13772
|
-
*
|
|
13773
|
-
* @since 1.0.0
|
|
13774
|
-
*/
|
|
13775
|
-
var SpanStatusCode;
|
|
13776
|
-
(function(SpanStatusCode) {
|
|
13777
|
-
/**
|
|
13778
|
-
* The default status.
|
|
13779
|
-
*/
|
|
13780
|
-
SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
|
|
13781
|
-
/**
|
|
13782
|
-
* The operation has been validated by an Application developer or
|
|
13783
|
-
* Operator to have completed successfully.
|
|
13784
|
-
*/
|
|
13785
|
-
SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
|
|
13786
|
-
/**
|
|
13787
|
-
* The operation contains an error.
|
|
13788
|
-
*/
|
|
13789
|
-
SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
|
|
13790
|
-
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
13791
|
-
/**
|
|
13792
13811
|
* Entrypoint for context API
|
|
13793
13812
|
* @since 1.0.0
|
|
13794
13813
|
*/
|
|
@@ -14006,7 +14025,7 @@ function getTotalTimeoutMs(timeout) {
|
|
|
14006
14025
|
if (typeof timeout === "number") return timeout;
|
|
14007
14026
|
return timeout.totalMs;
|
|
14008
14027
|
}
|
|
14009
|
-
var VERSION$3 = "6.0.
|
|
14028
|
+
var VERSION$3 = "6.0.317";
|
|
14010
14029
|
var dataContentSchema = z$1.union([
|
|
14011
14030
|
z$1.string(),
|
|
14012
14031
|
z$1.instanceof(Uint8Array),
|
|
@@ -15202,7 +15221,7 @@ createIdGenerator$1({
|
|
|
15202
15221
|
prefix: "aiobj",
|
|
15203
15222
|
size: 24
|
|
15204
15223
|
});
|
|
15205
|
-
// ../_vendored/ai_v7/dist/dist-
|
|
15224
|
+
// ../_vendored/ai_v7/dist/dist-5fMURLh0.js
|
|
15206
15225
|
/**
|
|
15207
15226
|
* Symbol used for identifying AI SDK Error instances.
|
|
15208
15227
|
* Enables checking if an error is an instance of AISDKError across package versions.
|
|
@@ -15789,6 +15808,7 @@ function convertBase64ToUint8Array(base64String) {
|
|
|
15789
15808
|
return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
|
|
15790
15809
|
}
|
|
15791
15810
|
function convertUint8ArrayToBase64(array) {
|
|
15811
|
+
if (typeof globalThis.Buffer?.from === "function") return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString("base64");
|
|
15792
15812
|
const chunks = [];
|
|
15793
15813
|
const chunkSize = 4096;
|
|
15794
15814
|
for (let i = 0; i < array.length; i += chunkSize) chunks.push(String.fromCodePoint(...array.subarray(i, i + chunkSize)));
|
|
@@ -15871,7 +15891,7 @@ function handleFetchError({ error, url, requestBodyValues }) {
|
|
|
15871
15891
|
}
|
|
15872
15892
|
return error;
|
|
15873
15893
|
}
|
|
15874
|
-
const VERSION$2 = "5.0.
|
|
15894
|
+
const VERSION$2 = "5.0.70";
|
|
15875
15895
|
/**
|
|
15876
15896
|
* Normalizes different header inputs into a plain record with lower-case keys.
|
|
15877
15897
|
* Entries with `undefined` or `null` values are removed.
|
|
@@ -18362,7 +18382,7 @@ function isSegment(value) {
|
|
|
18362
18382
|
function withoutTrailingSlash(url) {
|
|
18363
18383
|
return url?.replace(/\/$/, "");
|
|
18364
18384
|
}
|
|
18365
|
-
// ../_vendored/ai_v7/dist/dist-
|
|
18385
|
+
// ../_vendored/ai_v7/dist/dist-DFcOzoAh.js
|
|
18366
18386
|
/**
|
|
18367
18387
|
* Symbol used to define custom serialization for user-defined class instances.
|
|
18368
18388
|
* The static method should accept an instance and return serializable data.
|
|
@@ -21538,7 +21558,7 @@ const gatewayTools = {
|
|
|
21538
21558
|
async function getVercelRequestId() {
|
|
21539
21559
|
return getContext().headers?.["x-vercel-id"];
|
|
21540
21560
|
}
|
|
21541
|
-
const VERSION$1 = "4.0.
|
|
21561
|
+
const VERSION$1 = "4.0.128";
|
|
21542
21562
|
const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
21543
21563
|
/** Response shape of `POST /v1/realtime/client-secrets`. `expiresAt` is epoch seconds. */
|
|
21544
21564
|
const gatewayClientSecretResponseSchema = lazySchema(() => zodSchema(z$3.object({
|
|
@@ -22330,310 +22350,7 @@ function resolveEmbeddingModel(model) {
|
|
|
22330
22350
|
function getGlobalProvider() {
|
|
22331
22351
|
return asProviderV4(globalThis.AI_SDK_DEFAULT_PROVIDER ?? gateway);
|
|
22332
22352
|
}
|
|
22333
|
-
const VERSION = "7.0.
|
|
22334
|
-
const z$2 = {
|
|
22335
|
-
array,
|
|
22336
|
-
boolean,
|
|
22337
|
-
custom,
|
|
22338
|
-
discriminatedUnion,
|
|
22339
|
-
enum: enum$1,
|
|
22340
|
-
instanceof: instanceof$1,
|
|
22341
|
-
lazy,
|
|
22342
|
-
literal,
|
|
22343
|
-
looseObject,
|
|
22344
|
-
never,
|
|
22345
|
-
null: null$1,
|
|
22346
|
-
number,
|
|
22347
|
-
object,
|
|
22348
|
-
record,
|
|
22349
|
-
string,
|
|
22350
|
-
union,
|
|
22351
|
-
unknown
|
|
22352
|
-
};
|
|
22353
|
-
const jsonValueSchema = z$2.lazy(() => z$2.union([
|
|
22354
|
-
z$2.null(),
|
|
22355
|
-
z$2.string(),
|
|
22356
|
-
z$2.number(),
|
|
22357
|
-
z$2.boolean(),
|
|
22358
|
-
z$2.record(z$2.string(), jsonValueSchema.optional()),
|
|
22359
|
-
z$2.array(jsonValueSchema)
|
|
22360
|
-
]));
|
|
22361
|
-
const providerMetadataSchema = z$2.record(z$2.string(), z$2.record(z$2.string(), jsonValueSchema.optional()));
|
|
22362
|
-
const fileInlineDataSchema = z$2.union([
|
|
22363
|
-
z$2.string(),
|
|
22364
|
-
z$2.instanceof(Uint8Array),
|
|
22365
|
-
z$2.instanceof(ArrayBuffer),
|
|
22366
|
-
z$2.custom(isBuffer, { message: "Must be a Buffer" })
|
|
22367
|
-
]);
|
|
22368
|
-
const providerReferenceSchema$1 = z$2.record(z$2.string(), z$2.string());
|
|
22369
|
-
/**
|
|
22370
|
-
* @internal
|
|
22371
|
-
*/
|
|
22372
|
-
const textPartSchema = z$2.object({
|
|
22373
|
-
type: z$2.literal("text"),
|
|
22374
|
-
text: z$2.string(),
|
|
22375
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22376
|
-
});
|
|
22377
|
-
/**
|
|
22378
|
-
* @internal
|
|
22379
|
-
* @deprecated Use `filePartSchema` with `mediaType: 'image'` instead:
|
|
22380
|
-
* `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
|
|
22381
|
-
*/
|
|
22382
|
-
const imagePartSchema = z$2.object({
|
|
22383
|
-
type: z$2.literal("image"),
|
|
22384
|
-
image: z$2.union([
|
|
22385
|
-
fileInlineDataSchema,
|
|
22386
|
-
z$2.instanceof(URL),
|
|
22387
|
-
providerReferenceSchema$1
|
|
22388
|
-
]),
|
|
22389
|
-
mediaType: z$2.string().optional(),
|
|
22390
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22391
|
-
});
|
|
22392
|
-
const taggedFileDataSchema = z$2.discriminatedUnion("type", [
|
|
22393
|
-
z$2.object({
|
|
22394
|
-
type: z$2.literal("data"),
|
|
22395
|
-
data: fileInlineDataSchema
|
|
22396
|
-
}),
|
|
22397
|
-
z$2.object({
|
|
22398
|
-
type: z$2.literal("url"),
|
|
22399
|
-
url: z$2.instanceof(URL)
|
|
22400
|
-
}),
|
|
22401
|
-
z$2.object({
|
|
22402
|
-
type: z$2.literal("reference"),
|
|
22403
|
-
reference: providerReferenceSchema$1
|
|
22404
|
-
}),
|
|
22405
|
-
z$2.object({
|
|
22406
|
-
type: z$2.literal("text"),
|
|
22407
|
-
text: z$2.string()
|
|
22408
|
-
})
|
|
22409
|
-
]);
|
|
22410
|
-
const taggedReasoningFileDataSchema = z$2.discriminatedUnion("type", [z$2.object({
|
|
22411
|
-
type: z$2.literal("data"),
|
|
22412
|
-
data: fileInlineDataSchema
|
|
22413
|
-
}), z$2.object({
|
|
22414
|
-
type: z$2.literal("url"),
|
|
22415
|
-
url: z$2.instanceof(URL)
|
|
22416
|
-
})]);
|
|
22417
|
-
/**
|
|
22418
|
-
* @internal
|
|
22419
|
-
*/
|
|
22420
|
-
const filePartSchema = z$2.object({
|
|
22421
|
-
type: z$2.literal("file"),
|
|
22422
|
-
data: z$2.union([
|
|
22423
|
-
taggedFileDataSchema,
|
|
22424
|
-
fileInlineDataSchema,
|
|
22425
|
-
z$2.instanceof(URL),
|
|
22426
|
-
providerReferenceSchema$1
|
|
22427
|
-
]),
|
|
22428
|
-
filename: z$2.string().optional(),
|
|
22429
|
-
mediaType: z$2.string(),
|
|
22430
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22431
|
-
});
|
|
22432
|
-
/**
|
|
22433
|
-
* @internal
|
|
22434
|
-
*/
|
|
22435
|
-
const reasoningPartSchema = z$2.object({
|
|
22436
|
-
type: z$2.literal("reasoning"),
|
|
22437
|
-
text: z$2.string(),
|
|
22438
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22439
|
-
});
|
|
22440
|
-
/**
|
|
22441
|
-
* @internal
|
|
22442
|
-
*/
|
|
22443
|
-
const customPartSchema = z$2.object({
|
|
22444
|
-
type: z$2.literal("custom"),
|
|
22445
|
-
kind: z$2.string().transform((value) => value),
|
|
22446
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22447
|
-
});
|
|
22448
|
-
/**
|
|
22449
|
-
* @internal
|
|
22450
|
-
*/
|
|
22451
|
-
const reasoningFilePartSchema = z$2.object({
|
|
22452
|
-
type: z$2.literal("reasoning-file"),
|
|
22453
|
-
data: z$2.union([
|
|
22454
|
-
taggedReasoningFileDataSchema,
|
|
22455
|
-
fileInlineDataSchema,
|
|
22456
|
-
z$2.instanceof(URL)
|
|
22457
|
-
]),
|
|
22458
|
-
mediaType: z$2.string(),
|
|
22459
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22460
|
-
});
|
|
22461
|
-
/**
|
|
22462
|
-
* @internal
|
|
22463
|
-
*/
|
|
22464
|
-
const toolCallPartSchema = z$2.object({
|
|
22465
|
-
type: z$2.literal("tool-call"),
|
|
22466
|
-
toolCallId: z$2.string(),
|
|
22467
|
-
toolName: z$2.string(),
|
|
22468
|
-
input: z$2.unknown(),
|
|
22469
|
-
providerOptions: providerMetadataSchema.optional(),
|
|
22470
|
-
providerExecuted: z$2.boolean().optional()
|
|
22471
|
-
});
|
|
22472
|
-
/**
|
|
22473
|
-
* @internal
|
|
22474
|
-
*/
|
|
22475
|
-
const outputSchema = z$2.discriminatedUnion("type", [
|
|
22476
|
-
z$2.object({
|
|
22477
|
-
type: z$2.literal("text"),
|
|
22478
|
-
value: z$2.string(),
|
|
22479
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22480
|
-
}),
|
|
22481
|
-
z$2.object({
|
|
22482
|
-
type: z$2.literal("json"),
|
|
22483
|
-
value: jsonValueSchema,
|
|
22484
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22485
|
-
}),
|
|
22486
|
-
z$2.object({
|
|
22487
|
-
type: z$2.literal("execution-denied"),
|
|
22488
|
-
reason: z$2.string().optional(),
|
|
22489
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22490
|
-
}),
|
|
22491
|
-
z$2.object({
|
|
22492
|
-
type: z$2.literal("error-text"),
|
|
22493
|
-
value: z$2.string(),
|
|
22494
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22495
|
-
}),
|
|
22496
|
-
z$2.object({
|
|
22497
|
-
type: z$2.literal("error-json"),
|
|
22498
|
-
value: jsonValueSchema,
|
|
22499
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22500
|
-
}),
|
|
22501
|
-
z$2.object({
|
|
22502
|
-
type: z$2.literal("content"),
|
|
22503
|
-
value: z$2.array(z$2.union([
|
|
22504
|
-
z$2.object({
|
|
22505
|
-
type: z$2.literal("text"),
|
|
22506
|
-
text: z$2.string(),
|
|
22507
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22508
|
-
}),
|
|
22509
|
-
z$2.object({
|
|
22510
|
-
type: z$2.literal("file"),
|
|
22511
|
-
data: taggedFileDataSchema,
|
|
22512
|
-
mediaType: z$2.string(),
|
|
22513
|
-
filename: z$2.string().optional(),
|
|
22514
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22515
|
-
}),
|
|
22516
|
-
z$2.object({
|
|
22517
|
-
type: z$2.literal("file-data"),
|
|
22518
|
-
data: z$2.string(),
|
|
22519
|
-
mediaType: z$2.string(),
|
|
22520
|
-
filename: z$2.string().optional(),
|
|
22521
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22522
|
-
}),
|
|
22523
|
-
z$2.object({
|
|
22524
|
-
type: z$2.literal("file-url"),
|
|
22525
|
-
url: z$2.string(),
|
|
22526
|
-
mediaType: z$2.string().optional(),
|
|
22527
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22528
|
-
}),
|
|
22529
|
-
z$2.object({
|
|
22530
|
-
type: z$2.literal("file-id"),
|
|
22531
|
-
fileId: z$2.union([z$2.string(), z$2.record(z$2.string(), z$2.string())]),
|
|
22532
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22533
|
-
}),
|
|
22534
|
-
z$2.object({
|
|
22535
|
-
type: z$2.literal("file-reference"),
|
|
22536
|
-
providerReference: z$2.record(z$2.string(), z$2.string()),
|
|
22537
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22538
|
-
}),
|
|
22539
|
-
z$2.object({
|
|
22540
|
-
type: z$2.literal("image-data"),
|
|
22541
|
-
data: z$2.string(),
|
|
22542
|
-
mediaType: z$2.string(),
|
|
22543
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22544
|
-
}),
|
|
22545
|
-
z$2.object({
|
|
22546
|
-
type: z$2.literal("image-url"),
|
|
22547
|
-
url: z$2.string(),
|
|
22548
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22549
|
-
}),
|
|
22550
|
-
z$2.object({
|
|
22551
|
-
type: z$2.literal("image-file-id"),
|
|
22552
|
-
fileId: z$2.union([z$2.string(), z$2.record(z$2.string(), z$2.string())]),
|
|
22553
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22554
|
-
}),
|
|
22555
|
-
z$2.object({
|
|
22556
|
-
type: z$2.literal("image-file-reference"),
|
|
22557
|
-
providerReference: z$2.record(z$2.string(), z$2.string()),
|
|
22558
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22559
|
-
}),
|
|
22560
|
-
z$2.object({
|
|
22561
|
-
type: z$2.literal("custom"),
|
|
22562
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22563
|
-
})
|
|
22564
|
-
]))
|
|
22565
|
-
})
|
|
22566
|
-
]);
|
|
22567
|
-
/**
|
|
22568
|
-
* @internal
|
|
22569
|
-
*/
|
|
22570
|
-
const toolResultPartSchema = z$2.object({
|
|
22571
|
-
type: z$2.literal("tool-result"),
|
|
22572
|
-
toolCallId: z$2.string(),
|
|
22573
|
-
toolName: z$2.string(),
|
|
22574
|
-
output: outputSchema,
|
|
22575
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22576
|
-
});
|
|
22577
|
-
/**
|
|
22578
|
-
* @internal
|
|
22579
|
-
*/
|
|
22580
|
-
const toolApprovalRequestSchema = z$2.object({
|
|
22581
|
-
type: z$2.literal("tool-approval-request"),
|
|
22582
|
-
approvalId: z$2.string(),
|
|
22583
|
-
toolCallId: z$2.string(),
|
|
22584
|
-
reason: z$2.string().optional(),
|
|
22585
|
-
isAutomatic: z$2.boolean().optional(),
|
|
22586
|
-
signature: z$2.string().optional(),
|
|
22587
|
-
inputSchemaInput: z$2.unknown().optional()
|
|
22588
|
-
});
|
|
22589
|
-
/**
|
|
22590
|
-
* @internal
|
|
22591
|
-
*/
|
|
22592
|
-
const toolApprovalResponseSchema = z$2.object({
|
|
22593
|
-
type: z$2.literal("tool-approval-response"),
|
|
22594
|
-
approvalId: z$2.string(),
|
|
22595
|
-
approved: z$2.boolean(),
|
|
22596
|
-
reason: z$2.string().optional()
|
|
22597
|
-
});
|
|
22598
|
-
const systemModelMessageSchema = z$2.object({
|
|
22599
|
-
role: z$2.literal("system"),
|
|
22600
|
-
content: z$2.string(),
|
|
22601
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22602
|
-
});
|
|
22603
|
-
const userModelMessageSchema = z$2.object({
|
|
22604
|
-
role: z$2.literal("user"),
|
|
22605
|
-
content: z$2.union([z$2.string(), z$2.array(z$2.union([
|
|
22606
|
-
textPartSchema,
|
|
22607
|
-
imagePartSchema,
|
|
22608
|
-
filePartSchema
|
|
22609
|
-
]))]),
|
|
22610
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22611
|
-
});
|
|
22612
|
-
const assistantModelMessageSchema = z$2.object({
|
|
22613
|
-
role: z$2.literal("assistant"),
|
|
22614
|
-
content: z$2.union([z$2.string(), z$2.array(z$2.union([
|
|
22615
|
-
textPartSchema,
|
|
22616
|
-
customPartSchema,
|
|
22617
|
-
filePartSchema,
|
|
22618
|
-
reasoningPartSchema,
|
|
22619
|
-
reasoningFilePartSchema,
|
|
22620
|
-
toolCallPartSchema,
|
|
22621
|
-
toolResultPartSchema,
|
|
22622
|
-
toolApprovalRequestSchema
|
|
22623
|
-
]))]),
|
|
22624
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22625
|
-
});
|
|
22626
|
-
const toolModelMessageSchema = z$2.object({
|
|
22627
|
-
role: z$2.literal("tool"),
|
|
22628
|
-
content: z$2.array(z$2.union([toolResultPartSchema, toolApprovalResponseSchema])),
|
|
22629
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22630
|
-
});
|
|
22631
|
-
z$2.union([
|
|
22632
|
-
systemModelMessageSchema,
|
|
22633
|
-
userModelMessageSchema,
|
|
22634
|
-
assistantModelMessageSchema,
|
|
22635
|
-
toolModelMessageSchema
|
|
22636
|
-
]);
|
|
22353
|
+
const VERSION = "7.0.155";
|
|
22637
22354
|
/**
|
|
22638
22355
|
* Reads a property by an untrusted key, ignoring inherited prototype members.
|
|
22639
22356
|
*
|
|
@@ -22879,7 +22596,8 @@ function augmentEvent(event, telemetry, filterContext = false) {
|
|
|
22879
22596
|
const augmentedEvent = Object.assign(Object.create(Object.getPrototypeOf(event)), event, {
|
|
22880
22597
|
recordInputs: telemetry.recordInputs,
|
|
22881
22598
|
recordOutputs: telemetry.recordOutputs,
|
|
22882
|
-
functionId: telemetry.functionId
|
|
22599
|
+
functionId: telemetry.functionId,
|
|
22600
|
+
aiVersion: VERSION
|
|
22883
22601
|
});
|
|
22884
22602
|
if (filterContext && event != null && typeof event === "object" && "runtimeContext" in event) augmentedEvent.runtimeContext = filterIncludedContext({
|
|
22885
22603
|
context: event.runtimeContext,
|
|
@@ -22956,6 +22674,7 @@ function createTelemetryDispatcher({ telemetry }) {
|
|
|
22956
22674
|
onToolExecutionStart: mergeTelemetryCallback("onToolExecutionStart"),
|
|
22957
22675
|
onToolExecutionEnd: mergeTelemetryCallback("onToolExecutionEnd"),
|
|
22958
22676
|
onStepEnd: onStepEnd == null && onStepFinish == null ? void 0 : mergeCallbacks(onStepEnd, onStepFinish),
|
|
22677
|
+
onStepError: mergeTelemetryCallback("onStepError"),
|
|
22959
22678
|
onObjectStepStart: mergeTelemetryCallback("onObjectStepStart"),
|
|
22960
22679
|
onObjectStepEnd: mergeTelemetryCallback("onObjectStepEnd"),
|
|
22961
22680
|
onEmbedStart: mergeTelemetryCallback("onEmbedStart"),
|
|
@@ -23010,6 +22729,10 @@ function createTelemetryDispatcher({ telemetry }) {
|
|
|
23010
22729
|
}
|
|
23011
22730
|
};
|
|
23012
22731
|
}
|
|
22732
|
+
createIdGenerator({
|
|
22733
|
+
prefix: "steer",
|
|
22734
|
+
size: 24
|
|
22735
|
+
});
|
|
23013
22736
|
new TextEncoder();
|
|
23014
22737
|
new TextEncoder();
|
|
23015
22738
|
createIdGenerator({
|
|
@@ -23021,6 +22744,34 @@ createIdGenerator({
|
|
|
23021
22744
|
size: 24
|
|
23022
22745
|
});
|
|
23023
22746
|
TransformStream;
|
|
22747
|
+
const z$2 = {
|
|
22748
|
+
array,
|
|
22749
|
+
boolean,
|
|
22750
|
+
custom,
|
|
22751
|
+
discriminatedUnion,
|
|
22752
|
+
enum: enum$1,
|
|
22753
|
+
instanceof: instanceof$1,
|
|
22754
|
+
lazy,
|
|
22755
|
+
literal,
|
|
22756
|
+
looseObject,
|
|
22757
|
+
never,
|
|
22758
|
+
null: null$1,
|
|
22759
|
+
number,
|
|
22760
|
+
object,
|
|
22761
|
+
record,
|
|
22762
|
+
string,
|
|
22763
|
+
union,
|
|
22764
|
+
unknown
|
|
22765
|
+
};
|
|
22766
|
+
const jsonValueSchema = z$2.lazy(() => z$2.union([
|
|
22767
|
+
z$2.null(),
|
|
22768
|
+
z$2.string(),
|
|
22769
|
+
z$2.number(),
|
|
22770
|
+
z$2.boolean(),
|
|
22771
|
+
z$2.record(z$2.string(), jsonValueSchema.optional()),
|
|
22772
|
+
z$2.array(jsonValueSchema)
|
|
22773
|
+
]));
|
|
22774
|
+
const providerMetadataSchema = z$2.record(z$2.string(), z$2.record(z$2.string(), jsonValueSchema.optional()));
|
|
23024
22775
|
z$2.object({
|
|
23025
22776
|
source: z$2.discriminatedUnion("sourceType", [z$2.object({
|
|
23026
22777
|
type: z$2.literal("source"),
|
|
@@ -23467,6 +23218,281 @@ createIdGenerator({
|
|
|
23467
23218
|
prefix: "call",
|
|
23468
23219
|
size: 24
|
|
23469
23220
|
});
|
|
23221
|
+
const fileInlineDataSchema = z$2.union([
|
|
23222
|
+
z$2.string(),
|
|
23223
|
+
z$2.instanceof(Uint8Array),
|
|
23224
|
+
z$2.instanceof(ArrayBuffer),
|
|
23225
|
+
z$2.custom(isBuffer, { message: "Must be a Buffer" })
|
|
23226
|
+
]);
|
|
23227
|
+
const providerReferenceSchema = z$2.record(z$2.string(), z$2.string());
|
|
23228
|
+
/**
|
|
23229
|
+
* @internal
|
|
23230
|
+
*/
|
|
23231
|
+
const textPartSchema = z$2.object({
|
|
23232
|
+
type: z$2.literal("text"),
|
|
23233
|
+
text: z$2.string(),
|
|
23234
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23235
|
+
});
|
|
23236
|
+
/**
|
|
23237
|
+
* @internal
|
|
23238
|
+
* @deprecated Use `filePartSchema` with `mediaType: 'image'` instead:
|
|
23239
|
+
* `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
|
|
23240
|
+
*/
|
|
23241
|
+
const imagePartSchema = z$2.object({
|
|
23242
|
+
type: z$2.literal("image"),
|
|
23243
|
+
image: z$2.union([
|
|
23244
|
+
fileInlineDataSchema,
|
|
23245
|
+
z$2.instanceof(URL),
|
|
23246
|
+
providerReferenceSchema
|
|
23247
|
+
]),
|
|
23248
|
+
mediaType: z$2.string().optional(),
|
|
23249
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23250
|
+
});
|
|
23251
|
+
const taggedFileDataSchema = z$2.discriminatedUnion("type", [
|
|
23252
|
+
z$2.object({
|
|
23253
|
+
type: z$2.literal("data"),
|
|
23254
|
+
data: fileInlineDataSchema
|
|
23255
|
+
}),
|
|
23256
|
+
z$2.object({
|
|
23257
|
+
type: z$2.literal("url"),
|
|
23258
|
+
url: z$2.instanceof(URL)
|
|
23259
|
+
}),
|
|
23260
|
+
z$2.object({
|
|
23261
|
+
type: z$2.literal("reference"),
|
|
23262
|
+
reference: providerReferenceSchema
|
|
23263
|
+
}),
|
|
23264
|
+
z$2.object({
|
|
23265
|
+
type: z$2.literal("text"),
|
|
23266
|
+
text: z$2.string()
|
|
23267
|
+
})
|
|
23268
|
+
]);
|
|
23269
|
+
const taggedReasoningFileDataSchema = z$2.discriminatedUnion("type", [z$2.object({
|
|
23270
|
+
type: z$2.literal("data"),
|
|
23271
|
+
data: fileInlineDataSchema
|
|
23272
|
+
}), z$2.object({
|
|
23273
|
+
type: z$2.literal("url"),
|
|
23274
|
+
url: z$2.instanceof(URL)
|
|
23275
|
+
})]);
|
|
23276
|
+
/**
|
|
23277
|
+
* @internal
|
|
23278
|
+
*/
|
|
23279
|
+
const filePartSchema = z$2.object({
|
|
23280
|
+
type: z$2.literal("file"),
|
|
23281
|
+
data: z$2.union([
|
|
23282
|
+
taggedFileDataSchema,
|
|
23283
|
+
fileInlineDataSchema,
|
|
23284
|
+
z$2.instanceof(URL),
|
|
23285
|
+
providerReferenceSchema
|
|
23286
|
+
]),
|
|
23287
|
+
filename: z$2.string().optional(),
|
|
23288
|
+
mediaType: z$2.string(),
|
|
23289
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23290
|
+
});
|
|
23291
|
+
/**
|
|
23292
|
+
* @internal
|
|
23293
|
+
*/
|
|
23294
|
+
const reasoningPartSchema = z$2.object({
|
|
23295
|
+
type: z$2.literal("reasoning"),
|
|
23296
|
+
text: z$2.string(),
|
|
23297
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23298
|
+
});
|
|
23299
|
+
/**
|
|
23300
|
+
* @internal
|
|
23301
|
+
*/
|
|
23302
|
+
const customPartSchema = z$2.object({
|
|
23303
|
+
type: z$2.literal("custom"),
|
|
23304
|
+
kind: z$2.string().transform((value) => value),
|
|
23305
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23306
|
+
});
|
|
23307
|
+
/**
|
|
23308
|
+
* @internal
|
|
23309
|
+
*/
|
|
23310
|
+
const reasoningFilePartSchema = z$2.object({
|
|
23311
|
+
type: z$2.literal("reasoning-file"),
|
|
23312
|
+
data: z$2.union([
|
|
23313
|
+
taggedReasoningFileDataSchema,
|
|
23314
|
+
fileInlineDataSchema,
|
|
23315
|
+
z$2.instanceof(URL)
|
|
23316
|
+
]),
|
|
23317
|
+
mediaType: z$2.string(),
|
|
23318
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23319
|
+
});
|
|
23320
|
+
/**
|
|
23321
|
+
* @internal
|
|
23322
|
+
*/
|
|
23323
|
+
const toolCallPartSchema = z$2.object({
|
|
23324
|
+
type: z$2.literal("tool-call"),
|
|
23325
|
+
toolCallId: z$2.string(),
|
|
23326
|
+
toolName: z$2.string(),
|
|
23327
|
+
input: z$2.unknown(),
|
|
23328
|
+
providerOptions: providerMetadataSchema.optional(),
|
|
23329
|
+
providerExecuted: z$2.boolean().optional()
|
|
23330
|
+
});
|
|
23331
|
+
/**
|
|
23332
|
+
* @internal
|
|
23333
|
+
*/
|
|
23334
|
+
const outputSchema = z$2.discriminatedUnion("type", [
|
|
23335
|
+
z$2.object({
|
|
23336
|
+
type: z$2.literal("text"),
|
|
23337
|
+
value: z$2.string(),
|
|
23338
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23339
|
+
}),
|
|
23340
|
+
z$2.object({
|
|
23341
|
+
type: z$2.literal("json"),
|
|
23342
|
+
value: jsonValueSchema,
|
|
23343
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23344
|
+
}),
|
|
23345
|
+
z$2.object({
|
|
23346
|
+
type: z$2.literal("execution-denied"),
|
|
23347
|
+
reason: z$2.string().optional(),
|
|
23348
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23349
|
+
}),
|
|
23350
|
+
z$2.object({
|
|
23351
|
+
type: z$2.literal("error-text"),
|
|
23352
|
+
value: z$2.string(),
|
|
23353
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23354
|
+
}),
|
|
23355
|
+
z$2.object({
|
|
23356
|
+
type: z$2.literal("error-json"),
|
|
23357
|
+
value: jsonValueSchema,
|
|
23358
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23359
|
+
}),
|
|
23360
|
+
z$2.object({
|
|
23361
|
+
type: z$2.literal("content"),
|
|
23362
|
+
value: z$2.array(z$2.union([
|
|
23363
|
+
z$2.object({
|
|
23364
|
+
type: z$2.literal("text"),
|
|
23365
|
+
text: z$2.string(),
|
|
23366
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23367
|
+
}),
|
|
23368
|
+
z$2.object({
|
|
23369
|
+
type: z$2.literal("file"),
|
|
23370
|
+
data: taggedFileDataSchema,
|
|
23371
|
+
mediaType: z$2.string(),
|
|
23372
|
+
filename: z$2.string().optional(),
|
|
23373
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23374
|
+
}),
|
|
23375
|
+
z$2.object({
|
|
23376
|
+
type: z$2.literal("file-data"),
|
|
23377
|
+
data: z$2.string(),
|
|
23378
|
+
mediaType: z$2.string(),
|
|
23379
|
+
filename: z$2.string().optional(),
|
|
23380
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23381
|
+
}),
|
|
23382
|
+
z$2.object({
|
|
23383
|
+
type: z$2.literal("file-url"),
|
|
23384
|
+
url: z$2.string(),
|
|
23385
|
+
mediaType: z$2.string().optional(),
|
|
23386
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23387
|
+
}),
|
|
23388
|
+
z$2.object({
|
|
23389
|
+
type: z$2.literal("file-id"),
|
|
23390
|
+
fileId: z$2.union([z$2.string(), z$2.record(z$2.string(), z$2.string())]),
|
|
23391
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23392
|
+
}),
|
|
23393
|
+
z$2.object({
|
|
23394
|
+
type: z$2.literal("file-reference"),
|
|
23395
|
+
providerReference: z$2.record(z$2.string(), z$2.string()),
|
|
23396
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23397
|
+
}),
|
|
23398
|
+
z$2.object({
|
|
23399
|
+
type: z$2.literal("image-data"),
|
|
23400
|
+
data: z$2.string(),
|
|
23401
|
+
mediaType: z$2.string(),
|
|
23402
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23403
|
+
}),
|
|
23404
|
+
z$2.object({
|
|
23405
|
+
type: z$2.literal("image-url"),
|
|
23406
|
+
url: z$2.string(),
|
|
23407
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23408
|
+
}),
|
|
23409
|
+
z$2.object({
|
|
23410
|
+
type: z$2.literal("image-file-id"),
|
|
23411
|
+
fileId: z$2.union([z$2.string(), z$2.record(z$2.string(), z$2.string())]),
|
|
23412
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23413
|
+
}),
|
|
23414
|
+
z$2.object({
|
|
23415
|
+
type: z$2.literal("image-file-reference"),
|
|
23416
|
+
providerReference: z$2.record(z$2.string(), z$2.string()),
|
|
23417
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23418
|
+
}),
|
|
23419
|
+
z$2.object({
|
|
23420
|
+
type: z$2.literal("custom"),
|
|
23421
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23422
|
+
})
|
|
23423
|
+
]))
|
|
23424
|
+
})
|
|
23425
|
+
]);
|
|
23426
|
+
/**
|
|
23427
|
+
* @internal
|
|
23428
|
+
*/
|
|
23429
|
+
const toolResultPartSchema = z$2.object({
|
|
23430
|
+
type: z$2.literal("tool-result"),
|
|
23431
|
+
toolCallId: z$2.string(),
|
|
23432
|
+
toolName: z$2.string(),
|
|
23433
|
+
output: outputSchema,
|
|
23434
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23435
|
+
});
|
|
23436
|
+
/**
|
|
23437
|
+
* @internal
|
|
23438
|
+
*/
|
|
23439
|
+
const toolApprovalRequestSchema = z$2.object({
|
|
23440
|
+
type: z$2.literal("tool-approval-request"),
|
|
23441
|
+
approvalId: z$2.string(),
|
|
23442
|
+
toolCallId: z$2.string(),
|
|
23443
|
+
reason: z$2.string().optional(),
|
|
23444
|
+
isAutomatic: z$2.boolean().optional(),
|
|
23445
|
+
signature: z$2.string().optional(),
|
|
23446
|
+
inputSchemaInput: z$2.unknown().optional()
|
|
23447
|
+
});
|
|
23448
|
+
/**
|
|
23449
|
+
* @internal
|
|
23450
|
+
*/
|
|
23451
|
+
const toolApprovalResponseSchema = z$2.object({
|
|
23452
|
+
type: z$2.literal("tool-approval-response"),
|
|
23453
|
+
approvalId: z$2.string(),
|
|
23454
|
+
approved: z$2.boolean(),
|
|
23455
|
+
reason: z$2.string().optional()
|
|
23456
|
+
});
|
|
23457
|
+
const systemModelMessageSchema = z$2.object({
|
|
23458
|
+
role: z$2.literal("system"),
|
|
23459
|
+
content: z$2.string(),
|
|
23460
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23461
|
+
});
|
|
23462
|
+
const userModelMessageSchema = z$2.object({
|
|
23463
|
+
role: z$2.literal("user"),
|
|
23464
|
+
content: z$2.union([z$2.string(), z$2.array(z$2.union([
|
|
23465
|
+
textPartSchema,
|
|
23466
|
+
imagePartSchema,
|
|
23467
|
+
filePartSchema
|
|
23468
|
+
]))]),
|
|
23469
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23470
|
+
});
|
|
23471
|
+
const assistantModelMessageSchema = z$2.object({
|
|
23472
|
+
role: z$2.literal("assistant"),
|
|
23473
|
+
content: z$2.union([z$2.string(), z$2.array(z$2.union([
|
|
23474
|
+
textPartSchema,
|
|
23475
|
+
customPartSchema,
|
|
23476
|
+
filePartSchema,
|
|
23477
|
+
reasoningPartSchema,
|
|
23478
|
+
reasoningFilePartSchema,
|
|
23479
|
+
toolCallPartSchema,
|
|
23480
|
+
toolResultPartSchema,
|
|
23481
|
+
toolApprovalRequestSchema
|
|
23482
|
+
]))]),
|
|
23483
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23484
|
+
});
|
|
23485
|
+
const toolModelMessageSchema = z$2.object({
|
|
23486
|
+
role: z$2.literal("tool"),
|
|
23487
|
+
content: z$2.array(z$2.union([toolResultPartSchema, toolApprovalResponseSchema])),
|
|
23488
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23489
|
+
});
|
|
23490
|
+
z$2.union([
|
|
23491
|
+
systemModelMessageSchema,
|
|
23492
|
+
userModelMessageSchema,
|
|
23493
|
+
assistantModelMessageSchema,
|
|
23494
|
+
toolModelMessageSchema
|
|
23495
|
+
]);
|
|
23470
23496
|
z$2.object({
|
|
23471
23497
|
token: z$2.string().refine((value) => value.trim().length > 0),
|
|
23472
23498
|
url: z$2.string().refine((value) => {
|
|
@@ -27338,10 +27364,17 @@ function isOmModelExecutionFailure(error) {
|
|
|
27338
27364
|
}
|
|
27339
27365
|
var OmModelExecutionError = class extends Error {
|
|
27340
27366
|
failureKind;
|
|
27341
|
-
|
|
27367
|
+
#observerSpanId;
|
|
27368
|
+
get observerSpanId() {
|
|
27369
|
+
return this.#observerSpanId;
|
|
27370
|
+
}
|
|
27371
|
+
constructor(failureKind, cause, observerSpan) {
|
|
27342
27372
|
super(formatOmError(cause), { cause });
|
|
27343
27373
|
this.failureKind = failureKind;
|
|
27344
27374
|
this.name = "OmModelExecutionError";
|
|
27375
|
+
try {
|
|
27376
|
+
this.#observerSpanId = observerSpan && (typeof observerSpan.getExportedSpanId !== "function" || observerSpan.getExportedSpanId() === observerSpan.id) ? observerSpan.id : void 0;
|
|
27377
|
+
} catch {}
|
|
27345
27378
|
}
|
|
27346
27379
|
};
|
|
27347
27380
|
function isOmModelExecutionError(error) {
|
|
@@ -27352,8 +27385,22 @@ function isOmModelExecutionError(error) {
|
|
|
27352
27385
|
}
|
|
27353
27386
|
}
|
|
27354
27387
|
function getOmFailureMetadata(error, failurePolicy) {
|
|
27388
|
+
let observerFailure;
|
|
27389
|
+
if (typeof coreObservability.executionFailureTermination === "function") try {
|
|
27390
|
+
const modelFailure = isOmModelExecutionError(error);
|
|
27391
|
+
observerFailure = {
|
|
27392
|
+
...modelFailure && error.observerSpanId ? { observerSpanId: error.observerSpanId } : {},
|
|
27393
|
+
cause: coreObservability.executionFailureTermination(modelFailure ? error.cause : error, modelFailure ? "model_error" : "runtime_error")
|
|
27394
|
+
};
|
|
27395
|
+
} catch {
|
|
27396
|
+
observerFailure = { cause: {
|
|
27397
|
+
outcome: "error",
|
|
27398
|
+
stopReason: "runtime_error"
|
|
27399
|
+
} };
|
|
27400
|
+
}
|
|
27355
27401
|
return {
|
|
27356
27402
|
failurePolicy,
|
|
27403
|
+
...observerFailure ? { observerFailure } : {},
|
|
27357
27404
|
...isOmModelExecutionError(error) ? { failureKind: error.failureKind } : {}
|
|
27358
27405
|
};
|
|
27359
27406
|
}
|
|
@@ -30248,7 +30295,7 @@ var ObserverRunner = class {
|
|
|
30248
30295
|
aborted: abortSignal?.aborted ?? false
|
|
30249
30296
|
});
|
|
30250
30297
|
if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
|
|
30251
|
-
throw new OmModelExecutionError("observer-model", error);
|
|
30298
|
+
throw new OmModelExecutionError("observer-model", error, childObservabilityContext.tracingContext?.currentSpan);
|
|
30252
30299
|
}
|
|
30253
30300
|
}, abortSignal)
|
|
30254
30301
|
}), {
|
|
@@ -30463,7 +30510,7 @@ var ObserverRunner = class {
|
|
|
30463
30510
|
aborted: abortSignal?.aborted ?? false
|
|
30464
30511
|
});
|
|
30465
30512
|
if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
|
|
30466
|
-
throw new OmModelExecutionError("observer-model", error);
|
|
30513
|
+
throw new OmModelExecutionError("observer-model", error, childObservabilityContext.tracingContext?.currentSpan);
|
|
30467
30514
|
}
|
|
30468
30515
|
}, abortSignal)
|
|
30469
30516
|
}), {
|
|
@@ -38382,7 +38429,7 @@ var ReflectorRunner = class {
|
|
|
38382
38429
|
})).getFullOutput(), "OM reflector");
|
|
38383
38430
|
} catch (error) {
|
|
38384
38431
|
if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
|
|
38385
|
-
throw new OmModelExecutionError("reflector-model", error);
|
|
38432
|
+
throw new OmModelExecutionError("reflector-model", error, childObservabilityContext.tracingContext?.currentSpan);
|
|
38386
38433
|
}
|
|
38387
38434
|
}, abortSignal)
|
|
38388
38435
|
}), {
|
|
@@ -42429,7 +42476,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
42429
42476
|
await failedTurn.end().catch(() => {});
|
|
42430
42477
|
if (this.turn === failedTurn) this.turn = void 0;
|
|
42431
42478
|
state.__omTurn = void 0;
|
|
42432
|
-
if (typeof abort === "function") abort(abortMessage);
|
|
42479
|
+
if (typeof abort === "function") abort(abortMessage, { metadata: getOmFailureMetadata(error, "abort") });
|
|
42433
42480
|
throw err;
|
|
42434
42481
|
}
|
|
42435
42482
|
injectObservationContextMessages({
|
|
@@ -43296,6 +43343,7 @@ var Memory = class Memory extends MastraMemory {
|
|
|
43296
43343
|
const engine = this._omEngine ? await this._omEngine : this._omEngineInstance;
|
|
43297
43344
|
if (engine && resourceId) await engine.waitForBuffering(threadId, resourceId, OM_DELETE_DRAIN_TIMEOUT_MS);
|
|
43298
43345
|
await memoryStore.deleteThread({ threadId });
|
|
43346
|
+
if (typeof this.clearThreadStream === "function") this.clearThreadStream(threadId, resourceId);
|
|
43299
43347
|
if (resourceId && memoryStore.supportsObservationalMemory) await memoryStore.clearObservationalMemory(threadId, resourceId);
|
|
43300
43348
|
if (this.vector) this.trackVectorCleanup(this.deleteThreadVectors(threadId));
|
|
43301
43349
|
}
|
|
@@ -45318,4 +45366,4 @@ Notes:
|
|
|
45318
45366
|
};
|
|
45319
45367
|
export { renderSubconsciousActivity as $, buildObserverSystemPrompt as A, OBSERVATION_CONTEXT_INSTRUCTIONS as B, WorkingMemoryExtractor as C, TokenCounter as D, summarizeConversation as E, parseObserverOutput as F, Subconscious as G, OBSERVATION_CONTEXT_PROMPT_THREAD as H, injectAnchorIds as I, SubconsciousRemindExtractor as J, KnowledgeSemanticIndexCoordinator as K, parseAnchorId as L, formatMessagesForObserver as M, hasCurrentTaskSection as N, OBSERVER_SYSTEM_PROMPT as O, optimizeObservationsForContext as P, publishSubconsciousActivity as Q, stripEphemeralAnchorIds as R, wrapInObservationGroup as S, SUMMARIZE_THREAD_DEFAULTS as T, OBSERVATION_CONTINUATION_HINT as U, OBSERVATION_CONTEXT_PROMPT as V, getObservationContextPrompt as W, SUBCONSCIOUS_ACTIVITY_STATE_ID as X, ModelByInputTokens as Y, buildSubconsciousActivitySnapshot as Z, deriveObservationGroupProvenance as _, extractWorkingMemoryContent as a, renderObservationGroupsForReflection as b, getObservationsAsOf as c, AUTO_MODEL_BY_PROVIDER as d, Extractor as et, resolveAutoModelId as f, combineObservationGroupRanges as g, WorkingMemoryStateProcessor as h, WorkingMemory as i, extractCurrentTask as j, buildObserverPrompt as k, ObservationalMemoryProcessor as l, WORKING_MEMORY_STATE_PROCESSOR_ID as m, MessageHistory$1 as n, extractWorkingMemoryTags as o, WORKING_MEMORY_STATE_ID as p, StaleKnowledgeSemanticIndexError as q, SemanticRecall as r, removeWorkingMemoryTags as s, Memory as t, ObservationalMemory as u, parseObservationGroups as v, deepMergeWorkingMemory as w, stripObservationGroups as x, reconcileObservationGroupsFromReflection as y, OBSERVATIONAL_MEMORY_DEFAULTS as z };
|
|
45320
45368
|
|
|
45321
|
-
//# sourceMappingURL=src-
|
|
45369
|
+
//# sourceMappingURL=src-DhDMOGBn.js.map
|