@mastra/libsql 1.22.3-alpha.3 → 1.22.4-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.
@@ -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.22.3-alpha.3"
6
+ version: "1.22.4-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.22.3-alpha.3",
2
+ "version": "1.22.4-alpha.0",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -39,6 +39,12 @@ Polls storage for due cron schedules and publishes `workflow.start` events. It's
39
39
 
40
40
  The scheduler reads declarative `schedule` fields from your workflow definitions automatically. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows) for how to declare schedules.
41
41
 
42
+ The scheduler only polls storage once a schedule exists. At boot, a process with no declared schedules runs a single `listSchedules()` check. If that check finds no rows, the poll loop never starts, so idle deployments issue no recurring scheduler queries and can scale to zero.
43
+
44
+ When a schedule is created at runtime, Mastra publishes a wake event on the PubSub backend. Any process running the default worker set starts its scheduler in response, which is how a standalone worker discovers schedules created by the API process. This requires both processes to share the same PubSub backend.
45
+
46
+ To poll from startup regardless of whether schedules exist (for example, when your processes don't share a PubSub backend), set `scheduler: { enabled: true }` on the worker or run it with `MASTRA_WORKERS=scheduler`.
47
+
42
48
  **Don't run more than one scheduler instance.** Multiple schedulers polling the same storage would fire duplicate events for the same schedule.
43
49
 
44
50
  ### Background task worker
@@ -279,6 +285,8 @@ curl http://localhost:4111/api/agents
279
285
 
280
286
  ### Kubernetes
281
287
 
288
+ > **Helm:** On Kubernetes, the [`mastra-projects` Helm chart](https://mastra.ai/integrations/deploy/kubernetes-helm) renders these deployments for you, with the workers on the same image and environment as the server. It also refuses to install combinations that would run every worker twice. The manifests below are for writing them by hand.
289
+
282
290
  Create separate Deployments for the API, orchestration worker, scheduler worker, and background task worker. Use the same image and Secret for each Deployment. Set only the role-specific environment variables directly on each container.
283
291
 
284
292
  The orchestration worker Deployment has the following shape:
@@ -385,4 +393,5 @@ If the API crashes while a step is executing, that work can be lost and the work
385
393
  - [Workers reference](https://mastra.ai/reference/workers/overview): Details about worker environment variables and types, with a list of supported storage backends
386
394
  - [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
387
395
  - [PubSub](https://mastra.ai/docs/server/pubsub): Event delivery backends
396
+ - [Kubernetes (Helm)](https://mastra.ai/integrations/deploy/kubernetes-helm): Deploy worker roles with the official chart
388
397
  - [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows): Declare cron schedules on workflows
@@ -205,6 +205,7 @@ Each provider page includes installation instructions, configuration parameters,
205
205
  - [libSQL](https://mastra.ai/integrations/databases/libsql)
206
206
  - [Mastra](https://mastra.ai/docs/mastra-platform/database)
207
207
  - [MongoDB](https://mastra.ai/integrations/databases/mongodb)
208
+ - [MySQL](https://mastra.ai/integrations/databases/mysql)
208
209
  - [MSSQL](https://mastra.ai/integrations/databases/mssql)
209
210
  - [Neon Postgres](https://mastra.ai/integrations/databases/neon)
210
211
  - [OracleDB](https://mastra.ai/integrations/databases/oracledb)
@@ -125,7 +125,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
125
125
 
126
126
  **backgroundTasks.defaultRetries** (`RetryConfig`): Default retry configuration.
127
127
 
128
- **scheduler** (`object`): Configure the scheduler worker for cron-driven workflow triggers. Auto-enables when any workflow declares a schedule. See Scheduled workflows.
128
+ **scheduler** (`object`): Configure the scheduler worker for cron-driven workflow triggers. Auto-enables when any workflow declares a schedule, when schedule rows already exist in storage, or when a schedule is created at runtime. Apps that never schedule anything run one listSchedules() check at boot and never poll after that. See Scheduled workflows.
129
129
 
130
130
  **scheduler.enabled** (`boolean`): Explicitly enable or disable the scheduler.
131
131
 
package/dist/index.cjs CHANGED
@@ -9353,6 +9353,10 @@ var MemoryLibSQL = class MemoryLibSQL extends _mastra_core_storage.MemoryStorage
9353
9353
  } catch {
9354
9354
  existingChunks = [];
9355
9355
  }
9356
+ if (existingChunks.some((existing) => existing.cycleId === input.chunk.cycleId)) {
9357
+ await tx.commit();
9358
+ return;
9359
+ }
9356
9360
  const newChunk = {
9357
9361
  id: `ombuf-${(0, crypto$1.randomUUID)()}`,
9358
9362
  cycleId: input.chunk.cycleId,
@@ -10459,6 +10463,7 @@ var ObservabilityLibSQL = class ObservabilityLibSQL extends _mastra_core_storage
10459
10463
  }
10460
10464
  }
10461
10465
  async batchDeleteTraces(args) {
10466
+ this.assertUnscopedBatchDeleteTraces(args);
10462
10467
  try {
10463
10468
  const keys = args.traceIds.map((traceId) => ({ traceId }));
10464
10469
  return this.#db.batchDelete({