@mastra/client-js 0.13.2-alpha.3 → 0.14.0-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.
- package/CHANGELOG.md +28 -0
- package/dist/client.d.ts +2 -13
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +12 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -214
- package/dist/index.js.map +1 -1
- package/dist/resources/index.d.ts +0 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/types.d.ts +1 -21
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/resources/legacy-workflow.d.ts +0 -90
- package/dist/resources/legacy-workflow.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.14.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Remove legacy helpers ([#8017](https://github.com/mastra-ai/mastra/pull/8017))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`dc099b4`](https://github.com/mastra-ai/mastra/commit/dc099b40fb31147ba3f362f98d991892033c4c67), [`b342a68`](https://github.com/mastra-ai/mastra/commit/b342a68e1399cf1ece9ba11bda112db89d21118c), [`303a9c0`](https://github.com/mastra-ai/mastra/commit/303a9c0d7dd58795915979f06a0512359e4532fb), [`370f8a6`](https://github.com/mastra-ai/mastra/commit/370f8a6480faec70fef18d72e5f7538f27004301), [`623ffaf`](https://github.com/mastra-ai/mastra/commit/623ffaf2d969e11e99a0224633cf7b5a0815c857), [`9fc1613`](https://github.com/mastra-ai/mastra/commit/9fc16136400186648880fd990119ac15f7c02ee4), [`61f62aa`](https://github.com/mastra-ai/mastra/commit/61f62aa31bc88fe4ddf8da6240dbcfbeb07358bd), [`3e292ba`](https://github.com/mastra-ai/mastra/commit/3e292ba00837886d5d68a34cbc0d9b703c991883), [`418c136`](https://github.com/mastra-ai/mastra/commit/418c1366843d88e491bca3f87763899ce855ca29), [`c84b7d0`](https://github.com/mastra-ai/mastra/commit/c84b7d093c4657772140cbfd2b15ef72f3315ed5)]:
|
|
12
|
+
- @mastra/core@0.18.1-alpha.0
|
|
13
|
+
|
|
14
|
+
## 0.13.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- fix: result object type inference when using structuredOutput and unify output/structuredOutput types with single OUTPUT generic ([#7969](https://github.com/mastra-ai/mastra/pull/7969))
|
|
19
|
+
|
|
20
|
+
- Add model fallback handlers and apis ([#7378](https://github.com/mastra-ai/mastra/pull/7378))
|
|
21
|
+
|
|
22
|
+
- Get rid off swr one for all ([#7931](https://github.com/mastra-ai/mastra/pull/7931))
|
|
23
|
+
|
|
24
|
+
- Delayed streamVNext breaking change notice by 1 week ([#8121](https://github.com/mastra-ai/mastra/pull/8121))
|
|
25
|
+
|
|
26
|
+
- Add server api to score traces ([#8064](https://github.com/mastra-ai/mastra/pull/8064))
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a)]:
|
|
29
|
+
- @mastra/core@0.18.0
|
|
30
|
+
|
|
3
31
|
## 0.13.2-alpha.3
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AITraceRecord, AITracesPaginatedArg, WorkflowInfo } from '@mastra/core';
|
|
2
2
|
import type { ServerDetailInfo } from '@mastra/core/mcp';
|
|
3
3
|
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
4
|
-
import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, A2A, MCPTool,
|
|
4
|
+
import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, A2A, MCPTool, AgentBuilder } from './resources/index.js';
|
|
5
5
|
import { NetworkMemoryThread } from './resources/network-memory-thread.js';
|
|
6
6
|
import { VNextNetwork } from './resources/vNextNetwork.js';
|
|
7
|
-
import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetMemoryThreadParams, GetMemoryThreadResponse, GetTelemetryParams, GetTelemetryResponse, GetToolResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse,
|
|
7
|
+
import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetMemoryThreadParams, GetMemoryThreadResponse, GetTelemetryParams, GetTelemetryResponse, GetToolResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetVNextNetworkResponse, GetNetworkMemoryThreadParams, CreateNetworkMemoryThreadParams, SaveNetworkMessageToMemoryParams, GetScorerResponse, GetScoresByScorerIdParams, GetScoresResponse, GetScoresByRunIdParams, GetScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse, GetAITracesResponse, GetMemoryConfigParams, GetMemoryConfigResponse, GetMemoryThreadMessagesResponse } from './types.js';
|
|
8
8
|
export declare class MastraClient extends BaseResource {
|
|
9
9
|
private observability;
|
|
10
10
|
constructor(options: ClientOptions);
|
|
@@ -111,17 +111,6 @@ export declare class MastraClient extends BaseResource {
|
|
|
111
111
|
* @returns Tool instance
|
|
112
112
|
*/
|
|
113
113
|
getTool(toolId: string): Tool;
|
|
114
|
-
/**
|
|
115
|
-
* Retrieves all available legacy workflows
|
|
116
|
-
* @returns Promise containing map of legacy workflow IDs to legacy workflow details
|
|
117
|
-
*/
|
|
118
|
-
getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
|
|
119
|
-
/**
|
|
120
|
-
* Gets a legacy workflow instance by ID
|
|
121
|
-
* @param workflowId - ID of the legacy workflow to retrieve
|
|
122
|
-
* @returns Legacy Workflow instance
|
|
123
|
-
*/
|
|
124
|
-
getLegacyWorkflow(workflowId: string): LegacyWorkflow;
|
|
125
114
|
/**
|
|
126
115
|
* Retrieves all available workflows
|
|
127
116
|
* @param runtimeContext - Optional runtime context to pass as query parameter
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtF,O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AAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAUD;;;OAGG;IACI,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAI/D;;;;OAIG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIvD,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqBzF;;;;OAIG;IACI,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAenF;;;;OAIG;IACI,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAezF;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOrE;;;OAGG;IACH,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAItC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAInD,WAAW,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIvE,KAAK,CAAC,MAAM,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACtD,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAGjD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1517,193 +1517,6 @@ var Vector = class extends BaseResource {
|
|
|
1517
1517
|
}
|
|
1518
1518
|
};
|
|
1519
1519
|
|
|
1520
|
-
// src/resources/legacy-workflow.ts
|
|
1521
|
-
var RECORD_SEPARATOR = "";
|
|
1522
|
-
var LegacyWorkflow = class extends BaseResource {
|
|
1523
|
-
constructor(options, workflowId) {
|
|
1524
|
-
super(options);
|
|
1525
|
-
this.workflowId = workflowId;
|
|
1526
|
-
}
|
|
1527
|
-
/**
|
|
1528
|
-
* Retrieves details about the legacy workflow
|
|
1529
|
-
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1530
|
-
* @returns Promise containing legacy workflow details including steps and graphs
|
|
1531
|
-
*/
|
|
1532
|
-
details(runtimeContext) {
|
|
1533
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1534
|
-
}
|
|
1535
|
-
/**
|
|
1536
|
-
* Retrieves all runs for a legacy workflow
|
|
1537
|
-
* @param params - Parameters for filtering runs
|
|
1538
|
-
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1539
|
-
* @returns Promise containing legacy workflow runs array
|
|
1540
|
-
*/
|
|
1541
|
-
runs(params, runtimeContext) {
|
|
1542
|
-
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1543
|
-
const searchParams = new URLSearchParams();
|
|
1544
|
-
if (params?.fromDate) {
|
|
1545
|
-
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
1546
|
-
}
|
|
1547
|
-
if (params?.toDate) {
|
|
1548
|
-
searchParams.set("toDate", params.toDate.toISOString());
|
|
1549
|
-
}
|
|
1550
|
-
if (params?.limit) {
|
|
1551
|
-
searchParams.set("limit", String(params.limit));
|
|
1552
|
-
}
|
|
1553
|
-
if (params?.offset) {
|
|
1554
|
-
searchParams.set("offset", String(params.offset));
|
|
1555
|
-
}
|
|
1556
|
-
if (params?.resourceId) {
|
|
1557
|
-
searchParams.set("resourceId", params.resourceId);
|
|
1558
|
-
}
|
|
1559
|
-
if (runtimeContextParam) {
|
|
1560
|
-
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1561
|
-
}
|
|
1562
|
-
if (searchParams.size) {
|
|
1563
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}/runs?${searchParams}`);
|
|
1564
|
-
} else {
|
|
1565
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}/runs`);
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
/**
|
|
1569
|
-
* Creates a new legacy workflow run
|
|
1570
|
-
* @returns Promise containing the generated run ID
|
|
1571
|
-
*/
|
|
1572
|
-
createRun(params) {
|
|
1573
|
-
const searchParams = new URLSearchParams();
|
|
1574
|
-
if (!!params?.runId) {
|
|
1575
|
-
searchParams.set("runId", params.runId);
|
|
1576
|
-
}
|
|
1577
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}/create-run?${searchParams.toString()}`, {
|
|
1578
|
-
method: "POST"
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
/**
|
|
1582
|
-
* Starts a legacy workflow run synchronously without waiting for the workflow to complete
|
|
1583
|
-
* @param params - Object containing the runId and triggerData
|
|
1584
|
-
* @returns Promise containing success message
|
|
1585
|
-
*/
|
|
1586
|
-
start(params) {
|
|
1587
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}/start?runId=${params.runId}`, {
|
|
1588
|
-
method: "POST",
|
|
1589
|
-
body: params?.triggerData
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
/**
|
|
1593
|
-
* Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
|
|
1594
|
-
* @param stepId - ID of the step to resume
|
|
1595
|
-
* @param runId - ID of the legacy workflow run
|
|
1596
|
-
* @param context - Context to resume the legacy workflow with
|
|
1597
|
-
* @returns Promise containing the legacy workflow resume results
|
|
1598
|
-
*/
|
|
1599
|
-
resume({
|
|
1600
|
-
stepId,
|
|
1601
|
-
runId,
|
|
1602
|
-
context
|
|
1603
|
-
}) {
|
|
1604
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}/resume?runId=${runId}`, {
|
|
1605
|
-
method: "POST",
|
|
1606
|
-
body: {
|
|
1607
|
-
stepId,
|
|
1608
|
-
context
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1611
|
-
}
|
|
1612
|
-
/**
|
|
1613
|
-
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
1614
|
-
* @param params - Object containing the optional runId and triggerData
|
|
1615
|
-
* @returns Promise containing the workflow execution results
|
|
1616
|
-
*/
|
|
1617
|
-
startAsync(params) {
|
|
1618
|
-
const searchParams = new URLSearchParams();
|
|
1619
|
-
if (!!params?.runId) {
|
|
1620
|
-
searchParams.set("runId", params.runId);
|
|
1621
|
-
}
|
|
1622
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}/start-async?${searchParams.toString()}`, {
|
|
1623
|
-
method: "POST",
|
|
1624
|
-
body: params?.triggerData
|
|
1625
|
-
});
|
|
1626
|
-
}
|
|
1627
|
-
/**
|
|
1628
|
-
* Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
1629
|
-
* @param params - Object containing the runId, stepId, and context
|
|
1630
|
-
* @returns Promise containing the workflow resume results
|
|
1631
|
-
*/
|
|
1632
|
-
resumeAsync(params) {
|
|
1633
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}/resume-async?runId=${params.runId}`, {
|
|
1634
|
-
method: "POST",
|
|
1635
|
-
body: {
|
|
1636
|
-
stepId: params.stepId,
|
|
1637
|
-
context: params.context
|
|
1638
|
-
}
|
|
1639
|
-
});
|
|
1640
|
-
}
|
|
1641
|
-
/**
|
|
1642
|
-
* Creates an async generator that processes a readable stream and yields records
|
|
1643
|
-
* separated by the Record Separator character (\x1E)
|
|
1644
|
-
*
|
|
1645
|
-
* @param stream - The readable stream to process
|
|
1646
|
-
* @returns An async generator that yields parsed records
|
|
1647
|
-
*/
|
|
1648
|
-
async *streamProcessor(stream) {
|
|
1649
|
-
const reader = stream.getReader();
|
|
1650
|
-
let doneReading = false;
|
|
1651
|
-
let buffer = "";
|
|
1652
|
-
try {
|
|
1653
|
-
while (!doneReading) {
|
|
1654
|
-
const { done, value } = await reader.read();
|
|
1655
|
-
doneReading = done;
|
|
1656
|
-
if (done && !value) continue;
|
|
1657
|
-
try {
|
|
1658
|
-
const decoded = value ? new TextDecoder().decode(value) : "";
|
|
1659
|
-
const chunks = (buffer + decoded).split(RECORD_SEPARATOR);
|
|
1660
|
-
buffer = chunks.pop() || "";
|
|
1661
|
-
for (const chunk of chunks) {
|
|
1662
|
-
if (chunk) {
|
|
1663
|
-
if (typeof chunk === "string") {
|
|
1664
|
-
try {
|
|
1665
|
-
const parsedChunk = JSON.parse(chunk);
|
|
1666
|
-
yield parsedChunk;
|
|
1667
|
-
} catch {
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
} catch {
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
if (buffer) {
|
|
1676
|
-
try {
|
|
1677
|
-
yield JSON.parse(buffer);
|
|
1678
|
-
} catch {
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
} finally {
|
|
1682
|
-
reader.cancel().catch(() => {
|
|
1683
|
-
});
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
/**
|
|
1687
|
-
* Watches legacy workflow transitions in real-time
|
|
1688
|
-
* @param runId - Optional run ID to filter the watch stream
|
|
1689
|
-
* @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
|
|
1690
|
-
*/
|
|
1691
|
-
async watch({ runId }, onRecord) {
|
|
1692
|
-
const response = await this.request(`/api/workflows/legacy/${this.workflowId}/watch?runId=${runId}`, {
|
|
1693
|
-
stream: true
|
|
1694
|
-
});
|
|
1695
|
-
if (!response.ok) {
|
|
1696
|
-
throw new Error(`Failed to watch legacy workflow: ${response.statusText}`);
|
|
1697
|
-
}
|
|
1698
|
-
if (!response.body) {
|
|
1699
|
-
throw new Error("Response body is null");
|
|
1700
|
-
}
|
|
1701
|
-
for await (const record of this.streamProcessor(response.body)) {
|
|
1702
|
-
onRecord(record);
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
};
|
|
1706
|
-
|
|
1707
1520
|
// src/resources/tool.ts
|
|
1708
1521
|
var Tool = class extends BaseResource {
|
|
1709
1522
|
constructor(options, toolId) {
|
|
@@ -1740,7 +1553,7 @@ var Tool = class extends BaseResource {
|
|
|
1740
1553
|
};
|
|
1741
1554
|
|
|
1742
1555
|
// src/resources/workflow.ts
|
|
1743
|
-
var
|
|
1556
|
+
var RECORD_SEPARATOR = "";
|
|
1744
1557
|
var Workflow = class extends BaseResource {
|
|
1745
1558
|
constructor(options, workflowId) {
|
|
1746
1559
|
super(options);
|
|
@@ -1764,7 +1577,7 @@ var Workflow = class extends BaseResource {
|
|
|
1764
1577
|
if (done && !value) continue;
|
|
1765
1578
|
try {
|
|
1766
1579
|
const decoded = value ? new TextDecoder().decode(value) : "";
|
|
1767
|
-
const chunks = (buffer + decoded).split(
|
|
1580
|
+
const chunks = (buffer + decoded).split(RECORD_SEPARATOR);
|
|
1768
1581
|
buffer = chunks.pop() || "";
|
|
1769
1582
|
for (const chunk of chunks) {
|
|
1770
1583
|
if (chunk) {
|
|
@@ -2010,7 +1823,7 @@ var Workflow = class extends BaseResource {
|
|
|
2010
1823
|
async transform(chunk, controller) {
|
|
2011
1824
|
try {
|
|
2012
1825
|
const decoded = new TextDecoder().decode(chunk);
|
|
2013
|
-
const chunks = decoded.split(
|
|
1826
|
+
const chunks = decoded.split(RECORD_SEPARATOR);
|
|
2014
1827
|
for (const chunk2 of chunks) {
|
|
2015
1828
|
if (chunk2) {
|
|
2016
1829
|
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
@@ -2057,7 +1870,7 @@ var Workflow = class extends BaseResource {
|
|
|
2057
1870
|
async transform(chunk, controller) {
|
|
2058
1871
|
try {
|
|
2059
1872
|
const decoded = new TextDecoder().decode(chunk);
|
|
2060
|
-
const chunks = decoded.split(
|
|
1873
|
+
const chunks = decoded.split(RECORD_SEPARATOR);
|
|
2061
1874
|
for (const chunk2 of chunks) {
|
|
2062
1875
|
if (chunk2) {
|
|
2063
1876
|
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
@@ -2108,7 +1921,7 @@ var Workflow = class extends BaseResource {
|
|
|
2108
1921
|
async transform(chunk, controller) {
|
|
2109
1922
|
try {
|
|
2110
1923
|
const decoded = new TextDecoder().decode(chunk);
|
|
2111
|
-
const chunks = decoded.split(
|
|
1924
|
+
const chunks = decoded.split(RECORD_SEPARATOR);
|
|
2112
1925
|
for (const chunk2 of chunks) {
|
|
2113
1926
|
if (chunk2) {
|
|
2114
1927
|
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
@@ -2195,7 +2008,7 @@ var Workflow = class extends BaseResource {
|
|
|
2195
2008
|
async start(controller) {
|
|
2196
2009
|
try {
|
|
2197
2010
|
for await (const record of records) {
|
|
2198
|
-
const json = JSON.stringify(record) +
|
|
2011
|
+
const json = JSON.stringify(record) + RECORD_SEPARATOR;
|
|
2199
2012
|
controller.enqueue(encoder.encode(json));
|
|
2200
2013
|
}
|
|
2201
2014
|
controller.close();
|
|
@@ -2318,7 +2131,7 @@ var MCPTool = class extends BaseResource {
|
|
|
2318
2131
|
};
|
|
2319
2132
|
|
|
2320
2133
|
// src/resources/agent-builder.ts
|
|
2321
|
-
var
|
|
2134
|
+
var RECORD_SEPARATOR2 = "";
|
|
2322
2135
|
var AgentBuilder = class extends BaseResource {
|
|
2323
2136
|
constructor(options, actionId) {
|
|
2324
2137
|
super(options);
|
|
@@ -2458,7 +2271,7 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2458
2271
|
if (done && !value) continue;
|
|
2459
2272
|
try {
|
|
2460
2273
|
const decoded = value ? new TextDecoder().decode(value) : "";
|
|
2461
|
-
const chunks = (buffer + decoded).split(
|
|
2274
|
+
const chunks = (buffer + decoded).split(RECORD_SEPARATOR2);
|
|
2462
2275
|
buffer = chunks.pop() || "";
|
|
2463
2276
|
for (const chunk of chunks) {
|
|
2464
2277
|
if (chunk) {
|
|
@@ -2515,7 +2328,7 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2515
2328
|
async transform(chunk, controller) {
|
|
2516
2329
|
try {
|
|
2517
2330
|
const decoded = new TextDecoder().decode(chunk);
|
|
2518
|
-
const chunks = decoded.split(
|
|
2331
|
+
const chunks = decoded.split(RECORD_SEPARATOR2);
|
|
2519
2332
|
for (const chunk2 of chunks) {
|
|
2520
2333
|
if (chunk2) {
|
|
2521
2334
|
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
@@ -2564,7 +2377,7 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2564
2377
|
async transform(chunk, controller) {
|
|
2565
2378
|
try {
|
|
2566
2379
|
const decoded = new TextDecoder().decode(chunk);
|
|
2567
|
-
const chunks = decoded.split(
|
|
2380
|
+
const chunks = decoded.split(RECORD_SEPARATOR2);
|
|
2568
2381
|
for (const chunk2 of chunks) {
|
|
2569
2382
|
if (chunk2) {
|
|
2570
2383
|
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
@@ -2807,7 +2620,7 @@ var NetworkMemoryThread = class extends BaseResource {
|
|
|
2807
2620
|
};
|
|
2808
2621
|
|
|
2809
2622
|
// src/resources/vNextNetwork.ts
|
|
2810
|
-
var
|
|
2623
|
+
var RECORD_SEPARATOR3 = "";
|
|
2811
2624
|
var VNextNetwork = class extends BaseResource {
|
|
2812
2625
|
constructor(options, networkId) {
|
|
2813
2626
|
super(options);
|
|
@@ -2860,7 +2673,7 @@ var VNextNetwork = class extends BaseResource {
|
|
|
2860
2673
|
if (done && !value) continue;
|
|
2861
2674
|
try {
|
|
2862
2675
|
const decoded = value ? new TextDecoder().decode(value) : "";
|
|
2863
|
-
const chunks = (buffer + decoded).split(
|
|
2676
|
+
const chunks = (buffer + decoded).split(RECORD_SEPARATOR3);
|
|
2864
2677
|
buffer = chunks.pop() || "";
|
|
2865
2678
|
for (const chunk of chunks) {
|
|
2866
2679
|
if (chunk) {
|
|
@@ -3106,21 +2919,6 @@ var MastraClient = class extends BaseResource {
|
|
|
3106
2919
|
getTool(toolId) {
|
|
3107
2920
|
return new Tool(this.options, toolId);
|
|
3108
2921
|
}
|
|
3109
|
-
/**
|
|
3110
|
-
* Retrieves all available legacy workflows
|
|
3111
|
-
* @returns Promise containing map of legacy workflow IDs to legacy workflow details
|
|
3112
|
-
*/
|
|
3113
|
-
getLegacyWorkflows() {
|
|
3114
|
-
return this.request("/api/workflows/legacy");
|
|
3115
|
-
}
|
|
3116
|
-
/**
|
|
3117
|
-
* Gets a legacy workflow instance by ID
|
|
3118
|
-
* @param workflowId - ID of the legacy workflow to retrieve
|
|
3119
|
-
* @returns Legacy Workflow instance
|
|
3120
|
-
*/
|
|
3121
|
-
getLegacyWorkflow(workflowId) {
|
|
3122
|
-
return new LegacyWorkflow(this.options, workflowId);
|
|
3123
|
-
}
|
|
3124
2922
|
/**
|
|
3125
2923
|
* Retrieves all available workflows
|
|
3126
2924
|
* @param runtimeContext - Optional runtime context to pass as query parameter
|