@mastra/server 1.60.0-alpha.13 → 1.60.0-alpha.14

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 (36) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{api-schema-manifest-BdBDDuGv.js → api-schema-manifest-Bx_zU5qw.js} +2 -2
  3. package/dist/{api-schema-manifest-BdBDDuGv.js.map → api-schema-manifest-Bx_zU5qw.js.map} +1 -1
  4. package/dist/{api-schema-manifest-CLvx-Pd5.cjs → api-schema-manifest-DPgfugJT.cjs} +2 -2
  5. package/dist/{api-schema-manifest-CLvx-Pd5.cjs.map → api-schema-manifest-DPgfugJT.cjs.map} +1 -1
  6. package/dist/{dist-0PQDswJk.js → dist-Cw-T1gX6.js} +56 -10
  7. package/dist/dist-Cw-T1gX6.js.map +1 -0
  8. package/dist/{dist-Jy_bgZ7X.cjs → dist-DERatX43.cjs} +56 -10
  9. package/dist/dist-DERatX43.cjs.map +1 -0
  10. package/dist/docs/SKILL.md +1 -1
  11. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  12. package/dist/{routes-CT1kQN7A.js → routes-Bh2p-WqG.js} +6 -6
  13. package/dist/{routes-CT1kQN7A.js.map → routes-Bh2p-WqG.js.map} +1 -1
  14. package/dist/{routes-B0T6HEoP.cjs → routes-CdbboDwv.cjs} +6 -6
  15. package/dist/{routes-B0T6HEoP.cjs.map → routes-CdbboDwv.cjs.map} +1 -1
  16. package/dist/server/handlers/agent-builder.cjs +1 -1
  17. package/dist/server/handlers/agent-builder.js +1 -1
  18. package/dist/server/handlers/agent-controller.cjs +19 -18
  19. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  20. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  21. package/dist/server/handlers/agent-controller.js +19 -18
  22. package/dist/server/handlers/agent-controller.js.map +1 -1
  23. package/dist/server/handlers/datasets.d.ts +6 -6
  24. package/dist/server/handlers/stored-agents.cjs +2 -2
  25. package/dist/server/handlers/stored-agents.js +2 -2
  26. package/dist/server/handlers/system.cjs +1 -1
  27. package/dist/server/handlers/system.js +1 -1
  28. package/dist/server/schemas/datasets.d.ts +3 -3
  29. package/dist/server/schemas/index.cjs +5 -5
  30. package/dist/server/schemas/index.js +5 -5
  31. package/dist/server/server-adapter/index.cjs +2 -2
  32. package/dist/server/server-adapter/index.js +2 -2
  33. package/dist/server/server-adapter/routes/datasets.d.ts +6 -6
  34. package/package.json +5 -5
  35. package/dist/dist-0PQDswJk.js.map +0 -1
  36. package/dist/dist-Jy_bgZ7X.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.60.0-alpha.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`58c43d3`](https://github.com/mastra-ai/mastra/commit/58c43d3f7cb2eeaeb8ac733ae71dde822348e588)]:
8
+ - @mastra/core@1.60.0-alpha.14
9
+
3
10
  ## 1.60.0-alpha.13
4
11
 
5
12
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import { c as schemaToJsonSchema } from "./route-builder-YQ_gLIvW.js";
2
- import { t as SERVER_ROUTES } from "./routes-CT1kQN7A.js";
2
+ import { t as SERVER_ROUTES } from "./routes-Bh2p-WqG.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-BdBDDuGv.js.map
55
+ //# sourceMappingURL=api-schema-manifest-Bx_zU5qw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-BdBDDuGv.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
+ {"version":3,"file":"api-schema-manifest-Bx_zU5qw.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;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AC1C;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-CWsok5ci.cjs");
3
- const require_routes = require("./routes-B0T6HEoP.cjs");
3
+ const require_routes = require("./routes-CdbboDwv.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-CLvx-Pd5.cjs.map
56
+ //# sourceMappingURL=api-schema-manifest-DPgfugJT.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-CLvx-Pd5.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,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Y,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"api-schema-manifest-DPgfugJT.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"}
@@ -22,8 +22,8 @@ import { coreFeatures } from "@mastra/core/features";
22
22
  import { EntityType, SpanType, createObservabilityContext, getOrCreateSpan } from "@mastra/core/observability";
23
23
  import { MASTRA_THREAD_ID_KEY, RequestContext } from "@mastra/core/request-context";
24
24
  import { MessageHistory } from "@mastra/core/processors";
25
- import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
26
25
  import { createStep, createWorkflow } from "@mastra/core/workflows";
26
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
27
27
  import { tmpdir } from "os";
28
28
  import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "path";
29
29
  import { channel, tracingChannel } from "diagnostics_channel";
@@ -4693,7 +4693,7 @@ function splitLines(text) {
4693
4693
  return result;
4694
4694
  }
4695
4695
  //#endregion
4696
- //#region ../memory/dist/src-t_4yoTX9.js
4696
+ //#region ../memory/dist/src-aTfbkxBl.js
4697
4697
  var __defProp$3 = Object.defineProperty;
4698
4698
  var __exportAll = (all, no_symbols) => {
4699
4699
  let target = {};
@@ -23520,6 +23520,52 @@ function detectDegenerateRepetition(text) {
23520
23520
  return false;
23521
23521
  }
23522
23522
  /**
23523
+ * Build a single-line diagnostic description of output flagged by
23524
+ * {@link detectDegenerateRepetition}. Used when logging or surfacing a
23525
+ * degenerate-output failure so the discarded model output can be inspected —
23526
+ * without it there is no way to tell a real repetition loop apart from a
23527
+ * detector false-positive on legitimately repetitive content.
23528
+ *
23529
+ * Reuses the detector's sampling parameters (200-char windows, ~50 samples)
23530
+ * so the reported duplicate ratio and most-repeated window match what
23531
+ * triggered the detection. Snippets are JSON-escaped so the result stays on
23532
+ * one line.
23533
+ */
23534
+ function describeDegenerateOutput(text, snippetChars = 400) {
23535
+ const windowSize = 200;
23536
+ const step = Math.max(1, Math.floor(text.length / 50));
23537
+ const seen = /* @__PURE__ */ new Map();
23538
+ let duplicateWindows = 0;
23539
+ let totalWindows = 0;
23540
+ for (let i = 0; i + windowSize <= text.length; i += step) {
23541
+ const window = text.slice(i, i + windowSize);
23542
+ totalWindows++;
23543
+ const count = (seen.get(window) ?? 0) + 1;
23544
+ seen.set(window, count);
23545
+ if (count > 1) duplicateWindows++;
23546
+ }
23547
+ let topWindow = "";
23548
+ let topCount = 0;
23549
+ for (const [window, count] of seen) if (count > topCount) {
23550
+ topCount = count;
23551
+ topWindow = window;
23552
+ }
23553
+ let longestLine = 0;
23554
+ for (const line of text.split("\n")) if (line.length > longestLine) longestLine = line.length;
23555
+ const duplicateRatio = totalWindows > 0 ? (duplicateWindows / totalWindows).toFixed(2) : "n/a";
23556
+ const parts = [
23557
+ `length=${text.length}`,
23558
+ `sampledWindows=${totalWindows}`,
23559
+ `duplicateRatio=${duplicateRatio}`,
23560
+ `longestLine=${longestLine}`,
23561
+ `topWindowCount=${topCount}`
23562
+ ];
23563
+ if (topCount > 1) parts.push(`topWindow=${JSON.stringify(topWindow)}`);
23564
+ parts.push(`head=${JSON.stringify(text.slice(0, snippetChars))}`);
23565
+ if (text.length > snippetChars * 2) parts.push(`tail=${JSON.stringify(text.slice(-snippetChars))}`);
23566
+ return parts.join(" ");
23567
+ }
23568
+ /**
23523
23569
  * Check if observations contain a Current Task section.
23524
23570
  * Supports both XML format and legacy markdown format.
23525
23571
  */
@@ -23914,13 +23960,13 @@ var ObserverRunner = class {
23914
23960
  let parsed = parseObserverOutput(result.text, activeExtractors);
23915
23961
  let retriedDueToDegenerate = false;
23916
23962
  if (parsed.degenerate) {
23917
- omDebug(`[OM:callObserver] degenerate repetition detected, retrying once`);
23963
+ omDebug(`[OM:callObserver] degenerate repetition detected, retrying once. ${describeDegenerateOutput(result.text, 2e3)}`);
23918
23964
  result = await doGenerate();
23919
23965
  parsed = parseObserverOutput(result.text, activeExtractors);
23920
23966
  retriedDueToDegenerate = true;
23921
23967
  if (parsed.degenerate) {
23922
- omDebug(`[OM:callObserver] degenerate repetition on retry, failing`);
23923
- throw new Error("Observer produced degenerate output after retry");
23968
+ omDebug(`[OM:callObserver] degenerate repetition on retry, failing. ${describeDegenerateOutput(result.text, 2e3)}`);
23969
+ throw new Error(`Observer produced degenerate output after retry. ${describeDegenerateOutput(result.text)}`);
23924
23970
  }
23925
23971
  }
23926
23972
  const structuredExtraction = await extractStructuredValues({
@@ -24064,13 +24110,13 @@ var ObserverRunner = class {
24064
24110
  let parsed = parseMultiThreadObserverOutput(result.text, activeExtractors);
24065
24111
  let retriedDueToDegenerate = false;
24066
24112
  if (parsed.degenerate) {
24067
- omDebug(`[OM:callMultiThreadObserver] degenerate repetition detected, retrying once`);
24113
+ omDebug(`[OM:callMultiThreadObserver] degenerate repetition detected, retrying once. ${describeDegenerateOutput(result.text, 2e3)}`);
24068
24114
  result = await doGenerate();
24069
24115
  parsed = parseMultiThreadObserverOutput(result.text, activeExtractors);
24070
24116
  retriedDueToDegenerate = true;
24071
24117
  if (parsed.degenerate) {
24072
- omDebug(`[OM:callMultiThreadObserver] degenerate repetition on retry, failing`);
24073
- throw new Error("Multi-thread observer produced degenerate output after retry");
24118
+ omDebug(`[OM:callMultiThreadObserver] degenerate repetition on retry, failing. ${describeDegenerateOutput(result.text, 2e3)}`);
24119
+ throw new Error(`Multi-thread observer produced degenerate output after retry. ${describeDegenerateOutput(result.text)}`);
24074
24120
  }
24075
24121
  }
24076
24122
  const structuredExtractionByThread = /* @__PURE__ */ new Map();
@@ -29963,7 +30009,7 @@ var ReflectorRunner = class {
29963
30009
  finalProviderMetadata = result.providerMetadata ?? finalProviderMetadata;
29964
30010
  parsed = parseReflectorOutput(result.text, observations, activeExtractors);
29965
30011
  if (parsed.degenerate) {
29966
- omDebug(`[OM:callReflector] attempt #${attemptNumber}: degenerate repetition detected, treating as compression failure`);
30012
+ omDebug(`[OM:callReflector] attempt #${attemptNumber}: degenerate repetition detected, treating as compression failure. ${describeDegenerateOutput(result.text, 2e3)}`);
29967
30013
  reflectedTokens = originalTokens;
29968
30014
  } else reflectedTokens = this.tokenCounter.countObservations(parsed.observations);
29969
30015
  omDebug(`[OM:callReflector] attempt #${attemptNumber} parsed: reflectedTokens=${reflectedTokens}, targetThreshold=${targetThreshold}, compressionValid=${validateCompression(reflectedTokens, targetThreshold)}, parsedObsLen=${parsed.observations?.length}, degenerate=${parsed.degenerate ?? false}`);
@@ -46150,4 +46196,4 @@ const agentBuilderWorkflows = {
46150
46196
  //#endregion
46151
46197
  export { agentBuilderWorkflows };
46152
46198
 
46153
- //# sourceMappingURL=dist-0PQDswJk.js.map
46199
+ //# sourceMappingURL=dist-Cw-T1gX6.js.map