@upstash/workflow 0.2.5-agents-2 → 0.2.5
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/astro.d.mts +1 -1
- package/astro.d.ts +1 -1
- package/astro.js +44 -23
- package/astro.mjs +1 -1
- package/{chunk-VOM3CFYZ.mjs → chunk-42MM2EPQ.mjs} +44 -23
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +44 -23
- package/cloudflare.mjs +1 -1
- package/express.d.mts +1 -1
- package/express.d.ts +1 -1
- package/express.js +44 -23
- package/express.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +44 -23
- package/h3.mjs +1 -1
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +44 -23
- package/hono.mjs +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +44 -23
- package/index.mjs +1 -1
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +44 -23
- package/nextjs.mjs +1 -1
- package/package.json +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +44 -23
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +44 -23
- package/svelte.mjs +1 -1
- package/{types-D9gwTj2n.d.mts → types-CalpUeFX.d.mts} +2 -1
- package/{types-D9gwTj2n.d.ts → types-CalpUeFX.d.ts} +2 -1
package/astro.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIContext, APIRoute } from 'astro';
|
|
2
|
-
import { b as WorkflowContext, j as PublicServeOptions } from './types-
|
|
2
|
+
import { b as WorkflowContext, j as PublicServeOptions } from './types-CalpUeFX.mjs';
|
|
3
3
|
import '@upstash/qstash';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '@ai-sdk/openai';
|
package/astro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIContext, APIRoute } from 'astro';
|
|
2
|
-
import { b as WorkflowContext, j as PublicServeOptions } from './types-
|
|
2
|
+
import { b as WorkflowContext, j as PublicServeOptions } from './types-CalpUeFX.js';
|
|
3
3
|
import '@upstash/qstash';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '@ai-sdk/openai';
|
package/astro.js
CHANGED
|
@@ -1711,6 +1711,13 @@ var convertLangchainTool = (langchainTool) => {
|
|
|
1711
1711
|
// src/agents/agent.ts
|
|
1712
1712
|
var import_zod = require("zod");
|
|
1713
1713
|
var import_ai2 = require("ai");
|
|
1714
|
+
|
|
1715
|
+
// src/serve/utils.ts
|
|
1716
|
+
var isDisabledWorkflowContext = (context) => {
|
|
1717
|
+
return "disabled" in context;
|
|
1718
|
+
};
|
|
1719
|
+
|
|
1720
|
+
// src/agents/agent.ts
|
|
1714
1721
|
var Agent = class {
|
|
1715
1722
|
name;
|
|
1716
1723
|
tools;
|
|
@@ -1718,13 +1725,15 @@ var Agent = class {
|
|
|
1718
1725
|
background;
|
|
1719
1726
|
model;
|
|
1720
1727
|
temparature;
|
|
1721
|
-
|
|
1728
|
+
context;
|
|
1729
|
+
constructor({ tools, maxSteps, background, name, model, temparature = 0.1 }, context) {
|
|
1722
1730
|
this.name = name;
|
|
1723
1731
|
this.tools = tools ?? {};
|
|
1724
1732
|
this.maxSteps = maxSteps;
|
|
1725
1733
|
this.background = background;
|
|
1726
1734
|
this.model = model;
|
|
1727
1735
|
this.temparature = temparature;
|
|
1736
|
+
this.context = context;
|
|
1728
1737
|
}
|
|
1729
1738
|
/**
|
|
1730
1739
|
* Trigger the agent by passing a prompt
|
|
@@ -1734,6 +1743,9 @@ var Agent = class {
|
|
|
1734
1743
|
*/
|
|
1735
1744
|
async call({ prompt }) {
|
|
1736
1745
|
try {
|
|
1746
|
+
if (isDisabledWorkflowContext(this.context)) {
|
|
1747
|
+
await this.context.sleep("abort", 0);
|
|
1748
|
+
}
|
|
1737
1749
|
const result = await (0, import_ai2.generateText)({
|
|
1738
1750
|
model: this.model,
|
|
1739
1751
|
tools: this.tools,
|
|
@@ -1796,14 +1808,17 @@ var ManagerAgent = class extends Agent {
|
|
|
1796
1808
|
model,
|
|
1797
1809
|
maxSteps,
|
|
1798
1810
|
name = "manager llm"
|
|
1799
|
-
}) {
|
|
1800
|
-
super(
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1811
|
+
}, context) {
|
|
1812
|
+
super(
|
|
1813
|
+
{
|
|
1814
|
+
background,
|
|
1815
|
+
maxSteps,
|
|
1816
|
+
tools: Object.fromEntries(agents.map((agent) => [agent.name, agent.asTool()])),
|
|
1817
|
+
name,
|
|
1818
|
+
model
|
|
1819
|
+
},
|
|
1820
|
+
context
|
|
1821
|
+
);
|
|
1807
1822
|
this.agents = agents;
|
|
1808
1823
|
}
|
|
1809
1824
|
};
|
|
@@ -1826,23 +1841,25 @@ var Task = class {
|
|
|
1826
1841
|
*/
|
|
1827
1842
|
async run() {
|
|
1828
1843
|
const { prompt, ...otherParams } = this.taskParameters;
|
|
1829
|
-
const safePrompt = await this.context.run("Get Prompt", () => prompt);
|
|
1830
1844
|
if ("agent" in otherParams) {
|
|
1831
1845
|
const agent = otherParams.agent;
|
|
1832
1846
|
const result = await agent.call({
|
|
1833
|
-
prompt
|
|
1847
|
+
prompt
|
|
1834
1848
|
});
|
|
1835
1849
|
return { text: result.text };
|
|
1836
1850
|
} else {
|
|
1837
1851
|
const { agents, maxSteps, model, background } = otherParams;
|
|
1838
|
-
const managerAgent = new ManagerAgent(
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1852
|
+
const managerAgent = new ManagerAgent(
|
|
1853
|
+
{
|
|
1854
|
+
model,
|
|
1855
|
+
maxSteps,
|
|
1856
|
+
agents,
|
|
1857
|
+
name: "Manager LLM",
|
|
1858
|
+
background
|
|
1859
|
+
},
|
|
1860
|
+
this.context
|
|
1861
|
+
);
|
|
1862
|
+
const result = await managerAgent.call({ prompt });
|
|
1846
1863
|
return { text: result.text };
|
|
1847
1864
|
}
|
|
1848
1865
|
}
|
|
@@ -1879,10 +1896,13 @@ var WorkflowAgents = class {
|
|
|
1879
1896
|
*/
|
|
1880
1897
|
agent(params) {
|
|
1881
1898
|
const wrappedTools = wrapTools({ context: this.context, tools: params.tools });
|
|
1882
|
-
return new Agent(
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1899
|
+
return new Agent(
|
|
1900
|
+
{
|
|
1901
|
+
...params,
|
|
1902
|
+
tools: wrappedTools
|
|
1903
|
+
},
|
|
1904
|
+
this.context
|
|
1905
|
+
);
|
|
1886
1906
|
}
|
|
1887
1907
|
task(taskParameters) {
|
|
1888
1908
|
return new Task({ context: this.context, taskParameters });
|
|
@@ -2366,6 +2386,7 @@ function decodeBase64(base64) {
|
|
|
2366
2386
|
var import_qstash8 = require("@upstash/qstash");
|
|
2367
2387
|
var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
|
|
2368
2388
|
static disabledMessage = "disabled-qstash-worklfow-run";
|
|
2389
|
+
disabled = true;
|
|
2369
2390
|
/**
|
|
2370
2391
|
* overwrite the WorkflowContext.addStep method to always raise WorkflowAbort
|
|
2371
2392
|
* error in order to stop the execution whenever we encounter a step.
|
package/astro.mjs
CHANGED
|
@@ -1724,6 +1724,13 @@ var convertLangchainTool = (langchainTool) => {
|
|
|
1724
1724
|
// src/agents/agent.ts
|
|
1725
1725
|
import { z } from "zod";
|
|
1726
1726
|
import { generateText, tool as tool2, ToolExecutionError } from "ai";
|
|
1727
|
+
|
|
1728
|
+
// src/serve/utils.ts
|
|
1729
|
+
var isDisabledWorkflowContext = (context) => {
|
|
1730
|
+
return "disabled" in context;
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
// src/agents/agent.ts
|
|
1727
1734
|
var Agent = class {
|
|
1728
1735
|
name;
|
|
1729
1736
|
tools;
|
|
@@ -1731,13 +1738,15 @@ var Agent = class {
|
|
|
1731
1738
|
background;
|
|
1732
1739
|
model;
|
|
1733
1740
|
temparature;
|
|
1734
|
-
|
|
1741
|
+
context;
|
|
1742
|
+
constructor({ tools, maxSteps, background, name, model, temparature = 0.1 }, context) {
|
|
1735
1743
|
this.name = name;
|
|
1736
1744
|
this.tools = tools ?? {};
|
|
1737
1745
|
this.maxSteps = maxSteps;
|
|
1738
1746
|
this.background = background;
|
|
1739
1747
|
this.model = model;
|
|
1740
1748
|
this.temparature = temparature;
|
|
1749
|
+
this.context = context;
|
|
1741
1750
|
}
|
|
1742
1751
|
/**
|
|
1743
1752
|
* Trigger the agent by passing a prompt
|
|
@@ -1747,6 +1756,9 @@ var Agent = class {
|
|
|
1747
1756
|
*/
|
|
1748
1757
|
async call({ prompt }) {
|
|
1749
1758
|
try {
|
|
1759
|
+
if (isDisabledWorkflowContext(this.context)) {
|
|
1760
|
+
await this.context.sleep("abort", 0);
|
|
1761
|
+
}
|
|
1750
1762
|
const result = await generateText({
|
|
1751
1763
|
model: this.model,
|
|
1752
1764
|
tools: this.tools,
|
|
@@ -1809,14 +1821,17 @@ var ManagerAgent = class extends Agent {
|
|
|
1809
1821
|
model,
|
|
1810
1822
|
maxSteps,
|
|
1811
1823
|
name = "manager llm"
|
|
1812
|
-
}) {
|
|
1813
|
-
super(
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1824
|
+
}, context) {
|
|
1825
|
+
super(
|
|
1826
|
+
{
|
|
1827
|
+
background,
|
|
1828
|
+
maxSteps,
|
|
1829
|
+
tools: Object.fromEntries(agents.map((agent) => [agent.name, agent.asTool()])),
|
|
1830
|
+
name,
|
|
1831
|
+
model
|
|
1832
|
+
},
|
|
1833
|
+
context
|
|
1834
|
+
);
|
|
1820
1835
|
this.agents = agents;
|
|
1821
1836
|
}
|
|
1822
1837
|
};
|
|
@@ -1839,23 +1854,25 @@ var Task = class {
|
|
|
1839
1854
|
*/
|
|
1840
1855
|
async run() {
|
|
1841
1856
|
const { prompt, ...otherParams } = this.taskParameters;
|
|
1842
|
-
const safePrompt = await this.context.run("Get Prompt", () => prompt);
|
|
1843
1857
|
if ("agent" in otherParams) {
|
|
1844
1858
|
const agent = otherParams.agent;
|
|
1845
1859
|
const result = await agent.call({
|
|
1846
|
-
prompt
|
|
1860
|
+
prompt
|
|
1847
1861
|
});
|
|
1848
1862
|
return { text: result.text };
|
|
1849
1863
|
} else {
|
|
1850
1864
|
const { agents, maxSteps, model, background } = otherParams;
|
|
1851
|
-
const managerAgent = new ManagerAgent(
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1865
|
+
const managerAgent = new ManagerAgent(
|
|
1866
|
+
{
|
|
1867
|
+
model,
|
|
1868
|
+
maxSteps,
|
|
1869
|
+
agents,
|
|
1870
|
+
name: "Manager LLM",
|
|
1871
|
+
background
|
|
1872
|
+
},
|
|
1873
|
+
this.context
|
|
1874
|
+
);
|
|
1875
|
+
const result = await managerAgent.call({ prompt });
|
|
1859
1876
|
return { text: result.text };
|
|
1860
1877
|
}
|
|
1861
1878
|
}
|
|
@@ -1892,10 +1909,13 @@ var WorkflowAgents = class {
|
|
|
1892
1909
|
*/
|
|
1893
1910
|
agent(params) {
|
|
1894
1911
|
const wrappedTools = wrapTools({ context: this.context, tools: params.tools });
|
|
1895
|
-
return new Agent(
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1912
|
+
return new Agent(
|
|
1913
|
+
{
|
|
1914
|
+
...params,
|
|
1915
|
+
tools: wrappedTools
|
|
1916
|
+
},
|
|
1917
|
+
this.context
|
|
1918
|
+
);
|
|
1899
1919
|
}
|
|
1900
1920
|
task(taskParameters) {
|
|
1901
1921
|
return new Task({ context: this.context, taskParameters });
|
|
@@ -2379,6 +2399,7 @@ function decodeBase64(base64) {
|
|
|
2379
2399
|
import { Client as Client2 } from "@upstash/qstash";
|
|
2380
2400
|
var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
|
|
2381
2401
|
static disabledMessage = "disabled-qstash-worklfow-run";
|
|
2402
|
+
disabled = true;
|
|
2382
2403
|
/**
|
|
2383
2404
|
* overwrite the WorkflowContext.addStep method to always raise WorkflowAbort
|
|
2384
2405
|
* error in order to stop the execution whenever we encounter a step.
|
package/cloudflare.d.mts
CHANGED
package/cloudflare.d.ts
CHANGED
package/cloudflare.js
CHANGED
|
@@ -1711,6 +1711,13 @@ var convertLangchainTool = (langchainTool) => {
|
|
|
1711
1711
|
// src/agents/agent.ts
|
|
1712
1712
|
var import_zod = require("zod");
|
|
1713
1713
|
var import_ai2 = require("ai");
|
|
1714
|
+
|
|
1715
|
+
// src/serve/utils.ts
|
|
1716
|
+
var isDisabledWorkflowContext = (context) => {
|
|
1717
|
+
return "disabled" in context;
|
|
1718
|
+
};
|
|
1719
|
+
|
|
1720
|
+
// src/agents/agent.ts
|
|
1714
1721
|
var Agent = class {
|
|
1715
1722
|
name;
|
|
1716
1723
|
tools;
|
|
@@ -1718,13 +1725,15 @@ var Agent = class {
|
|
|
1718
1725
|
background;
|
|
1719
1726
|
model;
|
|
1720
1727
|
temparature;
|
|
1721
|
-
|
|
1728
|
+
context;
|
|
1729
|
+
constructor({ tools, maxSteps, background, name, model, temparature = 0.1 }, context) {
|
|
1722
1730
|
this.name = name;
|
|
1723
1731
|
this.tools = tools ?? {};
|
|
1724
1732
|
this.maxSteps = maxSteps;
|
|
1725
1733
|
this.background = background;
|
|
1726
1734
|
this.model = model;
|
|
1727
1735
|
this.temparature = temparature;
|
|
1736
|
+
this.context = context;
|
|
1728
1737
|
}
|
|
1729
1738
|
/**
|
|
1730
1739
|
* Trigger the agent by passing a prompt
|
|
@@ -1734,6 +1743,9 @@ var Agent = class {
|
|
|
1734
1743
|
*/
|
|
1735
1744
|
async call({ prompt }) {
|
|
1736
1745
|
try {
|
|
1746
|
+
if (isDisabledWorkflowContext(this.context)) {
|
|
1747
|
+
await this.context.sleep("abort", 0);
|
|
1748
|
+
}
|
|
1737
1749
|
const result = await (0, import_ai2.generateText)({
|
|
1738
1750
|
model: this.model,
|
|
1739
1751
|
tools: this.tools,
|
|
@@ -1796,14 +1808,17 @@ var ManagerAgent = class extends Agent {
|
|
|
1796
1808
|
model,
|
|
1797
1809
|
maxSteps,
|
|
1798
1810
|
name = "manager llm"
|
|
1799
|
-
}) {
|
|
1800
|
-
super(
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1811
|
+
}, context) {
|
|
1812
|
+
super(
|
|
1813
|
+
{
|
|
1814
|
+
background,
|
|
1815
|
+
maxSteps,
|
|
1816
|
+
tools: Object.fromEntries(agents.map((agent) => [agent.name, agent.asTool()])),
|
|
1817
|
+
name,
|
|
1818
|
+
model
|
|
1819
|
+
},
|
|
1820
|
+
context
|
|
1821
|
+
);
|
|
1807
1822
|
this.agents = agents;
|
|
1808
1823
|
}
|
|
1809
1824
|
};
|
|
@@ -1826,23 +1841,25 @@ var Task = class {
|
|
|
1826
1841
|
*/
|
|
1827
1842
|
async run() {
|
|
1828
1843
|
const { prompt, ...otherParams } = this.taskParameters;
|
|
1829
|
-
const safePrompt = await this.context.run("Get Prompt", () => prompt);
|
|
1830
1844
|
if ("agent" in otherParams) {
|
|
1831
1845
|
const agent = otherParams.agent;
|
|
1832
1846
|
const result = await agent.call({
|
|
1833
|
-
prompt
|
|
1847
|
+
prompt
|
|
1834
1848
|
});
|
|
1835
1849
|
return { text: result.text };
|
|
1836
1850
|
} else {
|
|
1837
1851
|
const { agents, maxSteps, model, background } = otherParams;
|
|
1838
|
-
const managerAgent = new ManagerAgent(
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1852
|
+
const managerAgent = new ManagerAgent(
|
|
1853
|
+
{
|
|
1854
|
+
model,
|
|
1855
|
+
maxSteps,
|
|
1856
|
+
agents,
|
|
1857
|
+
name: "Manager LLM",
|
|
1858
|
+
background
|
|
1859
|
+
},
|
|
1860
|
+
this.context
|
|
1861
|
+
);
|
|
1862
|
+
const result = await managerAgent.call({ prompt });
|
|
1846
1863
|
return { text: result.text };
|
|
1847
1864
|
}
|
|
1848
1865
|
}
|
|
@@ -1879,10 +1896,13 @@ var WorkflowAgents = class {
|
|
|
1879
1896
|
*/
|
|
1880
1897
|
agent(params) {
|
|
1881
1898
|
const wrappedTools = wrapTools({ context: this.context, tools: params.tools });
|
|
1882
|
-
return new Agent(
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1899
|
+
return new Agent(
|
|
1900
|
+
{
|
|
1901
|
+
...params,
|
|
1902
|
+
tools: wrappedTools
|
|
1903
|
+
},
|
|
1904
|
+
this.context
|
|
1905
|
+
);
|
|
1886
1906
|
}
|
|
1887
1907
|
task(taskParameters) {
|
|
1888
1908
|
return new Task({ context: this.context, taskParameters });
|
|
@@ -2366,6 +2386,7 @@ function decodeBase64(base64) {
|
|
|
2366
2386
|
var import_qstash8 = require("@upstash/qstash");
|
|
2367
2387
|
var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
|
|
2368
2388
|
static disabledMessage = "disabled-qstash-worklfow-run";
|
|
2389
|
+
disabled = true;
|
|
2369
2390
|
/**
|
|
2370
2391
|
* overwrite the WorkflowContext.addStep method to always raise WorkflowAbort
|
|
2371
2392
|
* error in order to stop the execution whenever we encounter a step.
|
package/cloudflare.mjs
CHANGED
package/express.d.mts
CHANGED
package/express.d.ts
CHANGED
package/express.js
CHANGED
|
@@ -25383,6 +25383,13 @@ var convertLangchainTool = (langchainTool) => {
|
|
|
25383
25383
|
// src/agents/agent.ts
|
|
25384
25384
|
var import_zod = require("zod");
|
|
25385
25385
|
var import_ai2 = require("ai");
|
|
25386
|
+
|
|
25387
|
+
// src/serve/utils.ts
|
|
25388
|
+
var isDisabledWorkflowContext = (context) => {
|
|
25389
|
+
return "disabled" in context;
|
|
25390
|
+
};
|
|
25391
|
+
|
|
25392
|
+
// src/agents/agent.ts
|
|
25386
25393
|
var Agent = class {
|
|
25387
25394
|
name;
|
|
25388
25395
|
tools;
|
|
@@ -25390,13 +25397,15 @@ var Agent = class {
|
|
|
25390
25397
|
background;
|
|
25391
25398
|
model;
|
|
25392
25399
|
temparature;
|
|
25393
|
-
|
|
25400
|
+
context;
|
|
25401
|
+
constructor({ tools, maxSteps, background, name, model, temparature = 0.1 }, context) {
|
|
25394
25402
|
this.name = name;
|
|
25395
25403
|
this.tools = tools ?? {};
|
|
25396
25404
|
this.maxSteps = maxSteps;
|
|
25397
25405
|
this.background = background;
|
|
25398
25406
|
this.model = model;
|
|
25399
25407
|
this.temparature = temparature;
|
|
25408
|
+
this.context = context;
|
|
25400
25409
|
}
|
|
25401
25410
|
/**
|
|
25402
25411
|
* Trigger the agent by passing a prompt
|
|
@@ -25406,6 +25415,9 @@ var Agent = class {
|
|
|
25406
25415
|
*/
|
|
25407
25416
|
async call({ prompt }) {
|
|
25408
25417
|
try {
|
|
25418
|
+
if (isDisabledWorkflowContext(this.context)) {
|
|
25419
|
+
await this.context.sleep("abort", 0);
|
|
25420
|
+
}
|
|
25409
25421
|
const result = await (0, import_ai2.generateText)({
|
|
25410
25422
|
model: this.model,
|
|
25411
25423
|
tools: this.tools,
|
|
@@ -25468,14 +25480,17 @@ var ManagerAgent = class extends Agent {
|
|
|
25468
25480
|
model,
|
|
25469
25481
|
maxSteps,
|
|
25470
25482
|
name = "manager llm"
|
|
25471
|
-
}) {
|
|
25472
|
-
super(
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
|
|
25477
|
-
|
|
25478
|
-
|
|
25483
|
+
}, context) {
|
|
25484
|
+
super(
|
|
25485
|
+
{
|
|
25486
|
+
background,
|
|
25487
|
+
maxSteps,
|
|
25488
|
+
tools: Object.fromEntries(agents.map((agent) => [agent.name, agent.asTool()])),
|
|
25489
|
+
name,
|
|
25490
|
+
model
|
|
25491
|
+
},
|
|
25492
|
+
context
|
|
25493
|
+
);
|
|
25479
25494
|
this.agents = agents;
|
|
25480
25495
|
}
|
|
25481
25496
|
};
|
|
@@ -25498,23 +25513,25 @@ var Task = class {
|
|
|
25498
25513
|
*/
|
|
25499
25514
|
async run() {
|
|
25500
25515
|
const { prompt, ...otherParams } = this.taskParameters;
|
|
25501
|
-
const safePrompt = await this.context.run("Get Prompt", () => prompt);
|
|
25502
25516
|
if ("agent" in otherParams) {
|
|
25503
25517
|
const agent = otherParams.agent;
|
|
25504
25518
|
const result = await agent.call({
|
|
25505
|
-
prompt
|
|
25519
|
+
prompt
|
|
25506
25520
|
});
|
|
25507
25521
|
return { text: result.text };
|
|
25508
25522
|
} else {
|
|
25509
25523
|
const { agents, maxSteps, model, background } = otherParams;
|
|
25510
|
-
const managerAgent = new ManagerAgent(
|
|
25511
|
-
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
|
|
25524
|
+
const managerAgent = new ManagerAgent(
|
|
25525
|
+
{
|
|
25526
|
+
model,
|
|
25527
|
+
maxSteps,
|
|
25528
|
+
agents,
|
|
25529
|
+
name: "Manager LLM",
|
|
25530
|
+
background
|
|
25531
|
+
},
|
|
25532
|
+
this.context
|
|
25533
|
+
);
|
|
25534
|
+
const result = await managerAgent.call({ prompt });
|
|
25518
25535
|
return { text: result.text };
|
|
25519
25536
|
}
|
|
25520
25537
|
}
|
|
@@ -25551,10 +25568,13 @@ var WorkflowAgents = class {
|
|
|
25551
25568
|
*/
|
|
25552
25569
|
agent(params) {
|
|
25553
25570
|
const wrappedTools = wrapTools({ context: this.context, tools: params.tools });
|
|
25554
|
-
return new Agent(
|
|
25555
|
-
|
|
25556
|
-
|
|
25557
|
-
|
|
25571
|
+
return new Agent(
|
|
25572
|
+
{
|
|
25573
|
+
...params,
|
|
25574
|
+
tools: wrappedTools
|
|
25575
|
+
},
|
|
25576
|
+
this.context
|
|
25577
|
+
);
|
|
25558
25578
|
}
|
|
25559
25579
|
task(taskParameters) {
|
|
25560
25580
|
return new Task({ context: this.context, taskParameters });
|
|
@@ -26038,6 +26058,7 @@ function decodeBase64(base64) {
|
|
|
26038
26058
|
var import_qstash8 = require("@upstash/qstash");
|
|
26039
26059
|
var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
|
|
26040
26060
|
static disabledMessage = "disabled-qstash-worklfow-run";
|
|
26061
|
+
disabled = true;
|
|
26041
26062
|
/**
|
|
26042
26063
|
* overwrite the WorkflowContext.addStep method to always raise WorkflowAbort
|
|
26043
26064
|
* error in order to stop the execution whenever we encounter a step.
|
package/express.mjs
CHANGED
package/h3.d.mts
CHANGED
package/h3.d.ts
CHANGED