0pflow 0.1.0-dev.00aaa03
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/__tests__/agent-parser.test.d.ts +2 -0
- package/dist/__tests__/agent-parser.test.d.ts.map +1 -0
- package/dist/__tests__/agent-parser.test.js +64 -0
- package/dist/__tests__/agent-parser.test.js.map +1 -0
- package/dist/__tests__/agent.e2e.test.d.ts +2 -0
- package/dist/__tests__/agent.e2e.test.d.ts.map +1 -0
- package/dist/__tests__/agent.e2e.test.js +90 -0
- package/dist/__tests__/agent.e2e.test.js.map +1 -0
- package/dist/__tests__/agent.test.d.ts +2 -0
- package/dist/__tests__/agent.test.d.ts.map +1 -0
- package/dist/__tests__/agent.test.js +30 -0
- package/dist/__tests__/agent.test.js.map +1 -0
- package/dist/__tests__/context.test.d.ts +2 -0
- package/dist/__tests__/context.test.d.ts.map +1 -0
- package/dist/__tests__/context.test.js +53 -0
- package/dist/__tests__/context.test.js.map +1 -0
- package/dist/__tests__/dbos.test.d.ts +2 -0
- package/dist/__tests__/dbos.test.d.ts.map +1 -0
- package/dist/__tests__/dbos.test.js +35 -0
- package/dist/__tests__/dbos.test.js.map +1 -0
- package/dist/__tests__/factory.test.d.ts +2 -0
- package/dist/__tests__/factory.test.d.ts.map +1 -0
- package/dist/__tests__/factory.test.js +126 -0
- package/dist/__tests__/factory.test.js.map +1 -0
- package/dist/__tests__/integration.e2e.test.d.ts +2 -0
- package/dist/__tests__/integration.e2e.test.d.ts.map +1 -0
- package/dist/__tests__/integration.e2e.test.js +127 -0
- package/dist/__tests__/integration.e2e.test.js.map +1 -0
- package/dist/__tests__/integration.test.d.ts +2 -0
- package/dist/__tests__/integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration.test.js +103 -0
- package/dist/__tests__/integration.test.js.map +1 -0
- package/dist/__tests__/model-config.test.d.ts +2 -0
- package/dist/__tests__/model-config.test.d.ts.map +1 -0
- package/dist/__tests__/model-config.test.js +48 -0
- package/dist/__tests__/model-config.test.js.map +1 -0
- package/dist/__tests__/node-registry.test.d.ts +2 -0
- package/dist/__tests__/node-registry.test.d.ts.map +1 -0
- package/dist/__tests__/node-registry.test.js +63 -0
- package/dist/__tests__/node-registry.test.js.map +1 -0
- package/dist/__tests__/node.test.d.ts +2 -0
- package/dist/__tests__/node.test.d.ts.map +1 -0
- package/dist/__tests__/node.test.js +48 -0
- package/dist/__tests__/node.test.js.map +1 -0
- package/dist/__tests__/registry.test.d.ts +2 -0
- package/dist/__tests__/registry.test.d.ts.map +1 -0
- package/dist/__tests__/registry.test.js +62 -0
- package/dist/__tests__/registry.test.js.map +1 -0
- package/dist/__tests__/web-tool.test.d.ts +2 -0
- package/dist/__tests__/web-tool.test.d.ts.map +1 -0
- package/dist/__tests__/web-tool.test.js +99 -0
- package/dist/__tests__/web-tool.test.js.map +1 -0
- package/dist/__tests__/workflow.test.d.ts +2 -0
- package/dist/__tests__/workflow.test.d.ts.map +1 -0
- package/dist/__tests__/workflow.test.js +49 -0
- package/dist/__tests__/workflow.test.js.map +1 -0
- package/dist/agent.d.ts +46 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +75 -0
- package/dist/agent.js.map +1 -0
- package/dist/cli/__tests__/discovery.test.d.ts +2 -0
- package/dist/cli/__tests__/discovery.test.d.ts.map +1 -0
- package/dist/cli/__tests__/discovery.test.js +26 -0
- package/dist/cli/__tests__/discovery.test.js.map +1 -0
- package/dist/cli/__tests__/env.test.d.ts +2 -0
- package/dist/cli/__tests__/env.test.d.ts.map +1 -0
- package/dist/cli/__tests__/env.test.js +32 -0
- package/dist/cli/__tests__/env.test.js.map +1 -0
- package/dist/cli/__tests__/runs.test.d.ts +2 -0
- package/dist/cli/__tests__/runs.test.d.ts.map +1 -0
- package/dist/cli/__tests__/runs.test.js +46 -0
- package/dist/cli/__tests__/runs.test.js.map +1 -0
- package/dist/cli/app.d.ts +6 -0
- package/dist/cli/app.d.ts.map +1 -0
- package/dist/cli/app.js +21 -0
- package/dist/cli/app.js.map +1 -0
- package/dist/cli/discovery.d.ts +24 -0
- package/dist/cli/discovery.d.ts.map +1 -0
- package/dist/cli/discovery.js +88 -0
- package/dist/cli/discovery.js.map +1 -0
- package/dist/cli/env.d.ts +15 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +54 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +423 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/install.d.ts +54 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +217 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/mcp/config.d.ts +5 -0
- package/dist/cli/mcp/config.d.ts.map +1 -0
- package/dist/cli/mcp/config.js +14 -0
- package/dist/cli/mcp/config.js.map +1 -0
- package/dist/cli/mcp/lib/templates.d.ts +12 -0
- package/dist/cli/mcp/lib/templates.d.ts.map +1 -0
- package/dist/cli/mcp/lib/templates.js +77 -0
- package/dist/cli/mcp/lib/templates.js.map +1 -0
- package/dist/cli/mcp/server.d.ts +5 -0
- package/dist/cli/mcp/server.d.ts.map +1 -0
- package/dist/cli/mcp/server.js +15 -0
- package/dist/cli/mcp/server.js.map +1 -0
- package/dist/cli/mcp/serverInfo.d.ts +7 -0
- package/dist/cli/mcp/serverInfo.d.ts.map +1 -0
- package/dist/cli/mcp/serverInfo.js +7 -0
- package/dist/cli/mcp/serverInfo.js.map +1 -0
- package/dist/cli/mcp/tools/createApp.d.ts +15 -0
- package/dist/cli/mcp/tools/createApp.d.ts.map +1 -0
- package/dist/cli/mcp/tools/createApp.js +81 -0
- package/dist/cli/mcp/tools/createApp.js.map +1 -0
- package/dist/cli/mcp/tools/createDatabase.d.ts +14 -0
- package/dist/cli/mcp/tools/createDatabase.d.ts.map +1 -0
- package/dist/cli/mcp/tools/createDatabase.js +66 -0
- package/dist/cli/mcp/tools/createDatabase.js.map +1 -0
- package/dist/cli/mcp/tools/index.d.ts +24 -0
- package/dist/cli/mcp/tools/index.d.ts.map +1 -0
- package/dist/cli/mcp/tools/index.js +11 -0
- package/dist/cli/mcp/tools/index.js.map +1 -0
- package/dist/cli/mcp/tools/setupAppSchema.d.ts +17 -0
- package/dist/cli/mcp/tools/setupAppSchema.d.ts.map +1 -0
- package/dist/cli/mcp/tools/setupAppSchema.js +157 -0
- package/dist/cli/mcp/tools/setupAppSchema.js.map +1 -0
- package/dist/cli/mcp/types.d.ts +3 -0
- package/dist/cli/mcp/types.d.ts.map +1 -0
- package/dist/cli/mcp/types.js +2 -0
- package/dist/cli/mcp/types.js.map +1 -0
- package/dist/cli/runs.d.ts +28 -0
- package/dist/cli/runs.d.ts.map +1 -0
- package/dist/cli/runs.js +70 -0
- package/dist/cli/runs.js.map +1 -0
- package/dist/cli/trace.d.ts +31 -0
- package/dist/cli/trace.d.ts.map +1 -0
- package/dist/cli/trace.js +264 -0
- package/dist/cli/trace.js.map +1 -0
- package/dist/context.d.ts +13 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +25 -0
- package/dist/context.js.map +1 -0
- package/dist/dbos.d.ts +15 -0
- package/dist/dbos.d.ts.map +1 -0
- package/dist/dbos.js +27 -0
- package/dist/dbos.js.map +1 -0
- package/dist/factory.d.ts +6 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +78 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +19 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +16 -0
- package/dist/node.js.map +1 -0
- package/dist/nodes/agent/executor.d.ts +70 -0
- package/dist/nodes/agent/executor.d.ts.map +1 -0
- package/dist/nodes/agent/executor.js +230 -0
- package/dist/nodes/agent/executor.js.map +1 -0
- package/dist/nodes/agent/index.d.ts +7 -0
- package/dist/nodes/agent/index.d.ts.map +1 -0
- package/dist/nodes/agent/index.js +5 -0
- package/dist/nodes/agent/index.js.map +1 -0
- package/dist/nodes/agent/model-config.d.ts +42 -0
- package/dist/nodes/agent/model-config.d.ts.map +1 -0
- package/dist/nodes/agent/model-config.js +58 -0
- package/dist/nodes/agent/model-config.js.map +1 -0
- package/dist/nodes/agent/parser.d.ts +22 -0
- package/dist/nodes/agent/parser.d.ts.map +1 -0
- package/dist/nodes/agent/parser.js +42 -0
- package/dist/nodes/agent/parser.js.map +1 -0
- package/dist/nodes/builtin/index.d.ts +9 -0
- package/dist/nodes/builtin/index.d.ts.map +1 -0
- package/dist/nodes/builtin/index.js +10 -0
- package/dist/nodes/builtin/index.js.map +1 -0
- package/dist/nodes/builtin/web.d.ts +25 -0
- package/dist/nodes/builtin/web.d.ts.map +1 -0
- package/dist/nodes/builtin/web.js +86 -0
- package/dist/nodes/builtin/web.js.map +1 -0
- package/dist/nodes/registry.d.ts +32 -0
- package/dist/nodes/registry.d.ts.map +1 -0
- package/dist/nodes/registry.js +58 -0
- package/dist/nodes/registry.js.map +1 -0
- package/dist/registry.d.ts +31 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +44 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/workflow.d.ts +26 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +50 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WorkflowContext, LogLevel } from "./types.js";
|
|
2
|
+
export interface ContextOptions {
|
|
3
|
+
/** Custom logger function (for testing or custom logging) */
|
|
4
|
+
logger?: (message: string, level: LogLevel) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Create a WorkflowContext for executing workflows
|
|
8
|
+
*
|
|
9
|
+
* Note: In Phase 2, this does not integrate with DBOS.
|
|
10
|
+
* DBOS step wrapping will be added when we integrate with the factory.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createWorkflowContext(options?: ContextOptions): WorkflowContext;
|
|
13
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CACrD;AAQD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,cAAmB,GAAG,eAAe,CAqBnF"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const defaultLogger = (message, level) => {
|
|
2
|
+
console[level === "debug" ? "log" : level](`[0pflow:${level}] ${message}`);
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Create a WorkflowContext for executing workflows
|
|
6
|
+
*
|
|
7
|
+
* Note: In Phase 2, this does not integrate with DBOS.
|
|
8
|
+
* DBOS step wrapping will be added when we integrate with the factory.
|
|
9
|
+
*/
|
|
10
|
+
export function createWorkflowContext(options = {}) {
|
|
11
|
+
const logger = options.logger ?? defaultLogger;
|
|
12
|
+
const ctx = {
|
|
13
|
+
run: async (executable, inputs) => {
|
|
14
|
+
// Validate inputs against schema
|
|
15
|
+
const validated = executable.inputSchema.parse(inputs);
|
|
16
|
+
// Execute (DBOS wrapping will be added in factory integration)
|
|
17
|
+
return executable.execute(ctx, validated);
|
|
18
|
+
},
|
|
19
|
+
log: (message, level = "info") => {
|
|
20
|
+
logger(message, level);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
return ctx;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAOA,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,KAAe,EAAE,EAAE;IACzD,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CACxC,WAAW,KAAK,KAAK,OAAO,EAAE,CAC/B,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAA0B,EAAE;IAChE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC;IAE/C,MAAM,GAAG,GAAoB;QAC3B,GAAG,EAAE,KAAK,EACR,UAAuC,EACvC,MAAc,EACI,EAAE;YACpB,iCAAiC;YACjC,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAEvD,+DAA+D;YAC/D,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC5C,CAAC;QAED,GAAG,EAAE,CAAC,OAAe,EAAE,QAAkB,MAAM,EAAE,EAAE;YACjD,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACzB,CAAC;KACF,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/dbos.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface DBOSConfig {
|
|
2
|
+
databaseUrl: string;
|
|
3
|
+
appName?: string;
|
|
4
|
+
}
|
|
5
|
+
/** Get the schema name for a given app */
|
|
6
|
+
export declare function getSchemaName(appName?: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Initialize DBOS with the given configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function initializeDBOS(config: DBOSConfig): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Shutdown DBOS gracefully
|
|
13
|
+
*/
|
|
14
|
+
export declare function shutdownDBOS(): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=dbos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dbos.d.ts","sourceRoot":"","sources":["../src/dbos.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0CAA0C;AAC1C,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAItD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAElD"}
|
package/dist/dbos.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// packages/core/src/dbos.ts
|
|
2
|
+
import { DBOS } from "@dbos-inc/dbos-sdk";
|
|
3
|
+
/** Get the schema name for a given app */
|
|
4
|
+
export function getSchemaName(appName) {
|
|
5
|
+
const name = appName ?? "opflow";
|
|
6
|
+
// Convert to valid schema name: lowercase, replace non-alphanumeric with underscore
|
|
7
|
+
return `${name.toLowerCase().replace(/[^a-z0-9]/g, "_")}_dbos`;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Initialize DBOS with the given configuration
|
|
11
|
+
*/
|
|
12
|
+
export async function initializeDBOS(config) {
|
|
13
|
+
DBOS.setConfig({
|
|
14
|
+
name: config.appName ?? "opflow",
|
|
15
|
+
systemDatabaseUrl: config.databaseUrl,
|
|
16
|
+
systemDatabaseSchemaName: getSchemaName(config.appName),
|
|
17
|
+
logLevel: process.env.LOG_LEVEL ?? "info",
|
|
18
|
+
});
|
|
19
|
+
await DBOS.launch();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Shutdown DBOS gracefully
|
|
23
|
+
*/
|
|
24
|
+
export async function shutdownDBOS() {
|
|
25
|
+
await DBOS.shutdown();
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=dbos.js.map
|
package/dist/dbos.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dbos.js","sourceRoot":"","sources":["../src/dbos.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAO1C,0CAA0C;AAC1C,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,IAAI,GAAG,OAAO,IAAI,QAAQ,CAAC;IACjC,oFAAoF;IACpF,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAkB;IACrD,IAAI,CAAC,SAAS,CAAC;QACb,IAAI,EAAE,MAAM,CAAC,OAAO,IAAI,QAAQ;QAChC,iBAAiB,EAAE,MAAM,CAAC,WAAW;QACrC,wBAAwB,EAAE,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;QACvD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;KAC1C,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAC;AAOtE;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAwFtE"}
|
package/dist/factory.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Registry } from "./registry.js";
|
|
2
|
+
import { initializeDBOS, shutdownDBOS } from "./dbos.js";
|
|
3
|
+
import { NodeRegistry } from "./nodes/registry.js";
|
|
4
|
+
import { configureAgentRuntime } from "./agent.js";
|
|
5
|
+
import { Workflow } from "./workflow.js";
|
|
6
|
+
/**
|
|
7
|
+
* Create a 0pflow instance
|
|
8
|
+
*/
|
|
9
|
+
export async function create0pflow(config) {
|
|
10
|
+
// Build registry from provided executables (before DBOS init)
|
|
11
|
+
const registry = new Registry({
|
|
12
|
+
workflows: config.workflows,
|
|
13
|
+
agents: config.agents,
|
|
14
|
+
nodes: config.nodes,
|
|
15
|
+
});
|
|
16
|
+
// Pre-create wrapper workflows for all nodes BEFORE DBOS.launch()
|
|
17
|
+
// This is required because DBOS doesn't allow registering workflows after launch
|
|
18
|
+
const nodeWrapperCache = new Map();
|
|
19
|
+
for (const nodeName of registry.listNodes()) {
|
|
20
|
+
const node = registry.getNode(nodeName);
|
|
21
|
+
if (node) {
|
|
22
|
+
const wrapper = Workflow.create({
|
|
23
|
+
name: `_node_${nodeName}`,
|
|
24
|
+
description: `Wrapper workflow for node ${nodeName}`,
|
|
25
|
+
version: 1,
|
|
26
|
+
inputSchema: node.inputSchema,
|
|
27
|
+
outputSchema: node.outputSchema,
|
|
28
|
+
run: async (ctx, nodeInputs) => ctx.run(node, nodeInputs),
|
|
29
|
+
});
|
|
30
|
+
nodeWrapperCache.set(nodeName, wrapper);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Initialize DBOS for durability (after all workflows are registered)
|
|
34
|
+
await initializeDBOS({ databaseUrl: config.databaseUrl, appName: config.appName });
|
|
35
|
+
// Build node registry (includes built-in nodes + user nodes)
|
|
36
|
+
// Nodes can be used both via ctx.run() and as agent tools
|
|
37
|
+
const nodeRegistry = new NodeRegistry({
|
|
38
|
+
userNodes: config.nodes,
|
|
39
|
+
});
|
|
40
|
+
// Configure agent runtime with node registry and model config
|
|
41
|
+
configureAgentRuntime({
|
|
42
|
+
nodeRegistry,
|
|
43
|
+
modelConfig: config.modelConfig,
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
listWorkflows: () => registry.listWorkflows(),
|
|
47
|
+
getWorkflow: (name) => registry.getWorkflow(name),
|
|
48
|
+
triggerWorkflow: async (name, inputs) => {
|
|
49
|
+
const workflow = registry.getWorkflow(name);
|
|
50
|
+
if (!workflow) {
|
|
51
|
+
throw new Error(`Workflow "${name}" not found`);
|
|
52
|
+
}
|
|
53
|
+
// Validate inputs and execute (workflow handles DBOS context internally)
|
|
54
|
+
const validated = workflow.inputSchema.parse(inputs);
|
|
55
|
+
return workflow.execute(null, validated);
|
|
56
|
+
},
|
|
57
|
+
listNodes: () => registry.listNodes(),
|
|
58
|
+
getNode: (name) => registry.getNode(name),
|
|
59
|
+
triggerNode: async (name, inputs) => {
|
|
60
|
+
const node = registry.getNode(name);
|
|
61
|
+
if (!node) {
|
|
62
|
+
throw new Error(`Node "${name}" not found`);
|
|
63
|
+
}
|
|
64
|
+
// Get pre-created wrapper workflow for this node
|
|
65
|
+
const wrapper = nodeWrapperCache.get(name);
|
|
66
|
+
if (!wrapper) {
|
|
67
|
+
throw new Error(`No wrapper workflow found for node "${name}"`);
|
|
68
|
+
}
|
|
69
|
+
// Validate inputs and execute via wrapper workflow
|
|
70
|
+
const validated = node.inputSchema.parse(inputs);
|
|
71
|
+
return wrapper.execute(null, validated);
|
|
72
|
+
},
|
|
73
|
+
shutdown: async () => {
|
|
74
|
+
await shutdownDBOS();
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings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IAAI,KAAK,CAAC,SAAS,IAAI,aAAa,CAAC,CAAC;YAC9C,CAAC;YAED,iDAAiD;YACjD,MAAM,OAAO,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,GAAG,CAAC,CAAC;YAClE,CAAC;YAED,mDAAmD;YACnD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAkC,EAAE,SAAS,CAAe,CAAC;QACtF,CAAC;QAED,QAAQ,EAAE,KAAK,IAAI,EAAE;YACnB,MAAM,YAAY,EAAE,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const VERSION = "0.1.0";
|
|
2
|
+
export { create0pflow } from "./factory.js";
|
|
3
|
+
export { getSchemaName } from "./dbos.js";
|
|
4
|
+
export { Node } from "./node.js";
|
|
5
|
+
export type { NodeDefinition } from "./node.js";
|
|
6
|
+
export { Workflow } from "./workflow.js";
|
|
7
|
+
export type { WorkflowDefinition, WorkflowExecutable } from "./workflow.js";
|
|
8
|
+
export { Agent } from "./agent.js";
|
|
9
|
+
export type { AgentDefinition, AgentExecutable } from "./agent.js";
|
|
10
|
+
export { NodeRegistry } from "./nodes/registry.js";
|
|
11
|
+
export type { NodeRegistryConfig } from "./nodes/registry.js";
|
|
12
|
+
export { webRead, builtinNodes } from "./nodes/builtin/index.js";
|
|
13
|
+
export { parseAgentSpec, parseAgentSpecContent } from "./nodes/agent/parser.js";
|
|
14
|
+
export type { AgentSpec } from "./nodes/agent/parser.js";
|
|
15
|
+
export { getDefaultModelConfig, createModelAndProvider, parseModelString, } from "./nodes/agent/model-config.js";
|
|
16
|
+
export type { ModelConfig, ModelProvider, ModelAndProvider, Provider, } from "./nodes/agent/model-config.js";
|
|
17
|
+
export { executeAgent } from "./nodes/agent/executor.js";
|
|
18
|
+
export type { AgentExecutionResult, ExecuteAgentOptions, AgentTool, AgentTools, } from "./nodes/agent/executor.js";
|
|
19
|
+
export type { Executable, WorkflowContext, LogLevel, PflowConfig, Pflow, } from "./types.js";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE5E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGjE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChF,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,QAAQ,GACT,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACT,UAAU,GACX,MAAM,2BAA2B,CAAC;AAGnC,YAAY,EACV,UAAU,EACV,eAAe,EACf,QAAQ,EACR,WAAW,EACX,KAAK,GACN,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// packages/core/src/index.ts
|
|
2
|
+
// 0pflow - AI-native workflow engine
|
|
3
|
+
export const VERSION = "0.1.0";
|
|
4
|
+
// Factory
|
|
5
|
+
export { create0pflow } from "./factory.js";
|
|
6
|
+
export { getSchemaName } from "./dbos.js";
|
|
7
|
+
// Executable factories
|
|
8
|
+
export { Node } from "./node.js";
|
|
9
|
+
export { Workflow } from "./workflow.js";
|
|
10
|
+
export { Agent } from "./agent.js";
|
|
11
|
+
// Node registry (for agent tool resolution)
|
|
12
|
+
export { NodeRegistry } from "./nodes/registry.js";
|
|
13
|
+
export { webRead, builtinNodes } from "./nodes/builtin/index.js";
|
|
14
|
+
// Agent internals (for advanced use cases)
|
|
15
|
+
export { parseAgentSpec, parseAgentSpecContent } from "./nodes/agent/parser.js";
|
|
16
|
+
export { getDefaultModelConfig, createModelAndProvider, parseModelString, } from "./nodes/agent/model-config.js";
|
|
17
|
+
export { executeAgent } from "./nodes/agent/executor.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,qCAAqC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,UAAU;AACV,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,uBAAuB;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEjE,2CAA2C;AAC3C,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Executable, WorkflowContext } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Definition for creating a function node
|
|
5
|
+
*/
|
|
6
|
+
export interface NodeDefinition<TInput, TOutput> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: z.ZodType<TInput>;
|
|
10
|
+
outputSchema?: z.ZodType<TOutput>;
|
|
11
|
+
execute: (ctx: WorkflowContext, inputs: TInput) => Promise<TOutput>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Factory for creating function node executables
|
|
15
|
+
*/
|
|
16
|
+
export declare const Node: {
|
|
17
|
+
create<TInput, TOutput>(definition: NodeDefinition<TInput, TOutput>): Executable<TInput, TOutput>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,MAAM,EAAE,OAAO;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,YAAY,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACrE;AAED;;GAEG;AACH,eAAO,MAAM,IAAI;WACR,MAAM,EAAE,OAAO,cACR,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1C,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC;CAU/B,CAAC"}
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory for creating function node executables
|
|
3
|
+
*/
|
|
4
|
+
export const Node = {
|
|
5
|
+
create(definition) {
|
|
6
|
+
return {
|
|
7
|
+
name: definition.name,
|
|
8
|
+
type: "node",
|
|
9
|
+
description: definition.description,
|
|
10
|
+
inputSchema: definition.inputSchema,
|
|
11
|
+
outputSchema: definition.outputSchema,
|
|
12
|
+
execute: definition.execute,
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,MAAM,CACJ,UAA2C;QAE3C,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,YAAY,EAAE,UAAU,CAAC,YAAY;YACrC,OAAO,EAAE,UAAU,CAAC,OAAO;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentSpec } from "./parser.js";
|
|
3
|
+
import type { ModelConfig } from "./model-config.js";
|
|
4
|
+
import type { NodeRegistry } from "../registry.js";
|
|
5
|
+
import type { Executable, WorkflowContext } from "../../types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Result of agent execution
|
|
8
|
+
*/
|
|
9
|
+
export interface AgentExecutionResult<TOutput = unknown> {
|
|
10
|
+
/** Final text response from the model */
|
|
11
|
+
text: string;
|
|
12
|
+
/** Parsed structured output (if outputSchema provided) */
|
|
13
|
+
output: TOutput;
|
|
14
|
+
/** Number of steps taken in the agentic loop */
|
|
15
|
+
steps: number;
|
|
16
|
+
/** Details of all tool calls made */
|
|
17
|
+
toolCalls: Array<{
|
|
18
|
+
toolName: string;
|
|
19
|
+
args: unknown;
|
|
20
|
+
result: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
type AnyExecutable = Executable<any, any>;
|
|
24
|
+
/**
|
|
25
|
+
* A provider tool from the AI SDK (e.g., openai.tools.webSearch()).
|
|
26
|
+
* Using a minimal interface since ToolSet's type is overly restrictive.
|
|
27
|
+
*/
|
|
28
|
+
type ProviderTool = {
|
|
29
|
+
execute?: (...args: any[]) => any;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A tool that can be passed to an agent.
|
|
34
|
+
* Can be either a node (Executable) or a provider tool from AI SDK.
|
|
35
|
+
*/
|
|
36
|
+
export type AgentTool = AnyExecutable | ProviderTool;
|
|
37
|
+
/**
|
|
38
|
+
* Tools available to an agent, keyed by tool name.
|
|
39
|
+
*/
|
|
40
|
+
export type AgentTools = Record<string, AgentTool>;
|
|
41
|
+
/**
|
|
42
|
+
* Options for agent execution
|
|
43
|
+
*/
|
|
44
|
+
export interface ExecuteAgentOptions<TOutput = unknown> {
|
|
45
|
+
/** Workflow context for tool execution */
|
|
46
|
+
ctx: WorkflowContext;
|
|
47
|
+
/** Parsed agent spec (for system prompt and model override) */
|
|
48
|
+
spec: AgentSpec;
|
|
49
|
+
/** User message / input to the agent */
|
|
50
|
+
userMessage: string;
|
|
51
|
+
/** Tools available to the agent, keyed by name */
|
|
52
|
+
tools: AgentTools;
|
|
53
|
+
/** Node registry (unused, kept for backward compatibility) */
|
|
54
|
+
nodeRegistry: NodeRegistry;
|
|
55
|
+
/** Optional model configuration override */
|
|
56
|
+
modelConfig?: ModelConfig;
|
|
57
|
+
/** Optional max steps override (defaults to spec.maxSteps or 10) */
|
|
58
|
+
maxSteps?: number;
|
|
59
|
+
/** Optional output schema for structured outputs */
|
|
60
|
+
outputSchema?: z.ZodType<TOutput>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Execute an agent with the given inputs
|
|
64
|
+
*
|
|
65
|
+
* Uses Vercel AI SDK's generateText with tool calling support.
|
|
66
|
+
* Supports structured outputs when outputSchema is provided.
|
|
67
|
+
*/
|
|
68
|
+
export declare function executeAgent<TOutput = unknown>(options: ExecuteAgentOptions<TOutput>): Promise<AgentExecutionResult<TOutput>>;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/nodes/agent/executor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE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C;IAClB,oDAAoD;IACpD,YAAY,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;CACnC;AAgDD;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,GAAG,OAAO,EAClD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACpC,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CA2MxC"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// packages/core/src/nodes/agent/executor.ts
|
|
2
|
+
import { generateText, tool, Output, stepCountIs } from "ai";
|
|
3
|
+
import { DBOS } from "@dbos-inc/dbos-sdk";
|
|
4
|
+
import { createModelAndProvider, getDefaultModelConfig, parseModelString } from "./model-config.js";
|
|
5
|
+
/**
|
|
6
|
+
* Check if a tool is an Executable (node) vs a CoreTool (provider tool).
|
|
7
|
+
* Executables have a `type` property ("node", "agent", "workflow").
|
|
8
|
+
*/
|
|
9
|
+
function isExecutable(t) {
|
|
10
|
+
return ("type" in t &&
|
|
11
|
+
typeof t.type === "string" &&
|
|
12
|
+
["node", "agent", "workflow"].includes(t.type));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert an Executable to Vercel AI SDK tool format
|
|
16
|
+
*/
|
|
17
|
+
function convertNodeToAITool(executable, ctx) {
|
|
18
|
+
return tool({
|
|
19
|
+
description: executable.description,
|
|
20
|
+
inputSchema: executable.inputSchema,
|
|
21
|
+
execute: async (args) => {
|
|
22
|
+
// Use ctx.run() to wrap in DBOS step for durability
|
|
23
|
+
const result = await ctx.run(executable, args);
|
|
24
|
+
return result;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Wrap a tool's execute function in a DBOS step for durability.
|
|
30
|
+
* Works for both converted node tools and provider tools.
|
|
31
|
+
*/
|
|
32
|
+
function wrapToolInStep(aiTool, toolName) {
|
|
33
|
+
if (!aiTool.execute) {
|
|
34
|
+
return aiTool; // No execute to wrap
|
|
35
|
+
}
|
|
36
|
+
const originalExecute = aiTool.execute;
|
|
37
|
+
return {
|
|
38
|
+
...aiTool,
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
execute: async (...args) => {
|
|
41
|
+
return DBOS.runStep(async () => originalExecute(...args), { name: toolName });
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Execute an agent with the given inputs
|
|
47
|
+
*
|
|
48
|
+
* Uses Vercel AI SDK's generateText with tool calling support.
|
|
49
|
+
* Supports structured outputs when outputSchema is provided.
|
|
50
|
+
*/
|
|
51
|
+
export async function executeAgent(options) {
|
|
52
|
+
const { ctx, spec, userMessage, tools: inputTools, modelConfig: providedModelConfig, maxSteps: providedMaxSteps, outputSchema, } = options;
|
|
53
|
+
// Resolve model configuration
|
|
54
|
+
// Priority: spec.model > providedModelConfig > default
|
|
55
|
+
let modelConfig = providedModelConfig ?? getDefaultModelConfig();
|
|
56
|
+
if (spec.model) {
|
|
57
|
+
const parsed = parseModelString(spec.model);
|
|
58
|
+
modelConfig = {
|
|
59
|
+
...modelConfig,
|
|
60
|
+
...parsed,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Create the model instance
|
|
64
|
+
const { model } = createModelAndProvider(modelConfig);
|
|
65
|
+
// Convert tools to AI SDK tools
|
|
66
|
+
// Don't annotate as ToolSet - let TypeScript infer so generateText's generics work
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
const tools = {};
|
|
69
|
+
// Track provider-executed tools (no client-side execute) for post-hoc recording
|
|
70
|
+
const providerExecutedTools = new Set();
|
|
71
|
+
for (const [toolName, t] of Object.entries(inputTools)) {
|
|
72
|
+
if (isExecutable(t)) {
|
|
73
|
+
// It's a node - convert to AI SDK tool
|
|
74
|
+
// ctx.run() already wraps in DBOS step for durability
|
|
75
|
+
tools[toolName] = convertNodeToAITool(t, ctx);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// It's a provider tool
|
|
79
|
+
if (t.execute) {
|
|
80
|
+
// Has execute function - wrap in DBOS step for durability
|
|
81
|
+
tools[toolName] = wrapToolInStep(t, toolName);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// No execute function - provider-executed (e.g., OpenAI webSearch)
|
|
85
|
+
// Will be recorded after generateText completes
|
|
86
|
+
providerExecutedTools.add(toolName);
|
|
87
|
+
tools[toolName] = t;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Determine max steps
|
|
92
|
+
// Add 1 extra step for final output generation when using structured outputs
|
|
93
|
+
const baseMaxSteps = providedMaxSteps ?? spec.maxSteps ?? 10;
|
|
94
|
+
const maxSteps = outputSchema ? baseMaxSteps + 1 : baseMaxSteps;
|
|
95
|
+
// Build the generateText options
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
const generateOptions = {
|
|
98
|
+
model,
|
|
99
|
+
system: spec.systemPrompt,
|
|
100
|
+
prompt: userMessage,
|
|
101
|
+
stopWhen: stepCountIs(maxSteps),
|
|
102
|
+
};
|
|
103
|
+
// Only add tools if we have any
|
|
104
|
+
if (Object.keys(tools).length > 0) {
|
|
105
|
+
generateOptions.tools = tools;
|
|
106
|
+
}
|
|
107
|
+
// Add output schema if provided
|
|
108
|
+
if (outputSchema) {
|
|
109
|
+
generateOptions.output = Output.object({ schema: outputSchema });
|
|
110
|
+
}
|
|
111
|
+
// Execute the agentic loop
|
|
112
|
+
let result;
|
|
113
|
+
try {
|
|
114
|
+
result = await generateText(generateOptions);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
// Debug logging for failed generations
|
|
118
|
+
ctx.log(`Agent execution failed: ${error.message}`, "error");
|
|
119
|
+
ctx.log(`Model: ${modelConfig.provider}/${modelConfig.modelId}`, "debug");
|
|
120
|
+
ctx.log(`Max steps: ${maxSteps}`, "debug");
|
|
121
|
+
ctx.log(`Has output schema: ${!!outputSchema}`, "debug");
|
|
122
|
+
ctx.log(`Tools: ${Object.keys(tools).join(", ")}`, "debug");
|
|
123
|
+
// Check if error has partial results (AI SDK sometimes includes them)
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
|
+
const anyError = error;
|
|
126
|
+
if (anyError.steps) {
|
|
127
|
+
ctx.log(`Steps completed: ${anyError.steps.length}`, "debug");
|
|
128
|
+
for (let i = 0; i < anyError.steps.length; i++) {
|
|
129
|
+
const step = anyError.steps[i];
|
|
130
|
+
ctx.log(`Step ${i}: toolCalls=${step.toolCalls?.length ?? 0}, text=${step.text?.substring(0, 100) ?? "none"}`, "debug");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (anyError.text) {
|
|
134
|
+
ctx.log(`Final text: ${anyError.text.substring(0, 500)}`, "debug");
|
|
135
|
+
}
|
|
136
|
+
if (anyError.response) {
|
|
137
|
+
ctx.log(`Response: ${JSON.stringify(anyError.response).substring(0, 500)}`, "debug");
|
|
138
|
+
}
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
// Log all tool calls for observability
|
|
142
|
+
for (const step of result.steps) {
|
|
143
|
+
for (const toolCall of step.toolCalls ?? []) {
|
|
144
|
+
const toolResult = step.toolResults?.find(
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
+
(r) => r.toolCallId === toolCall.toolCallId);
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
|
+
const args = toolCall.input ?? toolCall.args;
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
|
+
const resultValue = toolResult?.output ?? toolResult?.result;
|
|
151
|
+
ctx.log(`Tool call: ${toolCall.toolName} args=${JSON.stringify(args)} result=${JSON.stringify(resultValue)?.substring(0, 500)}`, "debug");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Record provider-executed tool calls as DBOS steps for observability
|
|
155
|
+
// These tools (like OpenAI webSearch) run server-side, so we record after the fact
|
|
156
|
+
//
|
|
157
|
+
// NOTE: OpenAI's web_search tool returns only URLs in sources, not titles/snippets.
|
|
158
|
+
// When using structured output (json_schema), OpenAI doesn't return URL citation
|
|
159
|
+
// annotations - the annotations array is empty. The model embeds markdown-style
|
|
160
|
+
// citations in the text instead (e.g., [title](url)).
|
|
161
|
+
// See: https://github.com/openai/openai-agents-python/issues/2051
|
|
162
|
+
for (const step of result.steps) {
|
|
163
|
+
for (const toolCall of step.toolCalls ?? []) {
|
|
164
|
+
if (providerExecutedTools.has(toolCall.toolName)) {
|
|
165
|
+
const toolResult = step.toolResults?.find(
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
|
+
(r) => r.toolCallId === toolCall.toolCallId);
|
|
168
|
+
// Record as a DBOS step (already executed server-side, recording for observability)
|
|
169
|
+
await DBOS.runStep(async () => ({
|
|
170
|
+
toolName: toolCall.toolName,
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
172
|
+
args: toolCall.input ?? toolCall.args,
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
+
result: toolResult?.output ?? toolResult?.result,
|
|
175
|
+
}), { name: `tool:${toolCall.toolName}` });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Collect all tool calls from all steps
|
|
180
|
+
const allToolCalls = [];
|
|
181
|
+
for (const step of result.steps) {
|
|
182
|
+
if (step.toolCalls) {
|
|
183
|
+
for (const toolCall of step.toolCalls) {
|
|
184
|
+
// Find the corresponding result
|
|
185
|
+
const toolResult = step.toolResults?.find(
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
187
|
+
(r) => r.toolCallId === toolCall.toolCallId);
|
|
188
|
+
allToolCalls.push({
|
|
189
|
+
toolName: toolCall.toolName,
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
191
|
+
args: toolCall.input ?? toolCall.args,
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
193
|
+
result: toolResult?.output ?? toolResult?.result,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// Extract output
|
|
199
|
+
// If we have an output schema, use the parsed object
|
|
200
|
+
// Otherwise, use the text response
|
|
201
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
|
+
let output;
|
|
203
|
+
if (outputSchema) {
|
|
204
|
+
// The result.output contains the parsed structured output
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
|
+
output = result.output;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
// Try to parse JSON from the text response
|
|
210
|
+
const text = result.text.trim();
|
|
211
|
+
if (text.startsWith("{") || text.startsWith("[")) {
|
|
212
|
+
try {
|
|
213
|
+
output = JSON.parse(text);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
output = text;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
output = text;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
text: result.text,
|
|
225
|
+
output,
|
|
226
|
+
steps: result.steps.length,
|
|
227
|
+
toolCalls: allToolCalls,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/nodes/agent/executor.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,OAAO,EAAE,sBAAs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AC;IAClC,CAAC;SAAM,CAAC;QACN,2CAA2C;QAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC;gBACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM;QACN,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;QAC1B,SAAS,EAAE,YAAY;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { parseAgentSpec, parseAgentSpecContent } from "./parser.js";
|
|
2
|
+
export type { AgentSpec } from "./parser.js";
|
|
3
|
+
export { getDefaultModelConfig, createModelAndProvider, parseModelString, } from "./model-config.js";
|
|
4
|
+
export type { ModelConfig, ModelProvider, ModelAndProvider, Provider } from "./model-config.js";
|
|
5
|
+
export { executeAgent } from "./executor.js";
|
|
6
|
+
export type { AgentExecutionResult, ExecuteAgentOptions } from "./executor.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nodes/agent/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEhG,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// packages/core/src/nodes/agent/index.ts
|
|
2
|
+
export { parseAgentSpec, parseAgentSpecContent } from "./parser.js";
|
|
3
|
+
export { getDefaultModelConfig, createModelAndProvider, parseModelString, } from "./model-config.js";
|
|
4
|
+
export { executeAgent } from "./executor.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nodes/agent/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|