@vantageos/agent-engine 0.3.0-alpha.1 → 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.
@@ -56,8 +56,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
56
56
  };
57
57
  awaitEventTimeout: {
58
58
  cancel: FunctionReference<"mutation", "internal", {
59
+ hookId: string;
59
60
  orgId: string;
60
- timeoutRowId: string;
61
61
  }, null, Name>;
62
62
  schedule: FunctionReference<"mutation", "internal", {
63
63
  awaitedEventName: string;
@@ -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<import("convex/values").GenericId<"awaitEventTimeouts">>>;
6
+ }, Promise<string>>;
7
7
  export declare const cancel: import("convex/server").RegisteredMutation<"public", {
8
8
  orgId: string;
9
- timeoutRowId: import("convex/values").GenericId<"awaitEventTimeouts">;
9
+ hookId: string;
10
10
  }, Promise<null>>;
11
- export declare const fire: import("convex/server").RegisteredMutation<"internal", {
12
- timeoutRowId: import("convex/values").GenericId<"awaitEventTimeouts">;
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 { findRunIdByCorrelation, legacyCorrelationId, loadRun, } from "./world.js";
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,60 +11,79 @@ export const schedule = mutation({
11
11
  awaitedEventName: v.string(),
12
12
  timeoutMs: v.number(),
13
13
  },
14
- returns: v.id("awaitEventTimeouts"),
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
- if (args.timeoutMs <= 0) {
18
+ if (!(args.timeoutMs > 0)) {
19
19
  throw new Error("Validation: timeoutMs must be > 0");
20
20
  }
21
- const timeoutRowId = await ctx.db.insert("awaitEventTimeouts", {
21
+ const hookId = `hook_${crypto.randomUUID()}`;
22
+ await appendEventCore(ctx, {
22
23
  orgId,
23
24
  runId: run.runId,
24
- awaitedEventName: args.awaitedEventName,
25
- deadlineAt: Date.now() + args.timeoutMs,
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
+ }),
26
32
  });
27
- const scheduledFunctionId = await ctx.scheduler.runAfter(args.timeoutMs, internal.engine.awaitEventTimeout.fire, { timeoutRowId });
28
- await ctx.db.patch(timeoutRowId, { scheduledFunctionId });
29
- return timeoutRowId;
33
+ return hookId;
30
34
  },
31
35
  });
32
36
  export const cancel = mutation({
33
- args: { orgId: v.string(), timeoutRowId: v.id("awaitEventTimeouts") },
37
+ args: { orgId: v.string(), hookId: v.string() },
34
38
  returns: v.null(),
35
39
  handler: async (ctx, args) => {
36
40
  const orgId = requireOrgId(args.orgId);
37
- const row = await ctx.db.get(args.timeoutRowId);
38
- assertSameOrg(orgId, row, "Timeout not found");
39
- if (!row.firedAt && !row.cancelledAt && row.scheduledFunctionId) {
40
- await ctx.scheduler.cancel(row.scheduledFunctionId);
41
- await ctx.db.patch(args.timeoutRowId, { cancelledAt: Date.now() });
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);
42
48
  }
49
+ await appendEventCore(ctx, {
50
+ orgId,
51
+ runId: hook.runId,
52
+ eventType: "hook_disposed",
53
+ hookId: args.hookId,
54
+ dataJson: "{}",
55
+ });
43
56
  return null;
44
57
  },
45
58
  });
46
- export const fire = internalMutation({
47
- args: { timeoutRowId: v.id("awaitEventTimeouts") },
59
+ export const expire = internalMutation({
60
+ args: { orgId: v.string(), hookId: v.string() },
48
61
  returns: v.null(),
49
62
  handler: async (ctx, args) => {
50
- const row = await ctx.db.get(args.timeoutRowId);
51
- if (!row || row.firedAt || row.cancelledAt) {
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) {
52
71
  return null;
53
72
  }
54
- await ctx.db.patch(args.timeoutRowId, { firedAt: Date.now() });
55
- let runId = row.runId;
56
- if (runId === undefined && row.sessionId !== undefined) {
57
- runId =
58
- (await findRunIdByCorrelation(ctx, row.orgId, legacyCorrelationId("session", row.sessionId))) ?? undefined;
59
- }
60
- if (runId === undefined)
61
- return null;
62
- const run = await loadRun(ctx, row.orgId, runId, "session", "Session not found");
73
+ const run = await loadRun(ctx, args.orgId, hook.runId, "session", "Session not found");
63
74
  await insertEvent(ctx, {
64
- orgId: row.orgId,
75
+ orgId: args.orgId,
65
76
  run,
66
77
  name: "sandbox.timeout",
67
- payload: JSON.stringify({ awaitedEventName: row.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: "{}",
68
87
  });
69
88
  return null;
70
89
  },
@@ -47,8 +47,8 @@ export declare const listByAgent: import("convex/server").RegisteredQuery<"publi
47
47
  }[]>>;
48
48
  export declare const requestAuthorization: import("convex/server").RegisteredMutation<"public", {
49
49
  orgId: string;
50
- awaitedEventName: string;
51
50
  workflowId: string;
51
+ awaitedEventName: string;
52
52
  connectionId: import("convex/values").GenericId<"connections">;
53
53
  url: string;
54
54
  userCode: string;
@@ -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
- awaitedEventName: string;
28
27
  scope: string;
29
28
  reason: string;
30
29
  workflowId: string;
30
+ awaitedEventName: string;
31
31
  cost: number;
32
32
  subagentId: import("convex/values").GenericId<"subagents">;
33
33
  workFunctionHandle: string;
@@ -36,10 +36,10 @@ export declare const invokeAgentClone: import("convex/server").RegisteredAction<
36
36
  payload?: string | undefined;
37
37
  orgId: string;
38
38
  agentId: import("convex/values").GenericId<"agents">;
39
- awaitedEventName: string;
40
39
  scope: string;
41
40
  reason: string;
42
41
  workflowId: string;
42
+ awaitedEventName: string;
43
43
  cost: number;
44
44
  workFunctionHandle: string;
45
45
  viaAgentTool: boolean;
@@ -62,14 +62,14 @@ export declare const getAgentInternal: import("convex/server").RegisteredQuery<"
62
62
  export declare const recordDelegationStartInternal: import("convex/server").RegisteredMutation<"internal", {
63
63
  orgId: string;
64
64
  toolName: string;
65
- awaitedEventName: string;
66
65
  workflowId: string;
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
72
  agentId: import("convex/values").GenericId<"agents">;
73
- awaitedEventName: string;
74
73
  workflowId: string;
74
+ awaitedEventName: string;
75
75
  }, Promise<import("convex/values").GenericId<"agentCloneRuns">>>;
@@ -38,8 +38,8 @@ export declare const runStepInternalV2: import("convex/server").RegisteredMutati
38
38
  }, Promise<null>>;
39
39
  export declare const markAbandonedInternalV2: import("convex/server").RegisteredMutation<"internal", {
40
40
  orgId: string;
41
- runId: string;
42
41
  error: string;
42
+ runId: string;
43
43
  stepIndex: number;
44
44
  }, Promise<null>>;
45
45
  export declare const markCompletedInternalV2: import("convex/server").RegisteredMutation<"internal", {
@@ -1,7 +1,7 @@
1
1
  export declare const startRun: import("convex/server").RegisteredMutation<"public", {
2
2
  orgId: string;
3
- awaitedEventName: string;
4
3
  workflowId: string;
4
+ awaitedEventName: string;
5
5
  timeoutMs: number;
6
6
  }, Promise<import("convex/values").GenericId<"sandboxRuns">>>;
7
7
  export declare const attachSandboxId: import("convex/server").RegisteredMutation<"public", {
@@ -32,8 +32,8 @@ export declare const appendReasoning: import("convex/server").RegisteredMutation
32
32
  export declare const requestToolCall: import("convex/server").RegisteredMutation<"public", {
33
33
  orgId: string;
34
34
  toolName: string;
35
- sessionId: string;
36
35
  argsJson: string;
36
+ sessionId: string;
37
37
  }, Promise<{
38
38
  authorized: boolean;
39
39
  approvalPending: boolean;
@@ -51,8 +51,8 @@ export declare const completeTurn: import("convex/server").RegisteredMutation<"p
51
51
  }, Promise<null>>;
52
52
  export declare const end: import("convex/server").RegisteredMutation<"public", {
53
53
  orgId: string;
54
- sessionId: string;
55
54
  outcome: "completed" | "cancelled";
55
+ sessionId: string;
56
56
  }, Promise<null>>;
57
57
  export declare const listEvents: import("convex/server").RegisteredQuery<"public", {
58
58
  orgId: string;
@@ -4,18 +4,18 @@ export declare const enqueue: import("convex/server").RegisteredAction<"public",
4
4
  payload?: string | undefined;
5
5
  orgId: string;
6
6
  agentId: import("convex/values").GenericId<"agents">;
7
- awaitedEventName: string;
8
7
  scope: string;
9
8
  reason: string;
10
9
  workflowId: string;
10
+ awaitedEventName: string;
11
11
  cost: number;
12
12
  workFunctionHandle: string;
13
13
  }, Promise<string>>;
14
14
  export declare const enqueueInternal: import("convex/server").RegisteredMutation<"internal", {
15
15
  payload?: string | undefined;
16
16
  orgId: string;
17
- awaitedEventName: string;
18
17
  workflowId: string;
18
+ awaitedEventName: string;
19
19
  workFunctionHandle: string;
20
20
  }, Promise<string>>;
21
21
  export declare const cancel: import("convex/server").RegisteredMutation<"public", {
@@ -10,6 +10,10 @@ export declare const sessionWorkflowV2: import("convex/server").RegisteredMutati
10
10
  }>, import("@convex-dev/workflow").WorkflowId>;
11
11
  export declare const onSessionWorkflowCompleteV2: import("convex/server").RegisteredMutation<"internal", {
12
12
  workflowId: import("@convex-dev/workflow").WorkflowId;
13
+ context: {
14
+ orgId: string;
15
+ runId: string;
16
+ };
13
17
  result: {
14
18
  kind: "success";
15
19
  returnValue: any;
@@ -19,10 +23,6 @@ export declare const onSessionWorkflowCompleteV2: import("convex/server").Regist
19
23
  } | {
20
24
  kind: "canceled";
21
25
  };
22
- context: {
23
- orgId: string;
24
- runId: string;
25
- };
26
26
  }, Promise<null>>;
27
27
  export declare const stopBoxInternal: import("convex/server").RegisteredAction<"internal", {
28
28
  boxId: string;
@@ -95,9 +95,6 @@ export declare const LEGACY_KIND_PREFIX = "legacy:";
95
95
  export type RunKind = "session" | "job";
96
96
  export type RunStatus = "running" | "completed" | "failed" | "cancelled";
97
97
  export declare function legacyCorrelationId(kind: RunKind, legacyId: string): string;
98
- export declare function findRunIdByCorrelation(ctx: {
99
- db: DatabaseReader;
100
- }, orgId: string, correlationId: string): Promise<string | null>;
101
98
  export declare function openRun(ctx: MutationCtx, args: {
102
99
  orgId: string;
103
100
  kind: RunKind;
@@ -1,5 +1,6 @@
1
1
  import { v } from "convex/values";
2
2
  import { mutation, query, } from "../_generated/server.js";
3
+ import { internal } from "../_generated/api.js";
3
4
  import { assertSameOrg, requireOrgId } from "../lib/auth.js";
4
5
  function pad26(n) {
5
6
  return String(n).padStart(26, "0");
@@ -243,15 +244,31 @@ export async function appendEventCore(ctx, args) {
243
244
  if (!parsed.token) {
244
245
  throw new Error("Validation: hook_created payload requires token");
245
246
  }
247
+ const hasDeadline = parsed.expiresAt !== undefined;
248
+ if (hasDeadline) {
249
+ if (!Number.isFinite(parsed.expiresAt)) {
250
+ throw new Error("Validation: hook_created expiresAt must be a number");
251
+ }
252
+ if (!parsed.awaitedEventName) {
253
+ throw new Error("Validation: a hook with expiresAt requires awaitedEventName");
254
+ }
255
+ await loadRun(ctx, orgId, runId, "session", "Validation: a hook with a deadline requires a session run");
256
+ }
246
257
  const hookDocId = await ctx.db.insert("worldHooks", {
247
258
  orgId,
248
259
  runId,
249
260
  hookId: args.hookId,
250
261
  token: parsed.token,
251
262
  status: "pending",
263
+ expiresAt: hasDeadline ? parsed.expiresAt : undefined,
264
+ awaitedEventName: hasDeadline ? parsed.awaitedEventName : undefined,
252
265
  createdAt: now,
253
266
  updatedAt: now,
254
267
  });
268
+ if (hasDeadline) {
269
+ const scheduledFunctionId = await ctx.scheduler.runAt(parsed.expiresAt, internal.engine.awaitEventTimeout.expire, { orgId, hookId: args.hookId });
270
+ await ctx.db.patch(hookDocId, { scheduledFunctionId });
271
+ }
255
272
  hookDoc = await ctx.db.get(hookDocId);
256
273
  break;
257
274
  }
@@ -264,6 +281,9 @@ export async function appendEventCore(ctx, args) {
264
281
  .withIndex("by_org_hook", (q) => q.eq("orgId", orgId).eq("hookId", args.hookId))
265
282
  .unique();
266
283
  assertSameOrg(orgId, existing, "Hook not found");
284
+ if (existing.scheduledFunctionId !== undefined) {
285
+ await ctx.scheduler.cancel(existing.scheduledFunctionId);
286
+ }
267
287
  await ctx.db.delete(existing._id);
268
288
  hookDoc = null;
269
289
  break;
@@ -371,13 +391,6 @@ function legacyKindPrefix(kind) {
371
391
  export function legacyCorrelationId(kind, legacyId) {
372
392
  return `${legacyKindPrefix(kind)}${legacyId}`;
373
393
  }
374
- export async function findRunIdByCorrelation(ctx, orgId, correlationId) {
375
- const events = await ctx.db
376
- .query("worldEvents")
377
- .withIndex("by_org_correlation", (q) => q.eq("orgId", orgId).eq("correlationId", correlationId))
378
- .collect();
379
- return events.find((e) => e.eventType === "run_created")?.runId ?? null;
380
- }
381
394
  export async function openRun(ctx, args) {
382
395
  const result = await appendEventCore(ctx, {
383
396
  orgId: args.orgId,
@@ -50,28 +50,6 @@ declare const _default: import("convex/server").SchemaDefinition<{
50
50
  by_org_agent: ["orgId", "agentId", "_creationTime"];
51
51
  by_org_agent_tool: ["orgId", "agentId", "toolName", "_creationTime"];
52
52
  }, {}, {}>;
53
- awaitEventTimeouts: import("convex/server").TableDefinition<import("convex/values").VObject<{
54
- runId?: string | undefined;
55
- sessionId?: string | undefined;
56
- scheduledFunctionId?: import("convex/values").GenericId<"_scheduled_functions"> | undefined;
57
- firedAt?: number | undefined;
58
- cancelledAt?: number | undefined;
59
- orgId: string;
60
- awaitedEventName: string;
61
- deadlineAt: number;
62
- }, {
63
- orgId: import("convex/values").VString<string, "required">;
64
- runId: import("convex/values").VString<string | undefined, "optional">;
65
- sessionId: import("convex/values").VString<string | undefined, "optional">;
66
- awaitedEventName: import("convex/values").VString<string, "required">;
67
- deadlineAt: import("convex/values").VFloat64<number, "required">;
68
- scheduledFunctionId: import("convex/values").VId<import("convex/values").GenericId<"_scheduled_functions"> | undefined, "optional">;
69
- firedAt: import("convex/values").VFloat64<number | undefined, "optional">;
70
- cancelledAt: import("convex/values").VFloat64<number | undefined, "optional">;
71
- }, "required", "orgId" | "runId" | "sessionId" | "awaitedEventName" | "deadlineAt" | "scheduledFunctionId" | "firedAt" | "cancelledAt">, {
72
- by_org: ["orgId", "_creationTime"];
73
- by_org_run: ["orgId", "runId", "_creationTime"];
74
- }, {}, {}>;
75
53
  wakeupDemoResults: import("convex/server").TableDefinition<import("convex/values").VObject<{
76
54
  wokenAt?: number | undefined;
77
55
  observedStatus?: "completed" | "failed" | "cancelled" | undefined;
@@ -169,8 +147,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
169
147
  status: "completed" | "failed" | "pending" | "timedOut";
170
148
  createdAt: number;
171
149
  updatedAt: number;
172
- awaitedEventName: string;
173
150
  workflowId: string;
151
+ awaitedEventName: string;
174
152
  sandboxId: string;
175
153
  }, {
176
154
  orgId: import("convex/values").VString<string, "required">;
@@ -181,7 +159,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
181
159
  resultSummary: import("convex/values").VString<string | undefined, "optional">;
182
160
  createdAt: import("convex/values").VFloat64<number, "required">;
183
161
  updatedAt: import("convex/values").VFloat64<number, "required">;
184
- }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "awaitedEventName" | "workflowId" | "sandboxId" | "resultSummary">, {
162
+ }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "workflowId" | "awaitedEventName" | "sandboxId" | "resultSummary">, {
185
163
  by_org: ["orgId", "_creationTime"];
186
164
  by_org_workflow: ["orgId", "workflowId", "_creationTime"];
187
165
  by_org_sandbox: ["orgId", "sandboxId", "_creationTime"];
@@ -247,8 +225,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
247
225
  createdAt: number;
248
226
  updatedAt: number;
249
227
  toolName: string;
250
- awaitedEventName: string;
251
228
  workflowId: string;
229
+ awaitedEventName: string;
252
230
  parentAgentId: import("convex/values").GenericId<"agents">;
253
231
  childAgentId: import("convex/values").GenericId<"agents">;
254
232
  }, {
@@ -262,7 +240,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
262
240
  resultSummary: import("convex/values").VString<string | undefined, "optional">;
263
241
  createdAt: import("convex/values").VFloat64<number, "required">;
264
242
  updatedAt: import("convex/values").VFloat64<number, "required">;
265
- }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "toolName" | "awaitedEventName" | "workflowId" | "resultSummary" | "parentAgentId" | "childAgentId">, {
243
+ }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "toolName" | "workflowId" | "awaitedEventName" | "resultSummary" | "parentAgentId" | "childAgentId">, {
266
244
  by_org: ["orgId", "_creationTime"];
267
245
  by_org_parent: ["orgId", "parentAgentId", "_creationTime"];
268
246
  by_org_workflow: ["orgId", "workflowId", "_creationTime"];
@@ -275,8 +253,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
275
253
  createdAt: number;
276
254
  updatedAt: number;
277
255
  agentId: import("convex/values").GenericId<"agents">;
278
- awaitedEventName: string;
279
256
  workflowId: string;
257
+ awaitedEventName: string;
280
258
  }, {
281
259
  orgId: import("convex/values").VString<string, "required">;
282
260
  agentId: import("convex/values").VId<import("convex/values").GenericId<"agents">, "required">;
@@ -286,7 +264,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
286
264
  resultSummary: import("convex/values").VString<string | undefined, "optional">;
287
265
  createdAt: import("convex/values").VFloat64<number, "required">;
288
266
  updatedAt: import("convex/values").VFloat64<number, "required">;
289
- }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "agentId" | "awaitedEventName" | "workflowId" | "resultSummary">, {
267
+ }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "agentId" | "workflowId" | "awaitedEventName" | "resultSummary">, {
290
268
  by_org: ["orgId", "_creationTime"];
291
269
  by_org_agent: ["orgId", "agentId", "_creationTime"];
292
270
  }, {}, {}>;
@@ -361,8 +339,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
361
339
  status: "pending" | "denied" | "authorized";
362
340
  createdAt: number;
363
341
  updatedAt: number;
364
- awaitedEventName: string;
365
342
  workflowId: string;
343
+ awaitedEventName: string;
366
344
  connectionId: import("convex/values").GenericId<"connections">;
367
345
  url: string;
368
346
  userCode: string;
@@ -378,7 +356,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
378
356
  createdAt: import("convex/values").VFloat64<number, "required">;
379
357
  updatedAt: import("convex/values").VFloat64<number, "required">;
380
358
  resolvedAt: import("convex/values").VFloat64<number | undefined, "optional">;
381
- }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "awaitedEventName" | "resolvedAt" | "workflowId" | "resultSummary" | "connectionId" | "url" | "userCode">, {
359
+ }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "resolvedAt" | "workflowId" | "awaitedEventName" | "resultSummary" | "connectionId" | "url" | "userCode">, {
382
360
  by_org: ["orgId", "_creationTime"];
383
361
  by_org_connection: ["orgId", "connectionId", "_creationTime"];
384
362
  }, {}, {}>;
@@ -434,6 +412,9 @@ declare const _default: import("convex/server").SchemaDefinition<{
434
412
  by_org_run_step: ["orgId", "runId", "stepId", "_creationTime"];
435
413
  }, {}, {}>;
436
414
  worldHooks: import("convex/server").TableDefinition<import("convex/values").VObject<{
415
+ awaitedEventName?: string | undefined;
416
+ expiresAt?: number | undefined;
417
+ scheduledFunctionId?: import("convex/values").GenericId<"_scheduled_functions"> | undefined;
437
418
  orgId: string;
438
419
  status: "pending" | "disposed";
439
420
  createdAt: number;
@@ -447,9 +428,12 @@ declare const _default: import("convex/server").SchemaDefinition<{
447
428
  hookId: import("convex/values").VString<string, "required">;
448
429
  token: import("convex/values").VString<string, "required">;
449
430
  status: import("convex/values").VUnion<"pending" | "disposed", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"disposed", "required">], "required", never>;
431
+ expiresAt: import("convex/values").VFloat64<number | undefined, "optional">;
432
+ scheduledFunctionId: import("convex/values").VId<import("convex/values").GenericId<"_scheduled_functions"> | undefined, "optional">;
433
+ awaitedEventName: import("convex/values").VString<string | undefined, "optional">;
450
434
  createdAt: import("convex/values").VFloat64<number, "required">;
451
435
  updatedAt: import("convex/values").VFloat64<number, "required">;
452
- }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "runId" | "hookId" | "token">, {
436
+ }, "required", "orgId" | "status" | "createdAt" | "updatedAt" | "awaitedEventName" | "runId" | "hookId" | "token" | "expiresAt" | "scheduledFunctionId">, {
453
437
  by_org_run: ["orgId", "runId", "_creationTime"];
454
438
  by_org_hook: ["orgId", "hookId", "_creationTime"];
455
439
  by_org_token: ["orgId", "token", "_creationTime"];
@@ -29,18 +29,6 @@ export default defineSchema({
29
29
  .index("by_org", ["orgId"])
30
30
  .index("by_org_agent", ["orgId", "agentId"])
31
31
  .index("by_org_agent_tool", ["orgId", "agentId", "toolName"]),
32
- awaitEventTimeouts: defineTable({
33
- orgId: v.string(),
34
- runId: v.optional(v.string()),
35
- sessionId: v.optional(v.string()),
36
- awaitedEventName: v.string(),
37
- deadlineAt: v.number(),
38
- scheduledFunctionId: v.optional(v.id("_scheduled_functions")),
39
- firedAt: v.optional(v.number()),
40
- cancelledAt: v.optional(v.number()),
41
- })
42
- .index("by_org", ["orgId"])
43
- .index("by_org_run", ["orgId", "runId"]),
44
32
  wakeupDemoResults: defineTable({
45
33
  orgId: v.string(),
46
34
  enqueuedAt: v.number(),
@@ -244,6 +232,9 @@ export default defineSchema({
244
232
  hookId: v.string(),
245
233
  token: v.string(),
246
234
  status: v.union(v.literal("pending"), v.literal("disposed")),
235
+ expiresAt: v.optional(v.number()),
236
+ scheduledFunctionId: v.optional(v.id("_scheduled_functions")),
237
+ awaitedEventName: v.optional(v.string()),
247
238
  createdAt: v.number(),
248
239
  updatedAt: v.number(),
249
240
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vantageos/agent-engine",
3
- "version": "0.3.0-alpha.1",
3
+ "version": "0.4.0-alpha.0",
4
4
  "description": "Reusable Convex component: durable agent engine. Agent = data aggregate (root sheet + child tables), never compiled code. Built on @convex-dev/workflow + @convex-dev/workpool (+ @convex-dev/agent). Eve parity by design.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-Apache-2.0",