@mastra/server 1.78.0-alpha.8 → 1.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{api-schema-manifest-CxYLpCNm.js → api-schema-manifest-BWXv2l4E.js} +2 -2
  2. package/dist/{api-schema-manifest-CxYLpCNm.js.map → api-schema-manifest-BWXv2l4E.js.map} +1 -1
  3. package/dist/{api-schema-manifest-Vyg2iAvG.cjs → api-schema-manifest-C1XMN6QZ.cjs} +2 -2
  4. package/dist/{api-schema-manifest-Vyg2iAvG.cjs.map → api-schema-manifest-C1XMN6QZ.cjs.map} +1 -1
  5. package/dist/{dist-KzbPuRgb.cjs → dist-BRej8vIF.cjs} +67 -30
  6. package/dist/dist-BRej8vIF.cjs.map +1 -0
  7. package/dist/{dist-0eJzATDs.js → dist-CPHBJa2G.js} +67 -30
  8. package/dist/dist-CPHBJa2G.js.map +1 -0
  9. package/dist/docs/SKILL.md +1 -1
  10. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  11. package/dist/{observability-new-endpoints-BsB76TBb.cjs → observability-new-endpoints-CJMR84MD.cjs} +10 -4
  12. package/dist/observability-new-endpoints-CJMR84MD.cjs.map +1 -0
  13. package/dist/{observability-new-endpoints-BMAX_aVZ.js → observability-new-endpoints-D9MEJyaw.js} +11 -5
  14. package/dist/observability-new-endpoints-D9MEJyaw.js.map +1 -0
  15. package/dist/{routes-i_aZcFuS.cjs → routes-BpxhmR6Y.cjs} +2 -2
  16. package/dist/{routes-i_aZcFuS.cjs.map → routes-BpxhmR6Y.cjs.map} +1 -1
  17. package/dist/{routes-BE0pbKE6.js → routes-CH2PZ0PI.js} +2 -2
  18. package/dist/{routes-BE0pbKE6.js.map → routes-CH2PZ0PI.js.map} +1 -1
  19. package/dist/server/handlers/agent-builder.cjs +1 -1
  20. package/dist/server/handlers/agent-builder.js +1 -1
  21. package/dist/server/handlers/mcp-client-versions.cjs +1 -1
  22. package/dist/server/handlers/mcp-client-versions.js +1 -1
  23. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  24. package/dist/server/handlers/observability-new-endpoints.d.ts +51 -0
  25. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  26. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  27. package/dist/server/handlers/observability-shared.cjs +7 -1
  28. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  29. package/dist/server/handlers/observability-shared.d.ts +2 -0
  30. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  31. package/dist/server/handlers/observability-shared.js +7 -2
  32. package/dist/server/handlers/observability-shared.js.map +1 -1
  33. package/dist/server/handlers/observability.cjs +1 -1
  34. package/dist/server/handlers/observability.js +1 -1
  35. package/dist/server/handlers/prompt-block-versions.cjs +1 -1
  36. package/dist/server/handlers/prompt-block-versions.js +1 -1
  37. package/dist/server/handlers/scorer-versions.cjs +1 -1
  38. package/dist/server/handlers/scorer-versions.js +1 -1
  39. package/dist/server/handlers/stored-mcp-clients.cjs +1 -1
  40. package/dist/server/handlers/stored-mcp-clients.js +1 -1
  41. package/dist/server/handlers/stored-prompt-blocks.cjs +1 -1
  42. package/dist/server/handlers/stored-prompt-blocks.js +1 -1
  43. package/dist/server/handlers/stored-scorers.cjs +1 -1
  44. package/dist/server/handlers/stored-scorers.js +1 -1
  45. package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
  46. package/dist/server/handlers/stored-skill-favorites.js +1 -1
  47. package/dist/server/handlers/stored-skills.cjs +1 -1
  48. package/dist/server/handlers/stored-skills.js +1 -1
  49. package/dist/server/handlers/system.cjs +2 -2
  50. package/dist/server/handlers/system.d.ts +2 -0
  51. package/dist/server/handlers/system.d.ts.map +1 -1
  52. package/dist/server/handlers/system.js +2 -2
  53. package/dist/server/schemas/index.cjs +2 -2
  54. package/dist/server/schemas/index.js +2 -2
  55. package/dist/server/schemas/system.d.ts +2 -0
  56. package/dist/server/schemas/system.d.ts.map +1 -1
  57. package/dist/server/server-adapter/index.cjs +1 -1
  58. package/dist/server/server-adapter/index.js +1 -1
  59. package/dist/server/server-adapter/routes/observability.d.ts +49 -0
  60. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  61. package/dist/server/server-adapter/routes/system.d.ts +2 -0
  62. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  63. package/dist/{system-BXYJvvYl.cjs → system-DY6UweSl.cjs} +2 -1
  64. package/dist/system-DY6UweSl.cjs.map +1 -0
  65. package/dist/{system-sM_0_qZd.js → system-MGpkVA20.js} +2 -1
  66. package/dist/system-MGpkVA20.js.map +1 -0
  67. package/package.json +9 -9
  68. package/dist/dist-0eJzATDs.js.map +0 -1
  69. package/dist/dist-KzbPuRgb.cjs.map +0 -1
  70. package/dist/observability-new-endpoints-BMAX_aVZ.js.map +0 -1
  71. package/dist/observability-new-endpoints-BsB76TBb.cjs.map +0 -1
  72. package/dist/system-BXYJvvYl.cjs.map +0 -1
  73. package/dist/system-sM_0_qZd.js.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-BE0pbKE6.js";
2
+ import { t as SERVER_ROUTES } from "./routes-CH2PZ0PI.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-CxYLpCNm.js.map
55
+ //# sourceMappingURL=api-schema-manifest-BWXv2l4E.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-CxYLpCNm.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-BWXv2l4E.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,QAAk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c;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-i_aZcFuS.cjs");
3
+ const require_routes = require("./routes-BpxhmR6Y.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-Vyg2iAvG.cjs.map
56
+ //# sourceMappingURL=api-schema-manifest-C1XMN6QZ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-Vyg2iAvG.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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1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"api-schema-manifest-C1XMN6QZ.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"}
@@ -4637,7 +4637,7 @@ function splitLines(text) {
4637
4637
  return result;
4638
4638
  }
4639
4639
  //#endregion
4640
- //#region ../memory/dist/src-CnLuefUv.js
4640
+ //#region ../memory/dist/src-CTyZJ6A-.js
4641
4641
  var __defProp$3 = Object.defineProperty;
4642
4642
  var __exportAll = (all, no_symbols) => {
4643
4643
  let target = {};
@@ -24319,18 +24319,19 @@ function safeSlice(str, end) {
24319
24319
  }
24320
24320
  const PATTERNS = {
24321
24321
  whitespace: /^\s+$/,
24322
- cjk: /[\u4E00-\u9FFF\u3400-\u4DBF\u3000-\u303F\uFF00-\uFFEF\u30A0-\u30FF\u2E80-\u2EFF\u31C0-\u31EF\u3200-\u32FF\u3300-\u33FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]/,
24323
- numeric: /^\d+(?:[.,]\d+)*$/,
24324
- punctuation: /[.,!?;(){}[\]<>:/\\|@#$%^&*+=`~_-]/,
24325
- alphanumeric: /^[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+$/
24322
+ structuredWhitespace: /\n\s/,
24323
+ cjk: /[\u4E00-\u9FFF\u3400-\u4DBF\u3000-\u30FF\uFF00-\uFFEF\u2E80-\u2EFF\u31C0-\u31EF\u3200-\u32FF\u3300-\u33FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]/,
24324
+ numeric: /^\d+$/,
24325
+ punctuation: /[.,!?;(){}[\]<>:/\\|@#$%^&*+=`~_"-]/
24326
24326
  };
24327
- const TOKEN_SPLIT_PATTERN = /* @__PURE__ */ new RegExp(`(\\s+|${PATTERNS.punctuation.source}+)`);
24327
+ const TOKEN_SPLIT_PATTERN = new RegExp(`(\\s+|${PATTERNS.punctuation.source}+)`);
24328
24328
  const DEFAULT_CHARS_PER_TOKEN = 6;
24329
24329
  const SHORT_TOKEN_THRESHOLD = 3;
24330
+ const KANA_CHARS_PER_TOKEN = 1.35;
24330
24331
  const DEFAULT_LANGUAGE_CONFIGS = [
24331
24332
  {
24332
24333
  pattern: /[äöüßẞ]/i,
24333
- averageCharsPerToken: 3
24334
+ averageCharsPerToken: 2.6
24334
24335
  },
24335
24336
  {
24336
24337
  pattern: /[éèêëàâîïôûùüÿçœæáíóúñ]/i,
@@ -24338,39 +24339,75 @@ const DEFAULT_LANGUAGE_CONFIGS = [
24338
24339
  },
24339
24340
  {
24340
24341
  pattern: /[ąćęłńóśźżěščřžýůúďťň]/i,
24341
- averageCharsPerToken: 3.5
24342
+ averageCharsPerToken: 2.5
24343
+ },
24344
+ {
24345
+ pattern: /[\u0430-\u044F\u0451]/i,
24346
+ averageCharsPerToken: 4
24347
+ },
24348
+ {
24349
+ pattern: /[\u03AC-\u03CE]/i,
24350
+ averageCharsPerToken: 2.75
24351
+ },
24352
+ {
24353
+ pattern: /^\p{Extended_Pictographic}[\p{Extended_Pictographic}\p{Emoji_Component}]*$/u,
24354
+ averageCharsPerToken: .75
24342
24355
  }
24343
24356
  ];
24344
24357
  /**
24345
- * Estimates the number of tokens in a text string using heuristic rules.
24358
+ * Walks a text as (segment, estimated token count) pairs. The segments
24359
+ * concatenate back to the original text; whitespace segments count zero
24360
+ * tokens unless they carry structure (indentation or blank lines).
24346
24361
  */
24347
- function estimateTokenCount(text, options = {}) {
24348
- if (!text) return 0;
24349
- const { defaultCharsPerToken = DEFAULT_CHARS_PER_TOKEN, languageConfigs = DEFAULT_LANGUAGE_CONFIGS } = options;
24350
- const segments = text.split(TOKEN_SPLIT_PATTERN).filter(Boolean);
24351
- let tokenCount = 0;
24352
- for (const segment of segments) tokenCount += estimateSegmentTokens(segment, languageConfigs, defaultCharsPerToken);
24353
- return tokenCount;
24362
+ function* walkSegments(text, options = {}) {
24363
+ if (!text) return;
24364
+ const resolvedOptions = resolveOptions(options);
24365
+ for (const segment of text.split(TOKEN_SPLIT_PATTERN)) if (segment) yield {
24366
+ segment,
24367
+ tokenCount: estimateSegmentTokens(segment, resolvedOptions)
24368
+ };
24354
24369
  }
24355
- function estimateSegmentTokens(segment, languageConfigs, defaultCharsPerToken) {
24356
- if (PATTERNS.whitespace.test(segment)) return 0;
24357
- if (PATTERNS.cjk.test(segment)) return getCharacterCount(segment);
24358
- if (PATTERNS.numeric.test(segment)) return 1;
24370
+ function resolveOptions(options) {
24371
+ return {
24372
+ defaultCharsPerToken: options.defaultCharsPerToken ?? DEFAULT_CHARS_PER_TOKEN,
24373
+ languageConfigs: options.languageConfigs ?? DEFAULT_LANGUAGE_CONFIGS
24374
+ };
24375
+ }
24376
+ function estimateSegmentTokens(segment, { languageConfigs, defaultCharsPerToken }) {
24377
+ if (PATTERNS.whitespace.test(segment)) return PATTERNS.structuredWhitespace.test(segment) ? 1 : 0;
24378
+ const languageCharsPerToken = getLanguageSpecificCharsPerToken(segment, languageConfigs);
24379
+ if (languageCharsPerToken !== void 0) return Math.ceil(getCharacterCount(segment) / languageCharsPerToken);
24380
+ if (PATTERNS.cjk.test(segment)) return estimateCjkTokens(segment);
24381
+ if (PATTERNS.numeric.test(segment)) return Math.ceil(segment.length / 3);
24359
24382
  if (segment.length <= SHORT_TOKEN_THRESHOLD) return 1;
24360
- if (PATTERNS.punctuation.test(segment)) return segment.length > 1 ? Math.ceil(segment.length / 2) : 1;
24361
- if (PATTERNS.alphanumeric.test(segment)) {
24362
- const charsPerToken$1 = getLanguageSpecificCharsPerToken(segment, languageConfigs) ?? defaultCharsPerToken;
24363
- return Math.ceil(segment.length / charsPerToken$1);
24364
- }
24365
- const charsPerToken = getLanguageSpecificCharsPerToken(segment, languageConfigs) ?? defaultCharsPerToken;
24366
- return Math.ceil(segment.length / charsPerToken);
24383
+ if (PATTERNS.punctuation.test(segment)) return Math.ceil(segment.length / 2);
24384
+ return Math.ceil(segment.length / defaultCharsPerToken);
24367
24385
  }
24368
24386
  function getLanguageSpecificCharsPerToken(segment, languageConfigs) {
24369
- for (const config of languageConfigs) if (config.pattern.test(segment)) return config.averageCharsPerToken;
24387
+ for (const config of languageConfigs) if (segment.search(config.pattern) !== -1) return config.averageCharsPerToken;
24370
24388
  }
24371
24389
  function getCharacterCount(text) {
24372
24390
  return Array.from(text).length;
24373
24391
  }
24392
+ function estimateCjkTokens(segment) {
24393
+ let kanaCount = 0;
24394
+ let otherCount = 0;
24395
+ for (const character of segment) {
24396
+ const codePoint = character.codePointAt(0);
24397
+ if (codePoint >= 12352 && codePoint <= 12543) kanaCount++;
24398
+ else otherCount++;
24399
+ }
24400
+ return otherCount + Math.ceil(kanaCount / KANA_CHARS_PER_TOKEN);
24401
+ }
24402
+ /**
24403
+ * Estimates the number of tokens in a text string using heuristic rules
24404
+ */
24405
+ function estimateTokenCount(text, options = {}) {
24406
+ if (!text) return 0;
24407
+ let tokenCount = 0;
24408
+ for (const segmentEstimate of walkSegments(text, options)) tokenCount += segmentEstimate.tokenCount;
24409
+ return tokenCount;
24410
+ }
24374
24411
  const DEFAULT_OBSERVER_TOOL_ARGUMENT_MAX_TOKENS = 2e3;
24375
24412
  const OBSERVER_TOOL_ARGUMENT_INLINE_STRING_MAX_CHARS = 160;
24376
24413
  const OBSERVER_TOOL_ARGUMENT_MAX_DEPTH = 5;
@@ -26873,7 +26910,7 @@ const IMAGE_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
26873
26910
  "heif",
26874
26911
  "avif"
26875
26912
  ]);
26876
- const TOKEN_ESTIMATE_CACHE_VERSION = 7;
26913
+ const TOKEN_ESTIMATE_CACHE_VERSION = 8;
26877
26914
  /**
26878
26915
  * Cache `source` marker for token estimates supplied by the caller via
26879
26916
  * `part.providerMetadata.mastra.tokenEstimate`. Pipelines that strip the real
@@ -51862,4 +51899,4 @@ const agentBuilderWorkflows = {
51862
51899
  //#endregion
51863
51900
  exports.agentBuilderWorkflows = agentBuilderWorkflows;
51864
51901
 
51865
- //# sourceMappingURL=dist-KzbPuRgb.cjs.map
51902
+ //# sourceMappingURL=dist-BRej8vIF.cjs.map