@mastra/libsql 1.2.0 → 1.3.0-alpha.1

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 (46) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/docs/SKILL.md +36 -26
  3. package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +1 -1
  4. package/dist/docs/{agents/03-agent-approval.md → references/docs-agents-agent-approval.md} +19 -19
  5. package/dist/docs/references/docs-agents-agent-memory.md +212 -0
  6. package/dist/docs/{agents/04-network-approval.md → references/docs-agents-network-approval.md} +13 -12
  7. package/dist/docs/{agents/02-networks.md → references/docs-agents-networks.md} +10 -12
  8. package/dist/docs/{memory/06-memory-processors.md → references/docs-memory-memory-processors.md} +6 -8
  9. package/dist/docs/{memory/03-message-history.md → references/docs-memory-message-history.md} +31 -20
  10. package/dist/docs/{memory/01-overview.md → references/docs-memory-overview.md} +8 -8
  11. package/dist/docs/{memory/05-semantic-recall.md → references/docs-memory-semantic-recall.md} +33 -17
  12. package/dist/docs/{memory/02-storage.md → references/docs-memory-storage.md} +29 -39
  13. package/dist/docs/{memory/04-working-memory.md → references/docs-memory-working-memory.md} +16 -27
  14. package/dist/docs/{observability/01-overview.md → references/docs-observability-overview.md} +4 -7
  15. package/dist/docs/{observability/02-default.md → references/docs-observability-tracing-exporters-default.md} +11 -14
  16. package/dist/docs/{rag/01-retrieval.md → references/docs-rag-retrieval.md} +26 -53
  17. package/dist/docs/{workflows/01-snapshots.md → references/docs-workflows-snapshots.md} +3 -5
  18. package/dist/docs/{guides/01-ai-sdk.md → references/guides-agent-frameworks-ai-sdk.md} +25 -9
  19. package/dist/docs/references/reference-core-getMemory.md +50 -0
  20. package/dist/docs/references/reference-core-listMemory.md +56 -0
  21. package/dist/docs/references/reference-core-mastra-class.md +66 -0
  22. package/dist/docs/{memory/07-reference.md → references/reference-memory-memory-class.md} +28 -14
  23. package/dist/docs/references/reference-storage-composite.md +235 -0
  24. package/dist/docs/references/reference-storage-dynamodb.md +282 -0
  25. package/dist/docs/references/reference-storage-libsql.md +135 -0
  26. package/dist/docs/{vectors/01-reference.md → references/reference-vectors-libsql.md} +105 -13
  27. package/dist/index.cjs +1690 -208
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.js +1690 -210
  30. package/dist/index.js.map +1 -1
  31. package/dist/storage/db/index.d.ts.map +1 -1
  32. package/dist/storage/domains/agents/index.d.ts +9 -12
  33. package/dist/storage/domains/agents/index.d.ts.map +1 -1
  34. package/dist/storage/domains/memory/index.d.ts +8 -2
  35. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  36. package/dist/storage/domains/prompt-blocks/index.d.ts +25 -0
  37. package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -0
  38. package/dist/storage/domains/scorer-definitions/index.d.ts +26 -0
  39. package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -0
  40. package/dist/storage/index.d.ts +3 -1
  41. package/dist/storage/index.d.ts.map +1 -1
  42. package/package.json +3 -4
  43. package/dist/docs/README.md +0 -39
  44. package/dist/docs/agents/01-agent-memory.md +0 -166
  45. package/dist/docs/core/01-reference.md +0 -151
  46. package/dist/docs/storage/01-reference.md +0 -556
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAS/C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAUvE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBA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AAC;QAC1B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAyCF;;;OAGG;IACG,yBAAyB,IAAI,OAAO,CAAC;QACzC,cAAc,EAAE,OAAO,CAAC;QACxB,aAAa,EAAE,OAAO,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAuBF;;;;;;OAMG;YACW,gBAAgB;IA2D9B;;OAEG;IACH,OAAO,CAAC,eAAe;IAoBvB;;;;;;;;OAQG;IACG,UAAU,CAAC,EACf,SAAS,EACT,MAAM,EACN,WAAW,GACZ,EAAE;QACD,SAAS,EAAE,WAAW,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACtC,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCjB;;;;;;OAMG;IACG,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoB3E"}
@@ -1,5 +1,5 @@
1
1
  import { AgentsStorage } from '@mastra/core/storage';
2
- import type { StorageAgentType, StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, AgentVersion, CreateVersionInput, ListVersionsInput, ListVersionsOutput } from '@mastra/core/storage';
2
+ import type { StorageAgentType, StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, AgentVersion, CreateVersionInput, ListVersionsInput, ListVersionsOutput } from '@mastra/core/storage';
3
3
  import type { LibSQLDomainConfig } from '../../db/index.js';
4
4
  export declare class AgentsLibSQL extends AgentsStorage {
5
5
  #private;
@@ -8,26 +8,23 @@ export declare class AgentsLibSQL extends AgentsStorage {
8
8
  dangerouslyClearAll(): Promise<void>;
9
9
  private parseJson;
10
10
  private parseRow;
11
- getAgentById({ id }: {
12
- id: string;
13
- }): Promise<StorageAgentType | null>;
14
- createAgent({ agent }: {
11
+ getById(id: string): Promise<StorageAgentType | null>;
12
+ create(input: {
15
13
  agent: StorageCreateAgentInput;
16
14
  }): Promise<StorageAgentType>;
17
- updateAgent({ id, ...updates }: StorageUpdateAgentInput): Promise<StorageAgentType>;
18
- deleteAgent({ id }: {
19
- id: string;
20
- }): Promise<void>;
21
- listAgents(args?: StorageListAgentsInput): Promise<StorageListAgentsOutput>;
22
- listAgentsResolved(args?: StorageListAgentsInput): Promise<StorageListAgentsResolvedOutput>;
15
+ update(input: StorageUpdateAgentInput): Promise<StorageAgentType>;
16
+ delete(id: string): Promise<void>;
17
+ list(args?: StorageListAgentsInput): Promise<StorageListAgentsOutput>;
23
18
  createVersion(input: CreateVersionInput): Promise<AgentVersion>;
24
19
  getVersion(id: string): Promise<AgentVersion | null>;
25
20
  getVersionByNumber(agentId: string, versionNumber: number): Promise<AgentVersion | null>;
26
21
  getLatestVersion(agentId: string): Promise<AgentVersion | null>;
27
22
  listVersions(input: ListVersionsInput): Promise<ListVersionsOutput>;
28
23
  deleteVersion(id: string): Promise<void>;
29
- deleteVersionsByAgentId(agentId: string): Promise<void>;
24
+ deleteVersionsByParentId(entityId: string): Promise<void>;
30
25
  countVersions(agentId: string): Promise<number>;
26
+ private serializeInstructions;
27
+ private deserializeInstructions;
31
28
  private parseVersionRow;
32
29
  }
33
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/agents/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAQd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAE/B,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,E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jC,IAAI,CAAC,IAAI,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAoErE,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IA+C/D,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA0BpD,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA8BxF,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA+B/D,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4EnE,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBxC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCzD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4BrD,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,eAAe;CAuBxB"}
@@ -1,6 +1,6 @@
1
1
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
2
  import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
3
- import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesByResourceIdInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, ObservationalMemoryRecord, CreateObservationalMemoryInput, UpdateActiveObservationsInput, CreateReflectionGenerationInput } from '@mastra/core/storage';
3
+ import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesByResourceIdInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, ObservationalMemoryRecord, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, SwapBufferedToActiveInput, SwapBufferedToActiveResult, UpdateBufferedReflectionInput, SwapBufferedReflectionToActiveInput, CreateReflectionGenerationInput } from '@mastra/core/storage';
4
4
  import { MemoryStorage } from '@mastra/core/storage';
5
5
  import type { LibSQLDomainConfig } from '../../db/index.js';
6
6
  export declare class MemoryLibSQL extends MemoryStorage {
@@ -69,7 +69,13 @@ export declare class MemoryLibSQL extends MemoryStorage {
69
69
  createReflectionGeneration(input: CreateReflectionGenerationInput): Promise<ObservationalMemoryRecord>;
70
70
  setReflectingFlag(id: string, isReflecting: boolean): Promise<void>;
71
71
  setObservingFlag(id: string, isObserving: boolean): Promise<void>;
72
+ setBufferingObservationFlag(id: string, isBuffering: boolean, lastBufferedAtTokens?: number): Promise<void>;
73
+ setBufferingReflectionFlag(id: string, isBuffering: boolean): Promise<void>;
72
74
  clearObservationalMemory(threadId: string | null, resourceId: string): Promise<void>;
73
- addPendingMessageTokens(id: string, tokenCount: number): Promise<void>;
75
+ setPendingMessageTokens(id: string, tokenCount: number): Promise<void>;
76
+ updateBufferedObservations(input: UpdateBufferedObservationsInput): Promise<void>;
77
+ swapBufferedToActive(input: SwapBufferedToActiveInput): Promise<SwapBufferedToActiveResult>;
78
+ updateBufferedReflection(input: UpdateBufferedReflectionInput): Promise<void>;
79
+ swapBufferedReflectionToActive(input: SwapBufferedReflectionToActiveInput): Promise<ObservationalMemoryRecord>;
74
80
  }
75
81
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB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C,IAAI,CAAC;IA0C3G,0BAA0B,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC3E,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBpF,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCtE,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;IAqFjF,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAqL3F,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IAoD7E,8BAA8B,CAAC,KAAK,EAAE,mCAAmC,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAkFrH"}
@@ -0,0 +1,25 @@
1
+ import { PromptBlocksStorage } from '@mastra/core/storage';
2
+ import type { StoragePromptBlockType, StorageCreatePromptBlockInput, StorageUpdatePromptBlockInput, StorageListPromptBlocksInput, StorageListPromptBlocksOutput, PromptBlockVersion, CreatePromptBlockVersionInput, ListPromptBlockVersionsInput, ListPromptBlockVersionsOutput } from '@mastra/core/storage';
3
+ import type { LibSQLDomainConfig } from '../../db/index.js';
4
+ export declare class PromptBlocksLibSQL extends PromptBlocksStorage {
5
+ #private;
6
+ constructor(config: LibSQLDomainConfig);
7
+ init(): Promise<void>;
8
+ dangerouslyClearAll(): Promise<void>;
9
+ getById(id: string): Promise<StoragePromptBlockType | null>;
10
+ create(input: {
11
+ promptBlock: StorageCreatePromptBlockInput;
12
+ }): Promise<StoragePromptBlockType>;
13
+ update(input: StorageUpdatePromptBlockInput): Promise<StoragePromptBlockType>;
14
+ delete(id: string): Promise<void>;
15
+ list(args?: StorageListPromptBlocksInput): Promise<StorageListPromptBlocksOutput>;
16
+ createVersion(input: CreatePromptBlockVersionInput): Promise<PromptBlockVersion>;
17
+ getVersion(id: string): Promise<PromptBlockVersion | null>;
18
+ getVersionByNumber(blockId: string, versionNumber: number): Promise<PromptBlockVersion | null>;
19
+ getLatestVersion(blockId: string): Promise<PromptBlockVersion | null>;
20
+ listVersions(input: ListPromptBlockVersionsInput): Promise<ListPromptBlockVersionsOutput>;
21
+ deleteVersion(id: string): Promise<void>;
22
+ deleteVersionsByParentId(entityId: string): Promise<void>;
23
+ countVersions(blockId: string): Promise<number>;
24
+ }
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/prompt-blocks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EAQpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC7B,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAQnD,qBAAa,kBAAmB,SAAQ,mBAAmB;;gBAI7C,MAAM,EAAE,kBAAkB;IAOhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IASpC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IAqB3D,MAAM,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,6BAA6B,CAAA;KAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAqD9F,MAAM,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAiG7E,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjC,IAAI,CAAC,IAAI,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAqFjF,aAAa,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoChF,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAqB1D,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAqB9F,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAqBrE,YAAY,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAsDzF,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA0EtD"}
@@ -0,0 +1,26 @@
1
+ import { ScorerDefinitionsStorage } from '@mastra/core/storage';
2
+ import type { StorageScorerDefinitionType, StorageCreateScorerDefinitionInput, StorageUpdateScorerDefinitionInput, StorageListScorerDefinitionsInput, StorageListScorerDefinitionsOutput } from '@mastra/core/storage';
3
+ import type { ScorerDefinitionVersion, CreateScorerDefinitionVersionInput, ListScorerDefinitionVersionsInput, ListScorerDefinitionVersionsOutput } from '@mastra/core/storage/domains/scorer-definitions';
4
+ import type { LibSQLDomainConfig } from '../../db/index.js';
5
+ export declare class ScorerDefinitionsLibSQL extends ScorerDefinitionsStorage {
6
+ #private;
7
+ constructor(config: LibSQLDomainConfig);
8
+ init(): Promise<void>;
9
+ dangerouslyClearAll(): Promise<void>;
10
+ getById(id: string): Promise<StorageScorerDefinitionType | null>;
11
+ create(input: {
12
+ scorerDefinition: StorageCreateScorerDefinitionInput;
13
+ }): Promise<StorageScorerDefinitionType>;
14
+ update(input: StorageUpdateScorerDefinitionInput): Promise<StorageScorerDefinitionType>;
15
+ delete(id: string): Promise<void>;
16
+ list(args?: StorageListScorerDefinitionsInput): Promise<StorageListScorerDefinitionsOutput>;
17
+ createVersion(input: CreateScorerDefinitionVersionInput): Promise<ScorerDefinitionVersion>;
18
+ getVersion(id: string): Promise<ScorerDefinitionVersion | null>;
19
+ getVersionByNumber(scorerDefinitionId: string, versionNumber: number): Promise<ScorerDefinitionVersion | null>;
20
+ getLatestVersion(scorerDefinitionId: string): Promise<ScorerDefinitionVersion | null>;
21
+ listVersions(input: ListScorerDefinitionVersionsInput): Promise<ListScorerDefinitionVersionsOutput>;
22
+ deleteVersion(id: string): Promise<void>;
23
+ deleteVersionsByParentId(entityId: string): Promise<void>;
24
+ countVersions(scorerDefinitionId: string): Promise<number>;
25
+ }
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scorer-definitions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wBAAwB,EAQzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,2BAA2B,EAC3B,kCAAkC,EAClC,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,uBAAuB,EACvB,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,iDAAiD,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAiBnD,qBAAa,uBAAwB,SAAQ,wBAAwB;;gBAIvD,MAAM,EAAE,kBAAkB;IAOhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IASpC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;IAqBhE,MAAM,CAAC,KAAK,EAAE;QAAE,gBAAgB,EAAE,kCAAkC,CAAA;KAAE,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAqD7G,MAAM,CAAC,KAAK,EAAE,kCAAkC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAiGvF,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjC,IAAI,CAAC,IAAI,CAAC,EAAE,iCAAiC,GAAG,OAAO,CAAC,kCAAkC,CAAC;IAqF3F,aAAa,CAAC,KAAK,EAAE,kCAAkC,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAwC1F,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAqB/D,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAqB9G,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAqBrF,YAAY,CAAC,KAAK,EAAE,iCAAiC,GAAG,OAAO,CAAC,kCAAkC,CAAC;IAsDnG,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzD,aAAa,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA8EjE"}
@@ -4,9 +4,11 @@ import { MastraCompositeStore } from '@mastra/core/storage';
4
4
  import { AgentsLibSQL } from './domains/agents/index.js';
5
5
  import { MemoryLibSQL } from './domains/memory/index.js';
6
6
  import { ObservabilityLibSQL } from './domains/observability/index.js';
7
+ import { PromptBlocksLibSQL } from './domains/prompt-blocks/index.js';
8
+ import { ScorerDefinitionsLibSQL } from './domains/scorer-definitions/index.js';
7
9
  import { ScoresLibSQL } from './domains/scores/index.js';
8
10
  import { WorkflowsLibSQL } from './domains/workflows/index.js';
9
- export { AgentsLibSQL, MemoryLibSQL, ObservabilityLibSQL, ScoresLibSQL, WorkflowsLibSQL };
11
+ export { AgentsLibSQL, MemoryLibSQL, ObservabilityLibSQL, PromptBlocksLibSQL, ScorerDefinitionsLibSQL, ScoresLibSQL, WorkflowsLibSQL, };
10
12
  export type { LibSQLDomainConfig } from './db/index.js';
11
13
  /**
12
14
  * Base configuration options shared across LibSQL configurations
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;AAC1F,YAAY,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,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,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,YAAY,EACZ,eAAe,GAChB,CAAC;AACF,YAAY,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,CAAC,gBAAgB,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,GACF,CAAC,gBAAgB,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEP;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,WAAY,SAAQ,oBAAoB;IACnD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAE1C,MAAM,EAAE,cAAc,CAAC;gBAEX,MAAM,EAAE,YAAY;CA2DjC;AAED,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/libsql",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-alpha.1",
4
4
  "description": "Libsql provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,9 +31,9 @@
31
31
  "typescript": "^5.9.3",
32
32
  "vitest": "4.0.16",
33
33
  "@internal/lint": "0.0.57",
34
+ "@internal/storage-test-utils": "0.0.53",
34
35
  "@internal/types-builder": "0.0.32",
35
- "@mastra/core": "1.2.0",
36
- "@internal/storage-test-utils": "0.0.53"
36
+ "@mastra/core": "1.3.0-alpha.2"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@mastra/core": ">=1.1.0-0 <2.0.0-0"
@@ -56,7 +56,6 @@
56
56
  },
57
57
  "scripts": {
58
58
  "build:lib": "tsup --silent --config tsup.config.ts",
59
- "build:docs": "pnpx tsx ../../scripts/generate-package-docs.ts stores/libsql",
60
59
  "build:watch": "tsup --watch --silent --config tsup.config.ts",
61
60
  "test": "vitest run",
62
61
  "lint": "eslint ."
@@ -1,39 +0,0 @@
1
- # @mastra/libsql Documentation
2
-
3
- > Embedded documentation for coding agents
4
-
5
- ## Quick Start
6
-
7
- ```bash
8
- # Read the skill overview
9
- cat docs/SKILL.md
10
-
11
- # Get the source map
12
- cat docs/SOURCE_MAP.json
13
-
14
- # Read topic documentation
15
- cat docs/<topic>/01-overview.md
16
- ```
17
-
18
- ## Structure
19
-
20
- ```
21
- docs/
22
- ├── SKILL.md # Entry point
23
- ├── README.md # This file
24
- ├── SOURCE_MAP.json # Export index
25
- ├── agents/ (4 files)
26
- ├── core/ (3 files)
27
- ├── guides/ (1 files)
28
- ├── memory/ (7 files)
29
- ├── observability/ (2 files)
30
- ├── rag/ (1 files)
31
- ├── storage/ (3 files)
32
- ├── vectors/ (1 files)
33
- ├── workflows/ (1 files)
34
- ```
35
-
36
- ## Version
37
-
38
- Package: @mastra/libsql
39
- Version: 1.2.0
@@ -1,166 +0,0 @@
1
- > Learn how to add memory to agents to store message history and maintain context across interactions.
2
-
3
- # Agent memory
4
-
5
- Agents use memory to maintain context across interactions. LLMs are stateless and don't retain information between calls, so agents need memory to track message history and recall relevant information.
6
-
7
- Mastra agents can be configured to store message history, with optional [working memory](../memory/working-memory) to maintain recent context or [semantic recall](../memory/semantic-recall) to retrieve past messages based on meaning.
8
-
9
- ## When to use memory
10
-
11
- Use memory when your agent needs to maintain multi-turn conversations that reference prior exchanges, recall user preferences or facts from earlier in a session, or build context over time within a conversation thread. Skip memory for single-turn requests where each interaction is independent.
12
-
13
- ## Setting up memory
14
-
15
- To enable memory in Mastra, install the `@mastra/memory` package along with a storage provider.
16
-
17
- ```bash npm2yarn
18
- npm install @mastra/memory@latest @mastra/libsql@latest
19
- ```
20
-
21
- ## Storage providers
22
-
23
- Memory requires a storage provider to persist message history, including user messages and agent responses. For more details on available providers and how storage works in Mastra, see the [Storage](https://mastra.ai/docs/memory/storage) documentation.
24
-
25
- ## Configuring memory
26
-
27
- ### Step
28
-
29
- Enable memory by creating a `Memory` instance and passing it to the agent’s `memory` option.
30
-
31
- ```typescript {7-11} title="src/mastra/agents/memory-agent.ts"
32
- import { Agent } from "@mastra/core/agent";
33
- import { Memory } from "@mastra/memory";
34
-
35
- export const memoryAgent = new Agent({
36
- id: 'memory-agent',
37
- name: 'Memory Agent',
38
- memory: new Memory({
39
- options: {
40
- lastMessages: 20,
41
- },
42
- }),
43
- });
44
- ```
45
-
46
- > **Note:**
47
-
48
- Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
49
-
50
-
51
-
52
- ### Step
53
-
54
- Add a storage provider to your main Mastra instance to enable memory across all configured agents.
55
-
56
- ```typescript {5-8} title="src/mastra/index.ts"
57
- import { Mastra } from "@mastra/core";
58
- import { LibSQLStore } from "@mastra/libsql";
59
-
60
- export const mastra = new Mastra({
61
- storage: new LibSQLStore({
62
- id: 'mastra-storage',
63
- url: ":memory:",
64
- }),
65
- });
66
- ```
67
-
68
- > **Note:**
69
-
70
- Visit [libSQL Storage](https://mastra.ai/reference/storage/libsql) for a full list of configuration options.
71
-
72
-
73
-
74
- Alternatively, add storage directly to an agent’s memory to keep data separate or use different providers per agent.
75
-
76
- ```typescript {9-12} title="src/mastra/agents/memory-agent.ts"
77
- import { Agent } from "@mastra/core/agent";
78
- import { Memory } from "@mastra/memory";
79
- import { LibSQLStore } from "@mastra/libsql";
80
-
81
- export const memoryAgent = new Agent({
82
- id: 'memory-agent',
83
- name: 'Memory Agent',
84
- memory: new Memory({
85
- storage: new LibSQLStore({
86
- id: 'mastra-storage',
87
- url: ":memory:",
88
- }),
89
- }),
90
- });
91
- ```
92
-
93
- > **Mastra Cloud Store limitation**
94
- Agent-level storage is not supported when using [Mastra Cloud Store](https://mastra.ai/docs/mastra-cloud/deployment#using-mastra-cloud-store). If you use Mastra Cloud Store, configure storage on the Mastra instance instead. This limitation does not apply if you bring your own database.
95
-
96
- ## Message history
97
-
98
- Include a `memory` object with both `resource` and `thread` to track message history during agent calls.
99
-
100
- - `resource`: A stable identifier for the user or entity.
101
- - `thread`: An ID that isolates a specific conversation or session.
102
-
103
- These fields tell the agent where to store and retrieve context, enabling persistent, thread-aware memory across a conversation.
104
-
105
- ```typescript {4-7}
106
- const response = await memoryAgent.generate(
107
- "Remember my favorite color is blue.",
108
- {
109
- memory: {
110
- resource: "user-123",
111
- thread: "conversation-123",
112
- },
113
- },
114
- );
115
- ```
116
-
117
- To recall information stored in memory, call the agent with the same `resource` and `thread` values used in the original conversation.
118
-
119
- ```typescript {2-5}
120
- const response = await memoryAgent.generate("What's my favorite color?", {
121
- memory: {
122
- resource: "user-123",
123
- thread: "conversation-123",
124
- },
125
- });
126
- ```
127
-
128
- > **Note:**
129
- Each thread has an owner (`resourceId`) that cannot be changed after creation. Avoid reusing the same thread ID for threads with different owners, as this will cause errors when querying.
130
-
131
- To learn more about memory see the [Memory](../memory/overview) documentation.
132
-
133
- ## Using `RequestContext`
134
-
135
- Use [RequestContext](https://mastra.ai/docs/server/request-context) to access request-specific values. This lets you conditionally select different memory or storage configurations based on the context of the request.
136
-
137
- ```typescript title="src/mastra/agents/memory-agent.ts"
138
- export type UserTier = {
139
- "user-tier": "enterprise" | "pro";
140
- };
141
-
142
- const premiumMemory = new Memory();
143
-
144
- const standardMemory = new Memory();
145
-
146
- export const memoryAgent = new Agent({
147
- id: 'memory-agent',
148
- name: 'Memory Agent',
149
- memory: ({ requestContext }) => {
150
- const userTier = requestContext.get("user-tier") as UserTier["user-tier"];
151
-
152
- return userTier === "enterprise" ? premiumMemory : standardMemory;
153
- },
154
- });
155
- ```
156
-
157
- > **Note:**
158
-
159
- Visit [Request Context](https://mastra.ai/docs/server/request-context) for more information.
160
-
161
- ## Related
162
-
163
- - [Working Memory](../memory/working-memory)
164
- - [Semantic Recall](../memory/semantic-recall)
165
- - [Storage](../memory/storage)
166
- - [Request Context](https://mastra.ai/docs/server/request-context)
@@ -1,151 +0,0 @@
1
- # Core API Reference
2
-
3
- > API reference for core - 3 entries
4
-
5
-
6
- ---
7
-
8
- ## Reference: Mastra Class
9
-
10
- > Documentation for the `Mastra` class in Mastra, the core entry point for managing agents, workflows, MCP servers, and server endpoints.
11
-
12
- The `Mastra` class is the central orchestrator in any Mastra application, managing agents, workflows, storage, logging, observability, and more. Typically, you create a single instance of `Mastra` to coordinate your application.
13
-
14
- Think of `Mastra` as a top-level registry where you register agents, workflows, tools, and other components that need to be accessible throughout your application.
15
-
16
- ## Usage example
17
-
18
- ```typescript title="src/mastra/index.ts"
19
- import { Mastra } from "@mastra/core";
20
- import { PinoLogger } from "@mastra/loggers";
21
- import { LibSQLStore } from "@mastra/libsql";
22
- import { weatherWorkflow } from "./workflows/weather-workflow";
23
- import { weatherAgent } from "./agents/weather-agent";
24
-
25
- export const mastra = new Mastra({
26
- workflows: { weatherWorkflow },
27
- agents: { weatherAgent },
28
- storage: new LibSQLStore({
29
- id: 'mastra-storage',
30
- url: ":memory:",
31
- }),
32
- logger: new PinoLogger({
33
- name: "Mastra",
34
- level: "info",
35
- }),
36
- });
37
- ```
38
-
39
- ## Constructor parameters
40
-
41
- Visit the [Configuration reference](https://mastra.ai/reference/configuration) for detailed documentation on all available configuration options.
42
-
43
- ---
44
-
45
- ## Reference: Mastra.getMemory()
46
-
47
- > Documentation for the `Mastra.getMemory()` method in Mastra, which retrieves a registered memory instance by its registry key.
48
-
49
- The `.getMemory()` method retrieves a memory instance from the Mastra registry by its key. Memory instances are registered in the Mastra constructor and can be referenced by stored agents.
50
-
51
- ## Usage example
52
-
53
- ```typescript
54
- const memory = mastra.getMemory("conversationMemory");
55
-
56
- // Use the memory instance
57
- const thread = await memory.createThread({
58
- resourceId: "user-123",
59
- title: "New Conversation",
60
- });
61
- ```
62
-
63
- ## Parameters
64
-
65
- ## Returns
66
-
67
- ## Example: Registering and Retrieving Memory
68
-
69
- ```typescript
70
- import { Mastra } from "@mastra/core";
71
- import { Memory } from "@mastra/memory";
72
- import { LibSQLStore } from "@mastra/libsql";
73
-
74
- const conversationMemory = new Memory({
75
- storage: new LibSQLStore({ id: 'conversation-store', url: ":memory:" }),
76
- });
77
-
78
- const mastra = new Mastra({
79
- memory: {
80
- conversationMemory,
81
- },
82
- });
83
-
84
- // Later, retrieve the memory instance
85
- const memory = mastra.getMemory("conversationMemory");
86
- ```
87
-
88
- ## Related
89
-
90
- - [Mastra.listMemory()](https://mastra.ai/reference/core/listMemory)
91
- - [Memory overview](https://mastra.ai/docs/memory/overview)
92
- - [Agent Memory](https://mastra.ai/docs/agents/agent-memory)
93
-
94
- ---
95
-
96
- ## Reference: Mastra.listMemory()
97
-
98
- > Documentation for the `Mastra.listMemory()` method in Mastra, which returns all registered memory instances.
99
-
100
- The `.listMemory()` method returns all memory instances registered with the Mastra instance.
101
-
102
- ## Usage example
103
-
104
- ```typescript
105
- const memoryInstances = mastra.listMemory();
106
-
107
- for (const [key, memory] of Object.entries(memoryInstances)) {
108
- console.log(`Memory "${key}": ${memory.id}`);
109
- }
110
- ```
111
-
112
- ## Parameters
113
-
114
- This method takes no parameters.
115
-
116
- ## Returns
117
-
118
- ## Example: Checking Registered Memory
119
-
120
- ```typescript
121
- import { Mastra } from "@mastra/core";
122
- import { Memory } from "@mastra/memory";
123
- import { LibSQLStore } from "@mastra/libsql";
124
-
125
- const conversationMemory = new Memory({
126
- id: "conversation-memory",
127
- storage: new LibSQLStore({ id: 'conversation-store', url: ":memory:" }),
128
- });
129
-
130
- const analyticsMemory = new Memory({
131
- id: "analytics-memory",
132
- storage: new LibSQLStore({ id: 'analytics-store', url: ":memory:" }),
133
- });
134
-
135
- const mastra = new Mastra({
136
- memory: {
137
- conversationMemory,
138
- analyticsMemory,
139
- },
140
- });
141
-
142
- // List all registered memory instances
143
- const allMemory = mastra.listMemory();
144
- console.log(Object.keys(allMemory)); // ["conversationMemory", "analyticsMemory"]
145
- ```
146
-
147
- ## Related
148
-
149
- - [Mastra.getMemory()](https://mastra.ai/reference/core/getMemory)
150
- - [Memory overview](https://mastra.ai/docs/memory/overview)
151
- - [Agent Memory](https://mastra.ai/docs/agents/agent-memory)