@mastra/server 1.79.0-alpha.8 → 1.79.0-alpha.9
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/{api-schema-manifest-CXiWNHBm.js → api-schema-manifest-CWRIJP-B.js} +2 -2
- package/dist/{api-schema-manifest-CXiWNHBm.js.map → api-schema-manifest-CWRIJP-B.js.map} +1 -1
- package/dist/{api-schema-manifest-Cs2cYG-m.cjs → api-schema-manifest-DUseI2VG.cjs} +2 -2
- package/dist/{api-schema-manifest-Cs2cYG-m.cjs.map → api-schema-manifest-DUseI2VG.cjs.map} +1 -1
- package/dist/{dist-BGzSzjTX.cjs → dist-9c3PXXpk.cjs} +100 -7
- package/dist/{dist-BGzSzjTX.cjs.map → dist-9c3PXXpk.cjs.map} +1 -1
- package/dist/{dist-BeXd4jq2.js → dist-DGCnbhNe.js} +100 -7
- package/dist/{dist-BeXd4jq2.js.map → dist-DGCnbhNe.js.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-guides-mcp-authentication-authorization.md +2 -2
- package/dist/docs/references/reference-observability-tracing-advanced-queries.md +11 -9
- package/dist/{observability-new-endpoints-outfOdc8.cjs → observability-new-endpoints-AMp9bnMV.cjs} +4 -4
- package/dist/observability-new-endpoints-AMp9bnMV.cjs.map +1 -0
- package/dist/{observability-new-endpoints-7wGwP3se.js → observability-new-endpoints-BU8JYPfh.js} +5 -5
- package/dist/{observability-new-endpoints-7wGwP3se.js.map → observability-new-endpoints-BU8JYPfh.js.map} +1 -1
- package/dist/{routes-gZRBp2vK.cjs → routes-DPojsNf1.cjs} +2 -2
- package/dist/{routes-gZRBp2vK.cjs.map → routes-DPojsNf1.cjs.map} +1 -1
- package/dist/{routes-BYcXmjX3.js → routes-rwufkyUe.js} +2 -2
- package/dist/{routes-BYcXmjX3.js.map → routes-rwufkyUe.js.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-controller.cjs +190 -170
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.d.ts +165 -155
- package/dist/server/handlers/agent-controller.d.ts.map +1 -1
- package/dist/server/handlers/agent-controller.js +190 -170
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.d.ts +8 -0
- package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability-shared.cjs +31 -21
- package/dist/server/handlers/observability-shared.cjs.map +1 -1
- package/dist/server/handlers/observability-shared.d.ts +9 -4
- package/dist/server/handlers/observability-shared.d.ts.map +1 -1
- package/dist/server/handlers/observability-shared.js +31 -20
- package/dist/server/handlers/observability-shared.js.map +1 -1
- package/dist/server/handlers/observability.cjs +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/system.cjs +2 -2
- package/dist/server/handlers/system.d.ts +4 -0
- package/dist/server/handlers/system.d.ts.map +1 -1
- package/dist/server/handlers/system.js +2 -2
- package/dist/server/schemas/index.cjs +1 -1
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/schemas/system.d.ts +4 -0
- package/dist/server/schemas/system.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +1 -1
- package/dist/server/server-adapter/index.js +1 -1
- package/dist/server/server-adapter/routes/observability.d.ts +4 -0
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/system.d.ts +4 -0
- package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
- package/dist/{system-DvpPWdIa.cjs → system-BvpFMIJB.cjs} +3 -1
- package/dist/system-BvpFMIJB.cjs.map +1 -0
- package/dist/{system-BLcPGYXT.js → system-CpzPxRRq.js} +3 -1
- package/dist/system-CpzPxRRq.js.map +1 -0
- package/package.json +6 -6
- package/dist/observability-new-endpoints-outfOdc8.cjs.map +0 -1
- package/dist/system-BLcPGYXT.js.map +0 -1
- package/dist/system-DvpPWdIa.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as schemaToJsonSchema } from "./route-builder-BfQYtclb.js";
|
|
2
|
-
import { t as SERVER_ROUTES } from "./routes-
|
|
2
|
+
import { t as SERVER_ROUTES } from "./routes-rwufkyUe.js";
|
|
3
3
|
//#region src/server/server-adapter/api-schema-manifest.ts
|
|
4
4
|
function convertSchema(schema) {
|
|
5
5
|
return schema ? schemaToJsonSchema(schema) : void 0;
|
|
@@ -58,4 +58,4 @@ function buildApiSchemaManifest(routes = SERVER_ROUTES) {
|
|
|
58
58
|
//#endregion
|
|
59
59
|
export { buildApiSchemaManifest };
|
|
60
60
|
|
|
61
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
61
|
+
//# sourceMappingURL=api-schema-manifest-CWRIJP-B.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-schema-manifest-
|
|
1
|
+
{"version":3,"file":"api-schema-manifest-CWRIJP-B.js","names":[],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"mappings":";;;AA2BA,SAAS,cAAc,QAA4D;CACjF,OAAO,SAAS,mBAAmB,MAAM,IAAI,KAAA;AAC/C;AAEA,SAAS,aAAa,OAAyC;CAC7D,OAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAwB,KAAA;AAChG;AAEA,SAAS,WAAW,QAAkE;CACpF,MAAM,OAAO,QAAQ;CACrB,OAAO,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,OAAO,IAAI;AACpD;AAEA,SAAS,mBAAmB,gBAAiE;CAC3F,IAAI,CAAC,gBAAgB,OAAO,EAAE,MAAM,UAAU;CAE9C,MAAM,eAAsC,eAAe,SAAS,eAAe;CACnF,IAAI,cAAc,QAAQ;EACxB,MAAM,SAAS,aAAa,KAAI,WAAU,mBAAmB,aAAa,MAAM,CAAC,CAAC;EAClF,MAAM,QAAQ,OAAO;EACrB,OAAO,OAAO,OACZ,UACE,MAAM,SAAS,MAAM,QACrB,MAAM,iBAAiB,MAAM,gBAC7B,MAAM,uBAAuB,MAAM,kBACvC,IACI,QACA,EAAE,MAAM,SAAS;CACvB;CAEA,MAAM,OAAO,WAAW,cAAc;CACtC,IAAI,SAAS,SAAS,OAAO,EAAE,MAAM,QAAQ;CAC7C,IAAI,SAAS,UAAU,OAAO,EAAE,MAAM,SAAS;CAE/C,MAAM,aACJ,eAAe,cAAc,CAAC,MAAM,QAAQ,eAAe,UAAU,IAAI,eAAe,aAAa,CAAC;CACxG,MAAM,gBAAgB,OAAO,KAAK,UAAU;CAC5C,MAAM,qBAAqB,UAAU,aAAa,SAAS,gBAAgB,aAAa,eAAe,KAAA;CACvG,MAAM,eAAe,OAAO,QAAQ,UAAU,CAAC,CAAC,MAC7C,GAAG,cAAc,WAAW,aAAa,QAAQ,CAAC,MAAM,OAC3D,CAAC,GAAG;CAEJ,IAAI,iBAAiB,sBAAsB,cAAc,UAAU,IACjE,OAAO;EAAE,MAAM;EAAmB;EAAc;CAAmB;CAErE,IAAI,eAAe,wBAAwB,cAAc,WAAW,GAAG,OAAO,EAAE,MAAM,SAAS;CAC/F,OAAO,EAAE,MAAM,SAAS;AAC1B;AAWA,SAAS,gBAAgB,OAA6B;CACpD,OAAO,MAAM,iBAAiB,UAAU,CAAC,MAAM;AACjD;AAEA,SAAgB,uBAAuB,SAAiC,eAAkC;CACxG,OAAO;EACL,SAAS;EACT,QAAQ,OAAO,OAAO,eAAe,CAAC,CAAC,KAAI,UAAS;GAClD,MAAM,iBAAiB,cAAc,MAAM,cAAc;GACzD,OAAO;IACL,QAAQ,MAAM;IACd,MAAM,MAAM;IACZ,cAAc,MAAM;IACpB,iBAAiB,cAAc,MAAM,eAAe;IACpD,kBAAkB,cAAc,MAAM,gBAAgB;IACtD,YAAY,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./rolldown-runtime-Bd6kNlEP.cjs");
|
|
2
2
|
const require_route_builder = require("./route-builder-BNZs643f.cjs");
|
|
3
|
-
const require_routes = require("./routes-
|
|
3
|
+
const require_routes = require("./routes-DPojsNf1.cjs");
|
|
4
4
|
//#region src/server/server-adapter/api-schema-manifest.ts
|
|
5
5
|
function convertSchema(schema) {
|
|
6
6
|
return schema ? require_route_builder.schemaToJsonSchema(schema) : void 0;
|
|
@@ -59,4 +59,4 @@ function buildApiSchemaManifest(routes = require_routes.SERVER_ROUTES) {
|
|
|
59
59
|
//#endregion
|
|
60
60
|
exports.buildApiSchemaManifest = buildApiSchemaManifest;
|
|
61
61
|
|
|
62
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
62
|
+
//# sourceMappingURL=api-schema-manifest-DUseI2VG.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-schema-manifest-
|
|
1
|
+
{"version":3,"file":"api-schema-manifest-DUseI2VG.cjs","names":["schemaToJsonSchema","SERVER_ROUTES"],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"mappings":";;;;AA2BA,SAAS,cAAc,QAA4D;CACjF,OAAO,SAASA,sBAAAA,mBAAmB,MAAM,IAAI,KAAA;AAC/C;AAEA,SAAS,aAAa,OAAyC;CAC7D,OAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAwB,KAAA;AAChG;AAEA,SAAS,WAAW,QAAkE;CACpF,MAAM,OAAO,QAAQ;CACrB,OAAO,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,OAAO,IAAI;AACpD;AAEA,SAAS,mBAAmB,gBAAiE;CAC3F,IAAI,CAAC,gBAAgB,OAAO,EAAE,MAAM,UAAU;CAE9C,MAAM,eAAsC,eAAe,SAAS,eAAe;CACnF,IAAI,cAAc,QAAQ;EACxB,MAAM,SAAS,aAAa,KAAI,WAAU,mBAAmB,aAAa,MAAM,CAAC,CAAC;EAClF,MAAM,QAAQ,OAAO;EACrB,OAAO,OAAO,OACZ,UACE,MAAM,SAAS,MAAM,QACrB,MAAM,iBAAiB,MAAM,gBAC7B,MAAM,uBAAuB,MAAM,kBACvC,IACI,QACA,EAAE,MAAM,SAAS;CACvB;CAEA,MAAM,OAAO,WAAW,cAAc;CACtC,IAAI,SAAS,SAAS,OAAO,EAAE,MAAM,QAAQ;CAC7C,IAAI,SAAS,UAAU,OAAO,EAAE,MAAM,SAAS;CAE/C,MAAM,aACJ,eAAe,cAAc,CAAC,MAAM,QAAQ,eAAe,UAAU,IAAI,eAAe,aAAa,CAAC;CACxG,MAAM,gBAAgB,OAAO,KAAK,UAAU;CAC5C,MAAM,qBAAqB,UAAU,aAAa,SAAS,gBAAgB,aAAa,eAAe,KAAA;CACvG,MAAM,eAAe,OAAO,QAAQ,UAAU,CAAC,CAAC,MAC7C,GAAG,cAAc,WAAW,aAAa,QAAQ,CAAC,MAAM,OAC3D,CAAC,GAAG;CAEJ,IAAI,iBAAiB,sBAAsB,cAAc,UAAU,IACjE,OAAO;EAAE,MAAM;EAAmB;EAAc;CAAmB;CAErE,IAAI,eAAe,wBAAwB,cAAc,WAAW,GAAG,OAAO,EAAE,MAAM,SAAS;CAC/F,OAAO,EAAE,MAAM,SAAS;AAC1B;AAWA,SAAS,gBAAgB,OAA6B;CACpD,OAAO,MAAM,iBAAiB,UAAU,CAAC,MAAM;AACjD;AAEA,SAAgB,uBAAuB,SAAiCC,eAAAA,eAAkC;CACxG,OAAO;EACL,SAAS;EACT,QAAQ,OAAO,OAAO,eAAe,CAAC,CAAC,KAAI,UAAS;GAClD,MAAM,iBAAiB,cAAc,MAAM,cAAc;GACzD,OAAO;IACL,QAAQ,MAAM;IACd,MAAM,MAAM;IACZ,cAAc,MAAM;IACpB,iBAAiB,cAAc,MAAM,eAAe;IACpD,kBAAkB,cAAc,MAAM,gBAAgB;IACtD,YAAY,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
|
|
@@ -4638,7 +4638,7 @@ function splitLines(text) {
|
|
|
4638
4638
|
return result;
|
|
4639
4639
|
}
|
|
4640
4640
|
//#endregion
|
|
4641
|
-
//#region ../memory/dist/src-
|
|
4641
|
+
//#region ../memory/dist/src-gDNjAELE.js
|
|
4642
4642
|
var __defProp$3 = Object.defineProperty;
|
|
4643
4643
|
var __exportAll = (all, no_symbols) => {
|
|
4644
4644
|
let target = {};
|
|
@@ -41825,6 +41825,7 @@ var ObservationStep = class {
|
|
|
41825
41825
|
sendSignal: this.turn.sendSignal,
|
|
41826
41826
|
sendStateSignal: this.turn.sendStateSignal,
|
|
41827
41827
|
requestContext: this.turn.requestContext,
|
|
41828
|
+
currentModel: this.turn.actorModelContext,
|
|
41828
41829
|
writer: this.turn.writer,
|
|
41829
41830
|
observabilityContext: this.turn.observabilityContext
|
|
41830
41831
|
});
|
|
@@ -44202,10 +44203,11 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
44202
44203
|
async resolveAutoModel(options) {
|
|
44203
44204
|
let mainModel = options?.currentModel?.model;
|
|
44204
44205
|
if (!mainModel && options?.mainAgent) mainModel = await options.mainAgent.getModel({ requestContext: options.requestContext });
|
|
44205
|
-
const mainModelId = getModelId(mainModel);
|
|
44206
|
-
const pick = resolveAutoModelId(mainModelId, this.autoModelOptions(options?.requestContext))
|
|
44206
|
+
const mainModelId = mainModel ? getModelId(mainModel) : getCurrentModel(options?.currentModel);
|
|
44207
|
+
const pick = resolveAutoModelId(mainModelId, this.autoModelOptions(options?.requestContext));
|
|
44207
44208
|
if (mainModel && (!pick || pick === mainModelId)) return mainModel;
|
|
44208
|
-
const modelId = pick;
|
|
44209
|
+
const modelId = pick ?? (this.canUseProvider ? void 0 : OBSERVATIONAL_MEMORY_DEFAULTS.observation.model);
|
|
44210
|
+
if (!modelId) throw new Error(`Observational memory model 'auto' could not determine the main model, and ${OBSERVATIONAL_MEMORY_DEFAULTS.observation.model} has no usable credential. Pass the actor model or choose a concrete memory model.`);
|
|
44209
44211
|
return this.resolveAutoModelHook ? await this.resolveAutoModelHook(modelId, { requestContext: options?.requestContext }) : modelId;
|
|
44210
44212
|
}
|
|
44211
44213
|
async resolveModelFunction(model, requestContext) {
|
|
@@ -46092,6 +46094,7 @@ ${formattedMessages}
|
|
|
46092
46094
|
sendSignal: opts.sendSignal,
|
|
46093
46095
|
sendStateSignal: opts.sendStateSignal,
|
|
46094
46096
|
requestContext,
|
|
46097
|
+
currentModel: opts.currentModel,
|
|
46095
46098
|
writer: opts.writer,
|
|
46096
46099
|
observabilityContext: opts.observabilityContext
|
|
46097
46100
|
}).run();
|
|
@@ -46660,6 +46663,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
46660
46663
|
if (this.turn?.ended) this.turn = void 0;
|
|
46661
46664
|
state.__omTurn = void 0;
|
|
46662
46665
|
}
|
|
46666
|
+
let responseMessageId = messageId;
|
|
46663
46667
|
if (!this.turn || !state.__omTurn) {
|
|
46664
46668
|
if (this.turn && !state.__omTurn) await this.turn.end().catch(() => {});
|
|
46665
46669
|
this.turn = this.engine.beginTurn({
|
|
@@ -46679,6 +46683,11 @@ var ObservationalMemoryProcessor = class {
|
|
|
46679
46683
|
this.turn.agent = args.agent;
|
|
46680
46684
|
this.turn.requestContext = requestContext;
|
|
46681
46685
|
await this.turn.start(this.memory, runState);
|
|
46686
|
+
if (messageId && this.turn.record.observedMessageIds?.includes(messageId)) {
|
|
46687
|
+
const observed = messageList.get.all.db().find((message) => message.id === messageId);
|
|
46688
|
+
if (observed) this.engine.sealMessagesForBuffering([observed]);
|
|
46689
|
+
responseMessageId = rotateResponseMessageId?.() ?? messageId;
|
|
46690
|
+
}
|
|
46682
46691
|
if (stepNumber === 0 && this.temporalMarkers) await insertTemporalGapMarkers({
|
|
46683
46692
|
messageList,
|
|
46684
46693
|
sendSignal: args.sendSignal
|
|
@@ -46693,7 +46702,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
46693
46702
|
state.__omObservabilityContext = observabilityContext;
|
|
46694
46703
|
this.turn.observabilityContext = observabilityContext;
|
|
46695
46704
|
this.turn.actorModelContext = actorModelContext;
|
|
46696
|
-
this.turn.responseMessageId =
|
|
46705
|
+
this.turn.responseMessageId = responseMessageId;
|
|
46697
46706
|
{
|
|
46698
46707
|
const step = this.turn.step(stepNumber);
|
|
46699
46708
|
let ctx;
|
|
@@ -46808,6 +46817,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
46808
46817
|
sendSignal: args.sendSignal,
|
|
46809
46818
|
sendStateSignal: args.sendStateSignal,
|
|
46810
46819
|
requestContext,
|
|
46820
|
+
currentModel: state.__omActorModelContext,
|
|
46811
46821
|
writer: args.writer,
|
|
46812
46822
|
observabilityContext: getOmObservabilityContext(args)
|
|
46813
46823
|
}));
|
|
@@ -46937,6 +46947,7 @@ function extractWorkingMemoryContent(text) {
|
|
|
46937
46947
|
return text.substring(contentStart, end);
|
|
46938
46948
|
}
|
|
46939
46949
|
const UPDATE_WORKING_MEMORY_TOOL_NAME = "updateWorkingMemory";
|
|
46950
|
+
const SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
|
|
46940
46951
|
/**
|
|
46941
46952
|
* Removes `updateWorkingMemory` tool invocations from stored message parts, one step
|
|
46942
46953
|
* at a time. A step starts at a `step-start` part, or where a tool part is followed by
|
|
@@ -46958,6 +46969,29 @@ function removeWorkingMemoryToolInvocationParts(parts) {
|
|
|
46958
46969
|
return steps.flatMap((step) => {
|
|
46959
46970
|
if (!step.some(isWorkingMemoryCall)) return step;
|
|
46960
46971
|
const remaining = step.filter((part) => !isWorkingMemoryCall(part));
|
|
46972
|
+
const targetIndex = remaining.findIndex((part) => part?.type === "tool-invocation");
|
|
46973
|
+
const target = remaining[targetIndex];
|
|
46974
|
+
if (target?.type === "tool-invocation") {
|
|
46975
|
+
let providerMetadata = target.providerMetadata;
|
|
46976
|
+
for (const removed of step) {
|
|
46977
|
+
if (!isWorkingMemoryCall(removed)) continue;
|
|
46978
|
+
for (const [provider, metadata] of Object.entries(removed.providerMetadata ?? {})) {
|
|
46979
|
+
if (metadata?.thoughtSignature === void 0) continue;
|
|
46980
|
+
if (providerMetadata?.[provider]?.thoughtSignature !== void 0) continue;
|
|
46981
|
+
providerMetadata = {
|
|
46982
|
+
...providerMetadata,
|
|
46983
|
+
[provider]: {
|
|
46984
|
+
...providerMetadata?.[provider],
|
|
46985
|
+
thoughtSignature: SKIP_THOUGHT_SIGNATURE_VALIDATOR
|
|
46986
|
+
}
|
|
46987
|
+
};
|
|
46988
|
+
}
|
|
46989
|
+
}
|
|
46990
|
+
if (providerMetadata !== target.providerMetadata) remaining[targetIndex] = {
|
|
46991
|
+
...target,
|
|
46992
|
+
providerMetadata
|
|
46993
|
+
};
|
|
46994
|
+
}
|
|
46961
46995
|
return remaining.every((part) => part?.type === "step-start" || part?.type === "reasoning" || part?.type === "text" && !removeWorkingMemoryTags(part.text ?? "").trim()) ? [] : remaining;
|
|
46962
46996
|
});
|
|
46963
46997
|
}
|
|
@@ -49042,7 +49076,7 @@ Notes:
|
|
|
49042
49076
|
const memoryStore = await this.getMemoryStore();
|
|
49043
49077
|
const config = this.getMergedThreadConfig(memoryConfig);
|
|
49044
49078
|
const migratesVectors = Boolean(this.vector && (this.embedder || this.isSelfEmbedding) && config.semanticRecall);
|
|
49045
|
-
if (!
|
|
49079
|
+
if (!this.vector) {
|
|
49046
49080
|
const existing = await memoryStore.getThreadById({ threadId });
|
|
49047
49081
|
if (existing && existing.resourceId === resourceId) return existing;
|
|
49048
49082
|
}
|
|
@@ -49071,9 +49105,68 @@ Notes:
|
|
|
49071
49105
|
});
|
|
49072
49106
|
throw new Error(`Thread "${threadId}" was transferred to resource "${resourceId}", but migrating its semantic-recall vectors failed. The thread's messages may not surface under resource-scoped recall until the vectors are re-indexed. Cause: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
49073
49107
|
}
|
|
49108
|
+
if (this.vector) try {
|
|
49109
|
+
await this.moveObservationVectors(threadId, resourceId);
|
|
49110
|
+
} catch (error) {
|
|
49111
|
+
this.logger.error("Failed to move observation vectors during thread transfer", {
|
|
49112
|
+
threadId,
|
|
49113
|
+
resourceId,
|
|
49114
|
+
error: error instanceof Error ? error.message : String(error)
|
|
49115
|
+
});
|
|
49116
|
+
throw new Error(`Thread "${threadId}" was transferred to resource "${resourceId}", but moving its observation vectors failed. Its observations may not surface in recall search under the new resource until the transfer is retried. Cause: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
49117
|
+
}
|
|
49074
49118
|
return thread;
|
|
49075
49119
|
}
|
|
49076
49120
|
/**
|
|
49121
|
+
* Re-tag a thread's observation vectors with its new resource. Recall search filters
|
|
49122
|
+
* observations by `resource_id`, so untouched vectors would hide the thread's past
|
|
49123
|
+
* observations under the new owner. Each vector is updated on its own with its metadata
|
|
49124
|
+
* merged, because filter-based updates replace the whole metadata object on some stores.
|
|
49125
|
+
*/
|
|
49126
|
+
async moveObservationVectors(threadId, resourceId) {
|
|
49127
|
+
const vector = this.vector;
|
|
49128
|
+
const indexes = await this.getMemoryVectorIndexes([this.observationIndexPrefix]);
|
|
49129
|
+
for (const indexName of indexes) {
|
|
49130
|
+
const { dimension } = await vector.describeIndex({ indexName });
|
|
49131
|
+
const queryVector = Array.from({ length: dimension }, (_, i) => i === 0 ? 1 : 0);
|
|
49132
|
+
const moved = /* @__PURE__ */ new Set();
|
|
49133
|
+
for (;;) {
|
|
49134
|
+
const pending = (await vector.query({
|
|
49135
|
+
indexName,
|
|
49136
|
+
queryVector,
|
|
49137
|
+
topK: 20,
|
|
49138
|
+
includeVector: true,
|
|
49139
|
+
filter: {
|
|
49140
|
+
thread_id: threadId,
|
|
49141
|
+
resource_id: { $ne: resourceId }
|
|
49142
|
+
}
|
|
49143
|
+
})).filter((result) => !moved.has(result.id));
|
|
49144
|
+
if (pending.length === 0) break;
|
|
49145
|
+
for (const result of pending) {
|
|
49146
|
+
moved.add(result.id);
|
|
49147
|
+
if (!result.metadata) {
|
|
49148
|
+
this.logger.warn("Skipping observation vector without metadata during thread transfer", {
|
|
49149
|
+
indexName,
|
|
49150
|
+
id: result.id
|
|
49151
|
+
});
|
|
49152
|
+
continue;
|
|
49153
|
+
}
|
|
49154
|
+
await vector.updateVector({
|
|
49155
|
+
indexName,
|
|
49156
|
+
id: result.id,
|
|
49157
|
+
update: {
|
|
49158
|
+
metadata: {
|
|
49159
|
+
...result.metadata,
|
|
49160
|
+
resource_id: resourceId
|
|
49161
|
+
},
|
|
49162
|
+
...result.vector ? { vector: result.vector } : {}
|
|
49163
|
+
}
|
|
49164
|
+
});
|
|
49165
|
+
}
|
|
49166
|
+
}
|
|
49167
|
+
}
|
|
49168
|
+
}
|
|
49169
|
+
/**
|
|
49077
49170
|
* Clone observational memory records when cloning a thread.
|
|
49078
49171
|
* Thread-scoped: always cloned to the new thread.
|
|
49079
49172
|
* Resource-scoped: cloned only when the resourceId changes (same resourceId shares OM naturally).
|
|
@@ -58116,4 +58209,4 @@ const agentBuilderWorkflows = {
|
|
|
58116
58209
|
//#endregion
|
|
58117
58210
|
exports.agentBuilderWorkflows = agentBuilderWorkflows;
|
|
58118
58211
|
|
|
58119
|
-
//# sourceMappingURL=dist-
|
|
58212
|
+
//# sourceMappingURL=dist-9c3PXXpk.cjs.map
|