@mastra/mssql 1.11.2 → 1.12.0-alpha.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.
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Shared rules for observational memory lifecycle writes. Every storage adapter applies
3
+ * these inside its own atomic section (lock, transaction, or conditional update), so the
4
+ * decisions are identical across adapters.
5
+ */
6
+ /**
7
+ * Observational memory columns that lifecycle writes depend on. Storage adapters merge these
8
+ * into the table schema they get from `@mastra/core`, so the columns exist even when the
9
+ * installed core predates them.
10
+ */
11
+ export declare const OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS: {
12
+ readonly supersededBy: {
13
+ readonly type: 'text';
14
+ readonly nullable: true;
15
+ };
16
+ };
17
+ /** `schema` plus {@link OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS}; `undefined` when `schema` is. */
18
+ export declare function withObservationalMemoryLifecycleColumns<T extends object>(schema: T | undefined): (T & typeof OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS) | undefined;
19
+ /**
20
+ * Result of `commitActiveObservations`.
21
+ */
22
+ export interface UpdateActiveObservationsResult {
23
+ /** Whether the observations were written. */
24
+ applied: boolean;
25
+ /**
26
+ * Why nothing was written: `retired` — the target record was superseded by a newer
27
+ * generation; `conflict` — `expectedActiveObservations` no longer matches the stored text.
28
+ */
29
+ reason?: 'retired' | 'conflict';
30
+ }
31
+ /**
32
+ * Result of `appendBufferedObservations`.
33
+ *
34
+ * The append targets the head generation: when `input.id` was superseded, the chunk is
35
+ * appended to the current head instead. The append is skipped (`persisted: false`) when the
36
+ * head already holds a chunk with the same `cycleId`, or when the chunk is wholly covered by
37
+ * the head's cursor. Chunks carry `lastObservedAt = max message time + 1ms`, so a chunk is
38
+ * wholly covered iff `head.lastObservedAt >= chunk.lastObservedAt - 1ms`.
39
+ */
40
+ export interface UpdateBufferedObservationsResult {
41
+ /** Whether the chunk was stored. */
42
+ persisted: boolean;
43
+ /** The record the chunk was written to (or would have been written to). */
44
+ recordId: string;
45
+ }
46
+ /** The fields of an observational memory record that decide head order. */
47
+ export interface ObservationalMemoryHeadOrderFields {
48
+ generationCount: number;
49
+ createdAt: Date | string;
50
+ id: string;
51
+ }
52
+ /**
53
+ * Canonical head order: `generationCount DESC, createdAt ASC, id ASC`.
54
+ * Returns a negative number when `a` sorts before `b` (i.e. `a` is the better head candidate).
55
+ */
56
+ export declare function compareObservationalMemoryHeadOrder(a: ObservationalMemoryHeadOrderFields, b: ObservationalMemoryHeadOrderFields): number;
57
+ /**
58
+ * A buffered chunk stores `lastObservedAt = max message time + 1ms`. It is wholly covered
59
+ * (every message it observed is already at or before the cursor) iff
60
+ * `cursor >= chunk.lastObservedAt - 1ms`.
61
+ */
62
+ export declare function isBufferedChunkCoveredByCursor(chunkLastObservedAt: Date | string, cursor: Date | string | null | undefined): boolean;
63
+ /** The later of two cursors; `undefined` only when both are absent. */
64
+ export declare function maxObservationCursor(a: Date | string | null | undefined, b: Date | string | null | undefined): Date | undefined;
65
+ export interface ReflectionTextPlan {
66
+ /** `equal`: stored text equals the snapshot. `append`: observations were appended after the snapshot. */
67
+ mode: 'equal' | 'append';
68
+ observations: string;
69
+ tokenCount: number;
70
+ }
71
+ /**
72
+ * Decide the new generation's text when a reflection built from `snapshot` commits against
73
+ * the stored record.
74
+ *
75
+ * - Stored text equals the snapshot: the reflection replaces it.
76
+ * - Stored text extends the snapshot (activation only appends): the appended tail is kept
77
+ * after the reflection, and its tokens are added.
78
+ * - Anything else (a non-append rewrite): `null` — the reflection must not be applied.
79
+ */
80
+ export declare function planReflectionGenerationText(input: {
81
+ storedObservations: string;
82
+ storedObservationTokenCount: number;
83
+ snapshotObservations: string;
84
+ snapshotObservationTokenCount: number;
85
+ reflection: string;
86
+ tokenCount: number;
87
+ }): ReflectionTextPlan | null;
88
+ /**
89
+ * Backs `updateActiveObservations` in adapters that implement `commitActiveObservations`.
90
+ * Callers of `updateActiveObservations` (which resolves `void`) can't see a commit result, so a
91
+ * write that was not applied throws instead of resolving as if it had committed.
92
+ */
93
+ export declare function assertActiveObservationsApplied(result: UpdateActiveObservationsResult, id: string): void;
94
+ /**
95
+ * Whether the stored text can still accept a reflection built from `snapshot`
96
+ * (equal, or only appended to since).
97
+ */
98
+ export declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
99
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -3,7 +3,7 @@ name: mastra-mssql
3
3
  description: Documentation for @mastra/mssql. Use when working with @mastra/mssql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mssql"
6
- version: "1.11.2"
6
+ version: "1.12.0-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,46 +1,46 @@
1
1
  {
2
- "version": "1.11.2",
2
+ "version": "1.12.0-alpha.0",
3
3
  "package": "@mastra/mssql",
4
4
  "exports": {
5
5
  "AgentsMSSQL": {
6
6
  "types": "dist/storage/domains/agents/index.d.ts",
7
7
  "implementation": "dist/index.js",
8
- "line": 1158
8
+ "line": 1173
9
9
  },
10
10
  "BackgroundTasksMSSQL": {
11
11
  "types": "dist/storage/domains/background-tasks/index.d.ts",
12
12
  "implementation": "dist/index.js",
13
- "line": 1793
13
+ "line": 1808
14
14
  },
15
15
  "MSSQLStore": {
16
16
  "types": "dist/storage/index.d.ts",
17
17
  "implementation": "dist/index.js",
18
- "line": 5287
18
+ "line": 6148
19
19
  },
20
20
  "MemoryMSSQL": {
21
21
  "types": "dist/storage/domains/memory/index.d.ts",
22
22
  "implementation": "dist/index.js",
23
- "line": 2241
23
+ "line": 2998
24
24
  },
25
25
  "ObservabilityMSSQL": {
26
26
  "types": "dist/storage/domains/observability/index.d.ts",
27
27
  "implementation": "dist/index.js",
28
- "line": 3373
28
+ "line": 4234
29
29
  },
30
30
  "ScoresMSSQL": {
31
31
  "types": "dist/storage/domains/scores/index.d.ts",
32
32
  "implementation": "dist/index.js",
33
- "line": 4041
33
+ "line": 4902
34
34
  },
35
35
  "WorkflowDefinitionsMSSQL": {
36
36
  "types": "dist/storage/domains/workflow-definitions/index.d.ts",
37
37
  "implementation": "dist/index.js",
38
- "line": 4470
38
+ "line": 5331
39
39
  },
40
40
  "WorkflowsMSSQL": {
41
41
  "types": "dist/storage/domains/workflows/index.d.ts",
42
42
  "implementation": "dist/index.js",
43
- "line": 4666
43
+ "line": 5527
44
44
  }
45
45
  },
46
46
  "modules": {}