@okrlinkhub/agent-factory 1.0.1 → 1.0.2
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/client/index.d.ts +3 -3
- package/dist/component/identity.d.ts +5 -5
- package/dist/component/pushing.d.ts +25 -25
- package/dist/component/queue.d.ts +42 -42
- package/dist/component/queue.d.ts.map +1 -1
- package/dist/component/queue.js +19 -1
- package/dist/component/queue.js.map +1 -1
- package/dist/component/scheduler.d.ts +18 -18
- package/dist/component/scheduler.js +5 -4
- package/dist/component/scheduler.js.map +1 -1
- package/dist/component/schema.d.ts +22 -22
- package/package.json +1 -1
- package/src/component/lib.test.ts +241 -0
- package/src/component/queue.ts +41 -1
- package/src/component/scheduler.ts +7 -4
package/dist/client/index.d.ts
CHANGED
|
@@ -184,8 +184,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
184
184
|
sizeBytes: number;
|
|
185
185
|
}, Promise<any>>;
|
|
186
186
|
workerFailSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
187
|
-
workerId: string;
|
|
188
187
|
error: string;
|
|
188
|
+
workerId: string;
|
|
189
189
|
snapshotId: string;
|
|
190
190
|
}, Promise<any>>;
|
|
191
191
|
workerLatestSnapshotForRestore: import("convex/server").RegisteredQuery<"public", {
|
|
@@ -213,14 +213,14 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
213
213
|
sourceJs: string;
|
|
214
214
|
}, Promise<any>>;
|
|
215
215
|
globalSkillsList: import("convex/server").RegisteredQuery<"public", {
|
|
216
|
+
status?: "active" | "disabled" | undefined;
|
|
216
217
|
limit?: number | undefined;
|
|
217
218
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
218
|
-
status?: "active" | "disabled" | undefined;
|
|
219
219
|
}, Promise<any>>;
|
|
220
220
|
globalSkillsSetStatus: import("convex/server").RegisteredMutation<"public", {
|
|
221
221
|
actor?: string | undefined;
|
|
222
|
-
slug: string;
|
|
223
222
|
status: "active" | "disabled";
|
|
223
|
+
slug: string;
|
|
224
224
|
}, Promise<any>>;
|
|
225
225
|
globalSkillsDelete: import("convex/server").RegisteredMutation<"public", {
|
|
226
226
|
slug: string;
|
|
@@ -29,8 +29,8 @@ export declare const createPairingCode: import("convex/server").RegisteredMutati
|
|
|
29
29
|
}>>;
|
|
30
30
|
export declare const consumePairingCode: import("convex/server").RegisteredMutation<"public", {
|
|
31
31
|
nowMs?: number | undefined;
|
|
32
|
-
telegramUserId: string;
|
|
33
32
|
telegramChatId: string;
|
|
33
|
+
telegramUserId: string;
|
|
34
34
|
code: string;
|
|
35
35
|
}, Promise<{
|
|
36
36
|
code: string;
|
|
@@ -50,7 +50,7 @@ export declare const getPairingCodeStatus: import("convex/server").RegisteredQue
|
|
|
50
50
|
code: string;
|
|
51
51
|
consumerUserId: string;
|
|
52
52
|
agentKey: string;
|
|
53
|
-
status: "pending" | "
|
|
53
|
+
status: "pending" | "used" | "expired";
|
|
54
54
|
createdAt: number;
|
|
55
55
|
expiresAt: number;
|
|
56
56
|
usedAt: number | null;
|
|
@@ -59,10 +59,10 @@ export declare const getPairingCodeStatus: import("convex/server").RegisteredQue
|
|
|
59
59
|
} | null>>;
|
|
60
60
|
export declare const bindUserAgent: import("convex/server").RegisteredMutation<"public", {
|
|
61
61
|
metadata?: Record<string, string> | undefined;
|
|
62
|
+
nowMs?: number | undefined;
|
|
62
63
|
source?: "manual" | "telegram_pairing" | "api" | undefined;
|
|
63
|
-
telegramUserId?: string | undefined;
|
|
64
64
|
telegramChatId?: string | undefined;
|
|
65
|
-
|
|
65
|
+
telegramUserId?: string | undefined;
|
|
66
66
|
agentKey: string;
|
|
67
67
|
consumerUserId: string;
|
|
68
68
|
}, Promise<{
|
|
@@ -89,8 +89,8 @@ export declare const resolveAgentForUser: import("convex/server").RegisteredQuer
|
|
|
89
89
|
agentKey: string | null;
|
|
90
90
|
}>>;
|
|
91
91
|
export declare const resolveAgentForTelegram: import("convex/server").RegisteredQuery<"public", {
|
|
92
|
-
telegramUserId?: string | undefined;
|
|
93
92
|
telegramChatId?: string | undefined;
|
|
93
|
+
telegramUserId?: string | undefined;
|
|
94
94
|
}, Promise<{
|
|
95
95
|
consumerUserId: string | null;
|
|
96
96
|
agentKey: string | null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Id } from "./_generated/dataModel.js";
|
|
2
2
|
export declare const createPushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
3
|
-
enabled?: boolean | undefined;
|
|
4
3
|
nowMs?: number | undefined;
|
|
4
|
+
enabled?: boolean | undefined;
|
|
5
5
|
companyId: string;
|
|
6
|
-
templateKey: string;
|
|
7
|
-
title: string;
|
|
8
|
-
text: string;
|
|
9
6
|
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
7
|
+
text: string;
|
|
8
|
+
title: string;
|
|
9
|
+
actorUserId: string;
|
|
10
10
|
suggestedTimes: ({
|
|
11
11
|
kind: "daily";
|
|
12
12
|
time: string;
|
|
@@ -19,13 +19,14 @@ export declare const createPushTemplate: import("convex/server").RegisteredMutat
|
|
|
19
19
|
time: string;
|
|
20
20
|
dayOfMonth: number | "last";
|
|
21
21
|
})[];
|
|
22
|
-
|
|
22
|
+
templateKey: string;
|
|
23
23
|
}, Promise<import("convex/values").GenericId<"messagePushTemplates">>>;
|
|
24
24
|
export declare const updatePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
25
|
+
nowMs?: number | undefined;
|
|
25
26
|
enabled?: boolean | undefined;
|
|
26
|
-
title?: string | undefined;
|
|
27
|
-
text?: string | undefined;
|
|
28
27
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
28
|
+
text?: string | undefined;
|
|
29
|
+
title?: string | undefined;
|
|
29
30
|
suggestedTimes?: ({
|
|
30
31
|
kind: "daily";
|
|
31
32
|
time: string;
|
|
@@ -38,9 +39,8 @@ export declare const updatePushTemplate: import("convex/server").RegisteredMutat
|
|
|
38
39
|
time: string;
|
|
39
40
|
dayOfMonth: number | "last";
|
|
40
41
|
})[] | undefined;
|
|
41
|
-
nowMs?: number | undefined;
|
|
42
|
-
actorUserId: string;
|
|
43
42
|
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
43
|
+
actorUserId: string;
|
|
44
44
|
}, Promise<boolean>>;
|
|
45
45
|
export declare const deletePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
46
46
|
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
@@ -74,6 +74,7 @@ export declare const listPushTemplatesByCompany: import("convex/server").Registe
|
|
|
74
74
|
updatedAt: number;
|
|
75
75
|
}[]>>;
|
|
76
76
|
export declare const createPushJobFromTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
77
|
+
nowMs?: number | undefined;
|
|
77
78
|
enabled?: boolean | undefined;
|
|
78
79
|
schedule?: {
|
|
79
80
|
kind: "manual";
|
|
@@ -89,21 +90,17 @@ export declare const createPushJobFromTemplate: import("convex/server").Register
|
|
|
89
90
|
time: string;
|
|
90
91
|
dayOfMonth: number | "last";
|
|
91
92
|
} | undefined;
|
|
92
|
-
nowMs?: number | undefined;
|
|
93
93
|
consumerUserId: string;
|
|
94
94
|
companyId: string;
|
|
95
95
|
timezone: string;
|
|
96
96
|
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
97
97
|
}, Promise<import("convex/values").GenericId<"messagePushJobs">>>;
|
|
98
98
|
export declare const createPushJobCustom: import("convex/server").RegisteredMutation<"public", {
|
|
99
|
-
enabled?: boolean | undefined;
|
|
100
99
|
nowMs?: number | undefined;
|
|
100
|
+
enabled?: boolean | undefined;
|
|
101
101
|
consumerUserId: string;
|
|
102
102
|
companyId: string;
|
|
103
|
-
title: string;
|
|
104
|
-
text: string;
|
|
105
103
|
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
106
|
-
timezone: string;
|
|
107
104
|
schedule: {
|
|
108
105
|
kind: "manual";
|
|
109
106
|
} | {
|
|
@@ -118,13 +115,14 @@ export declare const createPushJobCustom: import("convex/server").RegisteredMuta
|
|
|
118
115
|
time: string;
|
|
119
116
|
dayOfMonth: number | "last";
|
|
120
117
|
};
|
|
118
|
+
text: string;
|
|
119
|
+
timezone: string;
|
|
120
|
+
title: string;
|
|
121
121
|
}, Promise<import("convex/values").GenericId<"messagePushJobs">>>;
|
|
122
122
|
export declare const updatePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
123
|
+
nowMs?: number | undefined;
|
|
123
124
|
enabled?: boolean | undefined;
|
|
124
|
-
title?: string | undefined;
|
|
125
|
-
text?: string | undefined;
|
|
126
125
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
127
|
-
timezone?: string | undefined;
|
|
128
126
|
schedule?: {
|
|
129
127
|
kind: "manual";
|
|
130
128
|
} | {
|
|
@@ -139,7 +137,9 @@ export declare const updatePushJob: import("convex/server").RegisteredMutation<"
|
|
|
139
137
|
time: string;
|
|
140
138
|
dayOfMonth: number | "last";
|
|
141
139
|
} | undefined;
|
|
142
|
-
|
|
140
|
+
text?: string | undefined;
|
|
141
|
+
timezone?: string | undefined;
|
|
142
|
+
title?: string | undefined;
|
|
143
143
|
jobId: import("convex/values").GenericId<"messagePushJobs">;
|
|
144
144
|
}, Promise<boolean>>;
|
|
145
145
|
export declare const deletePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
@@ -185,34 +185,34 @@ export declare const listPushJobsForUser: import("convex/server").RegisteredQuer
|
|
|
185
185
|
updatedAt: number;
|
|
186
186
|
}[]>>;
|
|
187
187
|
export declare const triggerPushJobNow: import("convex/server").RegisteredMutation<"public", {
|
|
188
|
+
nowMs?: number | undefined;
|
|
188
189
|
providerConfig?: {
|
|
189
190
|
appName: string;
|
|
190
|
-
region: string;
|
|
191
191
|
kind: "fly" | "runpod" | "ecs";
|
|
192
192
|
organizationSlug: string;
|
|
193
193
|
image: string;
|
|
194
|
+
region: string;
|
|
194
195
|
volumeName: string;
|
|
195
196
|
volumePath: string;
|
|
196
197
|
volumeSizeGb: number;
|
|
197
198
|
} | undefined;
|
|
198
|
-
nowMs?: number | undefined;
|
|
199
199
|
jobId: import("convex/values").GenericId<"messagePushJobs">;
|
|
200
200
|
}, Promise<{
|
|
201
201
|
enqueuedMessageId: Id<"messageQueue">;
|
|
202
202
|
runKey: string;
|
|
203
203
|
}>>;
|
|
204
204
|
export declare const dispatchDuePushJobs: import("convex/server").RegisteredMutation<"public", {
|
|
205
|
+
nowMs?: number | undefined;
|
|
205
206
|
providerConfig?: {
|
|
206
207
|
appName: string;
|
|
207
|
-
region: string;
|
|
208
208
|
kind: "fly" | "runpod" | "ecs";
|
|
209
209
|
organizationSlug: string;
|
|
210
210
|
image: string;
|
|
211
|
+
region: string;
|
|
211
212
|
volumeName: string;
|
|
212
213
|
volumePath: string;
|
|
213
214
|
volumeSizeGb: number;
|
|
214
215
|
} | undefined;
|
|
215
|
-
nowMs?: number | undefined;
|
|
216
216
|
limit?: number | undefined;
|
|
217
217
|
}, Promise<{
|
|
218
218
|
scanned: number;
|
|
@@ -221,20 +221,20 @@ export declare const dispatchDuePushJobs: import("convex/server").RegisteredMuta
|
|
|
221
221
|
failed: number;
|
|
222
222
|
}>>;
|
|
223
223
|
export declare const sendBroadcastToAllActiveAgents: import("convex/server").RegisteredMutation<"public", {
|
|
224
|
+
nowMs?: number | undefined;
|
|
224
225
|
providerConfig?: {
|
|
225
226
|
appName: string;
|
|
226
|
-
region: string;
|
|
227
227
|
kind: "fly" | "runpod" | "ecs";
|
|
228
228
|
organizationSlug: string;
|
|
229
229
|
image: string;
|
|
230
|
+
region: string;
|
|
230
231
|
volumeName: string;
|
|
231
232
|
volumePath: string;
|
|
232
233
|
volumeSizeGb: number;
|
|
233
234
|
} | undefined;
|
|
234
|
-
nowMs?: number | undefined;
|
|
235
235
|
companyId: string;
|
|
236
|
-
title: string;
|
|
237
236
|
text: string;
|
|
237
|
+
title: string;
|
|
238
238
|
requestedBy: string;
|
|
239
239
|
}, Promise<{
|
|
240
240
|
broadcastId: import("convex/values").GenericId<"messagePushBroadcasts">;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
export declare const enqueueMessage: import("convex/server").RegisteredMutation<"public", {
|
|
2
|
-
|
|
3
|
-
scheduledFor?: number | undefined;
|
|
4
|
-
maxAttempts?: number | undefined;
|
|
2
|
+
nowMs?: number | undefined;
|
|
5
3
|
providerConfig?: {
|
|
6
4
|
appName: string;
|
|
7
|
-
region: string;
|
|
8
5
|
kind: "fly" | "runpod" | "ecs";
|
|
9
6
|
organizationSlug: string;
|
|
10
7
|
image: string;
|
|
8
|
+
region: string;
|
|
11
9
|
volumeName: string;
|
|
12
10
|
volumePath: string;
|
|
13
11
|
volumeSizeGb: number;
|
|
14
12
|
} | undefined;
|
|
15
|
-
|
|
13
|
+
maxAttempts?: number | undefined;
|
|
14
|
+
priority?: number | undefined;
|
|
15
|
+
scheduledFor?: number | undefined;
|
|
16
16
|
agentKey: string;
|
|
17
17
|
conversationId: string;
|
|
18
18
|
payload: {
|
|
19
|
+
metadata?: Record<string, string> | undefined;
|
|
19
20
|
externalMessageId?: string | undefined;
|
|
20
21
|
rawUpdateJson?: string | undefined;
|
|
21
|
-
metadata?: Record<string, string> | undefined;
|
|
22
22
|
provider: string;
|
|
23
23
|
providerUserId: string;
|
|
24
24
|
messageText: string;
|
|
25
25
|
};
|
|
26
26
|
}, Promise<import("convex/values").GenericId<"messageQueue">>>;
|
|
27
27
|
export declare const appendConversationMessages: import("convex/server").RegisteredMutation<"public", {
|
|
28
|
-
workspaceId?: string | undefined;
|
|
29
28
|
nowMs?: number | undefined;
|
|
29
|
+
workspaceId?: string | undefined;
|
|
30
30
|
conversationId: string;
|
|
31
31
|
messages: {
|
|
32
32
|
at?: number | undefined;
|
|
@@ -47,9 +47,9 @@ export declare const upsertAgentProfile: import("convex/server").RegisteredMutat
|
|
|
47
47
|
enabled: boolean;
|
|
48
48
|
} | undefined;
|
|
49
49
|
agentKey: string;
|
|
50
|
-
version: string;
|
|
51
|
-
secretsRef: string[];
|
|
52
50
|
enabled: boolean;
|
|
51
|
+
secretsRef: string[];
|
|
52
|
+
version: string;
|
|
53
53
|
}, Promise<import("convex/values").GenericId<"agentProfiles">>>;
|
|
54
54
|
export declare const importPlaintextSecret: import("convex/server").RegisteredMutation<"public", {
|
|
55
55
|
metadata?: Record<string, string> | undefined;
|
|
@@ -72,10 +72,10 @@ export declare const getActiveSecretPlaintext: import("convex/server").Registere
|
|
|
72
72
|
}, Promise<string | null>>;
|
|
73
73
|
export declare const getProviderRuntimeConfig: import("convex/server").RegisteredQuery<"internal", {}, Promise<{
|
|
74
74
|
appName: string;
|
|
75
|
-
region: string;
|
|
76
75
|
kind: "fly" | "runpod" | "ecs";
|
|
77
76
|
organizationSlug: string;
|
|
78
77
|
image: string;
|
|
78
|
+
region: string;
|
|
79
79
|
volumeName: string;
|
|
80
80
|
volumePath: string;
|
|
81
81
|
volumeSizeGb: number;
|
|
@@ -84,10 +84,10 @@ export declare const upsertProviderRuntimeConfig: import("convex/server").Regist
|
|
|
84
84
|
nowMs?: number | undefined;
|
|
85
85
|
providerConfig: {
|
|
86
86
|
appName: string;
|
|
87
|
-
region: string;
|
|
88
87
|
kind: "fly" | "runpod" | "ecs";
|
|
89
88
|
organizationSlug: string;
|
|
90
89
|
image: string;
|
|
90
|
+
region: string;
|
|
91
91
|
volumeName: string;
|
|
92
92
|
volumePath: string;
|
|
93
93
|
volumeSizeGb: number;
|
|
@@ -95,10 +95,10 @@ export declare const upsertProviderRuntimeConfig: import("convex/server").Regist
|
|
|
95
95
|
}, Promise<null>>;
|
|
96
96
|
export declare const providerRuntimeConfig: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
97
97
|
appName: string;
|
|
98
|
-
region: string;
|
|
99
98
|
kind: "fly" | "runpod" | "ecs";
|
|
100
99
|
organizationSlug: string;
|
|
101
100
|
image: string;
|
|
101
|
+
region: string;
|
|
102
102
|
volumeName: string;
|
|
103
103
|
volumePath: string;
|
|
104
104
|
volumeSizeGb: number;
|
|
@@ -107,10 +107,10 @@ export declare const setProviderRuntimeConfig: import("convex/server").Registere
|
|
|
107
107
|
nowMs?: number | undefined;
|
|
108
108
|
providerConfig: {
|
|
109
109
|
appName: string;
|
|
110
|
-
region: string;
|
|
111
110
|
kind: "fly" | "runpod" | "ecs";
|
|
112
111
|
organizationSlug: string;
|
|
113
112
|
image: string;
|
|
113
|
+
region: string;
|
|
114
114
|
volumeName: string;
|
|
115
115
|
volumePath: string;
|
|
116
116
|
volumeSizeGb: number;
|
|
@@ -135,13 +135,13 @@ export declare const setMessageRuntimeConfig: import("convex/server").Registered
|
|
|
135
135
|
};
|
|
136
136
|
}, Promise<null>>;
|
|
137
137
|
export declare const deployGlobalSkill: import("convex/server").RegisteredMutation<"public", {
|
|
138
|
-
|
|
138
|
+
nowMs?: number | undefined;
|
|
139
|
+
actor?: string | undefined;
|
|
139
140
|
description?: string | undefined;
|
|
140
|
-
|
|
141
|
+
displayName?: string | undefined;
|
|
141
142
|
entryPoint?: string | undefined;
|
|
143
|
+
moduleFormat?: "esm" | "cjs" | undefined;
|
|
142
144
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
143
|
-
nowMs?: number | undefined;
|
|
144
|
-
actor?: string | undefined;
|
|
145
145
|
version: string;
|
|
146
146
|
slug: string;
|
|
147
147
|
sourceJs: string;
|
|
@@ -156,8 +156,8 @@ export declare const deployGlobalSkill: import("convex/server").RegisteredMutati
|
|
|
156
156
|
}>>;
|
|
157
157
|
export declare const listGlobalSkills: import("convex/server").RegisteredQuery<"public", {
|
|
158
158
|
status?: "active" | "disabled" | undefined;
|
|
159
|
-
releaseChannel?: "stable" | "canary" | undefined;
|
|
160
159
|
limit?: number | undefined;
|
|
160
|
+
releaseChannel?: "stable" | "canary" | undefined;
|
|
161
161
|
}, Promise<{
|
|
162
162
|
skillId: any;
|
|
163
163
|
slug: string;
|
|
@@ -177,8 +177,8 @@ export declare const listGlobalSkills: import("convex/server").RegisteredQuery<"
|
|
|
177
177
|
} | null;
|
|
178
178
|
}[]>>;
|
|
179
179
|
export declare const getWorkerGlobalSkillsManifest: import("convex/server").RegisteredQuery<"public", {
|
|
180
|
-
workerId?: string | undefined;
|
|
181
180
|
workspaceId?: string | undefined;
|
|
181
|
+
workerId?: string | undefined;
|
|
182
182
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
183
183
|
}, Promise<{
|
|
184
184
|
manifestVersion: string;
|
|
@@ -223,8 +223,8 @@ export declare const attachMessageMetadata: import("convex/server").RegisteredMu
|
|
|
223
223
|
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
224
224
|
}, Promise<boolean>>;
|
|
225
225
|
export declare const claimNextJob: import("convex/server").RegisteredMutation<"public", {
|
|
226
|
-
conversationId?: string | undefined;
|
|
227
226
|
nowMs?: number | undefined;
|
|
227
|
+
conversationId?: string | undefined;
|
|
228
228
|
workerId: string;
|
|
229
229
|
}, Promise<{
|
|
230
230
|
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
@@ -233,9 +233,9 @@ export declare const claimNextJob: import("convex/server").RegisteredMutation<"p
|
|
|
233
233
|
leaseId: string;
|
|
234
234
|
leaseExpiresAt: number;
|
|
235
235
|
payload: {
|
|
236
|
+
metadata?: Record<string, string> | undefined;
|
|
236
237
|
externalMessageId?: string | undefined;
|
|
237
238
|
rawUpdateJson?: string | undefined;
|
|
238
|
-
metadata?: Record<string, string> | undefined;
|
|
239
239
|
provider: string;
|
|
240
240
|
providerUserId: string;
|
|
241
241
|
messageText: string;
|
|
@@ -243,41 +243,41 @@ export declare const claimNextJob: import("convex/server").RegisteredMutation<"p
|
|
|
243
243
|
} | null>>;
|
|
244
244
|
export declare const heartbeatJob: import("convex/server").RegisteredMutation<"public", {
|
|
245
245
|
nowMs?: number | undefined;
|
|
246
|
-
leaseId: string;
|
|
247
|
-
workerId: string;
|
|
248
246
|
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
247
|
+
workerId: string;
|
|
248
|
+
leaseId: string;
|
|
249
249
|
}, Promise<boolean>>;
|
|
250
250
|
export declare const completeJob: import("convex/server").RegisteredMutation<"public", {
|
|
251
|
+
nowMs?: number | undefined;
|
|
251
252
|
providerConfig?: {
|
|
252
253
|
appName: string;
|
|
253
|
-
region: string;
|
|
254
254
|
kind: "fly" | "runpod" | "ecs";
|
|
255
255
|
organizationSlug: string;
|
|
256
256
|
image: string;
|
|
257
|
+
region: string;
|
|
257
258
|
volumeName: string;
|
|
258
259
|
volumePath: string;
|
|
259
260
|
volumeSizeGb: number;
|
|
260
261
|
} | undefined;
|
|
261
|
-
nowMs?: number | undefined;
|
|
262
|
-
leaseId: string;
|
|
263
|
-
workerId: string;
|
|
264
262
|
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
263
|
+
workerId: string;
|
|
264
|
+
leaseId: string;
|
|
265
265
|
}, Promise<boolean>>;
|
|
266
266
|
export declare const failJob: import("convex/server").RegisteredMutation<"public", {
|
|
267
|
+
nowMs?: number | undefined;
|
|
267
268
|
providerConfig?: {
|
|
268
269
|
appName: string;
|
|
269
|
-
region: string;
|
|
270
270
|
kind: "fly" | "runpod" | "ecs";
|
|
271
271
|
organizationSlug: string;
|
|
272
272
|
image: string;
|
|
273
|
+
region: string;
|
|
273
274
|
volumeName: string;
|
|
274
275
|
volumePath: string;
|
|
275
276
|
volumeSizeGb: number;
|
|
276
277
|
} | undefined;
|
|
277
|
-
nowMs?: number | undefined;
|
|
278
|
-
leaseId: string;
|
|
279
|
-
workerId: string;
|
|
280
278
|
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
279
|
+
workerId: string;
|
|
280
|
+
leaseId: string;
|
|
281
281
|
errorMessage: string;
|
|
282
282
|
}, Promise<{
|
|
283
283
|
requeued: boolean;
|
|
@@ -306,9 +306,9 @@ export declare const getHydrationBundleForClaimedJob: import("convex/server").Re
|
|
|
306
306
|
conversationId: string;
|
|
307
307
|
agentKey: string;
|
|
308
308
|
payload: {
|
|
309
|
+
metadata?: Record<string, string> | undefined;
|
|
309
310
|
externalMessageId?: string | undefined;
|
|
310
311
|
rawUpdateJson?: string | undefined;
|
|
311
|
-
metadata?: Record<string, string> | undefined;
|
|
312
312
|
provider: string;
|
|
313
313
|
providerUserId: string;
|
|
314
314
|
messageText: string;
|
|
@@ -320,9 +320,9 @@ export declare const getHydrationBundleForClaimedJob: import("convex/server").Re
|
|
|
320
320
|
at: number;
|
|
321
321
|
}[];
|
|
322
322
|
pendingToolCalls: {
|
|
323
|
+
status: "pending" | "running" | "done" | "failed";
|
|
323
324
|
toolName: string;
|
|
324
325
|
callId: string;
|
|
325
|
-
status: "pending" | "running" | "done" | "failed";
|
|
326
326
|
}[];
|
|
327
327
|
};
|
|
328
328
|
telegramBotToken: string | null;
|
|
@@ -373,12 +373,12 @@ export declare const listJobsByStatus: import("convex/server").RegisteredQuery<"
|
|
|
373
373
|
lastError: string | undefined;
|
|
374
374
|
}[]>>;
|
|
375
375
|
export declare const upsertWorkerState: import("convex/server").RegisteredMutation<"internal", {
|
|
376
|
+
nowMs?: number | undefined;
|
|
376
377
|
appName?: string | undefined;
|
|
377
|
-
machineId?: string | undefined;
|
|
378
378
|
region?: string | undefined;
|
|
379
|
+
machineId?: string | undefined;
|
|
379
380
|
scheduledShutdownAt?: number | undefined;
|
|
380
381
|
stoppedAt?: number | undefined;
|
|
381
|
-
nowMs?: number | undefined;
|
|
382
382
|
clearLastSnapshotId?: boolean | undefined;
|
|
383
383
|
clearMachineRef?: boolean | undefined;
|
|
384
384
|
status: "active" | "draining" | "stopping" | "stopped";
|
|
@@ -392,12 +392,12 @@ export declare const getWorkerControlState: import("convex/server").RegisteredQu
|
|
|
392
392
|
shouldStop: boolean;
|
|
393
393
|
}>>;
|
|
394
394
|
export declare const prepareDataSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
395
|
-
conversationId?: string | undefined;
|
|
396
395
|
nowMs?: number | undefined;
|
|
396
|
+
conversationId?: string | undefined;
|
|
397
397
|
agentKey: string;
|
|
398
|
-
workerId: string;
|
|
399
398
|
workspaceId: string;
|
|
400
|
-
|
|
399
|
+
workerId: string;
|
|
400
|
+
reason: "manual" | "drain" | "signal";
|
|
401
401
|
}, Promise<{
|
|
402
402
|
snapshotId: import("convex/values").GenericId<"dataSnapshots">;
|
|
403
403
|
uploadUrl: string;
|
|
@@ -406,20 +406,20 @@ export declare const prepareDataSnapshotUpload: import("convex/server").Register
|
|
|
406
406
|
export declare const finalizeDataSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
407
407
|
nowMs?: number | undefined;
|
|
408
408
|
workerId: string;
|
|
409
|
-
sha256: string;
|
|
410
|
-
sizeBytes: number;
|
|
411
409
|
storageId: import("convex/values").GenericId<"_storage">;
|
|
412
410
|
snapshotId: import("convex/values").GenericId<"dataSnapshots">;
|
|
411
|
+
sha256: string;
|
|
412
|
+
sizeBytes: number;
|
|
413
413
|
}, Promise<boolean>>;
|
|
414
414
|
export declare const failDataSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
415
415
|
nowMs?: number | undefined;
|
|
416
|
-
workerId: string;
|
|
417
416
|
error: string;
|
|
417
|
+
workerId: string;
|
|
418
418
|
snapshotId: import("convex/values").GenericId<"dataSnapshots">;
|
|
419
419
|
}, Promise<boolean>>;
|
|
420
420
|
export declare const getLatestDataSnapshotForRestore: import("convex/server").RegisteredQuery<"public", {
|
|
421
|
-
conversationId?: string | undefined;
|
|
422
421
|
nowMs?: number | undefined;
|
|
422
|
+
conversationId?: string | undefined;
|
|
423
423
|
agentKey: string;
|
|
424
424
|
workspaceId: string;
|
|
425
425
|
}, Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/component/queue.ts"],"names":[],"mappings":"AA+GA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;8DAmGzB,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;GAiErC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;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EH,eAAO,MAAM,aAAa;;;;;;GAgCxB,CAAC;AAEH,eAAO,MAAM,4BAA4B;;oBAevC,CAAC;AAEH,eAAO,MAAM,qCAAqC;;;mBA6BhD,CAAC;AAEH,eAAO,MAAM,sCAAsC;;;mBA+BjD,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;qBAyB/C,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;KAsC3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBA8E5B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;GAsBhC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;GA+BpC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;oBAmCrC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;oBAmBjC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;UA8C1C,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;KAmClC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;mBAoBjC,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;GAsCzB,CAAC"}
|
package/dist/component/queue.js
CHANGED
|
@@ -879,6 +879,7 @@ export const claimNextJob = mutation({
|
|
|
879
879
|
returns: v.union(v.null(), claimedJobValidator),
|
|
880
880
|
handler: async (ctx, args) => {
|
|
881
881
|
const nowMs = args.nowMs ?? Date.now();
|
|
882
|
+
const staleHeartbeatCutoff = nowMs - DEFAULT_CONFIG.lease.staleAfterMs;
|
|
882
883
|
const worker = await ctx.db
|
|
883
884
|
.query("workers")
|
|
884
885
|
.withIndex("by_workerId", (q) => q.eq("workerId", args.workerId))
|
|
@@ -891,6 +892,7 @@ export const claimNextJob = mutation({
|
|
|
891
892
|
worker.assignment.conversationId !== args.conversationId) {
|
|
892
893
|
return null;
|
|
893
894
|
}
|
|
895
|
+
const workers = await ctx.db.query("workers").collect();
|
|
894
896
|
const candidates = await ctx.db
|
|
895
897
|
.query("messageQueue")
|
|
896
898
|
.withIndex("by_status_and_scheduledFor", (q) => q.eq("status", "queued").lte("scheduledFor", nowMs))
|
|
@@ -922,6 +924,15 @@ export const claimNextJob = mutation({
|
|
|
922
924
|
conversation.agentKey !== worker.assignment.agentKey) {
|
|
923
925
|
continue;
|
|
924
926
|
}
|
|
927
|
+
const existingOwner = findActiveAssignmentOwner(workers, {
|
|
928
|
+
conversationId: candidate.conversationId,
|
|
929
|
+
agentKey: candidate.agentKey,
|
|
930
|
+
excludeWorkerId: args.workerId,
|
|
931
|
+
staleHeartbeatCutoff,
|
|
932
|
+
});
|
|
933
|
+
if (existingOwner) {
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
925
936
|
const lock = conversation.processingLock;
|
|
926
937
|
if (lock && lock.leaseExpiresAt > nowMs)
|
|
927
938
|
continue;
|
|
@@ -1898,7 +1909,7 @@ async function scheduleIdleShutdownWatchdog(ctx, scheduledShutdownAt, nowMs, pro
|
|
|
1898
1909
|
console.warn(`[queue] failed to schedule idle-shutdown watchdog: ${error instanceof Error ? error.message : String(error)}`);
|
|
1899
1910
|
}
|
|
1900
1911
|
}
|
|
1901
|
-
async function scheduleLeaseRecoveryWatchdog(ctx,
|
|
1912
|
+
async function scheduleLeaseRecoveryWatchdog(ctx, _nowMs) {
|
|
1902
1913
|
const delayMs = DEFAULT_CONFIG.lease.leaseMs + 1_000;
|
|
1903
1914
|
try {
|
|
1904
1915
|
await ctx.scheduler.runAfter(delayMs, internal.scheduler.reconcileWorkerPoolInternal, {
|
|
@@ -1936,6 +1947,13 @@ function clearAssignmentForMessage(worker, message, nextLoad) {
|
|
|
1936
1947
|
}
|
|
1937
1948
|
return worker.assignment;
|
|
1938
1949
|
}
|
|
1950
|
+
function findActiveAssignmentOwner(workers, args) {
|
|
1951
|
+
return workers.find((candidate) => candidate.workerId !== args.excludeWorkerId &&
|
|
1952
|
+
isWorkerClaimable(candidate.status) &&
|
|
1953
|
+
candidate.heartbeatAt > args.staleHeartbeatCutoff &&
|
|
1954
|
+
candidate.assignment?.conversationId === args.conversationId &&
|
|
1955
|
+
candidate.assignment.agentKey === args.agentKey);
|
|
1956
|
+
}
|
|
1939
1957
|
function dedupeMessagesById(messages) {
|
|
1940
1958
|
const seen = new Set();
|
|
1941
1959
|
const deduped = [];
|