@mastra/memory 1.16.0-alpha.2 → 1.16.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.16.0-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed a security issue where several parsing and tracing paths could slow down on malformed or attacker-crafted input. Normal behavior is unchanged, and these packages now handle pathological input in linear time. ([#15566](https://github.com/mastra-ai/mastra/pull/15566))
8
+
9
+ - Updated dependencies [[`aba393e`](https://github.com/mastra-ai/mastra/commit/aba393e2da7390c69b80e516a4f153cda6f09376), [`0a5fa1d`](https://github.com/mastra-ai/mastra/commit/0a5fa1d3cb0583889d06687155f26fd7d2edc76c), [`ea43e64`](https://github.com/mastra-ai/mastra/commit/ea43e646dd95d507694b6112b0bf1df22ad552b2), [`00d1b16`](https://github.com/mastra-ai/mastra/commit/00d1b16b401199cb294fa23f43336547db4dca9b), [`af8a57e`](https://github.com/mastra-ai/mastra/commit/af8a57ed9ba9685ad8601d5b71ae3706da6222f9)]:
10
+ - @mastra/core@1.26.0-alpha.10
11
+
3
12
  ## 1.16.0-alpha.2
4
13
 
5
14
  ### Minor Changes
@@ -195,6 +195,8 @@ export declare interface Attachment {
195
195
  * Attributes is a map from string to attribute values.
196
196
  *
197
197
  * Note: only the own enumerable keys are counted as valid attribute keys.
198
+ *
199
+ * @since 1.3.0
198
200
  */
199
201
  declare interface Attributes {
200
202
  [attributeKey: string]: AttributeValue | undefined;
@@ -204,6 +206,8 @@ declare interface Attributes {
204
206
  * Attribute values may be any non-nullish primitive value except an object.
205
207
  *
206
208
  * null or undefined attribute values are invalid and will result in undefined behavior.
209
+ *
210
+ * @since 1.3.0
207
211
  */
208
212
  declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
209
213
 
@@ -1057,6 +1061,9 @@ declare type ConsumeStreamOptions = {
1057
1061
  onError?: (error: unknown) => void;
1058
1062
  };
1059
1063
 
1064
+ /**
1065
+ * @since 1.0.0
1066
+ */
1060
1067
  declare interface Context {
1061
1068
  /**
1062
1069
  * Get a value from the context.
@@ -1735,6 +1742,8 @@ declare const errorStreamPart: AssistantStreamPart<'3', 'error', string>;
1735
1742
  * Defines Exception.
1736
1743
  *
1737
1744
  * string or an object with one of (message or name or code) and optional stack
1745
+ *
1746
+ * @since 1.0.0
1738
1747
  */
1739
1748
  declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
1740
1749
 
@@ -2770,6 +2779,8 @@ export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
2770
2779
  * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
2771
2780
  * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
2772
2781
  * This is represented in HrTime format as [1609504210, 150000000].
2782
+ *
2783
+ * @since 1.0.0
2773
2784
  */
2774
2785
  declare type HrTime = [number, number];
2775
2786
 
@@ -4420,6 +4431,8 @@ declare interface LanguageModelV1ToolResultPart {
4420
4431
  * However, it is desirable to associate incoming SpanContext to new trace
4421
4432
  * initiated on service provider side so two traces (from Client and from
4422
4433
  * Service Provider) can be correlated.
4434
+ *
4435
+ * @since 1.0.0
4423
4436
  */
4424
4437
  declare interface Link {
4425
4438
  /** The {@link SpanContext} of a linked span. */
@@ -5289,6 +5302,8 @@ declare type SourceUIPart = {
5289
5302
  * may have children.
5290
5303
  *
5291
5304
  * Spans are created by the {@link Tracer.startSpan} method.
5305
+ *
5306
+ * @since 1.0.0
5292
5307
  */
5293
5308
  declare interface Span {
5294
5309
  /**
@@ -5348,11 +5363,21 @@ declare interface Span {
5348
5363
  */
5349
5364
  addLinks(links: Link[]): this;
5350
5365
  /**
5351
- * Sets a status to the span. If used, this will override the default Span
5352
- * status. Default is {@link SpanStatusCode.UNSET}. SetStatus overrides the value
5353
- * of previous calls to SetStatus on the Span.
5366
+ * Sets the status of the span.
5367
+ *
5368
+ * By default, a span has status {@link SpanStatusCode.UNSET}.
5369
+ * Calling this method overrides that default.
5370
+ *
5371
+ * The status codes have a total order: `OK > ERROR > UNSET`.
5372
+ *
5373
+ * - Once {@link SpanStatusCode.OK} is set, any further attempts to change
5374
+ * the status are ignored.
5375
+ * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.
5376
+ *
5377
+ * The `message` field is only used when {@link SpanStatusCode.ERROR} is set.
5378
+ * For all other status codes, `message` is ignored.
5354
5379
  *
5355
- * @param status the SpanStatus to set.
5380
+ * @param status The {@link SpanStatus} to set.
5356
5381
  */
5357
5382
  setStatus(status: SpanStatus): this;
5358
5383
  /**
@@ -5397,17 +5422,21 @@ declare interface Span {
5397
5422
 
5398
5423
  /**
5399
5424
  * @deprecated please use {@link Attributes}
5425
+ * @since 1.0.0
5400
5426
  */
5401
5427
  declare type SpanAttributes = Attributes;
5402
5428
 
5403
5429
  /**
5404
5430
  * @deprecated please use {@link AttributeValue}
5431
+ * @since 1.0.0
5405
5432
  */
5406
5433
  declare type SpanAttributeValue = AttributeValue;
5407
5434
 
5408
5435
  /**
5409
5436
  * A SpanContext represents the portion of a {@link Span} which must be
5410
5437
  * serialized and propagated along side of a {@link Baggage}.
5438
+ *
5439
+ * @since 1.0.0
5411
5440
  */
5412
5441
  declare interface SpanContext {
5413
5442
  /**
@@ -5457,6 +5486,9 @@ declare interface SpanContext {
5457
5486
  traceState?: TraceState;
5458
5487
  }
5459
5488
 
5489
+ /**
5490
+ * @since 1.0.0
5491
+ */
5460
5492
  declare enum SpanKind {
5461
5493
  /** Default value. Indicates that the span is used internally. */
5462
5494
  INTERNAL = 0,
@@ -5486,6 +5518,8 @@ declare enum SpanKind {
5486
5518
 
5487
5519
  /**
5488
5520
  * Options needed for span creation
5521
+ *
5522
+ * @since 1.0.0
5489
5523
  */
5490
5524
  declare interface SpanOptions {
5491
5525
  /**
@@ -5494,7 +5528,7 @@ declare interface SpanOptions {
5494
5528
  */
5495
5529
  kind?: SpanKind;
5496
5530
  /** A span's attributes */
5497
- attributes?: SpanAttributes;
5531
+ attributes?: Attributes;
5498
5532
  /** {@link Link}s span to other spans */
5499
5533
  links?: Link[];
5500
5534
  /** A manually specified start time for the created `Span` object. */
@@ -5503,6 +5537,9 @@ declare interface SpanOptions {
5503
5537
  root?: boolean;
5504
5538
  }
5505
5539
 
5540
+ /**
5541
+ * @since 1.0.0
5542
+ */
5506
5543
  declare interface SpanStatus {
5507
5544
  /** The status code of this message. */
5508
5545
  code: SpanStatusCode;
@@ -5512,6 +5549,8 @@ declare interface SpanStatus {
5512
5549
 
5513
5550
  /**
5514
5551
  * An enumeration of status codes.
5552
+ *
5553
+ * @since 1.0.0
5515
5554
  */
5516
5555
  declare enum SpanStatusCode {
5517
5556
  /**
@@ -6741,6 +6780,8 @@ declare type TextUIPart = {
6741
6780
  * Defines TimeInput.
6742
6781
  *
6743
6782
  * hrtime, epoch milliseconds, performance.now() or Date
6783
+ *
6784
+ * @since 1.0.0
6744
6785
  */
6745
6786
  declare type TimeInput = HrTime | number | Date;
6746
6787
 
@@ -7087,6 +7128,8 @@ declare type ToToolsWithExecute<TOOLS extends ToolSet> = {
7087
7128
 
7088
7129
  /**
7089
7130
  * Tracer provides an interface for creating {@link Span}s.
7131
+ *
7132
+ * @since 1.0.0
7090
7133
  */
7091
7134
  declare interface Tracer {
7092
7135
  /**
@@ -7153,6 +7196,9 @@ declare interface Tracer {
7153
7196
  startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
7154
7197
  }
7155
7198
 
7199
+ /**
7200
+ * @since 1.0.0
7201
+ */
7156
7202
  declare interface TraceState {
7157
7203
  /**
7158
7204
  * Create a new TraceState which inherits from this TraceState and has the
@@ -652,7 +652,7 @@ function sortThreadsByOldestMessage(messagesByThread) {
652
652
  })).sort((a, b) => a.oldestTimestamp - b.oldestTimestamp).map((t) => t.threadId);
653
653
  }
654
654
  function stripThreadTags(observations) {
655
- return observations.replace(/<thread[^>]*>|<\/thread>/gi, "").trim();
655
+ return observations.replace(/<\/?thread\b[^>]{0,1024}>/gi, "").trim();
656
656
  }
657
657
 
658
658
  // src/processors/observational-memory/model-by-input-tokens.ts
@@ -9074,5 +9074,5 @@ function getObservationsAsOf(activeObservations, asOf) {
9074
9074
  }
9075
9075
 
9076
9076
  export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, formatToolResultForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, resolveToolResultValue, stripEphemeralAnchorIds, stripObservationGroups, truncateStringByTokens, wrapInObservationGroup };
9077
- //# sourceMappingURL=chunk-MGHUIRKN.js.map
9078
- //# sourceMappingURL=chunk-MGHUIRKN.js.map
9077
+ //# sourceMappingURL=chunk-25XLVCFF.js.map
9078
+ //# sourceMappingURL=chunk-25XLVCFF.js.map