@mastra/server 1.75.0-alpha.0 → 1.75.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.
Files changed (60) hide show
  1. package/dist/{api-schema-manifest-BmraF-WX.js → api-schema-manifest-Cg5BAmJ6.js} +2 -2
  2. package/dist/{api-schema-manifest-BmraF-WX.js.map → api-schema-manifest-Cg5BAmJ6.js.map} +1 -1
  3. package/dist/{api-schema-manifest-Blh5-4VH.cjs → api-schema-manifest-hJw56vOw.cjs} +2 -2
  4. package/dist/{api-schema-manifest-Blh5-4VH.cjs.map → api-schema-manifest-hJw56vOw.cjs.map} +1 -1
  5. package/dist/{dist-DH39C5Bz.js → dist-BKGwFBci.js} +104 -38
  6. package/dist/{dist-DH39C5Bz.js.map → dist-BKGwFBci.js.map} +1 -1
  7. package/dist/{dist-IDt748Ya.cjs → dist-DL6nu99w.cjs} +104 -38
  8. package/dist/{dist-IDt748Ya.cjs.map → dist-DL6nu99w.cjs.map} +1 -1
  9. package/dist/docs/SKILL.md +1 -1
  10. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  11. package/dist/{routes-CcjyQojv.cjs → routes-mJga4N4C.cjs} +2 -2
  12. package/dist/{routes-CcjyQojv.cjs.map → routes-mJga4N4C.cjs.map} +1 -1
  13. package/dist/{routes-Boe1UThy.js → routes-obDo67aE.js} +2 -2
  14. package/dist/{routes-Boe1UThy.js.map → routes-obDo67aE.js.map} +1 -1
  15. package/dist/server/handlers/agent-builder.cjs +1 -1
  16. package/dist/server/handlers/agent-builder.js +1 -1
  17. package/dist/server/handlers/agent-controller.cjs +1 -1
  18. package/dist/server/handlers/agent-controller.js +1 -1
  19. package/dist/server/handlers/agents.cjs +17 -1
  20. package/dist/server/handlers/agents.cjs.map +1 -1
  21. package/dist/server/handlers/agents.d.ts.map +1 -1
  22. package/dist/server/handlers/agents.js +17 -1
  23. package/dist/server/handlers/agents.js.map +1 -1
  24. package/dist/server/handlers/conversations.cjs +1 -1
  25. package/dist/server/handlers/conversations.js +1 -1
  26. package/dist/server/handlers/logs.cjs +1 -1
  27. package/dist/server/handlers/logs.js +1 -1
  28. package/dist/server/handlers/memory.cjs +1 -1
  29. package/dist/server/handlers/memory.js +1 -1
  30. package/dist/server/handlers/plans.cjs +1 -1
  31. package/dist/server/handlers/plans.js +1 -1
  32. package/dist/server/handlers/responses.cjs +1 -1
  33. package/dist/server/handlers/responses.js +1 -1
  34. package/dist/server/handlers/responses.storage.cjs +1 -1
  35. package/dist/server/handlers/responses.storage.js +1 -1
  36. package/dist/server/handlers/system.cjs +1 -1
  37. package/dist/server/handlers/system.js +1 -1
  38. package/dist/server/handlers/tools.cjs +1 -1
  39. package/dist/server/handlers/tools.js +1 -1
  40. package/dist/server/handlers/utils.cjs +2 -1
  41. package/dist/server/handlers/utils.d.ts +6 -0
  42. package/dist/server/handlers/utils.d.ts.map +1 -1
  43. package/dist/server/handlers/utils.js +2 -2
  44. package/dist/server/handlers/workflow-builder.cjs +1 -1
  45. package/dist/server/handlers/workflow-builder.js +1 -1
  46. package/dist/server/handlers/workflows.cjs +1 -1
  47. package/dist/server/handlers/workflows.js +1 -1
  48. package/dist/server/server-adapter/index.cjs +1 -1
  49. package/dist/server/server-adapter/index.js +1 -1
  50. package/dist/{utils-aIu3gkhJ.cjs → utils-HqDZJwRc.cjs} +31 -1
  51. package/dist/utils-HqDZJwRc.cjs.map +1 -0
  52. package/dist/{utils-KsERfbhc.js → utils-KcHk7C0D.js} +26 -2
  53. package/dist/utils-KcHk7C0D.js.map +1 -0
  54. package/dist/{workflow-builder-DTcM8ER3.cjs → workflow-builder-BSjQJCVD.cjs} +2 -2
  55. package/dist/{workflow-builder-DTcM8ER3.cjs.map → workflow-builder-BSjQJCVD.cjs.map} +1 -1
  56. package/dist/{workflow-builder-KRSpDol2.js → workflow-builder-DJ48IzXQ.js} +2 -2
  57. package/dist/{workflow-builder-KRSpDol2.js.map → workflow-builder-DJ48IzXQ.js.map} +1 -1
  58. package/package.json +6 -6
  59. package/dist/utils-KsERfbhc.js.map +0 -1
  60. package/dist/utils-aIu3gkhJ.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { c as schemaToJsonSchema } from "./route-builder-lBil8Cvo.js";
2
- import { t as SERVER_ROUTES } from "./routes-Boe1UThy.js";
2
+ import { t as SERVER_ROUTES } from "./routes-obDo67aE.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;
@@ -52,4 +52,4 @@ function buildApiSchemaManifest(routes = SERVER_ROUTES) {
52
52
  //#endregion
53
53
  export { buildApiSchemaManifest };
54
54
 
55
- //# sourceMappingURL=api-schema-manifest-BmraF-WX.js.map
55
+ //# sourceMappingURL=api-schema-manifest-Cg5BAmJ6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-BmraF-WX.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 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\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,O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AC;CACH;AACF"}
1
+ {"version":3,"file":"api-schema-manifest-Cg5BAmJ6.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 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\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,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;AAEA,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-2yrD15TL.cjs");
3
- const require_routes = require("./routes-CcjyQojv.cjs");
3
+ const require_routes = require("./routes-mJga4N4C.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;
@@ -53,4 +53,4 @@ function buildApiSchemaManifest(routes = require_routes.SERVER_ROUTES) {
53
53
  //#endregion
54
54
  exports.buildApiSchemaManifest = buildApiSchemaManifest;
55
55
 
56
- //# sourceMappingURL=api-schema-manifest-Blh5-4VH.cjs.map
56
+ //# sourceMappingURL=api-schema-manifest-hJw56vOw.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-Blh5-4VH.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 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\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,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;AAEA,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"}
1
+ {"version":3,"file":"api-schema-manifest-hJw56vOw.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 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\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"],"mapp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,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"}
@@ -4637,7 +4637,7 @@ function splitLines(text) {
4637
4637
  return result;
4638
4638
  }
4639
4639
  //#endregion
4640
- //#region ../memory/dist/src-BV9eXuMM.js
4640
+ //#region ../memory/dist/src-CFTlELNa.js
4641
4641
  var __defProp$3 = Object.defineProperty;
4642
4642
  var __exportAll = (all, no_symbols) => {
4643
4643
  let target = {};
@@ -37682,22 +37682,32 @@ var Memory = class Memory extends MastraMemory {
37682
37682
  if (resourceScope && !resourceId && config?.semanticRecall && vectorSearchString) throw new Error("Memory error: Resource-scoped semantic recall is enabled but no resourceId was provided. Either provide a resourceId or explicitly set semanticRecall.scope to 'thread'.");
37683
37683
  let usage;
37684
37684
  if (config?.semanticRecall && vectorSearchString && this.vector) {
37685
- const result = await this.embedMessageContent(vectorSearchString);
37686
- usage = result.usage;
37687
- const { embeddings, dimension } = result;
37688
- const { indexName } = await this.createEmbeddingIndex(dimension, config);
37689
- await Promise.all(embeddings.map(async (embedding) => {
37690
- if (typeof this.vector === `undefined`) throw new Error(`Tried to query vector index ${indexName} but this Memory instance doesn't have an attached vector db.`);
37691
- const scopeFilter = resourceScope ? { resource_id: resourceId } : { thread_id: threadId };
37692
- const userFilter = typeof config.semanticRecall === "object" ? config.semanticRecall.filter : void 0;
37693
- const combinedFilter = userFilter ? { $and: [scopeFilter, userFilter] } : scopeFilter;
37685
+ const scopeFilter = resourceScope ? { resource_id: resourceId } : { thread_id: threadId };
37686
+ const userFilter = typeof config.semanticRecall === "object" ? config.semanticRecall.filter : void 0;
37687
+ const combinedFilter = userFilter ? { $and: [scopeFilter, userFilter] } : scopeFilter;
37688
+ if (this.isSelfEmbedding) {
37689
+ const { indexName } = await this.createEmbeddingIndex(void 0, config);
37694
37690
  vectorResults.push(...await this.vector.query({
37695
37691
  indexName,
37696
- queryVector: embedding,
37692
+ queryText: vectorSearchString,
37697
37693
  topK: vectorConfig.topK,
37698
37694
  filter: combinedFilter
37699
37695
  }));
37700
- }));
37696
+ } else {
37697
+ const result = await this.embedMessageContent(vectorSearchString);
37698
+ usage = result.usage;
37699
+ const { embeddings, dimension } = result;
37700
+ const { indexName } = await this.createEmbeddingIndex(dimension, config);
37701
+ await Promise.all(embeddings.map(async (embedding) => {
37702
+ if (typeof this.vector === `undefined`) throw new Error(`Tried to query vector index ${indexName} but this Memory instance doesn't have an attached vector db.`);
37703
+ vectorResults.push(...await this.vector.query({
37704
+ indexName,
37705
+ queryVector: embedding,
37706
+ topK: vectorConfig.topK,
37707
+ filter: combinedFilter
37708
+ }));
37709
+ }));
37710
+ }
37701
37711
  }
37702
37712
  const threshold = (typeof config.semanticRecall === "object" ? config.semanticRecall : void 0)?.threshold;
37703
37713
  const filteredVectorResults = threshold !== void 0 ? vectorResults.filter((r) => r.score >= threshold) : vectorResults;
@@ -37855,11 +37865,13 @@ var Memory = class Memory extends MastraMemory {
37855
37865
  if (this.vector) this.trackVectorCleanup(this.deleteThreadVectors(threadId));
37856
37866
  }
37857
37867
  /**
37858
- * Prefix shared by every message index. The index for the default embedding
37859
- * dimension is named with the bare prefix; other dimensions add a suffix.
37868
+ * Prefix shared by every message index. The index for the default embedding dimension is named
37869
+ * with the bare prefix; other dimensions add a dimension suffix, and a store that embeds the
37870
+ * text itself adds its own. Built here rather than read from `getEmbeddingIndexName()`, which
37871
+ * answers for one configuration and so would not match indexes written under another.
37860
37872
  */
37861
37873
  get messageIndexPrefix() {
37862
- return this.getEmbeddingIndexName();
37874
+ return `memory${this.vector?.indexSeparator ?? "_"}messages`;
37863
37875
  }
37864
37876
  /**
37865
37877
  * Prefix shared by every observation index. Each observation index adds a dimension suffix.
@@ -38144,13 +38156,24 @@ ${workingMemory}`;
38144
38156
  if (joined) textForEmbedding = joined;
38145
38157
  }
38146
38158
  if (!textForEmbedding) return;
38147
- const result = await this.embedMessageContent(textForEmbedding);
38148
- dimension = result.dimension;
38149
- if (result.usage?.tokens) totalTokens += result.usage.tokens;
38159
+ let embeddings = [];
38160
+ let documents;
38161
+ let chunks;
38162
+ if (this.isSelfEmbedding) {
38163
+ chunks = this.chunkText(textForEmbedding);
38164
+ documents = chunks;
38165
+ } else {
38166
+ const result = await this.embedMessageContent(textForEmbedding);
38167
+ dimension = result.dimension;
38168
+ if (result.usage?.tokens) totalTokens += result.usage.tokens;
38169
+ embeddings = result.embeddings;
38170
+ chunks = result.chunks;
38171
+ }
38150
38172
  const threadMetadata = message.threadId ? threadMetadataMap.get(message.threadId) || {} : {};
38151
38173
  embeddingData.push({
38152
- embeddings: result.embeddings,
38153
- metadata: result.chunks.map(() => ({
38174
+ embeddings,
38175
+ documents,
38176
+ metadata: chunks.map(() => ({
38154
38177
  ...threadMetadata,
38155
38178
  message_id: message.id,
38156
38179
  thread_id: message.threadId,
@@ -38161,16 +38184,23 @@ ${workingMemory}`;
38161
38184
  }))
38162
38185
  });
38163
38186
  }));
38164
- if (embeddingData.length > 0 && dimension !== void 0) {
38187
+ if (embeddingData.length > 0 && (this.isSelfEmbedding || dimension !== void 0)) {
38165
38188
  if (typeof this.vector === `undefined`) throw new Error(`Tried to upsert embeddings but this Memory instance doesn't have an attached vector db.`);
38166
38189
  const { indexName } = await this.createEmbeddingIndex(dimension, config);
38167
38190
  const allVectors = [];
38168
38191
  const allMetadata = [];
38192
+ const allDocuments = [];
38169
38193
  for (const data of embeddingData) {
38170
38194
  allVectors.push(...data.embeddings);
38195
+ if (data.documents) allDocuments.push(...data.documents);
38171
38196
  allMetadata.push(...data.metadata);
38172
38197
  }
38173
- await this.vector.upsert({
38198
+ if (this.isSelfEmbedding) await this.vector.upsert({
38199
+ indexName,
38200
+ documents: allDocuments,
38201
+ metadata: allMetadata
38202
+ });
38203
+ else await this.vector.upsert({
38174
38204
  indexName,
38175
38205
  vectors: allVectors,
38176
38206
  metadata: allMetadata
@@ -38955,11 +38985,22 @@ Notes:
38955
38985
  }
38956
38986
  }
38957
38987
  if (textForEmbedding) {
38958
- const result = await this.embedMessageContent(textForEmbedding);
38959
- dimension = result.dimension;
38988
+ let embeddings = [];
38989
+ let documents;
38990
+ let chunks;
38991
+ if (this.isSelfEmbedding) {
38992
+ chunks = this.chunkText(textForEmbedding);
38993
+ documents = chunks;
38994
+ } else {
38995
+ const result = await this.embedMessageContent(textForEmbedding);
38996
+ dimension = result.dimension;
38997
+ embeddings = result.embeddings;
38998
+ chunks = result.chunks;
38999
+ }
38960
39000
  embeddingData.push({
38961
- embeddings: result.embeddings,
38962
- metadata: result.chunks.map(() => ({
39001
+ embeddings,
39002
+ documents,
39003
+ metadata: chunks.map(() => ({
38963
39004
  message_id: message.id,
38964
39005
  thread_id: existingMessage.threadId,
38965
39006
  resource_id: existingMessage.resourceId,
@@ -38994,15 +39035,22 @@ Notes:
38994
39035
  } catch {
38995
39036
  this.logger.debug("Failed to clean up old vectors during message update");
38996
39037
  }
38997
- if (embeddingData.length > 0 && dimension !== void 0) {
39038
+ if (embeddingData.length > 0 && (this.isSelfEmbedding || dimension !== void 0)) {
38998
39039
  const { indexName } = await this.createEmbeddingIndex(dimension, config);
38999
39040
  const allVectors = [];
39000
39041
  const allMetadata = [];
39042
+ const allDocuments = [];
39001
39043
  for (const data of embeddingData) {
39002
39044
  allVectors.push(...data.embeddings);
39045
+ if (data.documents) allDocuments.push(...data.documents);
39003
39046
  allMetadata.push(...data.metadata);
39004
39047
  }
39005
- await this.vector.upsert({
39048
+ if (this.isSelfEmbedding) await this.vector.upsert({
39049
+ indexName,
39050
+ documents: allDocuments,
39051
+ metadata: allMetadata
39052
+ });
39053
+ else await this.vector.upsert({
39006
39054
  indexName,
39007
39055
  vectors: allVectors,
39008
39056
  metadata: allMetadata
@@ -39189,7 +39237,7 @@ Notes:
39189
39237
  await this.rollbackCopiedThread(memoryStore, result.thread, "OM clone", false, priorDestinationResourceWm);
39190
39238
  throw error;
39191
39239
  }
39192
- if (this.vector && this.embedder && config.semanticRecall) try {
39240
+ if (this.vector && (this.embedder || this.isSelfEmbedding) && config.semanticRecall) try {
39193
39241
  await this.embedCopiedMessagesInBatches(memoryStore, result, config);
39194
39242
  } catch (error) {
39195
39243
  await this.rollbackCopiedThread(memoryStore, result.thread, "embedding", true, priorDestinationResourceWm);
@@ -39258,7 +39306,7 @@ Notes:
39258
39306
  async updateThreadResourceId({ threadId, resourceId, memoryConfig }) {
39259
39307
  const memoryStore = await this.getMemoryStore();
39260
39308
  const config = this.getMergedThreadConfig(memoryConfig);
39261
- const migratesVectors = Boolean(this.vector && this.embedder && config.semanticRecall);
39309
+ const migratesVectors = Boolean(this.vector && (this.embedder || this.isSelfEmbedding) && config.semanticRecall);
39262
39310
  if (!migratesVectors) {
39263
39311
  const existing = await memoryStore.getThreadById({ threadId });
39264
39312
  if (existing && existing.resourceId === resourceId) return existing;
@@ -39364,7 +39412,7 @@ Notes:
39364
39412
  * This is similar to the embedding logic in saveMessages but operates on already-saved messages.
39365
39413
  */
39366
39414
  async embedClonedMessages(messages, config) {
39367
- if (!this.vector || !this.embedder) return;
39415
+ if (!this.vector || !this.embedder && !this.isSelfEmbedding) return;
39368
39416
  const embeddingData = [];
39369
39417
  let dimension;
39370
39418
  await Promise.all(messages.map(async (message) => {
@@ -39375,11 +39423,22 @@ Notes:
39375
39423
  if (joined) textForEmbedding = joined;
39376
39424
  }
39377
39425
  if (!textForEmbedding) return;
39378
- const result = await this.embedMessageContent(textForEmbedding);
39379
- dimension = result.dimension;
39426
+ let embeddings = [];
39427
+ let documents;
39428
+ let chunks;
39429
+ if (this.isSelfEmbedding) {
39430
+ chunks = this.chunkText(textForEmbedding);
39431
+ documents = chunks;
39432
+ } else {
39433
+ const result = await this.embedMessageContent(textForEmbedding);
39434
+ dimension = result.dimension;
39435
+ embeddings = result.embeddings;
39436
+ chunks = result.chunks;
39437
+ }
39380
39438
  embeddingData.push({
39381
- embeddings: result.embeddings,
39382
- metadata: result.chunks.map(() => ({
39439
+ embeddings,
39440
+ documents,
39441
+ metadata: chunks.map(() => ({
39383
39442
  message_id: message.id,
39384
39443
  thread_id: message.threadId,
39385
39444
  resource_id: message.resourceId,
@@ -39389,15 +39448,22 @@ Notes:
39389
39448
  }))
39390
39449
  });
39391
39450
  }));
39392
- if (embeddingData.length > 0 && dimension !== void 0) {
39451
+ if (embeddingData.length > 0 && (this.isSelfEmbedding || dimension !== void 0)) {
39393
39452
  const { indexName } = await this.createEmbeddingIndex(dimension, config);
39394
39453
  const allVectors = [];
39395
39454
  const allMetadata = [];
39455
+ const allDocuments = [];
39396
39456
  for (const data of embeddingData) {
39397
39457
  allVectors.push(...data.embeddings);
39458
+ if (data.documents) allDocuments.push(...data.documents);
39398
39459
  allMetadata.push(...data.metadata);
39399
39460
  }
39400
- await this.vector.upsert({
39461
+ if (this.isSelfEmbedding) await this.vector.upsert({
39462
+ indexName,
39463
+ documents: allDocuments,
39464
+ metadata: allMetadata
39465
+ });
39466
+ else await this.vector.upsert({
39401
39467
  indexName,
39402
39468
  vectors: allVectors,
39403
39469
  metadata: allMetadata
@@ -50371,4 +50437,4 @@ const agentBuilderWorkflows = {
50371
50437
  //#endregion
50372
50438
  export { agentBuilderWorkflows };
50373
50439
 
50374
- //# sourceMappingURL=dist-DH39C5Bz.js.map
50440
+ //# sourceMappingURL=dist-BKGwFBci.js.map