@mastra/server 1.70.0-alpha.1 → 1.70.0-alpha.2

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 (59) hide show
  1. package/dist/{api-schema-manifest-CeiI0HER.cjs → api-schema-manifest-CE2lXPKH.cjs} +2 -2
  2. package/dist/{api-schema-manifest-CeiI0HER.cjs.map → api-schema-manifest-CE2lXPKH.cjs.map} +1 -1
  3. package/dist/{api-schema-manifest-BvIpcxxq.js → api-schema-manifest-D0_Q8UhK.js} +2 -2
  4. package/dist/{api-schema-manifest-BvIpcxxq.js.map → api-schema-manifest-D0_Q8UhK.js.map} +1 -1
  5. package/dist/{dist-DcTSQIB2.js → dist-B3wkDytS.js} +104 -53
  6. package/dist/dist-B3wkDytS.js.map +1 -0
  7. package/dist/{dist-1bGgLbxg.cjs → dist-pojdOe9l.cjs} +104 -53
  8. package/dist/dist-pojdOe9l.cjs.map +1 -0
  9. package/dist/docs/SKILL.md +1 -1
  10. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  11. package/dist/docs/references/reference-observability-tracing-trace-query.md +17 -1
  12. package/dist/{observability-new-endpoints-BIoS0_PJ.cjs → observability-new-endpoints-DJYL-Y5A.cjs} +5 -2
  13. package/dist/observability-new-endpoints-DJYL-Y5A.cjs.map +1 -0
  14. package/dist/{observability-new-endpoints-0hQR-aWF.js → observability-new-endpoints-DQHOnzNX.js} +6 -3
  15. package/dist/observability-new-endpoints-DQHOnzNX.js.map +1 -0
  16. package/dist/{routes-BU_1NO20.js → routes-CeJQfjk5.js} +2 -2
  17. package/dist/{routes-BU_1NO20.js.map → routes-CeJQfjk5.js.map} +1 -1
  18. package/dist/{routes-Czb2jV4R.cjs → routes-l-SxuNkD.cjs} +2 -2
  19. package/dist/{routes-Czb2jV4R.cjs.map → routes-l-SxuNkD.cjs.map} +1 -1
  20. package/dist/server/handlers/agent-builder.cjs +1 -1
  21. package/dist/server/handlers/agent-builder.js +1 -1
  22. package/dist/server/handlers/mcp-client-versions.cjs +1 -1
  23. package/dist/server/handlers/mcp-client-versions.js +1 -1
  24. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  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 +17 -0
  28. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  29. package/dist/server/handlers/observability-shared.d.ts +3 -1
  30. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  31. package/dist/server/handlers/observability-shared.js +16 -1
  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 +1 -1
  50. package/dist/server/handlers/system.js +1 -1
  51. package/dist/server/schemas/index.cjs +1 -1
  52. package/dist/server/schemas/index.js +1 -1
  53. package/dist/server/server-adapter/index.cjs +1 -1
  54. package/dist/server/server-adapter/index.js +1 -1
  55. package/package.json +5 -5
  56. package/dist/dist-1bGgLbxg.cjs.map +0 -1
  57. package/dist/dist-DcTSQIB2.js.map +0 -1
  58. package/dist/observability-new-endpoints-0hQR-aWF.js.map +0 -1
  59. package/dist/observability-new-endpoints-BIoS0_PJ.cjs.map +0 -1
@@ -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-Czb2jV4R.cjs");
3
+ const require_routes = require("./routes-l-SxuNkD.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-CeiI0HER.cjs.map
56
+ //# sourceMappingURL=api-schema-manifest-CE2lXPKH.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-CeiI0HER.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-CE2lXPKH.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,5 +1,5 @@
1
1
  import { c as schemaToJsonSchema } from "./route-builder-lBil8Cvo.js";
2
- import { t as SERVER_ROUTES } from "./routes-BU_1NO20.js";
2
+ import { t as SERVER_ROUTES } from "./routes-CeJQfjk5.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-BvIpcxxq.js.map
55
+ //# sourceMappingURL=api-schema-manifest-D0_Q8UhK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-BvIpcxxq.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-D0_Q8UhK.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"}
@@ -4637,7 +4637,7 @@ function splitLines(text) {
4637
4637
  return result;
4638
4638
  }
4639
4639
  //#endregion
4640
- //#region ../memory/dist/src-2UN5fCQ5.js
4640
+ //#region ../memory/dist/src-B0ISVOJX.js
4641
4641
  var __defProp$3 = Object.defineProperty;
4642
4642
  var __exportAll = (all, no_symbols) => {
4643
4643
  let target = {};
@@ -22885,7 +22885,9 @@ var constants_exports = /* @__PURE__ */ __exportAll({
22885
22885
  OBSERVATIONAL_MEMORY_DEFAULTS: () => OBSERVATIONAL_MEMORY_DEFAULTS,
22886
22886
  OBSERVATION_CONTEXT_INSTRUCTIONS: () => OBSERVATION_CONTEXT_INSTRUCTIONS,
22887
22887
  OBSERVATION_CONTEXT_PROMPT: () => OBSERVATION_CONTEXT_PROMPT,
22888
+ OBSERVATION_CONTEXT_PROMPT_THREAD: () => OBSERVATION_CONTEXT_PROMPT_THREAD,
22888
22889
  OBSERVATION_CONTINUATION_HINT: () => OBSERVATION_CONTINUATION_HINT,
22890
+ getObservationContextPrompt: () => getObservationContextPrompt,
22889
22891
  getRetrievalInstructions: () => getRetrievalInstructions
22890
22892
  });
22891
22893
  /**
@@ -22935,6 +22937,19 @@ Any messages following this reminder are newer and should take priority.`;
22935
22937
  */
22936
22938
  const OBSERVATION_CONTEXT_PROMPT = `The following observations block contains your memory of past conversations with this user.`;
22937
22939
  /**
22940
+ * Preamble used when observations are thread-scoped: they describe earlier parts
22941
+ * of the current conversation, not other conversations.
22942
+ */
22943
+ const OBSERVATION_CONTEXT_PROMPT_THREAD = `The following observations block contains your memory of earlier parts of this current conversation. Everything recorded here (including IDs, artifacts, and tool results) came from this conversation and is available for you to reuse.`;
22944
+ /**
22945
+ * Returns the observations preamble matching the memory scope.
22946
+ * - `'thread'`: observations are earlier parts of the current conversation.
22947
+ * - `'resource'`: observations span past conversations with this user.
22948
+ */
22949
+ function getObservationContextPrompt(scope = "thread") {
22950
+ return scope === "resource" ? OBSERVATION_CONTEXT_PROMPT : OBSERVATION_CONTEXT_PROMPT_THREAD;
22951
+ }
22952
+ /**
22938
22953
  * Instructions that tell the model how to interpret and use observations.
22939
22954
  * Place AFTER the `<observations>` block so the model sees the data before the rules.
22940
22955
  */
@@ -23208,7 +23223,7 @@ async function applyExtractorHooks(opts) {
23208
23223
  failures: mergeExtractionFailures(failures)
23209
23224
  };
23210
23225
  }
23211
- function isRecord$4(value) {
23226
+ function isRecord$5(value) {
23212
23227
  return typeof value === "object" && value !== null;
23213
23228
  }
23214
23229
  /** Keep provider diagnostics in streamed/persisted markers, not whole API request/response objects. */
@@ -23220,7 +23235,7 @@ function formatOmError(error) {
23220
23235
  };
23221
23236
  function collectErrorDetails(value, depth) {
23222
23237
  if (depth > 5) return;
23223
- if (!isRecord$4(value)) {
23238
+ if (!isRecord$5(value)) {
23224
23239
  if (value !== void 0) add(String(value));
23225
23240
  return;
23226
23241
  }
@@ -23230,10 +23245,10 @@ function formatOmError(error) {
23230
23245
  if (typeof value.statusCode === "number") add(`HTTP ${value.statusCode}`);
23231
23246
  if (typeof value.responseBody === "string") try {
23232
23247
  const body = JSON.parse(value.responseBody);
23233
- if (isRecord$4(body)) {
23248
+ if (isRecord$5(body)) {
23234
23249
  add(body.message);
23235
23250
  add(body.detail);
23236
- if (isRecord$4(body.error)) add(body.error.message);
23251
+ if (isRecord$5(body.error)) add(body.error.message);
23237
23252
  else add(body.error);
23238
23253
  }
23239
23254
  } catch {}
@@ -23336,6 +23351,19 @@ ${extractorInstructions}${priorLines.length > 0 ? `\n\n## Prior Extracted Values
23336
23351
  failures
23337
23352
  };
23338
23353
  }
23354
+ const LEGACY_SYSTEM_REMINDER_METADATA_KEY = "dynamicAgentsMdReminder";
23355
+ function isRecord$4(value) {
23356
+ return typeof value === "object" && value !== null;
23357
+ }
23358
+ function isSystemReminderMessage(message) {
23359
+ if (!isRecord$4(message.content)) return false;
23360
+ const metadata = message.content.metadata;
23361
+ if (message.role === "signal") return isRecord$4(metadata) && isRecord$4(metadata.signal) && (metadata.signal.type === "system-reminder" || metadata.signal.type === "reactive");
23362
+ if (message.role !== "user") return false;
23363
+ if (isRecord$4(metadata) && (isRecord$4(metadata.systemReminder) || LEGACY_SYSTEM_REMINDER_METADATA_KEY in metadata)) return true;
23364
+ const firstTextPart = message.content.parts.find((part) => part.type === "text");
23365
+ return typeof firstTextPart?.text === "string" && firstTextPart.text.startsWith("<system-reminder");
23366
+ }
23339
23367
  const ANCHOR_ID_PATTERN = /^\[(O\d+(?:-N\d+)?)\]\s*/;
23340
23368
  const OBSERVATION_DATE_HEADER_PATTERN = /^\s*Date:\s+/;
23341
23369
  const XML_TAG_PATTERN = /^\s*<\/?[a-z][^>]*>\s*$/i;
@@ -24819,11 +24847,23 @@ function formatObserverToolArguments(args, maxCharacters) {
24819
24847
  if (args === void 0) return maybeTruncate("[arguments unavailable]", maxCharacters);
24820
24848
  return formatToolArgumentsForObserver(args, { maxCharacters: maxCharacters || void 0 });
24821
24849
  }
24850
+ /**
24851
+ * Labels signals and system reminders by their tag instead of as "User", so the Observer
24852
+ * does not record runtime instructions as things the user said (#22195).
24853
+ */
24854
+ function getObserverMessageLabel(msg) {
24855
+ if (msg.role === "signal") {
24856
+ const signal = msg.content?.metadata?.signal;
24857
+ return signal?.type === "user" ? "User" : signal?.tagName ?? signal?.type ?? "Signal";
24858
+ }
24859
+ if (isSystemReminderMessage(msg)) return "system-reminder";
24860
+ return msg.role.charAt(0).toUpperCase() + msg.role.slice(1);
24861
+ }
24822
24862
  function formatObserverMessage(msg, counter, toolFormatting, options) {
24823
24863
  const maxLen = options?.maxPartLength;
24824
24864
  const maxToolResultTokens = options?.maxToolResultTokens ?? 5e3;
24825
24865
  const attachmentFilter = options?.attachmentFilter;
24826
- const role = msg.role.charAt(0).toUpperCase() + msg.role.slice(1);
24866
+ const role = getObserverMessageLabel(msg);
24827
24867
  const attachments = [];
24828
24868
  const messageCreatedAt = normalizeObserverCreatedAt(msg.createdAt);
24829
24869
  let lines = [];
@@ -24997,7 +25037,36 @@ function buildMultiThreadObserverHistoryMessage(messagesByThread, threadOrder, o
24997
25037
  content
24998
25038
  };
24999
25039
  }
25000
- function buildMultiThreadObserverTaskPrompt(existingObservations, threadOrder, priorMetadataByThread, wasTruncated, includeThreadTitle, extractors = []) {
25040
+ /**
25041
+ * Build the Observer's single multi-thread request message: prior memory first, then the
25042
+ * thread histories, then the task. Keeping everything in one user message, with the task
25043
+ * after the history, stops the Observer from reading its own instructions as something
25044
+ * the user said (#22195).
25045
+ */
25046
+ function buildMultiThreadObserverRequestMessage(existingObservations, messagesByThread, threadOrder, priorMetadataByThread, wasTruncated, includeThreadTitle, extractors = [], formatOptions) {
25047
+ return surroundObserverHistory(buildMultiThreadObserverHistoryMessage(messagesByThread, threadOrder, formatOptions), buildMultiThreadObserverContextPrompt(existingObservations, threadOrder, priorMetadataByThread, wasTruncated, includeThreadTitle, extractors), buildMultiThreadObserverTaskInstructions(includeThreadTitle));
25048
+ }
25049
+ function surroundObserverHistory(history, contextPrompt, taskInstructions) {
25050
+ const historyContent = history.content;
25051
+ return {
25052
+ role: "user",
25053
+ content: [
25054
+ ...contextPrompt ? [{
25055
+ type: "text",
25056
+ text: contextPrompt
25057
+ }] : [],
25058
+ ...historyContent,
25059
+ {
25060
+ type: "text",
25061
+ text: `\n\n---\n\n${taskInstructions}`
25062
+ }
25063
+ ]
25064
+ };
25065
+ }
25066
+ function buildMultiThreadObserverTaskInstructions(includeThreadTitle) {
25067
+ return `## Your Task\n\nExtract new observations from each thread. Output your observations grouped by thread using <thread id="..."> tags inside your <observations> block. Each thread block should contain that thread's observations, current-task, suggested-response${includeThreadTitle ? ", and thread-title" : ""}, in the format specified in your instructions.`;
25068
+ }
25069
+ function buildMultiThreadObserverContextPrompt(existingObservations, threadOrder, priorMetadataByThread, wasTruncated, includeThreadTitle, extractors = []) {
25001
25070
  let prompt = "";
25002
25071
  if (existingObservations) {
25003
25072
  prompt += `## Previous Observations\n\n${existingObservations}\n\n---\n\n`;
@@ -25023,25 +25092,6 @@ function buildMultiThreadObserverTaskPrompt(existingObservations, threadOrder, p
25023
25092
  }
25024
25093
  prompt += `Use each thread's prior current-task, suggested-response${includeThreadTitle ? ", and thread-title" : ""} as continuity hints, then update them based on that thread's new messages.\n\n---\n\n`;
25025
25094
  }
25026
- prompt += `## Your Task\n\n`;
25027
- prompt += `Extract new observations from each thread. Output your observations grouped by thread using <thread id="..."> tags inside your <observations> block. Each thread block should contain that thread's observations, current-task, suggested-response${includeThreadTitle ? ", and thread-title" : ""}.\n\n`;
25028
- prompt += `Example output format:\n`;
25029
- prompt += `<observations>\n`;
25030
- prompt += `<thread id="thread1">\n`;
25031
- prompt += `Date: Dec 4, 2025\n`;
25032
- prompt += `* 🔴 (14:30) User prefers direct answers\n`;
25033
- prompt += `<current-task>Working on feature X</current-task>\n`;
25034
- prompt += `<suggested-response>Continue with the implementation</suggested-response>\n`;
25035
- if (includeThreadTitle) prompt += `<thread-title>Feature X implementation</thread-title>\n`;
25036
- prompt += `</thread>\n`;
25037
- prompt += `<thread id="thread2">\n`;
25038
- prompt += `Date: Dec 5, 2025\n`;
25039
- prompt += `* 🔴 (09:15) User asked about deployment\n`;
25040
- prompt += `<current-task>Discussing deployment options</current-task>\n`;
25041
- prompt += `<suggested-response>Explain the deployment process</suggested-response>\n`;
25042
- if (includeThreadTitle) prompt += `<thread-title>Deployment setup</thread-title>\n`;
25043
- prompt += `</thread>\n`;
25044
- prompt += `</observations>`;
25045
25095
  return prompt;
25046
25096
  }
25047
25097
  /**
@@ -25099,6 +25149,24 @@ function parseMultiThreadObserverOutput(output, extractors = []) {
25099
25149
  };
25100
25150
  }
25101
25151
  function buildObserverTaskPrompt(existingObservations, options) {
25152
+ return buildObserverContextPrompt(existingObservations, options) + buildObserverTaskInstructions(options);
25153
+ }
25154
+ /**
25155
+ * Build the Observer's single request message: prior memory first, then the message
25156
+ * history, then the task. Keeping everything in one user message, with the task after
25157
+ * the history, stops the Observer from reading its own instructions as something the
25158
+ * user said (#22195).
25159
+ */
25160
+ function buildObserverRequestMessage(existingObservations, messagesToObserve, options, formatOptions) {
25161
+ return surroundObserverHistory(buildObserverHistoryMessage(messagesToObserve, formatOptions), buildObserverContextPrompt(existingObservations, options), buildObserverTaskInstructions(options));
25162
+ }
25163
+ function buildObserverTaskInstructions(options) {
25164
+ let prompt = `## Your Task\n\n`;
25165
+ prompt += `Extract new observations from the message history above. Do not repeat observations that are already in the previous observations. Add your new observations in the format specified in your instructions.`;
25166
+ if (options?.skipContinuationHints) prompt += `\n\nOutput <observations> every time.`;
25167
+ return prompt;
25168
+ }
25169
+ function buildObserverContextPrompt(existingObservations, options) {
25102
25170
  let prompt = "";
25103
25171
  if (existingObservations) {
25104
25172
  prompt += `## Previous Observations\n\n${existingObservations}\n\n---\n\n`;
@@ -25119,9 +25187,6 @@ function buildObserverTaskPrompt(existingObservations, options) {
25119
25187
  const titleHint = options?.includeThreadTitle ? ", and thread-title" : "";
25120
25188
  prompt += `Use the prior current-task, suggested-response${titleHint} as continuity hints, then update them based on the new messages.\n\n---\n\n`;
25121
25189
  }
25122
- prompt += `## Your Task\n\n`;
25123
- prompt += `Extract new observations from the message history above. Do not repeat observations that are already in the previous observations. Add your new observations in the format specified in your instructions.`;
25124
- if (options?.skipContinuationHints) prompt += `\n\nOutput <observations> every time.`;
25125
25190
  return prompt;
25126
25191
  }
25127
25192
  /**
@@ -25750,14 +25815,11 @@ var ObserverRunner = class {
25750
25815
  const agent = temporaryMemory ? this.createAgent(resolvedModel.model, false, temporaryMemory.memory, activeExtractors) : this.createAgent(resolvedModel.model, false, void 0, activeExtractors);
25751
25816
  const internalRequestContext = withOmInternalThreadId(options?.requestContext, agent.id);
25752
25817
  const attachmentFilter = this.resolveAttachmentFilter(resolvedModel.model, options?.requestContext);
25753
- const observerMessages = [{
25754
- role: "user",
25755
- content: buildObserverTaskPrompt(existingObservations, {
25756
- ...options,
25757
- includeThreadTitle: this.observationConfig.threadTitle,
25758
- extractors: activeExtractors
25759
- })
25760
- }, buildObserverHistoryMessage(messagesToObserve, { attachmentFilter })];
25818
+ const observerMessages = [buildObserverRequestMessage(existingObservations, messagesToObserve, {
25819
+ ...options,
25820
+ includeThreadTitle: this.observationConfig.threadTitle,
25821
+ extractors: activeExtractors
25822
+ }, { attachmentFilter })];
25761
25823
  const doGenerate = async () => {
25762
25824
  return withRetry(() => withOmTracingSpan({
25763
25825
  phase: "observer",
@@ -25957,10 +26019,7 @@ var ObserverRunner = class {
25957
26019
  const agent = this.createAgent(resolvedModel.model, true, void 0, activeExtractors);
25958
26020
  const internalRequestContext = withOmInternalThreadId(requestContext, agent.id);
25959
26021
  const multiThreadAttachmentFilter = this.resolveAttachmentFilter(resolvedModel.model, requestContext);
25960
- const observerMessages = [{
25961
- role: "user",
25962
- content: buildMultiThreadObserverTaskPrompt(existingObservations, threadOrder, priorMetadataByThread, void 0, this.observationConfig.threadTitle, activeExtractors)
25963
- }, buildMultiThreadObserverHistoryMessage(messagesByThread, threadOrder, { attachmentFilter: multiThreadAttachmentFilter })];
26022
+ const observerMessages = [buildMultiThreadObserverRequestMessage(existingObservations, messagesByThread, threadOrder, priorMetadataByThread, void 0, this.observationConfig.threadTitle, activeExtractors, { attachmentFilter: multiThreadAttachmentFilter })];
25964
26023
  for (const msgs of messagesByThread.values()) for (const msg of msgs) this.observedMessageIds.add(msg.id);
25965
26024
  const doGenerate = async () => {
25966
26025
  return withRetry(() => withOmTracingSpan({
@@ -34119,7 +34178,7 @@ var ObservationalMemory = class ObservationalMemory {
34119
34178
  formatObservationsForContext(observations, currentTask, suggestedResponse, extractedValues, unobservedContextBlocks, currentDate, retrieval = false) {
34120
34179
  let optimized = retrieval ? renderObservationGroupsForReflection(observations) ?? optimizeObservationsForContext(observations) : optimizeObservationsForContext(observations);
34121
34180
  if (currentDate) optimized = addRelativeTimeToObservations(optimized, currentDate);
34122
- const messages = [`${OBSERVATION_CONTEXT_PROMPT}\n\n${OBSERVATION_CONTEXT_INSTRUCTIONS}${retrieval ? `\n\n${getRetrievalInstructions(this.retrievalScope, this.retrievalInstructions, this.retrievalSearch)}` : ""}`];
34181
+ const messages = [`${getObservationContextPrompt(this.scope)}\n\n${OBSERVATION_CONTEXT_INSTRUCTIONS}${retrieval ? `\n\n${getRetrievalInstructions(this.retrievalScope, this.retrievalInstructions, this.retrievalSearch)}` : ""}`];
34123
34182
  if (unobservedContextBlocks) messages.push(`The following content is from OTHER conversations different from the current conversation, they're here for reference, but they're not necessarily your focus:\nSTART_OTHER_CONVERSATIONS_BLOCK\n${unobservedContextBlocks}\nEND_OTHER_CONVERSATIONS_BLOCK`);
34124
34183
  const observationChunks = this.splitObservationContextChunks(optimized);
34125
34184
  if (observationChunks.length > 0) messages.push("<observations>", ...observationChunks);
@@ -36055,6 +36114,7 @@ var observational_memory_exports = /* @__PURE__ */ __exportAll({
36055
36114
  OBSERVATIONAL_MEMORY_DEFAULTS: () => OBSERVATIONAL_MEMORY_DEFAULTS,
36056
36115
  OBSERVATION_CONTEXT_INSTRUCTIONS: () => OBSERVATION_CONTEXT_INSTRUCTIONS,
36057
36116
  OBSERVATION_CONTEXT_PROMPT: () => OBSERVATION_CONTEXT_PROMPT,
36117
+ OBSERVATION_CONTEXT_PROMPT_THREAD: () => OBSERVATION_CONTEXT_PROMPT_THREAD,
36058
36118
  OBSERVATION_CONTINUATION_HINT: () => OBSERVATION_CONTINUATION_HINT,
36059
36119
  OBSERVER_SYSTEM_PROMPT: () => OBSERVER_SYSTEM_PROMPT,
36060
36120
  ObservationalMemory: () => ObservationalMemory,
@@ -36072,6 +36132,7 @@ var observational_memory_exports = /* @__PURE__ */ __exportAll({
36072
36132
  deriveObservationGroupProvenance: () => deriveObservationGroupProvenance,
36073
36133
  extractCurrentTask: () => extractCurrentTask,
36074
36134
  formatMessagesForObserver: () => formatMessagesForObserver,
36135
+ getObservationContextPrompt: () => getObservationContextPrompt,
36075
36136
  getObservationsAsOf: () => getObservationsAsOf,
36076
36137
  hasCurrentTaskSection: () => hasCurrentTaskSection,
36077
36138
  injectAnchorIds: () => injectAnchorIds,
@@ -36095,7 +36156,6 @@ var working_memory_state_exports = /* @__PURE__ */ __exportAll({
36095
36156
  });
36096
36157
  const WORKING_MEMORY_START_TAG = "<working_memory>";
36097
36158
  const WORKING_MEMORY_END_TAG = "</working_memory>";
36098
- const LEGACY_SYSTEM_REMINDER_METADATA_KEY = "dynamicAgentsMdReminder";
36099
36159
  function isRecord(value) {
36100
36160
  return typeof value === "object" && value !== null;
36101
36161
  }
@@ -36126,15 +36186,6 @@ function extractWorkingMemoryContent(text) {
36126
36186
  if (end === -1) return null;
36127
36187
  return text.substring(contentStart, end);
36128
36188
  }
36129
- function isSystemReminderMessage(message) {
36130
- if (!isRecord(message.content)) return false;
36131
- const metadata = message.content.metadata;
36132
- if (message.role === "signal") return isRecord(metadata) && isRecord(metadata.signal) && (metadata.signal.type === "system-reminder" || metadata.signal.type === "reactive");
36133
- if (message.role !== "user") return false;
36134
- if (isRecord(metadata) && (isRecord(metadata.systemReminder) || LEGACY_SYSTEM_REMINDER_METADATA_KEY in metadata)) return true;
36135
- const firstTextPart = message.content.parts.find((part) => part.type === "text");
36136
- return typeof firstTextPart?.text === "string" && firstTextPart.text.startsWith("<system-reminder");
36137
- }
36138
36189
  function isRecallSignalType(type) {
36139
36190
  return type === "user" || type === "state" || type === "reactive" || type === "notification" || type === "user-message" || type === "system-reminder";
36140
36191
  }
@@ -49152,4 +49203,4 @@ const agentBuilderWorkflows = {
49152
49203
  //#endregion
49153
49204
  export { agentBuilderWorkflows };
49154
49205
 
49155
- //# sourceMappingURL=dist-DcTSQIB2.js.map
49206
+ //# sourceMappingURL=dist-B3wkDytS.js.map