@mastra/pg 1.28.0-alpha.3 → 1.28.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-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.28.0-alpha.3"
6
+ version: "1.28.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.28.0-alpha.3",
2
+ "version": "1.28.0",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -35,7 +35,10 @@ The orchestration worker requires a PubSub backend that supports pull mode (e.g.
35
35
 
36
36
  ### Scheduler worker
37
37
 
38
- Polls storage for due cron schedules and publishes `workflow.start` events. It's a producer only, meaning it creates work for the orchestration worker to pick up.
38
+ Polls storage for due cron schedules and publishes a `workflow.start` event for each fire. It's a producer only, meaning it creates work for the orchestration worker to pick up:
39
+
40
+ - **Split processes**: Scheduled workflows run on the evented engine, and the orchestration worker runs each fire step by step.
41
+ - **In-process mode**: Scheduled workflows run on the default engine. The orchestration worker in the same process runs each fire in-process, the same way a direct `run.start()` does.
39
42
 
40
43
  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
44
 
@@ -132,6 +135,8 @@ You can also pass a worker name to the CLI. The command sets `MASTRA_WORKERS` in
132
135
  mastra worker start orchestration
133
136
  ```
134
137
 
138
+ Set `MASTRA_WORKERS` on every process in a split deployment, including `false` on the API process. Any value switches workflows that declare `schedule` to the evented engine, and every process must run those workflows on the same engine. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows). `mastra worker start` without a worker name doesn't set `MASTRA_WORKERS`, so pass a name or set the variable in the process environment.
139
+
135
140
  ## Network architecture
136
141
 
137
142
  Workers are internal infrastructure. They're not exposed to end users and don't need their own subdomain or public URL, including an inbound HTTP route.
@@ -142,7 +147,7 @@ In a split deployment:
142
147
  - **Workers connect outbound only**: They pull events from the distributed PubSub backend and read/write to the shared storage database. They don't accept inbound traffic from clients.
143
148
  - **The orchestration worker calls the API internally**: It sends step execution requests to the API over the container network using `MASTRA_STEP_EXECUTION_URL`. This is internal service-to-service communication, not a public endpoint.
144
149
 
145
- All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. HTTP routes for worker-related features run on the API server rather than the worker process. One example is token minting for a voice integration.
150
+ All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. HTTP routes for worker-related features run on the API server rather than the worker process. One example is creating a token for a voice integration.
146
151
 
147
152
  ## Deploy split workers
148
153
 
@@ -202,7 +202,7 @@ async function retentionTick() {
202
202
  }
203
203
  ```
204
204
 
205
- You can also cancel a long-running prune with an `AbortSignal`: the loop stops between batches and returns partial results with `done: false`, so the next run resumes cleanly.
205
+ You can also cancel a long-running prune with an `AbortSignal`: the loop stops between batches and returns partial results with `done: false`. The next run resumes cleanly.
206
206
 
207
207
  ## ClickHouse native TTL
208
208
 
package/dist/index.cjs CHANGED
@@ -17405,6 +17405,10 @@ const TRACE_FIELDS = {
17405
17405
  traceId: "r.\"traceId\"",
17406
17406
  threadId: "r.\"threadId\"",
17407
17407
  resourceId: "r.\"resourceId\"",
17408
+ runId: "r.\"runId\"",
17409
+ sessionId: "r.\"sessionId\"",
17410
+ userId: "r.\"userId\"",
17411
+ organizationId: "r.\"organizationId\"",
17408
17412
  startedAt: "r.\"startedAt\"",
17409
17413
  endedAt: "r.\"endedAt\"",
17410
17414
  durationMs: durationMsSql("r.\"startedAt\"", "r.\"endedAt\""),
@@ -17429,7 +17433,11 @@ const SPAN_FIELDS = {
17429
17433
  entityName: "s.\"entityName\"",
17430
17434
  entityVersionId: "s.\"entityVersionId\"",
17431
17435
  parentEntityVersionId: "s.\"parentEntityVersionId\"",
17432
- rootEntityVersionId: "s.\"rootEntityVersionId\""
17436
+ rootEntityVersionId: "s.\"rootEntityVersionId\"",
17437
+ runId: "s.\"runId\"",
17438
+ sessionId: "s.\"sessionId\"",
17439
+ userId: "s.\"userId\"",
17440
+ organizationId: "s.\"organizationId\""
17433
17441
  };
17434
17442
  const SCORE_FIELDS = {
17435
17443
  scorerId: "s.\"scorerId\"",
@@ -17745,7 +17753,11 @@ function compilePostgresTraceScope(schema, selection, relationCollections, scope
17745
17753
  s."entityName",
17746
17754
  s."entityVersionId",
17747
17755
  s."parentEntityVersionId",
17748
- s."rootEntityVersionId"
17756
+ s."rootEntityVersionId",
17757
+ s."runId",
17758
+ s."sessionId",
17759
+ s."userId",
17760
+ s."organizationId"
17749
17761
  FROM ${spanTable} s
17750
17762
  WHERE s."traceId" IS NOT NULL
17751
17763
  AND s."traceId" IN (SELECT "traceId" FROM root_scope)
@@ -19088,7 +19100,8 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
19088
19100
  "trace-query-discovery",
19089
19101
  "thread-query",
19090
19102
  "trace-query-tenant-scope",
19091
- "feedback"
19103
+ "feedback",
19104
+ "trace-query-context-ids"
19092
19105
  ];
19093
19106
  return [
19094
19107
  "metrics",
@@ -19105,7 +19118,8 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
19105
19118
  "trace-query-discovery",
19106
19119
  "thread-query",
19107
19120
  "trace-query-tenant-scope",
19108
- "feedback"
19121
+ "feedback",
19122
+ "trace-query-context-ids"
19109
19123
  ];
19110
19124
  }
19111
19125
  async #run(op, fn, details) {