@mastra/libsql 1.24.0 → 1.24.1-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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-human-in-the-loop.md +6 -4
- package/dist/docs/references/docs-deployment-workers.md +3 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/notifications/index.d.ts.map +1 -1
- package/dist/storage/factory-storage.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/docs/SKILL.md
CHANGED
|
@@ -120,14 +120,12 @@ The function can be asynchronous. For decisions that depend on the tool name and
|
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
122
|
import { Classifier } from '@mastra/core/classifier'
|
|
123
|
-
import {
|
|
123
|
+
import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
124
124
|
import { agent } from './agent'
|
|
125
125
|
|
|
126
126
|
const approvalClassifier = new Classifier({
|
|
127
127
|
id: 'tool-approval-classifier',
|
|
128
|
-
model:
|
|
129
|
-
'jev-latest',
|
|
130
|
-
),
|
|
128
|
+
model: typeSafeAi.evaluationModel('jev-latest'),
|
|
131
129
|
questions: {
|
|
132
130
|
requiresApproval: {
|
|
133
131
|
type: 'boolean',
|
|
@@ -409,6 +407,10 @@ const handleResume = async () => {
|
|
|
409
407
|
}
|
|
410
408
|
```
|
|
411
409
|
|
|
410
|
+
When a suspended or approval-gated tool call resumes, the stream emits a `tool-call-resumed` chunk with the same `toolCallId` before the call's `tool-result`. Its `payload.kind` is `'suspension'` or `'approval'`, and the payload repeats the original `args`, `suspendPayload`, and `resumeSchema`. The chunk is only emitted when a real suspension or approval request is cleared.
|
|
411
|
+
|
|
412
|
+
With `@mastra/ai-sdk`, it arrives as a `data-tool-call-suspended` part (or `data-tool-call-approval` part for approvals) with `resumed: true`, which replaces the original part and keeps its payload. Use this signal to mark a question as answered. Don't infer it from the shape of the tool output: when the suspension came from a sub-agent, the output of the delegation call is the sub-agent's result, not your answer.
|
|
413
|
+
|
|
412
414
|
## Automatic tool resumption
|
|
413
415
|
|
|
414
416
|
When using tools that call `suspend()`, you can enable automatic resumption so the agent resumes suspended tools based on the user's next message. Set `autoResumeSuspendedTools` to `true` in the agent's default options or per-request:
|
|
@@ -60,7 +60,7 @@ The background task worker manages concurrency limits, task lifecycle, and resul
|
|
|
60
60
|
|
|
61
61
|
### In-process mode (default)
|
|
62
62
|
|
|
63
|
-
With no configuration, Mastra
|
|
63
|
+
With no configuration, Mastra runs workers inside the API process. Events flow through an in-memory PubSub, and everything shares a single Node.js runtime.
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
66
|
import { Mastra } from '@mastra/core/mastra'
|
|
@@ -71,6 +71,8 @@ export const mastra = new Mastra({
|
|
|
71
71
|
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
The server generated by `mastra build` starts these workers automatically. If you use a [server adapter](https://mastra.ai/docs/server/server-adapters) instead, add a call to `mastra.startWorkers()` after your server starts listening. See [Start background workers](https://mastra.ai/docs/server/server-adapters).
|
|
75
|
+
|
|
74
76
|
This setup needs no external infrastructure beyond your storage adapter. It doesn't survive process crashes, and you can't scale individual components.
|
|
75
77
|
|
|
76
78
|
### Split processes
|
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,6 @@ let _mastra_core_vector_filter = require("@mastra/core/vector/filter");
|
|
|
8
8
|
let fs_promises = require("fs/promises");
|
|
9
9
|
let path = require("path");
|
|
10
10
|
let _mastra_core_base = require("@mastra/core/base");
|
|
11
|
-
let crypto$1 = require("crypto");
|
|
12
11
|
let _mastra_core_agent = require("@mastra/core/agent");
|
|
13
12
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
14
13
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
@@ -9580,7 +9579,7 @@ var MemoryLibSQL = class MemoryLibSQL extends _mastra_core_storage.MemoryStorage
|
|
|
9580
9579
|
return;
|
|
9581
9580
|
}
|
|
9582
9581
|
const newChunk = {
|
|
9583
|
-
id: `ombuf-${
|
|
9582
|
+
id: `ombuf-${globalThis.crypto.randomUUID()}`,
|
|
9584
9583
|
cycleId: input.chunk.cycleId,
|
|
9585
9584
|
observations: input.chunk.observations,
|
|
9586
9585
|
tokenCount: input.chunk.tokenCount,
|
|
@@ -10046,7 +10045,7 @@ var NotificationsLibSQL = class NotificationsLibSQL extends _mastra_core_storage
|
|
|
10046
10045
|
}
|
|
10047
10046
|
const now = input.createdAt ?? /* @__PURE__ */ new Date();
|
|
10048
10047
|
const record = {
|
|
10049
|
-
id: input.id ??
|
|
10048
|
+
id: input.id ?? globalThis.crypto.randomUUID(),
|
|
10050
10049
|
threadId: input.threadId,
|
|
10051
10050
|
source: input.source,
|
|
10052
10051
|
kind: input.kind,
|
|
@@ -13507,9 +13506,10 @@ var WorkflowsLibSQL = class WorkflowsLibSQL extends _mastra_core_storage.Workflo
|
|
|
13507
13506
|
...state
|
|
13508
13507
|
};
|
|
13509
13508
|
await tx.execute({
|
|
13510
|
-
sql: `UPDATE ${_mastra_core_storage.TABLE_WORKFLOW_SNAPSHOT} SET snapshot = jsonb(?) WHERE workflow_name = ? AND run_id = ?`,
|
|
13509
|
+
sql: `UPDATE ${_mastra_core_storage.TABLE_WORKFLOW_SNAPSHOT} SET snapshot = jsonb(?), updatedAt = ? WHERE workflow_name = ? AND run_id = ?`,
|
|
13511
13510
|
args: [
|
|
13512
13511
|
safeStringify(updatedSnapshot),
|
|
13512
|
+
(/* @__PURE__ */ new Date()).toISOString(),
|
|
13513
13513
|
workflowName,
|
|
13514
13514
|
runId
|
|
13515
13515
|
]
|
|
@@ -14351,7 +14351,7 @@ var LibSQLFactoryStorageOps = class {
|
|
|
14351
14351
|
const schema = this.#schema(collection);
|
|
14352
14352
|
const pk = primaryKeyOf(schema);
|
|
14353
14353
|
const values = { ...row };
|
|
14354
|
-
if (schema.columns[pk].type === "uuid-pk" && values[pk] === void 0) values[pk] =
|
|
14354
|
+
if (schema.columns[pk].type === "uuid-pk" && values[pk] === void 0) values[pk] = globalThis.crypto.randomUUID();
|
|
14355
14355
|
const columns = Object.keys(values).filter((column) => values[column] !== void 0);
|
|
14356
14356
|
for (const column of columns) this.#column(schema, column);
|
|
14357
14357
|
const sql = `INSERT INTO "${schema.name}" (${columns.map((c) => `"${c}"`).join(", ")}) VALUES (${columns.map(() => "?").join(", ")})`;
|