@mastra/libsql 1.13.0-alpha.0 → 1.13.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 1.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed updateThread not refreshing a thread's updatedAt timestamp. Editing a thread's title or metadata now bumps updatedAt, so edited threads correctly resurface when listing threads sorted by most recently updated. ([#17934](https://github.com/mastra-ai/mastra/pull/17934))
8
+
9
+ - Keep the agent loop alive after a tool suspension (e.g. `ask_user`, `request_access`). ([#17990](https://github.com/mastra-ai/mastra/pull/17990))
10
+
11
+ Two related fixes that stop the agent from appearing to quit mid-task right after a suspended tool resumes:
12
+ - **Harness resume step budget**: `resumeStream()` was called without a step budget, so a resumed run merged over the agent's small default `maxSteps` and stopped after a single step. The harness now threads a shared set of run options (`maxSteps`, `savePerStep`, `modelSettings`, etc.) into both the initial stream and the resume via one helper, so the two paths can no longer drift.
13
+ - **LibSQL `busy_timeout` survival**: bump `@libsql/client` to `^0.17.4` and add a configurable connection timeout so `PRAGMA busy_timeout` survives connections created after `transaction()` (libsql-client-ts#288/#345). This reduces `SQLITE_BUSY` retry-exhaustion stalls under the evented engine's concurrent writes.
14
+
15
+ - Fixed skill updates creating duplicate versions when a snapshot had not meaningfully changed. Comparison previously relied on `JSON.stringify`, so reordered object keys (common with PostgreSQL JSONB) or optional fields round-tripping between `undefined` and `null` looked like changes. Skill snapshots are now compared by value, so repeated no-op publish/update cycles no longer increment the version number. ([#16811](https://github.com/mastra-ai/mastra/pull/16811))
16
+
17
+ - Updated dependencies [[`de66bb0`](https://github.com/mastra-ai/mastra/commit/de66bb040570444c702ce4d8e1e228a5de2949cb), [`67bf8e2`](https://github.com/mastra-ai/mastra/commit/67bf8e206dfe583954d96015cf0d09f7ac50e45f), [`8216d05`](https://github.com/mastra-ai/mastra/commit/8216d0528d866eb9a07f5d4c87ea3bb1e1139b45), [`d18b23c`](https://github.com/mastra-ai/mastra/commit/d18b23c5e29dfc381e73e3c51fcf6c779afd1823), [`5eb94eb`](https://github.com/mastra-ai/mastra/commit/5eb94ebcf66d4e28c9e26d5821ac93379bab20a0), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`f9ee2ac`](https://github.com/mastra-ai/mastra/commit/f9ee2ac661af584e61bc063ac208c9035cd752ef), [`c853d53`](https://github.com/mastra-ai/mastra/commit/c853d535d2df84ab89db1adb4c28900c54c9a2d2), [`d8df1f8`](https://github.com/mastra-ai/mastra/commit/d8df1f8e947e1966c9d4e54713df56d0d0d65226), [`9192ddb`](https://github.com/mastra-ai/mastra/commit/9192ddbced8949113b30de444cbe763f075b59f5), [`ae96523`](https://github.com/mastra-ai/mastra/commit/ae965231f562d9766b0c90c49a69fc68acaa031c), [`17d5a92`](https://github.com/mastra-ai/mastra/commit/17d5a9211aa293b4d4418de3de70dc0394d58101), [`5573693`](https://github.com/mastra-ai/mastra/commit/5573693b589822250e20dfe6cf66e9ff3bc96da8), [`ec4da8a`](https://github.com/mastra-ai/mastra/commit/ec4da8a09e0d2ab452c6ee2c786042ea826b77e5), [`adc44e1`](https://github.com/mastra-ai/mastra/commit/adc44e13c7e570b91e86b20ea7556e61d819db31), [`ed346c0`](https://github.com/mastra-ai/mastra/commit/ed346c0bee2d8496690a4e538bfba1e46894660f), [`c9ce1b2`](https://github.com/mastra-ai/mastra/commit/c9ce1b28d10871110648f9d7b6d76e880b9fa999), [`3ef01fd`](https://github.com/mastra-ai/mastra/commit/3ef01fd130b53d5bd4f828beb174e516a2eb1158), [`245a9a3`](https://github.com/mastra-ai/mastra/commit/245a9a315705fce17ddd980f78a92504b6615c4a), [`dc0b611`](https://github.com/mastra-ai/mastra/commit/dc0b6119b769bd00ee2c5df9259fb376fe63077a), [`38b5de8`](https://github.com/mastra-ai/mastra/commit/38b5de8e5d1d41a69522addf53d96f4b3a1d5bf0), [`dc0b611`](https://github.com/mastra-ai/mastra/commit/dc0b6119b769bd00ee2c5df9259fb376fe63077a), [`dd6a66e`](https://github.com/mastra-ai/mastra/commit/dd6a66ea0b32e0dea8059aec6b35d151e2c87dc4), [`d785c59`](https://github.com/mastra-ai/mastra/commit/d785c593b67fcb4cdc4fab9fdbde5f3b7665efc0), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`8b984f4`](https://github.com/mastra-ai/mastra/commit/8b984f4361c202270ceb69257185c4756c9a7c56), [`bf08402`](https://github.com/mastra-ai/mastra/commit/bf084022374fa5d06ca70ed67a86dd64e379071b), [`81fe587`](https://github.com/mastra-ai/mastra/commit/81fe587275035715c1720ddf3fee0505cf053036), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`403c438`](https://github.com/mastra-ai/mastra/commit/403c438e417278989ce247233d2c465b8d902cdd), [`f8ba195`](https://github.com/mastra-ai/mastra/commit/f8ba1954e27ee2b20586cc6cd9cf13c002c232f2)]:
18
+ - @mastra/core@1.43.0
19
+
20
+ ## 1.13.0
21
+
22
+ ### Minor Changes
23
+
24
+ - Added LibSQL storage support for durable harness sessions. ([#17712](https://github.com/mastra-ai/mastra/pull/17712))
25
+
26
+ ```ts
27
+ const storage = new LibSQLStore({ id: 'mastra-storage', url: 'file:./mastra.db' });
28
+
29
+ const harness = new Harness({
30
+ ownerId: 'my-app',
31
+ agent,
32
+ memory,
33
+ storage,
34
+ modes: [{ id: 'default', defaultModelId: '__GATEWAY_OPENAI_MODEL__' }],
35
+ defaultModeId: 'default',
36
+ });
37
+ ```
38
+
39
+ - Add `ThreadStateLibSQL`, the LibSQL implementation of the new `ThreadStateStorage` domain. It persists per-thread, per-type state (e.g. the agent task list under `type: "task"`) in the `mastra_thread_state` table, keyed by `(threadId, type)`. Composing a LibSQL store wires this domain automatically, so an agent's task list now survives a process restart. ([#17820](https://github.com/mastra-ai/mastra/pull/17820))
40
+
41
+ ### Patch Changes
42
+
43
+ - dependencies updates: ([#17148](https://github.com/mastra-ai/mastra/pull/17148))
44
+ - Updated dependency [`@libsql/client@^0.17.3` ↗︎](https://www.npmjs.com/package/@libsql/client/v/0.17.3) (from `^0.15.15`, in `dependencies`)
45
+
46
+ - Fixed concurrent writes silently disappearing when using LibSQL with a local (`file:`) database. ([#16796](https://github.com/mastra-ai/mastra/pull/16796))
47
+
48
+ LibSQL backs a local database with a single connection. When one operation held an interactive write transaction (for example, persisting workflow snapshots) and another operation wrote at the same time (for example, creating a dataset experiment), the second write could be swept into the open transaction and rolled back — so it appeared to succeed but never persisted. This surfaced as concurrent agent/workflow runs losing unrelated records.
49
+
50
+ Writes on a LibSQL client are now serialized, so a write issued during an in-flight transaction no longer interleaves with it.
51
+
52
+ - Updated dependencies [[`d468acb`](https://github.com/mastra-ai/mastra/commit/d468acb07aec1bb19a2cb0ada8042b05b46746b2), [`575f815`](https://github.com/mastra-ai/mastra/commit/575f815c5c3567b71c0b83cbb7fa98c8253a9d9c), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`053735a`](https://github.com/mastra-ai/mastra/commit/053735a75c2c18e23ce34d9468007efa4a45f4c4), [`306909a`](https://github.com/mastra-ai/mastra/commit/306909a693de77d709b38706e2673c9547d24a28), [`5191af8`](https://github.com/mastra-ai/mastra/commit/5191af80c799eea25357c545fc05d91b3883531d), [`43bd3d4`](https://github.com/mastra-ai/mastra/commit/43bd3d421987463fdf35386a45199c49499ed069), [`e6fa79e`](https://github.com/mastra-ai/mastra/commit/e6fa79ec72a2ddffdd25e85270398951e9d552a4), [`904bcdf`](https://github.com/mastra-ai/mastra/commit/904bcdf7b8004aa7be823f9f70ca63580e47e470), [`7f5ee1d`](https://github.com/mastra-ai/mastra/commit/7f5ee1dca46daee8d2817f2ebe49e6335da81956), [`1e9aab5`](https://github.com/mastra-ai/mastra/commit/1e9aab50ff11e6e88fde4d7cbf512c44a9fe8d61), [`2bccba4`](https://github.com/mastra-ai/mastra/commit/2bccba4c03cadc815c2d54cbf4dd43a922140a8d), [`bf8eb6d`](https://github.com/mastra-ai/mastra/commit/bf8eb6d0ec213a403eb9265a594ad283c44ab3dc), [`e9be4e7`](https://github.com/mastra-ai/mastra/commit/e9be4e747ec3d8b65548bff92f9377db06105376), [`493a328`](https://github.com/mastra-ai/mastra/commit/493a328f4346a1deeb9f1e2e44c8f2a3a4d7591b), [`d53cfc2`](https://github.com/mastra-ai/mastra/commit/d53cfc2c7f8d78343a4aa84ec4e129ba25f3325e), [`65799d4`](https://github.com/mastra-ai/mastra/commit/65799d4d549e5ebb9c848fbe3f51ac090f64becf), [`c268c89`](https://github.com/mastra-ai/mastra/commit/c268c89f4c63a93ee474d3cffdf3ea60bf00d4f2), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`014e00f`](https://github.com/mastra-ai/mastra/commit/014e00f2b3a597a016b72f9901c6ab27d491f822), [`029a414`](https://github.com/mastra-ai/mastra/commit/029a4141719793bd3e898a39eb5a0466a55f5f3a), [`d468acb`](https://github.com/mastra-ai/mastra/commit/d468acb07aec1bb19a2cb0ada8042b05b46746b2), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`d371ac1`](https://github.com/mastra-ai/mastra/commit/d371ac1d9820afaaf7cfdbc380a475946a994d8f), [`2bccba4`](https://github.com/mastra-ai/mastra/commit/2bccba4c03cadc815c2d54cbf4dd43a922140a8d), [`0c72f03`](https://github.com/mastra-ai/mastra/commit/0c72f032abb13254df5a7856d64be2f207b8006d), [`cf182b7`](https://github.com/mastra-ai/mastra/commit/cf182b7fb495767946d9840ef29f19cfa906f31f), [`3b45ea9`](https://github.com/mastra-ai/mastra/commit/3b45ea95015557a6cb9d70dc5252af54ab1b78ac), [`a049c2a`](https://github.com/mastra-ai/mastra/commit/a049c2a9dfb41d0ee2e7a28874a88cd64fd5669f), [`f084be1`](https://github.com/mastra-ai/mastra/commit/f084be1fcbe33ad7480913e44d6130c421c0976f), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`2a96528`](https://github.com/mastra-ai/mastra/commit/2a9652848dfa3c5a2426f952e9d93554c26fd90f), [`f2ab060`](https://github.com/mastra-ai/mastra/commit/f2ab060162bea81505fda553e2cee29c1979fd04), [`5d302c8`](https://github.com/mastra-ai/mastra/commit/5d302c8eda1a6ac74eab5e442c4f64db6cc97a06), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`a952852`](https://github.com/mastra-ai/mastra/commit/a952852c971a21fb646cd907c75fcf4443cdc963), [`2656d9c`](https://github.com/mastra-ai/mastra/commit/2656d9c2976d4f3354253bfbbbf9b88a1b2bbf34), [`63e3fe1`](https://github.com/mastra-ai/mastra/commit/63e3fe13cc1ea96f91d7c68aea92f400faf9e4da), [`1d4ce8d`](https://github.com/mastra-ai/mastra/commit/1d4ce8daaa54511f325c1b609d31b8e54009d677), [`8c68372`](https://github.com/mastra-ai/mastra/commit/8c68372e85fe0b066ec12c58bd29ffb93e54c552)]:
53
+ - @mastra/core@1.42.0
54
+
3
55
  ## 1.13.0-alpha.0
4
56
 
5
57
  ### Minor Changes
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.13.0-alpha.0"
6
+ version: "1.13.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.13.0-alpha.0",
2
+ "version": "1.13.2",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -2,16 +2,16 @@
2
2
 
3
3
  > **Note:** The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. [Contact sales](https://mastra.ai/contact) for more information.
4
4
 
5
- Production deployments swap the local primitives in the Quickstart for cloud-backed equivalents. The shape of the `Mastra` and `MastraEditor` config doesn't change only the providers behind it.
5
+ Production deployments swap the local primitives in the Quickstart for cloud-backed equivalents. The shape of the `Mastra` and `MastraEditor` config doesn't change, only the providers behind it.
6
6
 
7
7
  ## What a production deployment needs
8
8
 
9
- 1. **EE license** a valid `MASTRA_EE_LICENSE` so the server will start with the Builder enabled.
10
- 2. **Hosted storage** a shared store for agents, skills, runs, and memory.
11
- 3. **Shared workspace filesystem** survives across instances; `local` is single-node only.
12
- 4. **Cloud sandbox** runs agent commands safely; `local` is unsafe in shared environments.
13
- 5. **Auth and RBAC** gates the Builder UI and `/agent-builder/*` routes.
14
- 6. **Public base URL for channels** Slack and other channel providers need a reachable URL.
9
+ 1. **EE license**: A valid `MASTRA_EE_LICENSE` so the server will start with the Builder enabled.
10
+ 2. **Hosted storage**: A shared store for agents, skills, runs, and memory.
11
+ 3. **Shared workspace filesystem**: Survives across instances; `local` is single-node only.
12
+ 4. **Cloud sandbox**: Runs agent commands safely; `local` is unsafe in shared environments.
13
+ 5. **Auth and RBAC**: Gates the Builder UI and `/agent-builder/*` routes.
14
+ 6. **Public base URL for channels**: Slack and other channel providers need a reachable URL.
15
15
 
16
16
  ## EE license
17
17
 
@@ -101,7 +101,7 @@ new Mastra({
101
101
 
102
102
  `S3Filesystem` uses the default AWS credential chain (environment variables, `~/.aws` config, IAM roles, EC2 instance profile). For long-running deployments, use a credential provider function so credentials refresh automatically.
103
103
 
104
- `DockerSandbox` and `VercelSandbox` are alternative cloud sandbox providers pick whichever matches your runtime.
104
+ `DockerSandbox` and `VercelSandbox` are alternative cloud sandbox providers, pick whichever matches your runtime.
105
105
 
106
106
  > **Warning:** A local sandbox can't run commands safely in a shared environment. Always register a cloud sandbox provider and reference it in the workspace config before deploying.
107
107
 
@@ -117,5 +117,5 @@ Slack needs to reach your server through a public URL. Pass `baseUrl` to `SlackP
117
117
 
118
118
  ## Related
119
119
 
120
- - [Access control](https://mastra.ai/docs/agent-builder/access-control) auth and RBAC setup.
121
- - [Channels](https://mastra.ai/docs/agent-builder/channels) Slack `baseUrl` and channel-specific setup.
120
+ - [Access control](https://mastra.ai/docs/agent-builder/access-control): Auth and RBAC setup.
121
+ - [Channels](https://mastra.ai/docs/agent-builder/channels): Slack `baseUrl` and channel-specific setup.
@@ -7,6 +7,8 @@ The Agent Builder lets you build, configure, and operate Mastra agents all withi
7
7
  - [**Configuration**](https://mastra.ai/docs/agent-builder/configuration): Toggle UI sections and pin admin-controlled defaults for every new agent.
8
8
  - [**Model policy**](https://mastra.ai/docs/agent-builder/model-policy): Restrict which providers and models the Builder exposes, and pin a default.
9
9
  - [**Memory**](https://mastra.ai/docs/agent-builder/memory): Configure the default memory shape for every Builder-created agent.
10
+ - [**Workspace**](https://mastra.ai/docs/agent-builder/workspace): Configure the default filesystem, sandbox, and skills workspace for Builder-created agents.
11
+ - [**Browser**](https://mastra.ai/docs/agent-builder/browser): Register browser providers and pin a default browser configuration.
10
12
  - [**Access control**](https://mastra.ai/docs/agent-builder/access-control): Gate the Builder behind Mastra RBAC roles and permissions.
11
13
  - [**Channels**](https://mastra.ai/docs/agent-builder/channels): Connect Builder-created agents to Slack and other channels.
12
14
  - [**Tool providers**](https://mastra.ai/docs/agent-builder/integrations): Connect Builder-created agents to third-party apps through OAuth-backed tool providers.
@@ -15,9 +17,18 @@ The Agent Builder lets you build, configure, and operate Mastra agents all withi
15
17
 
16
18
  For building agents entirely in code, see the [Agents overview](https://mastra.ai/docs/agents/overview). For editing code-defined agents through Studio, see the [Editor overview](https://mastra.ai/docs/editor/overview).
17
19
 
20
+ ## Prerequisites
21
+
22
+ The Agent Builder requires:
23
+
24
+ - An existing Mastra project (Follow the [installation guide](https://mastra.ai/guides/getting-started/quickstart) to set up a new project)
25
+ - **Storage**: A `@mastra/core` storage adapter on the `Mastra` instance. Agents, memory, and workspace state all persist through `Mastra.storage`.
26
+ - **A builder agent**: Register a `builderAgent` created with the `createBuilderAgent()` factory from `@mastra/editor/ee` on `Mastra.agents`. The chat-based editor invokes it through the same `Mastra.getAgent(id)` lookup as any other agent. Without this registration, the chat-based editor returns 404.
27
+ - **Model credentials**: `createBuilderAgent()` uses an OpenAI model by default, which requires `OPENAI_API_KEY`. To use a different provider, pass a `model` override to `createBuilderAgent({ model })` and set that provider's credentials instead.
28
+
18
29
  ## Get started
19
30
 
20
- Install `@mastra/editor` alongside a storage adapter:
31
+ Install `@mastra/editor` alongside a storage adapter. This example uses `@mastra/libsql`:
21
32
 
22
33
  **npm**:
23
34
 
@@ -43,7 +54,7 @@ yarn add @mastra/editor @mastra/libsql
43
54
  bun add @mastra/editor @mastra/libsql
44
55
  ```
45
56
 
46
- Wire the Agent Builder onto a `Mastra` instance:
57
+ The example below defines a storage adapter, registers a builder agent, and enables the editor as explained in the prerequisites:
47
58
 
48
59
  ```typescript
49
60
  import { Mastra } from '@mastra/core/mastra'
@@ -67,7 +78,7 @@ export const mastra = new Mastra({
67
78
  })
68
79
  ```
69
80
 
70
- Start the dev server:
81
+ Start Mastra's development server:
71
82
 
72
83
  ```bash
73
84
  npx mastra dev
@@ -75,14 +86,6 @@ npx mastra dev
75
86
 
76
87
  The Agent Builder is mounted at `http://localhost:4111/agent-builder`.
77
88
 
78
- ## Prerequisites
79
-
80
- The Agent Builder requires:
81
-
82
- - **Storage**: An `@mastra/core` storage adapter on the `Mastra` instance. Agents, memory, and workspace state all persist through `Mastra.storage`.
83
- - **The Builder agent**: Register a Builder agent created with the `createBuilderAgent()` factory from `@mastra/editor/ee` on `Mastra.agents`. The chat-based editor invokes it through the same `Mastra.getAgent(id)` lookup as any other agent. Without this registration, the chat-based editor returns 404.
84
- - **`OPENAI_API_KEY`**: The Builder agent created by `createBuilderAgent()` runs on an OpenAI model, so an `OPENAI_API_KEY` environment variable is required.
85
-
86
89
  ## Disabling the Builder
87
90
 
88
91
  Set `enabled: false` to keep the config in place but turn the surface off:
@@ -95,4 +98,10 @@ new MastraEditor({
95
98
  })
96
99
  ```
97
100
 
98
- Omitting the `builder` field has the same effect.
101
+ Omitting the `builder` field has the same effect.
102
+
103
+ ## Next steps
104
+
105
+ - [Configuration](https://mastra.ai/docs/agent-builder/configuration): Toggle Builder surfaces and pin defaults for new agents.
106
+ - [Access control](https://mastra.ai/docs/agent-builder/access-control): Gate the Builder with authentication and role-based access control.
107
+ - [Deploying](https://mastra.ai/docs/agent-builder/deploying): Replace local development primitives with production-ready storage, filesystems, and sandboxes.
package/dist/index.cjs CHANGED
@@ -10,6 +10,7 @@ var base = require('@mastra/core/base');
10
10
  var crypto$1 = require('crypto');
11
11
  var agent = require('@mastra/core/agent');
12
12
  var evals = require('@mastra/core/evals');
13
+ var skills = require('@mastra/core/storage/domains/skills');
13
14
 
14
15
  // src/vector/index.ts
15
16
  var LibSQLFilterTranslator = class extends filter.BaseFilterTranslator {
@@ -1442,13 +1443,19 @@ function withClientWriteLock(client, fn) {
1442
1443
  }
1443
1444
 
1444
1445
  // src/storage/db/index.ts
1446
+ var DEFAULT_CONNECTION_TIMEOUT_MS = 5e3;
1445
1447
  function resolveClient(config) {
1446
1448
  if ("client" in config) {
1447
1449
  return config.client;
1448
1450
  }
1451
+ const isLocal = config.url.startsWith("file:") || config.url.includes(":memory:");
1452
+ const timeout = config.connectionTimeoutMs ?? DEFAULT_CONNECTION_TIMEOUT_MS;
1449
1453
  return client.createClient({
1450
1454
  url: config.url,
1451
- ...config.authToken ? { authToken: config.authToken } : {}
1455
+ ...config.authToken ? { authToken: config.authToken } : {},
1456
+ // Only local sqlite3 connections honor `busy_timeout`; remote contention is
1457
+ // resolved server-side, so passing it there is meaningless.
1458
+ ...isLocal ? { timeout } : {}
1452
1459
  });
1453
1460
  }
1454
1461
  var LibSQLDB = class extends base.MastraBase {
@@ -2272,8 +2279,6 @@ Note: This migration may take some time for large tables.
2272
2279
  }
2273
2280
  }
2274
2281
  };
2275
-
2276
- // src/storage/domains/agents/index.ts
2277
2282
  var AgentsLibSQL = class extends storage.AgentsStorage {
2278
2283
  #db;
2279
2284
  #client;
@@ -7357,18 +7362,20 @@ var MemoryLibSQL = class extends storage.MemoryStorage {
7357
7362
  }
7358
7363
  });
7359
7364
  }
7365
+ const now = /* @__PURE__ */ new Date();
7360
7366
  const updatedThread = {
7361
7367
  ...thread,
7362
7368
  title,
7363
7369
  metadata: {
7364
7370
  ...thread.metadata,
7365
7371
  ...metadata
7366
- }
7372
+ },
7373
+ updatedAt: now
7367
7374
  };
7368
7375
  try {
7369
7376
  await this.#client.execute({
7370
- sql: `UPDATE ${storage.TABLE_THREADS} SET title = ?, metadata = jsonb(?) WHERE id = ?`,
7371
- args: [title, JSON.stringify(updatedThread.metadata), id]
7377
+ sql: `UPDATE ${storage.TABLE_THREADS} SET title = ?, metadata = jsonb(?), updatedAt = ? WHERE id = ?`,
7378
+ args: [title, JSON.stringify(updatedThread.metadata), now.toISOString(), id]
7372
7379
  });
7373
7380
  return updatedThread;
7374
7381
  } catch (error$1) {
@@ -10999,7 +11006,10 @@ var SkillsLibSQL = class extends storage.SkillsStorage {
10999
11006
  } = latestVersion;
11000
11007
  const newConfig = { ...latestConfig, ...configFields };
11001
11008
  const changedFields = configFieldNames.filter(
11002
- (field) => field in configFields && JSON.stringify(configFields[field]) !== JSON.stringify(latestConfig[field])
11009
+ (field) => field in configFields && !skills.skillSnapshotFieldValuesEqual(
11010
+ configFields[field],
11011
+ latestConfig[field]
11012
+ )
11003
11013
  );
11004
11014
  if (changedFields.length > 0) {
11005
11015
  const newVersionId = crypto.randomUUID();
@@ -12601,6 +12611,7 @@ var LibSQLStore = class extends storage.MastraCompositeStore {
12601
12611
  client;
12602
12612
  maxRetries;
12603
12613
  initialBackoffMs;
12614
+ connectionTimeoutMs;
12604
12615
  pragmasReady;
12605
12616
  isLocalDb;
12606
12617
  localPragmas;
@@ -12612,6 +12623,7 @@ var LibSQLStore = class extends storage.MastraCompositeStore {
12612
12623
  super({ id: config.id, name: `LibSQLStore`, disableInit: config.disableInit });
12613
12624
  this.maxRetries = config.maxRetries ?? 5;
12614
12625
  this.initialBackoffMs = config.initialBackoffMs ?? 100;
12626
+ this.connectionTimeoutMs = config.connectionTimeoutMs ?? DEFAULT_CONNECTION_TIMEOUT_MS;
12615
12627
  this.localPragmas = {
12616
12628
  cacheSize: config.localPragmas?.cacheSize ?? DEFAULT_LOCAL_CACHE_SIZE,
12617
12629
  mmapSize: config.localPragmas?.mmapSize ?? DEFAULT_LOCAL_MMAP_SIZE
@@ -12620,11 +12632,14 @@ var LibSQLStore = class extends storage.MastraCompositeStore {
12620
12632
  if (config.url.includes(":memory:")) {
12621
12633
  this.shouldCacheInit = false;
12622
12634
  }
12635
+ this.isLocalDb = config.url.startsWith("file:") || config.url.includes(":memory:");
12623
12636
  this.client = client.createClient({
12624
12637
  url: config.url,
12625
- ...config.authToken ? { authToken: config.authToken } : {}
12638
+ ...config.authToken ? { authToken: config.authToken } : {},
12639
+ // `busy_timeout` only applies to local sqlite3 connections; remote
12640
+ // contention is handled server-side. See libsql-client-ts#288/#345.
12641
+ ...this.isLocalDb ? { timeout: this.connectionTimeoutMs } : {}
12626
12642
  });
12627
- this.isLocalDb = config.url.startsWith("file:") || config.url.includes(":memory:");
12628
12643
  this.pragmasReady = this.isLocalDb ? this.applyLocalPragmas() : Promise.resolve();
12629
12644
  } else {
12630
12645
  this.client = config.client;
@@ -12686,7 +12701,9 @@ var LibSQLStore = class extends storage.MastraCompositeStore {
12686
12701
  async applyLocalPragmas() {
12687
12702
  const pragmas = [
12688
12703
  ["journal_mode=WAL", "PRAGMA journal_mode=WAL;"],
12689
- ["busy_timeout=5000", "PRAGMA busy_timeout=5000;"],
12704
+ // Keep in sync with the connection-level `timeout` passed to createClient
12705
+ // so a custom connectionTimeoutMs isn't clobbered back to a hardcoded value.
12706
+ [`busy_timeout=${this.connectionTimeoutMs}`, `PRAGMA busy_timeout=${this.connectionTimeoutMs};`],
12690
12707
  ["synchronous=NORMAL", "PRAGMA synchronous=NORMAL;"],
12691
12708
  ["temp_store=MEMORY", "PRAGMA temp_store=MEMORY;"],
12692
12709
  [`cache_size=${this.localPragmas.cacheSize}`, `PRAGMA cache_size=${this.localPragmas.cacheSize};`],