@mastra/client-js 1.40.1-alpha.7 → 1.41.0-alpha.9
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 +33 -0
- package/dist/docs/SKILL.md +6 -6
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/{docs-agents-a2a.md → docs-connections-a2a.md} +2 -2
- package/dist/docs/references/{docs-long-running-agents-schedules.md → docs-harness-schedules.md} +5 -5
- package/dist/docs/references/docs-server-mastra-client.md +2 -2
- package/dist/docs/references/integrations-auth-workos.md +1 -1
- package/dist/docs/references/reference-client-js-agents.md +4 -4
- package/dist/docs/references/reference-editor-versioning.md +3 -3
- package/dist/index.cjs +48 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -20
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-controller.d.ts +3 -1
- package/dist/resources/agent-controller.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +7 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +81 -36
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- /package/dist/docs/references/{docs-server-auth-jwt.md → docs-auth-jwt.md} +0 -0
- /package/dist/docs/references/{docs-long-running-agents-signals.md → docs-harness-signals.md} +0 -0
- /package/dist/docs/references/{docs-editor-overview.md → docs-studio-editor.md} +0 -0
package/dist/index.js
CHANGED
|
@@ -860,6 +860,15 @@ var Agent = class extends BaseResource {
|
|
|
860
860
|
return this.request(`/agents/${this.agentId}${this.getQueryString(requestContext)}`);
|
|
861
861
|
}
|
|
862
862
|
/**
|
|
863
|
+
* Reads a markdown plan submitted by this agent through the core submit_plan tool.
|
|
864
|
+
* The server only serves paths under `.mastracode/plans/` and only when the
|
|
865
|
+
* agent exposes that capability.
|
|
866
|
+
*/
|
|
867
|
+
readPlan(path, requestContext) {
|
|
868
|
+
const contextQuery = this.getQueryString(requestContext, "&");
|
|
869
|
+
return this.request(`/agents/${this.agentId}/plans/file?path=${encodeURIComponent(path)}${contextQuery}`);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
863
872
|
* Probe the agent's browser session state before opening a screencast WebSocket.
|
|
864
873
|
*
|
|
865
874
|
* Returns `{ hasSession, screencastAvailable }`. Use this to avoid opening a WS
|
|
@@ -1380,13 +1389,22 @@ var Agent = class extends BaseResource {
|
|
|
1380
1389
|
let currentTextPart = void 0;
|
|
1381
1390
|
let currentReasoningPart = void 0;
|
|
1382
1391
|
let currentReasoningTextDetail = void 0;
|
|
1383
|
-
function updateToolInvocationPart(toolCallId, invocation) {
|
|
1392
|
+
function updateToolInvocationPart(toolCallId, invocation, partProviderMetadata) {
|
|
1384
1393
|
const part = message.parts.find((part) => part.type === "tool-invocation" && part.toolInvocation.toolCallId === toolCallId);
|
|
1385
|
-
if (part != null)
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1394
|
+
if (part != null) {
|
|
1395
|
+
part.toolInvocation = invocation;
|
|
1396
|
+
if (partProviderMetadata !== void 0) part.providerMetadata = {
|
|
1397
|
+
...part.providerMetadata ?? {},
|
|
1398
|
+
...partProviderMetadata
|
|
1399
|
+
};
|
|
1400
|
+
} else {
|
|
1401
|
+
const newPart = {
|
|
1402
|
+
type: "tool-invocation",
|
|
1403
|
+
toolInvocation: invocation
|
|
1404
|
+
};
|
|
1405
|
+
if (partProviderMetadata !== void 0) newPart.providerMetadata = partProviderMetadata;
|
|
1406
|
+
message.parts.push(newPart);
|
|
1407
|
+
}
|
|
1390
1408
|
}
|
|
1391
1409
|
const data = [];
|
|
1392
1410
|
let messageAnnotations = replaceLastMessage ? lastMessage?.annotations : void 0;
|
|
@@ -1524,7 +1542,7 @@ var Agent = class extends BaseResource {
|
|
|
1524
1542
|
if (message.toolInvocations == null) message.toolInvocations = [];
|
|
1525
1543
|
message.toolInvocations.push(invocation);
|
|
1526
1544
|
}
|
|
1527
|
-
updateToolInvocationPart(value.toolCallId, invocation);
|
|
1545
|
+
updateToolInvocationPart(value.toolCallId, invocation, value.providerMetadata);
|
|
1528
1546
|
execUpdate();
|
|
1529
1547
|
if (onToolCall) {
|
|
1530
1548
|
const result = await onToolCall({ toolCall: value });
|
|
@@ -1536,7 +1554,7 @@ var Agent = class extends BaseResource {
|
|
|
1536
1554
|
result
|
|
1537
1555
|
};
|
|
1538
1556
|
message.toolInvocations[message.toolInvocations.length - 1] = invocation;
|
|
1539
|
-
updateToolInvocationPart(value.toolCallId, invocation);
|
|
1557
|
+
updateToolInvocationPart(value.toolCallId, invocation, value.providerMetadata);
|
|
1540
1558
|
execUpdate();
|
|
1541
1559
|
}
|
|
1542
1560
|
}
|
|
@@ -1552,7 +1570,7 @@ var Agent = class extends BaseResource {
|
|
|
1552
1570
|
...value
|
|
1553
1571
|
};
|
|
1554
1572
|
toolInvocations[toolInvocationIndex] = invocation;
|
|
1555
|
-
updateToolInvocationPart(value.toolCallId, invocation);
|
|
1573
|
+
updateToolInvocationPart(value.toolCallId, invocation, value.providerMetadata);
|
|
1556
1574
|
execUpdate();
|
|
1557
1575
|
},
|
|
1558
1576
|
onDataPart(value) {
|
|
@@ -1632,13 +1650,22 @@ var Agent = class extends BaseResource {
|
|
|
1632
1650
|
let currentTextPart = void 0;
|
|
1633
1651
|
let currentReasoningPart = void 0;
|
|
1634
1652
|
let currentReasoningTextDetail = void 0;
|
|
1635
|
-
function updateToolInvocationPart(toolCallId, invocation) {
|
|
1653
|
+
function updateToolInvocationPart(toolCallId, invocation, partProviderMetadata) {
|
|
1636
1654
|
const part = message.parts.find((part) => part.type === "tool-invocation" && part.toolInvocation.toolCallId === toolCallId);
|
|
1637
|
-
if (part != null)
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1655
|
+
if (part != null) {
|
|
1656
|
+
part.toolInvocation = invocation;
|
|
1657
|
+
if (partProviderMetadata !== void 0) part.providerMetadata = {
|
|
1658
|
+
...part.providerMetadata ?? {},
|
|
1659
|
+
...partProviderMetadata
|
|
1660
|
+
};
|
|
1661
|
+
} else {
|
|
1662
|
+
const newPart = {
|
|
1663
|
+
type: "tool-invocation",
|
|
1664
|
+
toolInvocation: invocation
|
|
1665
|
+
};
|
|
1666
|
+
if (partProviderMetadata !== void 0) newPart.providerMetadata = partProviderMetadata;
|
|
1667
|
+
message.parts.push(newPart);
|
|
1668
|
+
}
|
|
1642
1669
|
}
|
|
1643
1670
|
const data = [];
|
|
1644
1671
|
let messageAnnotations = replaceLastMessage ? lastMessage?.annotations : void 0;
|
|
@@ -1734,7 +1761,7 @@ var Agent = class extends BaseResource {
|
|
|
1734
1761
|
if (message.toolInvocations == null) message.toolInvocations = [];
|
|
1735
1762
|
message.toolInvocations.push(invocation);
|
|
1736
1763
|
}
|
|
1737
|
-
updateToolInvocationPart(chunk.payload.toolCallId, invocation);
|
|
1764
|
+
updateToolInvocationPart(chunk.payload.toolCallId, invocation, chunk.payload.providerMetadata);
|
|
1738
1765
|
execUpdate();
|
|
1739
1766
|
if (onToolCall) {
|
|
1740
1767
|
const result = await onToolCall({ toolCall: chunk.payload });
|
|
@@ -1746,7 +1773,7 @@ var Agent = class extends BaseResource {
|
|
|
1746
1773
|
result
|
|
1747
1774
|
};
|
|
1748
1775
|
message.toolInvocations[message.toolInvocations.length - 1] = invocation;
|
|
1749
|
-
updateToolInvocationPart(chunk.payload.toolCallId, invocation);
|
|
1776
|
+
updateToolInvocationPart(chunk.payload.toolCallId, invocation, chunk.payload.providerMetadata);
|
|
1750
1777
|
execUpdate();
|
|
1751
1778
|
}
|
|
1752
1779
|
}
|
|
@@ -1803,7 +1830,7 @@ var Agent = class extends BaseResource {
|
|
|
1803
1830
|
...chunk.payload
|
|
1804
1831
|
};
|
|
1805
1832
|
toolInvocations[toolInvocationIndex] = invocation;
|
|
1806
|
-
updateToolInvocationPart(chunk.payload.toolCallId, invocation);
|
|
1833
|
+
updateToolInvocationPart(chunk.payload.toolCallId, invocation, chunk.payload.providerMetadata);
|
|
1807
1834
|
execUpdate();
|
|
1808
1835
|
break;
|
|
1809
1836
|
}
|
|
@@ -5965,8 +5992,9 @@ var AgentControllerSession = class extends BaseResource {
|
|
|
5965
5992
|
});
|
|
5966
5993
|
}
|
|
5967
5994
|
/** Get the current mode, model, and thread (for initial UI hydration). */
|
|
5968
|
-
state() {
|
|
5969
|
-
|
|
5995
|
+
state(options) {
|
|
5996
|
+
const path = options?.threadId ? `${this.base()}?threadId=${encodeURIComponent(options.threadId)}` : this.base();
|
|
5997
|
+
return this.request(this.url(path));
|
|
5970
5998
|
}
|
|
5971
5999
|
/** Merge key-value pairs into the session state. Existing keys not in the payload are preserved. */
|
|
5972
6000
|
async setState(updates) {
|