@okrlinkhub/agent-factory 1.0.2 → 1.0.3
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/component/identity.d.ts +5 -5
- package/dist/component/pushing.d.ts +25 -25
- package/dist/component/queue.d.ts +46 -42
- package/dist/component/queue.d.ts.map +1 -1
- package/dist/component/queue.js +59 -0
- package/dist/component/queue.js.map +1 -1
- package/dist/component/scheduler.d.ts +18 -18
- package/dist/component/scheduler.js +14 -2
- package/dist/component/scheduler.js.map +1 -1
- package/package.json +1 -1
- package/src/component/lib.test.ts +190 -0
- package/src/component/queue.ts +96 -0
- package/src/component/scheduler.ts +20 -2
|
@@ -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
|
-
telegramChatId: string;
|
|
33
32
|
telegramUserId: string;
|
|
33
|
+
telegramChatId: 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" | "expired" | "used";
|
|
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;
|
|
63
62
|
source?: "manual" | "telegram_pairing" | "api" | undefined;
|
|
64
|
-
telegramChatId?: string | undefined;
|
|
65
63
|
telegramUserId?: string | undefined;
|
|
64
|
+
telegramChatId?: string | undefined;
|
|
65
|
+
nowMs?: number | 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
|
-
telegramChatId?: string | undefined;
|
|
93
92
|
telegramUserId?: string | undefined;
|
|
93
|
+
telegramChatId?: 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
|
-
nowMs?: number | undefined;
|
|
4
3
|
enabled?: boolean | undefined;
|
|
4
|
+
nowMs?: number | undefined;
|
|
5
5
|
companyId: string;
|
|
6
|
-
|
|
7
|
-
text: string;
|
|
6
|
+
templateKey: string;
|
|
8
7
|
title: string;
|
|
9
|
-
|
|
8
|
+
text: string;
|
|
9
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
10
10
|
suggestedTimes: ({
|
|
11
11
|
kind: "daily";
|
|
12
12
|
time: string;
|
|
@@ -19,14 +19,13 @@ export declare const createPushTemplate: import("convex/server").RegisteredMutat
|
|
|
19
19
|
time: string;
|
|
20
20
|
dayOfMonth: number | "last";
|
|
21
21
|
})[];
|
|
22
|
-
|
|
22
|
+
actorUserId: string;
|
|
23
23
|
}, Promise<import("convex/values").GenericId<"messagePushTemplates">>>;
|
|
24
24
|
export declare const updatePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
25
|
-
nowMs?: number | undefined;
|
|
26
25
|
enabled?: boolean | undefined;
|
|
27
|
-
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
28
|
-
text?: string | undefined;
|
|
29
26
|
title?: string | undefined;
|
|
27
|
+
text?: string | undefined;
|
|
28
|
+
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
30
29
|
suggestedTimes?: ({
|
|
31
30
|
kind: "daily";
|
|
32
31
|
time: string;
|
|
@@ -39,8 +38,9 @@ export declare const updatePushTemplate: import("convex/server").RegisteredMutat
|
|
|
39
38
|
time: string;
|
|
40
39
|
dayOfMonth: number | "last";
|
|
41
40
|
})[] | undefined;
|
|
42
|
-
|
|
41
|
+
nowMs?: number | undefined;
|
|
43
42
|
actorUserId: string;
|
|
43
|
+
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
44
44
|
}, Promise<boolean>>;
|
|
45
45
|
export declare const deletePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
46
46
|
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
@@ -74,7 +74,6 @@ 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;
|
|
78
77
|
enabled?: boolean | undefined;
|
|
79
78
|
schedule?: {
|
|
80
79
|
kind: "manual";
|
|
@@ -90,17 +89,21 @@ export declare const createPushJobFromTemplate: import("convex/server").Register
|
|
|
90
89
|
time: string;
|
|
91
90
|
dayOfMonth: number | "last";
|
|
92
91
|
} | 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
|
-
nowMs?: number | undefined;
|
|
100
99
|
enabled?: boolean | undefined;
|
|
100
|
+
nowMs?: number | undefined;
|
|
101
101
|
consumerUserId: string;
|
|
102
102
|
companyId: string;
|
|
103
|
+
title: string;
|
|
104
|
+
text: string;
|
|
103
105
|
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
106
|
+
timezone: string;
|
|
104
107
|
schedule: {
|
|
105
108
|
kind: "manual";
|
|
106
109
|
} | {
|
|
@@ -115,14 +118,13 @@ export declare const createPushJobCustom: import("convex/server").RegisteredMuta
|
|
|
115
118
|
time: string;
|
|
116
119
|
dayOfMonth: number | "last";
|
|
117
120
|
};
|
|
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;
|
|
124
123
|
enabled?: boolean | undefined;
|
|
124
|
+
title?: string | undefined;
|
|
125
|
+
text?: string | undefined;
|
|
125
126
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
127
|
+
timezone?: string | undefined;
|
|
126
128
|
schedule?: {
|
|
127
129
|
kind: "manual";
|
|
128
130
|
} | {
|
|
@@ -137,9 +139,7 @@ export declare const updatePushJob: import("convex/server").RegisteredMutation<"
|
|
|
137
139
|
time: string;
|
|
138
140
|
dayOfMonth: number | "last";
|
|
139
141
|
} | undefined;
|
|
140
|
-
|
|
141
|
-
timezone?: string | undefined;
|
|
142
|
-
title?: string | undefined;
|
|
142
|
+
nowMs?: number | 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;
|
|
189
188
|
providerConfig?: {
|
|
190
189
|
appName: string;
|
|
190
|
+
region: string;
|
|
191
191
|
kind: "fly" | "runpod" | "ecs";
|
|
192
192
|
organizationSlug: string;
|
|
193
193
|
image: string;
|
|
194
|
-
region: string;
|
|
195
194
|
volumeName: string;
|
|
196
195
|
volumePath: string;
|
|
197
196
|
volumeSizeGb: number;
|
|
198
197
|
} | 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;
|
|
206
205
|
providerConfig?: {
|
|
207
206
|
appName: string;
|
|
207
|
+
region: string;
|
|
208
208
|
kind: "fly" | "runpod" | "ecs";
|
|
209
209
|
organizationSlug: string;
|
|
210
210
|
image: string;
|
|
211
|
-
region: string;
|
|
212
211
|
volumeName: string;
|
|
213
212
|
volumePath: string;
|
|
214
213
|
volumeSizeGb: number;
|
|
215
214
|
} | 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;
|
|
225
224
|
providerConfig?: {
|
|
226
225
|
appName: string;
|
|
226
|
+
region: string;
|
|
227
227
|
kind: "fly" | "runpod" | "ecs";
|
|
228
228
|
organizationSlug: string;
|
|
229
229
|
image: string;
|
|
230
|
-
region: string;
|
|
231
230
|
volumeName: string;
|
|
232
231
|
volumePath: string;
|
|
233
232
|
volumeSizeGb: number;
|
|
234
233
|
} | undefined;
|
|
234
|
+
nowMs?: number | undefined;
|
|
235
235
|
companyId: string;
|
|
236
|
-
text: string;
|
|
237
236
|
title: string;
|
|
237
|
+
text: 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
|
-
|
|
2
|
+
priority?: number | undefined;
|
|
3
|
+
scheduledFor?: number | undefined;
|
|
4
|
+
maxAttempts?: number | undefined;
|
|
3
5
|
providerConfig?: {
|
|
4
6
|
appName: string;
|
|
7
|
+
region: string;
|
|
5
8
|
kind: "fly" | "runpod" | "ecs";
|
|
6
9
|
organizationSlug: string;
|
|
7
10
|
image: string;
|
|
8
|
-
region: string;
|
|
9
11
|
volumeName: string;
|
|
10
12
|
volumePath: string;
|
|
11
13
|
volumeSizeGb: number;
|
|
12
14
|
} | undefined;
|
|
13
|
-
|
|
14
|
-
priority?: number | undefined;
|
|
15
|
-
scheduledFor?: number | undefined;
|
|
15
|
+
nowMs?: number | undefined;
|
|
16
16
|
agentKey: string;
|
|
17
17
|
conversationId: string;
|
|
18
18
|
payload: {
|
|
19
|
-
metadata?: Record<string, string> | undefined;
|
|
20
19
|
externalMessageId?: string | undefined;
|
|
21
20
|
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
|
-
nowMs?: number | undefined;
|
|
29
28
|
workspaceId?: string | undefined;
|
|
29
|
+
nowMs?: number | 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
|
-
enabled: boolean;
|
|
51
|
-
secretsRef: string[];
|
|
52
50
|
version: string;
|
|
51
|
+
secretsRef: string[];
|
|
52
|
+
enabled: boolean;
|
|
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;
|
|
@@ -70,12 +70,16 @@ export declare const getSecretsStatus: import("convex/server").RegisteredQuery<"
|
|
|
70
70
|
export declare const getActiveSecretPlaintext: import("convex/server").RegisteredQuery<"internal", {
|
|
71
71
|
secretRef: string;
|
|
72
72
|
}, Promise<string | null>>;
|
|
73
|
+
export declare const getWorkerSpawnOpenClawEnv: import("convex/server").RegisteredQuery<"internal", {}, Promise<{
|
|
74
|
+
OPENCLAW_SERVICE_ID?: string;
|
|
75
|
+
OPENCLAW_SERVICE_KEY?: string;
|
|
76
|
+
}>>;
|
|
73
77
|
export declare const getProviderRuntimeConfig: import("convex/server").RegisteredQuery<"internal", {}, Promise<{
|
|
74
78
|
appName: string;
|
|
79
|
+
region: string;
|
|
75
80
|
kind: "fly" | "runpod" | "ecs";
|
|
76
81
|
organizationSlug: string;
|
|
77
82
|
image: string;
|
|
78
|
-
region: string;
|
|
79
83
|
volumeName: string;
|
|
80
84
|
volumePath: string;
|
|
81
85
|
volumeSizeGb: number;
|
|
@@ -84,10 +88,10 @@ export declare const upsertProviderRuntimeConfig: import("convex/server").Regist
|
|
|
84
88
|
nowMs?: number | undefined;
|
|
85
89
|
providerConfig: {
|
|
86
90
|
appName: string;
|
|
91
|
+
region: string;
|
|
87
92
|
kind: "fly" | "runpod" | "ecs";
|
|
88
93
|
organizationSlug: string;
|
|
89
94
|
image: string;
|
|
90
|
-
region: string;
|
|
91
95
|
volumeName: string;
|
|
92
96
|
volumePath: string;
|
|
93
97
|
volumeSizeGb: number;
|
|
@@ -95,10 +99,10 @@ export declare const upsertProviderRuntimeConfig: import("convex/server").Regist
|
|
|
95
99
|
}, Promise<null>>;
|
|
96
100
|
export declare const providerRuntimeConfig: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
97
101
|
appName: string;
|
|
102
|
+
region: string;
|
|
98
103
|
kind: "fly" | "runpod" | "ecs";
|
|
99
104
|
organizationSlug: string;
|
|
100
105
|
image: string;
|
|
101
|
-
region: string;
|
|
102
106
|
volumeName: string;
|
|
103
107
|
volumePath: string;
|
|
104
108
|
volumeSizeGb: number;
|
|
@@ -107,10 +111,10 @@ export declare const setProviderRuntimeConfig: import("convex/server").Registere
|
|
|
107
111
|
nowMs?: number | undefined;
|
|
108
112
|
providerConfig: {
|
|
109
113
|
appName: string;
|
|
114
|
+
region: string;
|
|
110
115
|
kind: "fly" | "runpod" | "ecs";
|
|
111
116
|
organizationSlug: string;
|
|
112
117
|
image: string;
|
|
113
|
-
region: string;
|
|
114
118
|
volumeName: string;
|
|
115
119
|
volumePath: string;
|
|
116
120
|
volumeSizeGb: number;
|
|
@@ -135,13 +139,13 @@ export declare const setMessageRuntimeConfig: import("convex/server").Registered
|
|
|
135
139
|
};
|
|
136
140
|
}, Promise<null>>;
|
|
137
141
|
export declare const deployGlobalSkill: import("convex/server").RegisteredMutation<"public", {
|
|
138
|
-
nowMs?: number | undefined;
|
|
139
|
-
actor?: string | undefined;
|
|
140
|
-
description?: string | undefined;
|
|
141
142
|
displayName?: string | undefined;
|
|
142
|
-
|
|
143
|
+
description?: string | undefined;
|
|
143
144
|
moduleFormat?: "esm" | "cjs" | undefined;
|
|
145
|
+
entryPoint?: string | undefined;
|
|
144
146
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
147
|
+
nowMs?: number | undefined;
|
|
148
|
+
actor?: string | undefined;
|
|
145
149
|
version: string;
|
|
146
150
|
slug: string;
|
|
147
151
|
sourceJs: string;
|
|
@@ -156,8 +160,8 @@ export declare const deployGlobalSkill: import("convex/server").RegisteredMutati
|
|
|
156
160
|
}>>;
|
|
157
161
|
export declare const listGlobalSkills: import("convex/server").RegisteredQuery<"public", {
|
|
158
162
|
status?: "active" | "disabled" | undefined;
|
|
159
|
-
limit?: number | undefined;
|
|
160
163
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
164
|
+
limit?: number | undefined;
|
|
161
165
|
}, Promise<{
|
|
162
166
|
skillId: any;
|
|
163
167
|
slug: string;
|
|
@@ -177,8 +181,8 @@ export declare const listGlobalSkills: import("convex/server").RegisteredQuery<"
|
|
|
177
181
|
} | null;
|
|
178
182
|
}[]>>;
|
|
179
183
|
export declare const getWorkerGlobalSkillsManifest: import("convex/server").RegisteredQuery<"public", {
|
|
180
|
-
workspaceId?: string | undefined;
|
|
181
184
|
workerId?: string | undefined;
|
|
185
|
+
workspaceId?: string | undefined;
|
|
182
186
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
183
187
|
}, Promise<{
|
|
184
188
|
manifestVersion: string;
|
|
@@ -223,8 +227,8 @@ export declare const attachMessageMetadata: import("convex/server").RegisteredMu
|
|
|
223
227
|
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
224
228
|
}, Promise<boolean>>;
|
|
225
229
|
export declare const claimNextJob: import("convex/server").RegisteredMutation<"public", {
|
|
226
|
-
nowMs?: number | undefined;
|
|
227
230
|
conversationId?: string | undefined;
|
|
231
|
+
nowMs?: number | undefined;
|
|
228
232
|
workerId: string;
|
|
229
233
|
}, Promise<{
|
|
230
234
|
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
@@ -233,9 +237,9 @@ export declare const claimNextJob: import("convex/server").RegisteredMutation<"p
|
|
|
233
237
|
leaseId: string;
|
|
234
238
|
leaseExpiresAt: number;
|
|
235
239
|
payload: {
|
|
236
|
-
metadata?: Record<string, string> | undefined;
|
|
237
240
|
externalMessageId?: string | undefined;
|
|
238
241
|
rawUpdateJson?: string | undefined;
|
|
242
|
+
metadata?: Record<string, string> | undefined;
|
|
239
243
|
provider: string;
|
|
240
244
|
providerUserId: string;
|
|
241
245
|
messageText: string;
|
|
@@ -243,41 +247,41 @@ export declare const claimNextJob: import("convex/server").RegisteredMutation<"p
|
|
|
243
247
|
} | null>>;
|
|
244
248
|
export declare const heartbeatJob: import("convex/server").RegisteredMutation<"public", {
|
|
245
249
|
nowMs?: number | undefined;
|
|
246
|
-
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
247
|
-
workerId: string;
|
|
248
250
|
leaseId: string;
|
|
251
|
+
workerId: string;
|
|
252
|
+
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
249
253
|
}, Promise<boolean>>;
|
|
250
254
|
export declare const completeJob: import("convex/server").RegisteredMutation<"public", {
|
|
251
|
-
nowMs?: number | undefined;
|
|
252
255
|
providerConfig?: {
|
|
253
256
|
appName: string;
|
|
257
|
+
region: string;
|
|
254
258
|
kind: "fly" | "runpod" | "ecs";
|
|
255
259
|
organizationSlug: string;
|
|
256
260
|
image: string;
|
|
257
|
-
region: string;
|
|
258
261
|
volumeName: string;
|
|
259
262
|
volumePath: string;
|
|
260
263
|
volumeSizeGb: number;
|
|
261
264
|
} | undefined;
|
|
262
|
-
|
|
263
|
-
workerId: string;
|
|
265
|
+
nowMs?: number | undefined;
|
|
264
266
|
leaseId: string;
|
|
267
|
+
workerId: string;
|
|
268
|
+
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
265
269
|
}, Promise<boolean>>;
|
|
266
270
|
export declare const failJob: import("convex/server").RegisteredMutation<"public", {
|
|
267
|
-
nowMs?: number | undefined;
|
|
268
271
|
providerConfig?: {
|
|
269
272
|
appName: string;
|
|
273
|
+
region: string;
|
|
270
274
|
kind: "fly" | "runpod" | "ecs";
|
|
271
275
|
organizationSlug: string;
|
|
272
276
|
image: string;
|
|
273
|
-
region: string;
|
|
274
277
|
volumeName: string;
|
|
275
278
|
volumePath: string;
|
|
276
279
|
volumeSizeGb: number;
|
|
277
280
|
} | undefined;
|
|
278
|
-
|
|
279
|
-
workerId: string;
|
|
281
|
+
nowMs?: number | undefined;
|
|
280
282
|
leaseId: string;
|
|
283
|
+
workerId: string;
|
|
284
|
+
messageId: import("convex/values").GenericId<"messageQueue">;
|
|
281
285
|
errorMessage: string;
|
|
282
286
|
}, Promise<{
|
|
283
287
|
requeued: boolean;
|
|
@@ -306,9 +310,9 @@ export declare const getHydrationBundleForClaimedJob: import("convex/server").Re
|
|
|
306
310
|
conversationId: string;
|
|
307
311
|
agentKey: string;
|
|
308
312
|
payload: {
|
|
309
|
-
metadata?: Record<string, string> | undefined;
|
|
310
313
|
externalMessageId?: string | undefined;
|
|
311
314
|
rawUpdateJson?: string | undefined;
|
|
315
|
+
metadata?: Record<string, string> | undefined;
|
|
312
316
|
provider: string;
|
|
313
317
|
providerUserId: string;
|
|
314
318
|
messageText: string;
|
|
@@ -320,9 +324,9 @@ export declare const getHydrationBundleForClaimedJob: import("convex/server").Re
|
|
|
320
324
|
at: number;
|
|
321
325
|
}[];
|
|
322
326
|
pendingToolCalls: {
|
|
323
|
-
status: "pending" | "running" | "done" | "failed";
|
|
324
327
|
toolName: string;
|
|
325
328
|
callId: string;
|
|
329
|
+
status: "pending" | "running" | "done" | "failed";
|
|
326
330
|
}[];
|
|
327
331
|
};
|
|
328
332
|
telegramBotToken: string | null;
|
|
@@ -373,12 +377,12 @@ export declare const listJobsByStatus: import("convex/server").RegisteredQuery<"
|
|
|
373
377
|
lastError: string | undefined;
|
|
374
378
|
}[]>>;
|
|
375
379
|
export declare const upsertWorkerState: import("convex/server").RegisteredMutation<"internal", {
|
|
376
|
-
nowMs?: number | undefined;
|
|
377
380
|
appName?: string | undefined;
|
|
378
|
-
region?: string | undefined;
|
|
379
381
|
machineId?: string | undefined;
|
|
382
|
+
region?: string | undefined;
|
|
380
383
|
scheduledShutdownAt?: number | undefined;
|
|
381
384
|
stoppedAt?: number | undefined;
|
|
385
|
+
nowMs?: number | undefined;
|
|
382
386
|
clearLastSnapshotId?: boolean | undefined;
|
|
383
387
|
clearMachineRef?: boolean | undefined;
|
|
384
388
|
status: "active" | "draining" | "stopping" | "stopped";
|
|
@@ -392,12 +396,12 @@ export declare const getWorkerControlState: import("convex/server").RegisteredQu
|
|
|
392
396
|
shouldStop: boolean;
|
|
393
397
|
}>>;
|
|
394
398
|
export declare const prepareDataSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
395
|
-
nowMs?: number | undefined;
|
|
396
399
|
conversationId?: string | undefined;
|
|
400
|
+
nowMs?: number | undefined;
|
|
397
401
|
agentKey: string;
|
|
398
|
-
workspaceId: string;
|
|
399
402
|
workerId: string;
|
|
400
|
-
|
|
403
|
+
workspaceId: string;
|
|
404
|
+
reason: "drain" | "signal" | "manual";
|
|
401
405
|
}, Promise<{
|
|
402
406
|
snapshotId: import("convex/values").GenericId<"dataSnapshots">;
|
|
403
407
|
uploadUrl: string;
|
|
@@ -406,20 +410,20 @@ export declare const prepareDataSnapshotUpload: import("convex/server").Register
|
|
|
406
410
|
export declare const finalizeDataSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
407
411
|
nowMs?: number | undefined;
|
|
408
412
|
workerId: string;
|
|
409
|
-
storageId: import("convex/values").GenericId<"_storage">;
|
|
410
|
-
snapshotId: import("convex/values").GenericId<"dataSnapshots">;
|
|
411
413
|
sha256: string;
|
|
412
414
|
sizeBytes: number;
|
|
415
|
+
storageId: import("convex/values").GenericId<"_storage">;
|
|
416
|
+
snapshotId: import("convex/values").GenericId<"dataSnapshots">;
|
|
413
417
|
}, Promise<boolean>>;
|
|
414
418
|
export declare const failDataSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
415
419
|
nowMs?: number | undefined;
|
|
416
|
-
error: string;
|
|
417
420
|
workerId: string;
|
|
421
|
+
error: string;
|
|
418
422
|
snapshotId: import("convex/values").GenericId<"dataSnapshots">;
|
|
419
423
|
}, Promise<boolean>>;
|
|
420
424
|
export declare const getLatestDataSnapshotForRestore: import("convex/server").RegisteredQuery<"public", {
|
|
421
|
-
nowMs?: number | undefined;
|
|
422
425
|
conversationId?: string | undefined;
|
|
426
|
+
nowMs?: number | undefined;
|
|
423
427
|
agentKey: string;
|
|
424
428
|
workspaceId: string;
|
|
425
429
|
}, Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/component/queue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/component/queue.ts"],"names":[],"mappings":"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"}
|
package/dist/component/queue.js
CHANGED
|
@@ -49,6 +49,10 @@ const bridgeRuntimeConfigValidator = v.object({
|
|
|
49
49
|
serviceKey: v.union(v.null(), v.string()),
|
|
50
50
|
serviceKeySecretRef: v.union(v.null(), v.string()),
|
|
51
51
|
});
|
|
52
|
+
const workerSpawnOpenClawEnvValidator = v.object({
|
|
53
|
+
OPENCLAW_SERVICE_ID: v.optional(v.string()),
|
|
54
|
+
OPENCLAW_SERVICE_KEY: v.optional(v.string()),
|
|
55
|
+
});
|
|
52
56
|
const messageRuntimeConfigValidator = v.object({
|
|
53
57
|
systemPrompt: v.optional(v.string()),
|
|
54
58
|
});
|
|
@@ -315,6 +319,28 @@ export const getActiveSecretPlaintext = internalQuery({
|
|
|
315
319
|
return decryptSecretValue(active.encryptedValue, active.algorithm);
|
|
316
320
|
},
|
|
317
321
|
});
|
|
322
|
+
export const getWorkerSpawnOpenClawEnv = internalQuery({
|
|
323
|
+
args: {},
|
|
324
|
+
returns: workerSpawnOpenClawEnvValidator,
|
|
325
|
+
handler: async (ctx) => {
|
|
326
|
+
const [, globalServiceId] = await resolveFirstActiveSecretValue(ctx, [BRIDGE_SECRET_REFS.serviceId]);
|
|
327
|
+
const [, globalServiceKey] = await resolveFirstActiveSecretValue(ctx, [BRIDGE_SECRET_REFS.serviceKey]);
|
|
328
|
+
const bridgeProfiles = await ctx.db
|
|
329
|
+
.query("agentProfiles")
|
|
330
|
+
.withIndex("by_enabled", (q) => q.eq("enabled", true))
|
|
331
|
+
.collect();
|
|
332
|
+
const serviceId = globalServiceId ?? (await resolveUnambiguousBridgeProfileServiceId(ctx, bridgeProfiles));
|
|
333
|
+
const serviceKey = globalServiceKey ?? (await resolveUnambiguousBridgeProfileServiceKey(ctx, bridgeProfiles));
|
|
334
|
+
const env = {};
|
|
335
|
+
if (serviceId) {
|
|
336
|
+
env.OPENCLAW_SERVICE_ID = serviceId;
|
|
337
|
+
}
|
|
338
|
+
if (serviceKey) {
|
|
339
|
+
env.OPENCLAW_SERVICE_KEY = serviceKey;
|
|
340
|
+
}
|
|
341
|
+
return env;
|
|
342
|
+
},
|
|
343
|
+
});
|
|
318
344
|
export const getProviderRuntimeConfig = internalQuery({
|
|
319
345
|
args: {},
|
|
320
346
|
returns: v.union(v.null(), providerConfigValidator),
|
|
@@ -1887,6 +1913,33 @@ async function resolveBridgeRuntimeConfig(ctx, profile) {
|
|
|
1887
1913
|
serviceKeySecretRef,
|
|
1888
1914
|
};
|
|
1889
1915
|
}
|
|
1916
|
+
async function resolveUnambiguousBridgeProfileServiceId(ctx, profiles) {
|
|
1917
|
+
const values = new Set();
|
|
1918
|
+
for (const profile of profiles) {
|
|
1919
|
+
if (!profile.bridgeConfig?.enabled) {
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
const [, serviceId] = await resolveFirstActiveSecretValue(ctx, getScopedSecretRefCandidates(profile.agentKey, BRIDGE_SECRET_REFS.serviceId));
|
|
1923
|
+
const resolvedServiceId = profile.bridgeConfig.serviceId ?? serviceId;
|
|
1924
|
+
if (resolvedServiceId) {
|
|
1925
|
+
values.add(resolvedServiceId);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
return uniqueValueOrNull(values);
|
|
1929
|
+
}
|
|
1930
|
+
async function resolveUnambiguousBridgeProfileServiceKey(ctx, profiles) {
|
|
1931
|
+
const values = new Set();
|
|
1932
|
+
for (const profile of profiles) {
|
|
1933
|
+
if (!profile.bridgeConfig?.enabled) {
|
|
1934
|
+
continue;
|
|
1935
|
+
}
|
|
1936
|
+
const [, serviceKey] = await resolveFirstActiveSecretValue(ctx, getScopedSecretRefCandidates(profile.agentKey, BRIDGE_SECRET_REFS.serviceKey, profile.bridgeConfig.serviceKeySecretRef ?? null));
|
|
1937
|
+
if (serviceKey) {
|
|
1938
|
+
values.add(serviceKey);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
return uniqueValueOrNull(values);
|
|
1942
|
+
}
|
|
1890
1943
|
function appendSystemPromptToMessage(messageText, systemPrompt) {
|
|
1891
1944
|
const normalizedSystemPrompt = normalizeSystemPrompt(systemPrompt);
|
|
1892
1945
|
if (normalizedSystemPrompt === null) {
|
|
@@ -2012,6 +2065,12 @@ async function resolveFirstActiveSecretValue(ctx, secretRefs) {
|
|
|
2012
2065
|
}
|
|
2013
2066
|
return [null, null];
|
|
2014
2067
|
}
|
|
2068
|
+
function uniqueValueOrNull(values) {
|
|
2069
|
+
if (values.size !== 1) {
|
|
2070
|
+
return null;
|
|
2071
|
+
}
|
|
2072
|
+
return values.values().next().value ?? null;
|
|
2073
|
+
}
|
|
2015
2074
|
function fingerprintConversationDelta(deltaContext) {
|
|
2016
2075
|
const payload = deltaContext.map((entry) => `${entry.role}:${entry.at}:${entry.content}`).join("|");
|
|
2017
2076
|
let hash = 2166136261;
|