@vantageos/agent-engine 0.3.0-alpha.0 → 0.4.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/README.md +1 -1
- package/dist/component/_generated/api.d.ts +26 -2
- package/dist/component/_generated/component.d.ts +20 -1
- package/dist/component/_generated/dataModel.d.ts +38 -0
- package/dist/component/_generated/server.d.ts +106 -0
- package/dist/component/engine/agents.d.ts +3 -3
- package/dist/component/engine/awaitEventTimeout.d.ts +6 -5
- package/dist/component/engine/awaitEventTimeout.js +50 -33
- package/dist/component/engine/delegation.d.ts +6 -6
- package/dist/component/engine/durableJob.d.ts +4 -27
- package/dist/component/engine/durableJob.js +14 -217
- package/dist/component/engine/mandates.d.ts +2 -2
- package/dist/component/engine/resolvers.js +1 -1
- package/dist/component/engine/sessions.d.ts +2 -2
- package/dist/component/engine/sessions.js +10 -38
- package/dist/component/engine/streams.d.ts +1 -1
- package/dist/component/engine/wakeup.d.ts +2 -2
- package/dist/component/engine/workflows.d.ts +3 -27
- package/dist/component/engine/workflows.js +2 -66
- package/dist/component/engine/world.d.ts +28 -30
- package/dist/component/engine/world.js +79 -42
- package/dist/component/schema.d.ts +31 -132
- package/dist/component/schema.js +3 -59
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ components.agentEngine.engine.resolvers.resolveManifest({
|
|
|
106
106
|
components.agentEngine.engine.sessions.start({
|
|
107
107
|
orgId, agentId, createdBy,
|
|
108
108
|
}) -> { sessionId: string /* the world runId */, workflowId: string }
|
|
109
|
-
// 0.3.0: every `sessionId` below IS that runId (string); an unknown,
|
|
109
|
+
// 0.3.0: every `sessionId` below IS that runId (string); an unknown,
|
|
110
110
|
// cross-org or non-session id is refused as "Session not found".
|
|
111
111
|
components.agentEngine.engine.sessions.sendTurn({
|
|
112
112
|
orgId, sessionId, input,
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `api` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
1
9
|
import type * as engine_agents from "../engine/agents.js";
|
|
2
10
|
import type * as engine_awaitEventTimeout from "../engine/awaitEventTimeout.js";
|
|
3
11
|
import type * as engine_connections from "../engine/connections.js";
|
|
@@ -20,7 +28,7 @@ import type * as lib_auth from "../lib/auth.js";
|
|
|
20
28
|
import type * as lib_connectionSecret from "../lib/connectionSecret.js";
|
|
21
29
|
import type * as testFixtures_callerSteps from "../testFixtures/callerSteps.js";
|
|
22
30
|
import type * as testFixtures_delegationDemoWorkflow from "../testFixtures/delegationDemoWorkflow.js";
|
|
23
|
-
import type * as
|
|
31
|
+
import type * as testFixtures_runBinding from "../testFixtures/runBinding.js";
|
|
24
32
|
import type * as testFixtures_sandboxDemoWorkflow from "../testFixtures/sandboxDemoWorkflow.js";
|
|
25
33
|
import type * as testFixtures_vpTool from "../testFixtures/vpTool.js";
|
|
26
34
|
import type * as testFixtures_wakeupDemoWorkflow from "../testFixtures/wakeupDemoWorkflow.js";
|
|
@@ -49,13 +57,29 @@ declare const fullApi: ApiFromModules<{
|
|
|
49
57
|
"lib/connectionSecret": typeof lib_connectionSecret;
|
|
50
58
|
"testFixtures/callerSteps": typeof testFixtures_callerSteps;
|
|
51
59
|
"testFixtures/delegationDemoWorkflow": typeof testFixtures_delegationDemoWorkflow;
|
|
52
|
-
"testFixtures/
|
|
60
|
+
"testFixtures/runBinding": typeof testFixtures_runBinding;
|
|
53
61
|
"testFixtures/sandboxDemoWorkflow": typeof testFixtures_sandboxDemoWorkflow;
|
|
54
62
|
"testFixtures/vpTool": typeof testFixtures_vpTool;
|
|
55
63
|
"testFixtures/wakeupDemoWorkflow": typeof testFixtures_wakeupDemoWorkflow;
|
|
56
64
|
"testFixtures/wakeupWork": typeof testFixtures_wakeupWork;
|
|
57
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
68
|
+
*
|
|
69
|
+
* Usage:
|
|
70
|
+
* ```js
|
|
71
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
58
74
|
export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
|
|
75
|
+
/**
|
|
76
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
77
|
+
*
|
|
78
|
+
* Usage:
|
|
79
|
+
* ```js
|
|
80
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
59
83
|
export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
|
|
60
84
|
export declare const components: {
|
|
61
85
|
workflow: import("@convex-dev/workflow/_generated/component.js").ComponentApi<"workflow">;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `ComponentApi` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
1
9
|
import type { FunctionReference } from "convex/server";
|
|
10
|
+
/**
|
|
11
|
+
* A utility for referencing a Convex component's exposed API.
|
|
12
|
+
*
|
|
13
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```ts
|
|
16
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
17
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
2
21
|
export type ComponentApi<Name extends string | undefined = string | undefined> = {
|
|
3
22
|
engine: {
|
|
4
23
|
agents: {
|
|
@@ -37,8 +56,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
37
56
|
};
|
|
38
57
|
awaitEventTimeout: {
|
|
39
58
|
cancel: FunctionReference<"mutation", "internal", {
|
|
59
|
+
hookId: string;
|
|
40
60
|
orgId: string;
|
|
41
|
-
timeoutRowId: string;
|
|
42
61
|
}, null, Name>;
|
|
43
62
|
schedule: FunctionReference<"mutation", "internal", {
|
|
44
63
|
awaitedEventName: string;
|
|
@@ -1,7 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated data model types.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
1
9
|
import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
|
|
2
10
|
import type { GenericId } from "convex/values";
|
|
3
11
|
import schema from "../schema.js";
|
|
12
|
+
/**
|
|
13
|
+
* The names of all of your Convex tables.
|
|
14
|
+
*/
|
|
4
15
|
export type TableNames = TableNamesInDataModel<DataModel>;
|
|
16
|
+
/**
|
|
17
|
+
* The type of a document stored in Convex.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
20
|
+
*/
|
|
5
21
|
export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
|
|
22
|
+
/**
|
|
23
|
+
* An identifier for a document in Convex.
|
|
24
|
+
*
|
|
25
|
+
* Convex documents are uniquely identified by their `Id`, which is accessible
|
|
26
|
+
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
|
|
27
|
+
*
|
|
28
|
+
* Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
|
|
29
|
+
*
|
|
30
|
+
* IDs are just strings at runtime, but this type can be used to distinguish them from other
|
|
31
|
+
* strings when type checking.
|
|
32
|
+
*
|
|
33
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
34
|
+
*/
|
|
6
35
|
export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
|
|
36
|
+
/**
|
|
37
|
+
* A type describing your Convex data model.
|
|
38
|
+
*
|
|
39
|
+
* This type includes information about what tables you have, the type of
|
|
40
|
+
* documents stored in those tables, and the indexes defined on them.
|
|
41
|
+
*
|
|
42
|
+
* This type is used to parameterize methods like `queryGeneric` and
|
|
43
|
+
* `mutationGeneric` to make them type-safe.
|
|
44
|
+
*/
|
|
7
45
|
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
|
|
@@ -1,14 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
1
9
|
import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
|
|
2
10
|
import type { DataModel } from "./dataModel.js";
|
|
11
|
+
/**
|
|
12
|
+
* Define a query in this Convex app's public API.
|
|
13
|
+
*
|
|
14
|
+
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
15
|
+
*
|
|
16
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
17
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
18
|
+
*/
|
|
3
19
|
export declare const query: QueryBuilder<DataModel, "public">;
|
|
20
|
+
/**
|
|
21
|
+
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
22
|
+
*
|
|
23
|
+
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
24
|
+
*
|
|
25
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
26
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
27
|
+
*/
|
|
4
28
|
export declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
29
|
+
/**
|
|
30
|
+
* Define a mutation in this Convex app's public API.
|
|
31
|
+
*
|
|
32
|
+
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
33
|
+
*
|
|
34
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
35
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
36
|
+
*/
|
|
5
37
|
export declare const mutation: MutationBuilder<DataModel, "public">;
|
|
38
|
+
/**
|
|
39
|
+
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
40
|
+
*
|
|
41
|
+
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
42
|
+
*
|
|
43
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
44
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
45
|
+
*/
|
|
6
46
|
export declare const internalMutation: MutationBuilder<DataModel, "internal">;
|
|
47
|
+
/**
|
|
48
|
+
* Define an action in this Convex app's public API.
|
|
49
|
+
*
|
|
50
|
+
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
51
|
+
* code and code with side-effects, like calling third-party services.
|
|
52
|
+
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
53
|
+
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
54
|
+
*
|
|
55
|
+
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
56
|
+
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
57
|
+
*/
|
|
7
58
|
export declare const action: ActionBuilder<DataModel, "public">;
|
|
59
|
+
/**
|
|
60
|
+
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
61
|
+
*
|
|
62
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
63
|
+
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
64
|
+
*/
|
|
8
65
|
export declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
66
|
+
/**
|
|
67
|
+
* Define an HTTP action.
|
|
68
|
+
*
|
|
69
|
+
* The wrapped function will be used to respond to HTTP requests received
|
|
70
|
+
* by a Convex deployment if the requests matches the path and method where
|
|
71
|
+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
72
|
+
*
|
|
73
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
74
|
+
* and a Fetch API `Request` object as its second.
|
|
75
|
+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
76
|
+
*/
|
|
9
77
|
export declare const httpAction: HttpActionBuilder;
|
|
78
|
+
/**
|
|
79
|
+
* A set of services for use within Convex query functions.
|
|
80
|
+
*
|
|
81
|
+
* The query context is passed as the first argument to any Convex query
|
|
82
|
+
* function run on the server.
|
|
83
|
+
*
|
|
84
|
+
* If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
|
|
85
|
+
*/
|
|
10
86
|
export type QueryCtx = GenericQueryCtx<DataModel>;
|
|
87
|
+
/**
|
|
88
|
+
* A set of services for use within Convex mutation functions.
|
|
89
|
+
*
|
|
90
|
+
* The mutation context is passed as the first argument to any Convex mutation
|
|
91
|
+
* function run on the server.
|
|
92
|
+
*
|
|
93
|
+
* If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
|
|
94
|
+
*/
|
|
11
95
|
export type MutationCtx = GenericMutationCtx<DataModel>;
|
|
96
|
+
/**
|
|
97
|
+
* A set of services for use within Convex action functions.
|
|
98
|
+
*
|
|
99
|
+
* The action context is passed as the first argument to any Convex action
|
|
100
|
+
* function run on the server.
|
|
101
|
+
*/
|
|
12
102
|
export type ActionCtx = GenericActionCtx<DataModel>;
|
|
103
|
+
/**
|
|
104
|
+
* An interface to read from the database within Convex query functions.
|
|
105
|
+
*
|
|
106
|
+
* The two entry points are {@link DatabaseReader.get}, which fetches a single
|
|
107
|
+
* document by its {@link Id}, or {@link DatabaseReader.query}, which starts
|
|
108
|
+
* building a query.
|
|
109
|
+
*/
|
|
13
110
|
export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
111
|
+
/**
|
|
112
|
+
* An interface to read from and write to the database within Convex mutation
|
|
113
|
+
* functions.
|
|
114
|
+
*
|
|
115
|
+
* Convex guarantees that all writes within a single mutation are
|
|
116
|
+
* executed atomically, so you never have to worry about partial writes leaving
|
|
117
|
+
* your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
|
|
118
|
+
* for the guarantees Convex provides your functions.
|
|
119
|
+
*/
|
|
14
120
|
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
@@ -23,10 +23,10 @@ export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
|
23
23
|
maxInputTokensPerSession?: number | false | undefined;
|
|
24
24
|
name: string;
|
|
25
25
|
orgId: string;
|
|
26
|
-
status: "draft" | "live" | "archived";
|
|
27
|
-
createdAt: number;
|
|
28
|
-
updatedAt: number;
|
|
29
26
|
instructions: string;
|
|
30
27
|
model: string;
|
|
28
|
+
status: "draft" | "live" | "archived";
|
|
31
29
|
createdBy: string;
|
|
30
|
+
createdAt: number;
|
|
31
|
+
updatedAt: number;
|
|
32
32
|
} | null>>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export declare const schedule: import("convex/server").RegisteredMutation<"public", {
|
|
2
2
|
orgId: string;
|
|
3
|
-
sessionId: string;
|
|
4
3
|
awaitedEventName: string;
|
|
4
|
+
sessionId: string;
|
|
5
5
|
timeoutMs: number;
|
|
6
|
-
}, Promise<
|
|
6
|
+
}, Promise<string>>;
|
|
7
7
|
export declare const cancel: import("convex/server").RegisteredMutation<"public", {
|
|
8
8
|
orgId: string;
|
|
9
|
-
|
|
9
|
+
hookId: string;
|
|
10
10
|
}, Promise<null>>;
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
11
|
+
export declare const expire: import("convex/server").RegisteredMutation<"internal", {
|
|
12
|
+
orgId: string;
|
|
13
|
+
hookId: string;
|
|
13
14
|
}, Promise<null>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { v } from "convex/values";
|
|
2
|
-
import { internal } from "../_generated/api.js";
|
|
3
2
|
import { internalMutation, mutation } from "../_generated/server.js";
|
|
4
3
|
import { assertSameOrg, requireOrgId } from "../lib/auth.js";
|
|
5
4
|
import { insertEvent, loadSessionRun } from "./sessions.js";
|
|
6
|
-
import {
|
|
5
|
+
import { appendEventCore, loadRun } from "./world.js";
|
|
6
|
+
const NOT_FOUND = "Timeout not found";
|
|
7
7
|
export const schedule = mutation({
|
|
8
8
|
args: {
|
|
9
9
|
orgId: v.string(),
|
|
@@ -11,62 +11,79 @@ export const schedule = mutation({
|
|
|
11
11
|
awaitedEventName: v.string(),
|
|
12
12
|
timeoutMs: v.number(),
|
|
13
13
|
},
|
|
14
|
-
returns: v.
|
|
14
|
+
returns: v.string(),
|
|
15
15
|
handler: async (ctx, args) => {
|
|
16
16
|
const orgId = requireOrgId(args.orgId);
|
|
17
17
|
const run = await loadSessionRun(ctx, orgId, args.sessionId);
|
|
18
|
-
|
|
19
|
-
if (args.timeoutMs <= 0) {
|
|
18
|
+
if (!(args.timeoutMs > 0)) {
|
|
20
19
|
throw new Error("Validation: timeoutMs must be > 0");
|
|
21
20
|
}
|
|
22
|
-
const
|
|
21
|
+
const hookId = `hook_${crypto.randomUUID()}`;
|
|
22
|
+
await appendEventCore(ctx, {
|
|
23
23
|
orgId,
|
|
24
24
|
runId: run.runId,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
eventType: "hook_created",
|
|
26
|
+
hookId,
|
|
27
|
+
dataJson: JSON.stringify({
|
|
28
|
+
token: `tok_${crypto.randomUUID()}`,
|
|
29
|
+
expiresAt: Date.now() + args.timeoutMs,
|
|
30
|
+
awaitedEventName: args.awaitedEventName,
|
|
31
|
+
}),
|
|
28
32
|
});
|
|
29
|
-
|
|
30
|
-
await ctx.db.patch(timeoutRowId, { scheduledFunctionId });
|
|
31
|
-
return timeoutRowId;
|
|
33
|
+
return hookId;
|
|
32
34
|
},
|
|
33
35
|
});
|
|
34
36
|
export const cancel = mutation({
|
|
35
|
-
args: { orgId: v.string(),
|
|
37
|
+
args: { orgId: v.string(), hookId: v.string() },
|
|
36
38
|
returns: v.null(),
|
|
37
39
|
handler: async (ctx, args) => {
|
|
38
40
|
const orgId = requireOrgId(args.orgId);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const hook = await ctx.db
|
|
42
|
+
.query("worldHooks")
|
|
43
|
+
.withIndex("by_org_hook", (q) => q.eq("orgId", orgId).eq("hookId", args.hookId))
|
|
44
|
+
.unique();
|
|
45
|
+
assertSameOrg(orgId, hook, NOT_FOUND);
|
|
46
|
+
if (hook.expiresAt === undefined) {
|
|
47
|
+
throw new Error(NOT_FOUND);
|
|
44
48
|
}
|
|
49
|
+
await appendEventCore(ctx, {
|
|
50
|
+
orgId,
|
|
51
|
+
runId: hook.runId,
|
|
52
|
+
eventType: "hook_disposed",
|
|
53
|
+
hookId: args.hookId,
|
|
54
|
+
dataJson: "{}",
|
|
55
|
+
});
|
|
45
56
|
return null;
|
|
46
57
|
},
|
|
47
58
|
});
|
|
48
|
-
export const
|
|
49
|
-
args: {
|
|
59
|
+
export const expire = internalMutation({
|
|
60
|
+
args: { orgId: v.string(), hookId: v.string() },
|
|
50
61
|
returns: v.null(),
|
|
51
62
|
handler: async (ctx, args) => {
|
|
52
|
-
const
|
|
53
|
-
|
|
63
|
+
const hook = await ctx.db
|
|
64
|
+
.query("worldHooks")
|
|
65
|
+
.withIndex("by_org_hook", (q) => q.eq("orgId", args.orgId).eq("hookId", args.hookId))
|
|
66
|
+
.unique();
|
|
67
|
+
if (!hook ||
|
|
68
|
+
hook.status !== "pending" ||
|
|
69
|
+
hook.awaitedEventName === undefined ||
|
|
70
|
+
hook.expiresAt === undefined) {
|
|
54
71
|
return null;
|
|
55
72
|
}
|
|
56
|
-
await ctx
|
|
57
|
-
let runId = row.runId;
|
|
58
|
-
if (runId === undefined && row.sessionId !== undefined) {
|
|
59
|
-
runId =
|
|
60
|
-
(await findRunIdByCorrelation(ctx, row.orgId, legacyCorrelationId("sessions", row.sessionId))) ?? undefined;
|
|
61
|
-
}
|
|
62
|
-
if (runId === undefined)
|
|
63
|
-
return null;
|
|
64
|
-
const run = await loadRun(ctx, row.orgId, runId, "sessions", "Session not found");
|
|
73
|
+
const run = await loadRun(ctx, args.orgId, hook.runId, "session", "Session not found");
|
|
65
74
|
await insertEvent(ctx, {
|
|
66
|
-
orgId:
|
|
75
|
+
orgId: args.orgId,
|
|
67
76
|
run,
|
|
68
77
|
name: "sandbox.timeout",
|
|
69
|
-
payload: JSON.stringify({ awaitedEventName:
|
|
78
|
+
payload: JSON.stringify({ awaitedEventName: hook.awaitedEventName }),
|
|
79
|
+
});
|
|
80
|
+
await ctx.db.patch(hook._id, { scheduledFunctionId: undefined });
|
|
81
|
+
await appendEventCore(ctx, {
|
|
82
|
+
orgId: args.orgId,
|
|
83
|
+
runId: hook.runId,
|
|
84
|
+
eventType: "hook_disposed",
|
|
85
|
+
hookId: args.hookId,
|
|
86
|
+
dataJson: "{}",
|
|
70
87
|
});
|
|
71
88
|
return null;
|
|
72
89
|
},
|
|
@@ -24,10 +24,10 @@ export declare const listSubagents: import("convex/server").RegisteredQuery<"pub
|
|
|
24
24
|
export declare const delegateToSubagent: import("convex/server").RegisteredAction<"public", {
|
|
25
25
|
payload?: string | undefined;
|
|
26
26
|
orgId: string;
|
|
27
|
-
workflowId: string;
|
|
28
|
-
awaitedEventName: string;
|
|
29
27
|
scope: string;
|
|
30
28
|
reason: string;
|
|
29
|
+
workflowId: string;
|
|
30
|
+
awaitedEventName: string;
|
|
31
31
|
cost: number;
|
|
32
32
|
subagentId: import("convex/values").GenericId<"subagents">;
|
|
33
33
|
workFunctionHandle: string;
|
|
@@ -35,11 +35,11 @@ export declare const delegateToSubagent: import("convex/server").RegisteredActio
|
|
|
35
35
|
export declare const invokeAgentClone: import("convex/server").RegisteredAction<"public", {
|
|
36
36
|
payload?: string | undefined;
|
|
37
37
|
orgId: string;
|
|
38
|
-
workflowId: string;
|
|
39
38
|
agentId: import("convex/values").GenericId<"agents">;
|
|
40
|
-
awaitedEventName: string;
|
|
41
39
|
scope: string;
|
|
42
40
|
reason: string;
|
|
41
|
+
workflowId: string;
|
|
42
|
+
awaitedEventName: string;
|
|
43
43
|
cost: number;
|
|
44
44
|
workFunctionHandle: string;
|
|
45
45
|
viaAgentTool: boolean;
|
|
@@ -61,15 +61,15 @@ export declare const getAgentInternal: import("convex/server").RegisteredQuery<"
|
|
|
61
61
|
} | null>>;
|
|
62
62
|
export declare const recordDelegationStartInternal: import("convex/server").RegisteredMutation<"internal", {
|
|
63
63
|
orgId: string;
|
|
64
|
-
workflowId: string;
|
|
65
64
|
toolName: string;
|
|
65
|
+
workflowId: string;
|
|
66
66
|
awaitedEventName: string;
|
|
67
67
|
parentAgentId: import("convex/values").GenericId<"agents">;
|
|
68
68
|
childAgentId: import("convex/values").GenericId<"agents">;
|
|
69
69
|
}, Promise<import("convex/values").GenericId<"delegationRuns">>>;
|
|
70
70
|
export declare const recordCloneStartInternal: import("convex/server").RegisteredMutation<"internal", {
|
|
71
71
|
orgId: string;
|
|
72
|
-
workflowId: string;
|
|
73
72
|
agentId: import("convex/values").GenericId<"agents">;
|
|
73
|
+
workflowId: string;
|
|
74
74
|
awaitedEventName: string;
|
|
75
75
|
}, Promise<import("convex/values").GenericId<"agentCloneRuns">>>;
|
|
@@ -3,10 +3,10 @@ type JobRunStatus = "running" | "completed" | "abandoned" | "cancelled";
|
|
|
3
3
|
export declare const workflow: WorkflowManager;
|
|
4
4
|
export declare const start: import("convex/server").RegisteredMutation<"public", {
|
|
5
5
|
orgId: string;
|
|
6
|
+
kind: string;
|
|
6
7
|
stepFunctionHandle: string;
|
|
7
8
|
totalSteps: number;
|
|
8
9
|
maxAttemptsPerStep: number;
|
|
9
|
-
kind: string;
|
|
10
10
|
}, Promise<string>>;
|
|
11
11
|
export declare const getStatus: import("convex/server").RegisteredQuery<"public", {
|
|
12
12
|
orgId: string;
|
|
@@ -22,29 +22,6 @@ export declare const cancel: import("convex/server").RegisteredMutation<"public"
|
|
|
22
22
|
orgId: string;
|
|
23
23
|
jobId: string;
|
|
24
24
|
}, Promise<null>>;
|
|
25
|
-
export declare const getJobInternal: import("convex/server").RegisteredQuery<"internal", {
|
|
26
|
-
jobId: import("convex/values").GenericId<"durableJobs">;
|
|
27
|
-
}, Promise<{
|
|
28
|
-
cursor: number;
|
|
29
|
-
totalSteps: number;
|
|
30
|
-
maxAttemptsPerStep: number;
|
|
31
|
-
status: "running" | "completed" | "abandoned" | "cancelled";
|
|
32
|
-
} | null>>;
|
|
33
|
-
export declare const runStepInternal: import("convex/server").RegisteredMutation<"internal", {
|
|
34
|
-
jobId: import("convex/values").GenericId<"durableJobs">;
|
|
35
|
-
stepIndex: number;
|
|
36
|
-
}, Promise<null>>;
|
|
37
|
-
export declare const markAbandonedInternal: import("convex/server").RegisteredMutation<"internal", {
|
|
38
|
-
jobId: import("convex/values").GenericId<"durableJobs">;
|
|
39
|
-
stepIndex: number;
|
|
40
|
-
error: string;
|
|
41
|
-
}, Promise<null>>;
|
|
42
|
-
export declare const markCompletedInternal: import("convex/server").RegisteredMutation<"internal", {
|
|
43
|
-
jobId: import("convex/values").GenericId<"durableJobs">;
|
|
44
|
-
}, Promise<null>>;
|
|
45
|
-
export declare const durableJobWorkflowV1: import("convex/server").RegisteredMutation<"internal", import("@convex-dev/workflow").WorkflowArgs<{
|
|
46
|
-
jobId: import("convex/values").VId<import("convex/values").GenericId<"durableJobs">, "required">;
|
|
47
|
-
}>, WorkflowId>;
|
|
48
25
|
export declare const getJobInternalV2: import("convex/server").RegisteredQuery<"internal", {
|
|
49
26
|
orgId: string;
|
|
50
27
|
runId: string;
|
|
@@ -56,14 +33,14 @@ export declare const getJobInternalV2: import("convex/server").RegisteredQuery<"
|
|
|
56
33
|
} | null>>;
|
|
57
34
|
export declare const runStepInternalV2: import("convex/server").RegisteredMutation<"internal", {
|
|
58
35
|
orgId: string;
|
|
59
|
-
stepIndex: number;
|
|
60
36
|
runId: string;
|
|
37
|
+
stepIndex: number;
|
|
61
38
|
}, Promise<null>>;
|
|
62
39
|
export declare const markAbandonedInternalV2: import("convex/server").RegisteredMutation<"internal", {
|
|
63
40
|
orgId: string;
|
|
64
|
-
stepIndex: number;
|
|
65
|
-
runId: string;
|
|
66
41
|
error: string;
|
|
42
|
+
runId: string;
|
|
43
|
+
stepIndex: number;
|
|
67
44
|
}, Promise<null>>;
|
|
68
45
|
export declare const markCompletedInternalV2: import("convex/server").RegisteredMutation<"internal", {
|
|
69
46
|
orgId: string;
|