@mastra/libsql 0.0.0-fix-cloudflare-rest-api-20260225162901 → 0.0.0-fix-cloudflare-rest-api-20260227192337
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 +27 -3
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-agent-approval.md +181 -0
- package/dist/docs/references/docs-agents-networks.md +15 -2
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-cloudflare-rest-api-
|
|
3
|
+
## 0.0.0-fix-cloudflare-rest-api-20260227192337
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
7
|
+
- Added atomic `updateWorkflowResults` and `updateWorkflowState` to safely merge concurrent step results into workflow snapshots. ([#12575](https://github.com/mastra-ai/mastra/pull/12575))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`88de7e8`](https://github.com/mastra-ai/mastra/commit/88de7e8dfe4b7e1951a9e441bb33136e705ce24e), [`edee4b3`](https://github.com/mastra-ai/mastra/commit/edee4b37dff0af515fc7cc0e8d71ee39e6a762f0), [`d5f0d8d`](https://github.com/mastra-ai/mastra/commit/d5f0d8d6a03e515ddaa9b5da19b7e44b8357b07b), [`09c3b18`](https://github.com/mastra-ai/mastra/commit/09c3b1802ff14e243a8a8baea327440bc8cc2e32), [`524c0f3`](https://github.com/mastra-ai/mastra/commit/524c0f3c434c3d9d18f66338dcef383d6161b59c), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9311c17`](https://github.com/mastra-ai/mastra/commit/9311c17d7a0640d9c4da2e71b814dc67c57c6369), [`d25b9ea`](https://github.com/mastra-ai/mastra/commit/d25b9eabd400167255a97b690ffbc4ee4097ded5), [`b03c0e0`](https://github.com/mastra-ai/mastra/commit/b03c0e0389a799523929a458b0509c9e4244d562), [`191e5bd`](https://github.com/mastra-ai/mastra/commit/191e5bd29b82f5bda35243945790da7bc7b695c2), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`31c78b3`](https://github.com/mastra-ai/mastra/commit/31c78b3eb28f58a8017f1dcc795c33214d87feac), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0)]:
|
|
10
|
+
- @mastra/core@0.0.0-fix-cloudflare-rest-api-20260227192337
|
|
11
|
+
|
|
12
|
+
## 1.6.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Fixed observation activation to always preserve a minimum amount of context. Previously, swapping buffered observation chunks could unexpectedly drop the context window to near-zero tokens. ([#13476](https://github.com/mastra-ai/mastra/pull/13476))
|
|
17
|
+
|
|
18
|
+
- Add a clear runtime error when `queryVector` is omitted for vector stores that require a vector for queries. Previously, omitting `queryVector` would produce confusing SDK-level errors; now each store throws a structured `MastraError` with `ErrorCategory.USER` explaining that metadata-only queries are not supported by that backend. ([#13286](https://github.com/mastra-ai/mastra/pull/13286))
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
|
|
21
|
+
- @mastra/core@1.8.0
|
|
22
|
+
|
|
23
|
+
## 1.6.2-alpha.0
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Fixed observation activation to always preserve a minimum amount of context. Previously, swapping buffered observation chunks could unexpectedly drop the context window to near-zero tokens. ([#13476](https://github.com/mastra-ai/mastra/pull/13476))
|
|
28
|
+
|
|
29
|
+
- Add a clear runtime error when `queryVector` is omitted for vector stores that require a vector for queries. Previously, omitting `queryVector` would produce confusing SDK-level errors; now each store throws a structured `MastraError` with `ErrorCategory.USER` explaining that metadata-only queries are not supported by that backend. ([#13286](https://github.com/mastra-ai/mastra/pull/13286))
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
|
|
32
|
+
- @mastra/core@1.8.0-alpha.0
|
|
9
33
|
|
|
10
34
|
## 1.6.1
|
|
11
35
|
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -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: "0.0.0-fix-cloudflare-rest-api-
|
|
6
|
+
version: "0.0.0-fix-cloudflare-rest-api-20260227192337"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -368,6 +368,187 @@ For automatic tool resumption to work:
|
|
|
368
368
|
|
|
369
369
|
Both approaches work with the same tool definitions. Automatic resumption triggers only when suspended tools exist in the message history and the user sends a new message on the same thread.
|
|
370
370
|
|
|
371
|
+
## Tool approval: Supervisor pattern
|
|
372
|
+
|
|
373
|
+
The [supervisor pattern](https://mastra.ai/docs/agents/networks) lets a supervisor agent coordinate multiple subagents using `.stream()` or `.generate()`. The supervisor delegates tasks to subagents, which may use tools that require approval. When this happens, tool approvals properly propagate through the delegation chain -- the approval request surfaces at the supervisor level where you can handle it, regardless of which subagent triggered it.
|
|
374
|
+
|
|
375
|
+
### How it works
|
|
376
|
+
|
|
377
|
+
1. The supervisor agent delegates a task to a subagent.
|
|
378
|
+
2. The subagent calls a tool that has `requireApproval: true` or uses `suspend()`.
|
|
379
|
+
3. The approval request bubbles up through the delegation chain to the supervisor.
|
|
380
|
+
4. You handle the approval or decline at the supervisor level.
|
|
381
|
+
5. The decision propagates back down to the subagent, which continues or terminates accordingly.
|
|
382
|
+
|
|
383
|
+
### Example
|
|
384
|
+
|
|
385
|
+
The following example creates a subagent with a database lookup tool that requires approval. The supervisor delegates to this subagent, and when the tool triggers an approval request, it surfaces in the supervisor's stream as a `tool-call-approval` chunk. You then approve the tool call using `approveToolCall` with the stream's `runId`.
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
import { Agent } from '@mastra/core/agent'
|
|
389
|
+
import { createTool } from '@mastra/core/tools'
|
|
390
|
+
import { Memory } from '@mastra/memory'
|
|
391
|
+
import { z } from 'zod'
|
|
392
|
+
|
|
393
|
+
// subagent with approval-required tool
|
|
394
|
+
const findUserTool = createTool({
|
|
395
|
+
id: 'find-user',
|
|
396
|
+
description: 'Finds user by ID in the database',
|
|
397
|
+
inputSchema: z.object({
|
|
398
|
+
userId: z.string(),
|
|
399
|
+
}),
|
|
400
|
+
outputSchema: z.object({
|
|
401
|
+
user: z.object({
|
|
402
|
+
id: z.string(),
|
|
403
|
+
name: z.string(),
|
|
404
|
+
email: z.string(),
|
|
405
|
+
}),
|
|
406
|
+
}),
|
|
407
|
+
requireApproval: true, // Requires approval before execution
|
|
408
|
+
execute: async input => {
|
|
409
|
+
const user = await database.findUser(input.userId)
|
|
410
|
+
return { user }
|
|
411
|
+
},
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
const dataAgent = new Agent({
|
|
415
|
+
id: 'data-agent',
|
|
416
|
+
name: 'Data Agent',
|
|
417
|
+
description: 'Handles database queries and user data retrieval',
|
|
418
|
+
model: 'openai/gpt-4o-mini',
|
|
419
|
+
tools: { findUserTool },
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
const supervisorAgent = new Agent({
|
|
423
|
+
id: 'supervisor',
|
|
424
|
+
name: 'Supervisor Agent',
|
|
425
|
+
instructions: `You coordinate data retrieval tasks.
|
|
426
|
+
Delegate to data-agent for user lookups.`,
|
|
427
|
+
model: 'openai/gpt-5.1',
|
|
428
|
+
agents: { dataAgent },
|
|
429
|
+
memory: new Memory(),
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
// When supervisor delegates to dataAgent and tool requires approval
|
|
433
|
+
const stream = await supervisorAgent.stream('Find user with ID 12345')
|
|
434
|
+
|
|
435
|
+
for await (const chunk of stream.fullStream) {
|
|
436
|
+
if (chunk.type === 'tool-call-approval') {
|
|
437
|
+
console.log('Tool requires approval:', chunk.payload.toolName)
|
|
438
|
+
console.log('Arguments:', chunk.payload.args)
|
|
439
|
+
|
|
440
|
+
// Approve the tool call
|
|
441
|
+
const resumeStream = await supervisorAgent.approveToolCall({
|
|
442
|
+
runId: stream.runId,
|
|
443
|
+
toolCallId: chunk.payload.toolCallId,
|
|
444
|
+
})
|
|
445
|
+
|
|
446
|
+
// Process resumed stream
|
|
447
|
+
for await (const resumeChunk of resumeStream.textStream) {
|
|
448
|
+
process.stdout.write(resumeChunk)
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Declining tool calls in supervisor pattern
|
|
455
|
+
|
|
456
|
+
You can also decline tool calls at the supervisor level by calling `declineToolCall`. The supervisor will respond acknowledging the declined tool without executing it:
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
for await (const chunk of stream.fullStream) {
|
|
460
|
+
if (chunk.type === 'tool-call-approval') {
|
|
461
|
+
console.log('Declining tool call:', chunk.payload.toolName)
|
|
462
|
+
|
|
463
|
+
// Decline the tool call
|
|
464
|
+
const declineStream = await supervisorAgent.declineToolCall({
|
|
465
|
+
runId: stream.runId,
|
|
466
|
+
toolCallId: chunk.payload.toolCallId,
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
// The supervisor will respond acknowledging the declined tool
|
|
470
|
+
for await (const declineChunk of declineStream.textStream) {
|
|
471
|
+
process.stdout.write(declineChunk)
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Using suspend() in supervisor pattern
|
|
478
|
+
|
|
479
|
+
Tools can also use [`suspend()`](#tool-approval-using-suspend) to pause execution and return context to the user. This approach works through the supervisor delegation chain the same way `requireApproval` does -- the suspension surfaces at the supervisor level:
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
const conditionalTool = createTool({
|
|
483
|
+
id: 'conditional-operation',
|
|
484
|
+
description: 'Performs an operation that may require confirmation',
|
|
485
|
+
inputSchema: z.object({
|
|
486
|
+
operation: z.string(),
|
|
487
|
+
}),
|
|
488
|
+
suspendSchema: z.object({
|
|
489
|
+
message: z.string(),
|
|
490
|
+
}),
|
|
491
|
+
resumeSchema: z.object({
|
|
492
|
+
confirmed: z.boolean(),
|
|
493
|
+
}),
|
|
494
|
+
execute: async (input, context) => {
|
|
495
|
+
const { resumeData } = context?.agent ?? {}
|
|
496
|
+
|
|
497
|
+
if (!resumeData?.confirmed) {
|
|
498
|
+
return context?.agent?.suspend({
|
|
499
|
+
message: `Confirm: ${input.operation}?`,
|
|
500
|
+
})
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Proceed with operation
|
|
504
|
+
return await performOperation(input.operation)
|
|
505
|
+
},
|
|
506
|
+
})
|
|
507
|
+
|
|
508
|
+
// When using this tool through a subagent in supervisor pattern
|
|
509
|
+
for await (const chunk of stream.fullStream) {
|
|
510
|
+
if (chunk.type === 'tool-call-suspended') {
|
|
511
|
+
console.log('Tool suspended:', chunk.payload.suspendPayload.message)
|
|
512
|
+
|
|
513
|
+
// Resume with confirmation
|
|
514
|
+
const resumeStream = await supervisorAgent.resumeStream(
|
|
515
|
+
{ confirmed: true },
|
|
516
|
+
{ runId: stream.runId },
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
for await (const resumeChunk of resumeStream.textStream) {
|
|
520
|
+
process.stdout.write(resumeChunk)
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Tool approval with generate()
|
|
527
|
+
|
|
528
|
+
Tool approval propagation also works with `generate()` in supervisor pattern:
|
|
529
|
+
|
|
530
|
+
```typescript
|
|
531
|
+
const output = await supervisorAgent.generate('Find user with ID 12345', {
|
|
532
|
+
maxSteps: 10,
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
if (output.finishReason === 'suspended') {
|
|
536
|
+
console.log('Tool requires approval:', output.suspendPayload.toolName)
|
|
537
|
+
|
|
538
|
+
// Approve
|
|
539
|
+
const result = await supervisorAgent.approveToolCallGenerate({
|
|
540
|
+
runId: output.runId,
|
|
541
|
+
toolCallId: output.suspendPayload.toolCallId,
|
|
542
|
+
})
|
|
543
|
+
|
|
544
|
+
console.log('Final result:', result.text)
|
|
545
|
+
}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Multi-level delegation
|
|
549
|
+
|
|
550
|
+
Tool approvals propagate through multiple levels of delegation. For example, if a supervisor delegates to subagent A, which in turn delegates to subagent B that has a tool with `requireApproval: true`, the approval request still surfaces at the top-level supervisor. You handle the approval or decline there, and the result flows back down through the entire delegation chain to the tool that requested it.
|
|
551
|
+
|
|
371
552
|
## Related
|
|
372
553
|
|
|
373
554
|
- [Using Tools](https://mastra.ai/docs/agents/using-tools)
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Agent Networks
|
|
2
2
|
|
|
3
|
+
> **Supervisor Pattern Recommended:** The [supervisor pattern](https://mastra.ai/docs/agents/supervisor-agents) using `agent.stream()` or `agent.generate()` is now the recommended approach for coordinating multiple agents. It provides the same multi-agent coordination capabilities as `.network()` with significant improvements:
|
|
4
|
+
>
|
|
5
|
+
> - **Better control**: Iteration hooks, delegation hooks, and task completion scoring give you fine-grained control over execution
|
|
6
|
+
> - **Simpler API**: Uses familiar `stream()` and `generate()` methods instead of a separate `.network()` API
|
|
7
|
+
> - **More flexible**: Stop execution early, modify delegations, filter context, and provide feedback to guide the agent
|
|
8
|
+
> - **Type-safe**: Full TypeScript support for all hooks and callbacks
|
|
9
|
+
> - **Easier debugging**: Monitor progress with `onIterationComplete`, track delegations with `onDelegationStart`/`onDelegationComplete`
|
|
10
|
+
>
|
|
11
|
+
> See the [migration guide](https://mastra.ai/guides/migrations/network-to-supervisor) to upgrade from `.network()`.
|
|
12
|
+
|
|
3
13
|
Agent networks in Mastra coordinate multiple agents, workflows, and tools to handle tasks that aren't clearly defined upfront but can be inferred from the user's message or context. A top-level **routing agent** (a Mastra agent with other agents, workflows, and tools configured) uses an LLM to interpret the request and decide which primitives (subagents, workflows, or tools) to call, in what order, and with what data.
|
|
4
14
|
|
|
5
15
|
## When to use networks
|
|
@@ -280,7 +290,10 @@ const final = await stream.object
|
|
|
280
290
|
|
|
281
291
|
## Related
|
|
282
292
|
|
|
293
|
+
- [Supervisor Agents](https://mastra.ai/docs/agents/supervisor-agents)
|
|
294
|
+
- [Migration: .network() to Supervisor Pattern](https://mastra.ai/guides/migrations/network-to-supervisor)
|
|
295
|
+
- [Guide: Research Coordinator](https://mastra.ai/guides/guide/research-coordinator)
|
|
283
296
|
- [Agent Memory](https://mastra.ai/docs/agents/agent-memory)
|
|
297
|
+
- [Agent Approval](https://mastra.ai/docs/agents/agent-approval)
|
|
284
298
|
- [Workflows Overview](https://mastra.ai/docs/workflows/overview)
|
|
285
|
-
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
286
|
-
- [Supervisor example](https://github.com/mastra-ai/mastra/tree/main/examples/supervisor-agent)
|
|
299
|
+
- [Request Context](https://mastra.ai/docs/server/request-context)
|
package/dist/index.cjs
CHANGED
|
@@ -576,6 +576,15 @@ var LibSQLVector = class extends vector.MastraVector {
|
|
|
576
576
|
// Default to -1 to include all results (cosine similarity ranges from -1 to 1)
|
|
577
577
|
}) {
|
|
578
578
|
vector.validateTopK("LIBSQL", topK);
|
|
579
|
+
if (!queryVector) {
|
|
580
|
+
throw new error.MastraError({
|
|
581
|
+
id: storage.createVectorErrorId("LIBSQL", "QUERY", "MISSING_VECTOR"),
|
|
582
|
+
text: "queryVector is required for LibSQL queries. Metadata-only queries are not supported by this vector store.",
|
|
583
|
+
domain: error.ErrorDomain.STORAGE,
|
|
584
|
+
category: error.ErrorCategory.USER,
|
|
585
|
+
details: { indexName }
|
|
586
|
+
});
|
|
587
|
+
}
|
|
579
588
|
if (!Array.isArray(queryVector) || !queryVector.every((x) => typeof x === "number" && Number.isFinite(x))) {
|
|
580
589
|
throw new error.MastraError({
|
|
581
590
|
id: storage.createVectorErrorId("LIBSQL", "QUERY", "INVALID_ARGS"),
|
|
@@ -6802,12 +6811,14 @@ var MemoryLibSQL = class extends storage.MemoryStorage {
|
|
|
6802
6811
|
const maxOvershoot = retentionFloor * 0.95;
|
|
6803
6812
|
const overshoot = bestOverTokens - targetMessageTokens;
|
|
6804
6813
|
const remainingAfterOver = input.currentPendingTokens - bestOverTokens;
|
|
6814
|
+
const remainingAfterUnder = input.currentPendingTokens - bestUnderTokens;
|
|
6815
|
+
const minRemaining = Math.min(1e3, retentionFloor);
|
|
6805
6816
|
let chunksToActivate;
|
|
6806
|
-
if (input.forceMaxActivation && bestOverBoundary > 0) {
|
|
6817
|
+
if (input.forceMaxActivation && bestOverBoundary > 0 && remainingAfterOver >= minRemaining) {
|
|
6807
6818
|
chunksToActivate = bestOverBoundary;
|
|
6808
|
-
} else if (bestOverBoundary > 0 && overshoot <= maxOvershoot &&
|
|
6819
|
+
} else if (bestOverBoundary > 0 && overshoot <= maxOvershoot && remainingAfterOver >= minRemaining) {
|
|
6809
6820
|
chunksToActivate = bestOverBoundary;
|
|
6810
|
-
} else if (bestUnderBoundary > 0) {
|
|
6821
|
+
} else if (bestUnderBoundary > 0 && remainingAfterUnder >= minRemaining) {
|
|
6811
6822
|
chunksToActivate = bestUnderBoundary;
|
|
6812
6823
|
} else if (bestOverBoundary > 0) {
|
|
6813
6824
|
chunksToActivate = bestOverBoundary;
|
|
@@ -9265,6 +9276,9 @@ var WorkflowsLibSQL = class extends storage.WorkflowsStorage {
|
|
|
9265
9276
|
(err) => this.logger.warn("LibSQL Workflows: Failed to setup PRAGMA settings.", err)
|
|
9266
9277
|
);
|
|
9267
9278
|
}
|
|
9279
|
+
supportsConcurrentUpdates() {
|
|
9280
|
+
return true;
|
|
9281
|
+
}
|
|
9268
9282
|
parseWorkflowRun(row) {
|
|
9269
9283
|
let parsedSnapshot = row.snapshot;
|
|
9270
9284
|
if (typeof parsedSnapshot === "string") {
|