agentbnb 5.1.11 → 6.0.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/dist/{card-RSGDCHCV.js → card-REW7BSWW.js} +1 -1
- package/dist/{chunk-EPIWHNB2.js → chunk-2TLZ6G2B.js} +446 -373
- package/dist/{chunk-WGZ5AGOX.js → chunk-3CIMVISQ.js} +24 -1
- package/dist/{chunk-NH2FIERR.js → chunk-574W3HHE.js} +1 -1
- package/dist/{chunk-B5FTAGFN.js → chunk-7XHDSWRD.js} +75 -75
- package/dist/{chunk-NLAWT4DT.js → chunk-7YLFLC5C.js} +6 -6
- package/dist/chunk-BP3L2TET.js +148 -0
- package/dist/{chunk-EGUOAHCW.js → chunk-C2T4BMRW.js} +12 -12
- package/dist/{chunk-5KFI5X7B.js → chunk-F53QQIM2.js} +1 -1
- package/dist/chunk-JR6TJDIF.js +425 -0
- package/dist/{chunk-DFBX3BBD.js → chunk-KA2VIEGM.js} +211 -16
- package/dist/chunk-NQTE577Q.js +159 -0
- package/dist/{chunk-WTXRY7R2.js → chunk-NYV3NE5Z.js} +157 -9
- package/dist/{chunk-UKT6H7YT.js → chunk-OZXCRLP3.js} +1 -1
- package/dist/{chunk-QITOPASZ.js → chunk-PSQHUZ7X.js} +1 -1
- package/dist/{chunk-EANI2N2V.js → chunk-RVYQSC6L.js} +2 -99
- package/dist/{chunk-MLS6IGGG.js → chunk-TQDV254A.js} +1 -1
- package/dist/{chunk-QQFBFV4V.js → chunk-TR6UZDNX.js} +57 -18
- package/dist/{chunk-ZX5623ER.js → chunk-VMH2YS2I.js} +1 -1
- package/dist/{chunk-XND2DWTZ.js → chunk-VPQ44XKE.js} +2 -2
- package/dist/{chunk-CSATDXZC.js → chunk-Y7T6IMM3.js} +1 -1
- package/dist/{chunk-FLY3WIQR.js → chunk-YRRVFTDR.js} +3 -3
- package/dist/cli/index.js +261 -125
- package/dist/{client-T5MTY3CS.js → client-HRYRJKSA.js} +3 -3
- package/dist/{conduct-WU3VEXB6.js → conduct-LF6FYPLD.js} +11 -11
- package/dist/conduct-QAFZIEY6.js +21 -0
- package/dist/{conductor-mode-ZMTFZGJP.js → conductor-mode-NUDQLZFM.js} +309 -13
- package/dist/conductor-mode-YQ6QSPPT.js +275 -0
- package/dist/{execute-4D4ITQCL.js → execute-ITHIYYOX.js} +4 -3
- package/dist/execute-PNJFABVJ.js +14 -0
- package/dist/index.d.ts +555 -0
- package/dist/index.js +592 -83
- package/dist/{process-guard-CC7CNRQJ.js → process-guard-QCCBGILS.js} +1 -1
- package/dist/publish-capability-TS6CNR5G.js +12 -0
- package/dist/{request-VOXBFUOG.js → request-P6QCTCCG.js} +14 -14
- package/dist/{serve-skill-IH7UAJNR.js → serve-skill-EZOL7UYN.js} +10 -9
- package/dist/{server-JVQW2TID.js → server-3G6ZTASA.js} +16 -16
- package/dist/{service-coordinator-EYRDTHL5.js → service-coordinator-CRSE4GWC.js} +174 -242
- package/dist/skill-config-4W5W5O6T.js +22 -0
- package/dist/skills/agentbnb/bootstrap.js +227 -67
- package/package.json +1 -1
- package/skills/agentbnb/SKILL.md +35 -0
- package/skills/agentbnb/bootstrap.ts +126 -8
- package/skills/agentbnb/install.sh +49 -9
- package/dist/chunk-CRFCWD6V.js +0 -366
- package/dist/conduct-6LKIJJKQ.js +0 -21
- package/dist/conductor-mode-Q4IIDY5E.js +0 -123
- package/dist/execute-T7Y6RKSW.js +0 -13
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StructuredFeedbackSchema
|
|
3
3
|
} from "./chunk-AUBHR7HH.js";
|
|
4
|
+
import {
|
|
5
|
+
executeCapabilityBatch,
|
|
6
|
+
executeCapabilityRequest
|
|
7
|
+
} from "./chunk-TR6UZDNX.js";
|
|
4
8
|
import {
|
|
5
9
|
KNOWN_API_KEYS,
|
|
6
10
|
announceGateway,
|
|
@@ -8,14 +12,19 @@ import {
|
|
|
8
12
|
detectApiKeys,
|
|
9
13
|
getPricingStats,
|
|
10
14
|
stopAnnouncement
|
|
11
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TQDV254A.js";
|
|
12
16
|
import {
|
|
13
17
|
deriveAgentId
|
|
14
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PSQHUZ7X.js";
|
|
15
19
|
import {
|
|
16
20
|
createLedger,
|
|
17
21
|
identityAuthPlugin
|
|
18
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YRRVFTDR.js";
|
|
23
|
+
import "./chunk-OZXCRLP3.js";
|
|
24
|
+
import {
|
|
25
|
+
ApiSkillConfigSchema,
|
|
26
|
+
parseSkillsFile
|
|
27
|
+
} from "./chunk-NQTE577Q.js";
|
|
19
28
|
import {
|
|
20
29
|
RelayMessageSchema
|
|
21
30
|
} from "./chunk-QT7TEVNV.js";
|
|
@@ -28,58 +37,54 @@ import {
|
|
|
28
37
|
insertAuditEvent,
|
|
29
38
|
listPendingRequests,
|
|
30
39
|
resolvePendingRequest
|
|
31
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-Y7T6IMM3.js";
|
|
32
41
|
import {
|
|
33
42
|
buildReputationMap,
|
|
34
43
|
computeReputation,
|
|
35
44
|
filterCards,
|
|
36
45
|
searchCards
|
|
37
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-574W3HHE.js";
|
|
47
|
+
import {
|
|
48
|
+
bootstrapAgent,
|
|
49
|
+
getBalance,
|
|
50
|
+
getTransactions,
|
|
51
|
+
holdEscrow,
|
|
52
|
+
migrateOwner,
|
|
53
|
+
openCreditDb,
|
|
54
|
+
releaseEscrow,
|
|
55
|
+
settleEscrow
|
|
56
|
+
} from "./chunk-RVYQSC6L.js";
|
|
57
|
+
import {
|
|
58
|
+
generateKeyPair,
|
|
59
|
+
verifyEscrowReceipt
|
|
60
|
+
} from "./chunk-F53QQIM2.js";
|
|
38
61
|
import {
|
|
39
62
|
getConfigDir
|
|
40
63
|
} from "./chunk-75OC6E4F.js";
|
|
41
|
-
import {
|
|
42
|
-
executeCapabilityBatch,
|
|
43
|
-
executeCapabilityRequest
|
|
44
|
-
} from "./chunk-QQFBFV4V.js";
|
|
45
|
-
import "./chunk-UKT6H7YT.js";
|
|
46
64
|
import {
|
|
47
65
|
getActivityFeed,
|
|
48
66
|
getCard,
|
|
67
|
+
getCardsBySkillCapability,
|
|
49
68
|
getEvolutionHistory,
|
|
69
|
+
getFeedbackForProvider,
|
|
70
|
+
getFeedbackForSkill,
|
|
50
71
|
getLatestEvolution,
|
|
51
72
|
getRequestLog,
|
|
52
73
|
getSkillRequestCount,
|
|
53
74
|
insertCard,
|
|
54
75
|
insertEvolution,
|
|
76
|
+
insertFeedback,
|
|
55
77
|
insertRequestLog,
|
|
56
78
|
listCards,
|
|
57
79
|
openDatabase,
|
|
58
80
|
updateCard,
|
|
59
81
|
updateSkillAvailability,
|
|
60
82
|
updateSkillIdleRate
|
|
61
|
-
} from "./chunk-
|
|
62
|
-
import {
|
|
63
|
-
bootstrapAgent,
|
|
64
|
-
getBalance,
|
|
65
|
-
getFeedbackForProvider,
|
|
66
|
-
getFeedbackForSkill,
|
|
67
|
-
getTransactions,
|
|
68
|
-
holdEscrow,
|
|
69
|
-
insertFeedback,
|
|
70
|
-
migrateOwner,
|
|
71
|
-
openCreditDb,
|
|
72
|
-
releaseEscrow,
|
|
73
|
-
settleEscrow
|
|
74
|
-
} from "./chunk-EANI2N2V.js";
|
|
75
|
-
import {
|
|
76
|
-
generateKeyPair,
|
|
77
|
-
verifyEscrowReceipt
|
|
78
|
-
} from "./chunk-5KFI5X7B.js";
|
|
83
|
+
} from "./chunk-KA2VIEGM.js";
|
|
79
84
|
import {
|
|
80
85
|
AgentBnBError,
|
|
81
86
|
AnyCardSchema
|
|
82
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-3CIMVISQ.js";
|
|
83
88
|
|
|
84
89
|
// src/runtime/agent-runtime.ts
|
|
85
90
|
import { readFileSync, existsSync } from "fs";
|
|
@@ -164,135 +169,6 @@ function createSkillExecutor(configs, modes) {
|
|
|
164
169
|
return new SkillExecutor(configs, modes);
|
|
165
170
|
}
|
|
166
171
|
|
|
167
|
-
// src/skills/skill-config.ts
|
|
168
|
-
import { z } from "zod";
|
|
169
|
-
import yaml from "js-yaml";
|
|
170
|
-
var PricingSchema = z.object({
|
|
171
|
-
credits_per_call: z.number().nonnegative(),
|
|
172
|
-
credits_per_minute: z.number().nonnegative().optional(),
|
|
173
|
-
free_tier: z.number().nonnegative().optional()
|
|
174
|
-
});
|
|
175
|
-
var ApiAuthSchema = z.discriminatedUnion("type", [
|
|
176
|
-
z.object({
|
|
177
|
-
type: z.literal("bearer"),
|
|
178
|
-
token: z.string()
|
|
179
|
-
}),
|
|
180
|
-
z.object({
|
|
181
|
-
type: z.literal("apikey"),
|
|
182
|
-
header: z.string().default("X-API-Key"),
|
|
183
|
-
key: z.string()
|
|
184
|
-
}),
|
|
185
|
-
z.object({
|
|
186
|
-
type: z.literal("basic"),
|
|
187
|
-
username: z.string(),
|
|
188
|
-
password: z.string()
|
|
189
|
-
})
|
|
190
|
-
]);
|
|
191
|
-
var ApiSkillConfigSchema = z.object({
|
|
192
|
-
id: z.string().min(1),
|
|
193
|
-
type: z.literal("api"),
|
|
194
|
-
name: z.string().min(1),
|
|
195
|
-
endpoint: z.string().min(1),
|
|
196
|
-
method: z.enum(["GET", "POST", "PUT", "DELETE"]),
|
|
197
|
-
auth: ApiAuthSchema.optional(),
|
|
198
|
-
input_mapping: z.record(z.string()).default({}),
|
|
199
|
-
output_mapping: z.record(z.string()).default({}),
|
|
200
|
-
pricing: PricingSchema,
|
|
201
|
-
timeout_ms: z.number().positive().default(3e4),
|
|
202
|
-
retries: z.number().nonnegative().int().default(0),
|
|
203
|
-
provider: z.string().optional()
|
|
204
|
-
});
|
|
205
|
-
var PipelineStepSchema = z.union([
|
|
206
|
-
z.object({
|
|
207
|
-
skill_id: z.string().min(1),
|
|
208
|
-
input_mapping: z.record(z.string()).default({})
|
|
209
|
-
}),
|
|
210
|
-
z.object({
|
|
211
|
-
command: z.string().min(1),
|
|
212
|
-
input_mapping: z.record(z.string()).default({})
|
|
213
|
-
})
|
|
214
|
-
]);
|
|
215
|
-
var PipelineSkillConfigSchema = z.object({
|
|
216
|
-
id: z.string().min(1),
|
|
217
|
-
type: z.literal("pipeline"),
|
|
218
|
-
name: z.string().min(1),
|
|
219
|
-
steps: z.array(PipelineStepSchema).min(1),
|
|
220
|
-
pricing: PricingSchema,
|
|
221
|
-
timeout_ms: z.number().positive().optional()
|
|
222
|
-
});
|
|
223
|
-
var OpenClawSkillConfigSchema = z.object({
|
|
224
|
-
id: z.string().min(1),
|
|
225
|
-
type: z.literal("openclaw"),
|
|
226
|
-
name: z.string().min(1),
|
|
227
|
-
agent_name: z.string().min(1),
|
|
228
|
-
channel: z.enum(["telegram", "webhook", "process"]),
|
|
229
|
-
pricing: PricingSchema,
|
|
230
|
-
timeout_ms: z.number().positive().optional()
|
|
231
|
-
});
|
|
232
|
-
var CommandSkillConfigSchema = z.object({
|
|
233
|
-
id: z.string().min(1),
|
|
234
|
-
type: z.literal("command"),
|
|
235
|
-
name: z.string().min(1),
|
|
236
|
-
command: z.string().min(1),
|
|
237
|
-
output_type: z.enum(["json", "text", "file"]),
|
|
238
|
-
allowed_commands: z.array(z.string()).optional(),
|
|
239
|
-
working_dir: z.string().optional(),
|
|
240
|
-
timeout_ms: z.number().positive().default(3e4),
|
|
241
|
-
pricing: PricingSchema
|
|
242
|
-
});
|
|
243
|
-
var ConductorSkillConfigSchema = z.object({
|
|
244
|
-
id: z.string().min(1),
|
|
245
|
-
type: z.literal("conductor"),
|
|
246
|
-
name: z.string().min(1),
|
|
247
|
-
conductor_skill: z.enum(["orchestrate", "plan"]),
|
|
248
|
-
pricing: PricingSchema,
|
|
249
|
-
timeout_ms: z.number().positive().optional()
|
|
250
|
-
});
|
|
251
|
-
var SkillConfigSchema = z.discriminatedUnion("type", [
|
|
252
|
-
ApiSkillConfigSchema,
|
|
253
|
-
PipelineSkillConfigSchema,
|
|
254
|
-
OpenClawSkillConfigSchema,
|
|
255
|
-
CommandSkillConfigSchema,
|
|
256
|
-
ConductorSkillConfigSchema
|
|
257
|
-
]);
|
|
258
|
-
var SkillsFileSchema = z.object({
|
|
259
|
-
skills: z.array(SkillConfigSchema)
|
|
260
|
-
});
|
|
261
|
-
function expandEnvVars(value) {
|
|
262
|
-
return value.replace(/\$\{([^}]+)\}/g, (_match, varName) => {
|
|
263
|
-
if (/[.a-z]/.test(varName)) {
|
|
264
|
-
return _match;
|
|
265
|
-
}
|
|
266
|
-
const envValue = process.env[varName];
|
|
267
|
-
if (envValue === void 0) {
|
|
268
|
-
throw new Error(`Environment variable "${varName}" is not defined`);
|
|
269
|
-
}
|
|
270
|
-
return envValue;
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
function expandEnvVarsDeep(value) {
|
|
274
|
-
if (typeof value === "string") {
|
|
275
|
-
return expandEnvVars(value);
|
|
276
|
-
}
|
|
277
|
-
if (Array.isArray(value)) {
|
|
278
|
-
return value.map(expandEnvVarsDeep);
|
|
279
|
-
}
|
|
280
|
-
if (value !== null && typeof value === "object") {
|
|
281
|
-
const result = {};
|
|
282
|
-
for (const [k, v] of Object.entries(value)) {
|
|
283
|
-
result[k] = expandEnvVarsDeep(v);
|
|
284
|
-
}
|
|
285
|
-
return result;
|
|
286
|
-
}
|
|
287
|
-
return value;
|
|
288
|
-
}
|
|
289
|
-
function parseSkillsFile(yamlContent) {
|
|
290
|
-
const raw = yaml.load(yamlContent);
|
|
291
|
-
const expanded = expandEnvVarsDeep(raw);
|
|
292
|
-
const result = SkillsFileSchema.parse(expanded);
|
|
293
|
-
return result.skills;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
172
|
// src/skills/api-executor.ts
|
|
297
173
|
function parseMappingTarget(mapping) {
|
|
298
174
|
const dotIndex = mapping.indexOf(".");
|
|
@@ -914,8 +790,8 @@ var AgentRuntime = class {
|
|
|
914
790
|
}
|
|
915
791
|
const modes = /* @__PURE__ */ new Map();
|
|
916
792
|
if (this.conductorEnabled) {
|
|
917
|
-
const { ConductorMode } = await import("./conductor-mode-
|
|
918
|
-
const { registerConductorCard, CONDUCTOR_OWNER } = await import("./card-
|
|
793
|
+
const { ConductorMode } = await import("./conductor-mode-YQ6QSPPT.js");
|
|
794
|
+
const { registerConductorCard, CONDUCTOR_OWNER } = await import("./card-REW7BSWW.js");
|
|
919
795
|
const { loadPeers } = await import("./peers-K7FSHPN3.js");
|
|
920
796
|
registerConductorCard(this.registryDb);
|
|
921
797
|
const resolveAgentUrl = (owner) => {
|
|
@@ -1021,6 +897,7 @@ var AgentRuntime = class {
|
|
|
1021
897
|
|
|
1022
898
|
// src/gateway/server.ts
|
|
1023
899
|
import Fastify from "fastify";
|
|
900
|
+
import { randomUUID } from "crypto";
|
|
1024
901
|
var VERSION = "0.0.1";
|
|
1025
902
|
function createGatewayServer(opts) {
|
|
1026
903
|
const {
|
|
@@ -1034,6 +911,8 @@ function createGatewayServer(opts) {
|
|
|
1034
911
|
} = opts;
|
|
1035
912
|
const fastify = Fastify({ logger: !silent });
|
|
1036
913
|
const tokenSet = new Set(tokens);
|
|
914
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
915
|
+
const OVERLOAD_RETRY_MS = 5e3;
|
|
1037
916
|
fastify.addHook("onRequest", async (request) => {
|
|
1038
917
|
if (request.method === "GET" && request.url === "/health") return;
|
|
1039
918
|
const auth = request.headers.authorization;
|
|
@@ -1099,18 +978,63 @@ function createGatewayServer(opts) {
|
|
|
1099
978
|
}
|
|
1100
979
|
const requester = params.requester ?? "unknown";
|
|
1101
980
|
const receipt = params.escrow_receipt;
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
981
|
+
if (skillExecutor && skillId && typeof skillExecutor.getSkillConfig === "function") {
|
|
982
|
+
const skillConfig = skillExecutor.getSkillConfig(skillId);
|
|
983
|
+
const maxConcurrent = skillConfig?.capacity?.max_concurrent;
|
|
984
|
+
if (maxConcurrent !== void 0) {
|
|
985
|
+
const current = inFlight.get(skillId) ?? 0;
|
|
986
|
+
if (current >= maxConcurrent) {
|
|
987
|
+
try {
|
|
988
|
+
insertRequestLog(registryDb, {
|
|
989
|
+
id: randomUUID(),
|
|
990
|
+
card_id: cardId,
|
|
991
|
+
card_name: "<overload>",
|
|
992
|
+
requester,
|
|
993
|
+
status: "failure",
|
|
994
|
+
latency_ms: 0,
|
|
995
|
+
credits_charged: 0,
|
|
996
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
997
|
+
skill_id: skillId,
|
|
998
|
+
failure_reason: "overload"
|
|
999
|
+
});
|
|
1000
|
+
} catch {
|
|
1001
|
+
}
|
|
1002
|
+
return reply.status(200).send({
|
|
1003
|
+
jsonrpc: "2.0",
|
|
1004
|
+
id,
|
|
1005
|
+
error: {
|
|
1006
|
+
code: -32e3,
|
|
1007
|
+
message: "overload",
|
|
1008
|
+
data: { error: "overload", retry_after_ms: OVERLOAD_RETRY_MS }
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
const trackKey = skillId ?? cardId;
|
|
1015
|
+
inFlight.set(trackKey, (inFlight.get(trackKey) ?? 0) + 1);
|
|
1016
|
+
let result;
|
|
1017
|
+
try {
|
|
1018
|
+
result = await executeCapabilityRequest({
|
|
1019
|
+
registryDb,
|
|
1020
|
+
creditDb,
|
|
1021
|
+
cardId,
|
|
1022
|
+
skillId,
|
|
1023
|
+
params,
|
|
1024
|
+
requester,
|
|
1025
|
+
escrowReceipt: receipt,
|
|
1026
|
+
skillExecutor,
|
|
1027
|
+
handlerUrl,
|
|
1028
|
+
timeoutMs
|
|
1029
|
+
});
|
|
1030
|
+
} finally {
|
|
1031
|
+
const next = (inFlight.get(trackKey) ?? 1) - 1;
|
|
1032
|
+
if (next <= 0) {
|
|
1033
|
+
inFlight.delete(trackKey);
|
|
1034
|
+
} else {
|
|
1035
|
+
inFlight.set(trackKey, next);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1114
1038
|
if (result.success) {
|
|
1115
1039
|
return reply.send({ jsonrpc: "2.0", id, result: result.result });
|
|
1116
1040
|
} else {
|
|
@@ -1130,10 +1054,10 @@ import fastifyWebsocket from "@fastify/websocket";
|
|
|
1130
1054
|
import { join, dirname } from "path";
|
|
1131
1055
|
import { fileURLToPath } from "url";
|
|
1132
1056
|
import { existsSync as existsSync2 } from "fs";
|
|
1133
|
-
import { z as
|
|
1057
|
+
import { z as z4 } from "zod";
|
|
1134
1058
|
|
|
1135
1059
|
// src/relay/websocket-relay.ts
|
|
1136
|
-
import { randomUUID as
|
|
1060
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
1137
1061
|
|
|
1138
1062
|
// src/relay/relay-credit.ts
|
|
1139
1063
|
function lookupCardPrice(registryDb, cardId, skillId) {
|
|
@@ -1191,10 +1115,10 @@ function releaseForRelay(creditDb, escrowId) {
|
|
|
1191
1115
|
}
|
|
1192
1116
|
|
|
1193
1117
|
// src/hub-agent/relay-bridge.ts
|
|
1194
|
-
import { randomUUID as
|
|
1118
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
1195
1119
|
|
|
1196
1120
|
// src/hub-agent/job-queue.ts
|
|
1197
|
-
import { randomUUID } from "crypto";
|
|
1121
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
1198
1122
|
function initJobQueue(db) {
|
|
1199
1123
|
db.exec(`
|
|
1200
1124
|
CREATE TABLE IF NOT EXISTS hub_agent_jobs (
|
|
@@ -1213,7 +1137,7 @@ function initJobQueue(db) {
|
|
|
1213
1137
|
`);
|
|
1214
1138
|
}
|
|
1215
1139
|
function insertJob(db, input) {
|
|
1216
|
-
const id =
|
|
1140
|
+
const id = randomUUID2();
|
|
1217
1141
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1218
1142
|
const paramsJson = JSON.stringify(input.params);
|
|
1219
1143
|
db.prepare(`
|
|
@@ -1425,7 +1349,7 @@ function createRelayBridge(opts) {
|
|
|
1425
1349
|
updateJobStatus(registryDb, job.id, "dispatched");
|
|
1426
1350
|
const agent = getHubAgent(registryDb, job.hub_agent_id);
|
|
1427
1351
|
const cardId = agent ? agent.agent_id.padEnd(32, "0").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12}).*$/, "$1-$2-$3-$4-$5") : job.hub_agent_id;
|
|
1428
|
-
const requestId =
|
|
1352
|
+
const requestId = randomUUID3();
|
|
1429
1353
|
let params = {};
|
|
1430
1354
|
try {
|
|
1431
1355
|
params = JSON.parse(job.params);
|
|
@@ -1571,7 +1495,7 @@ function registerWebSocketRelay(server, db, creditDb) {
|
|
|
1571
1495
|
function logAgentJoined(owner, cardName, cardId) {
|
|
1572
1496
|
try {
|
|
1573
1497
|
insertRequestLog(db, {
|
|
1574
|
-
id:
|
|
1498
|
+
id: randomUUID4(),
|
|
1575
1499
|
card_id: cardId,
|
|
1576
1500
|
card_name: cardName,
|
|
1577
1501
|
requester: owner,
|
|
@@ -1918,16 +1842,16 @@ function registerWebSocketRelay(server, db, creditDb) {
|
|
|
1918
1842
|
}
|
|
1919
1843
|
|
|
1920
1844
|
// src/identity/guarantor.ts
|
|
1921
|
-
import { z
|
|
1922
|
-
import { randomUUID as
|
|
1845
|
+
import { z } from "zod";
|
|
1846
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
1923
1847
|
var MAX_AGENTS_PER_GUARANTOR = 10;
|
|
1924
1848
|
var GUARANTOR_CREDIT_POOL = 50;
|
|
1925
|
-
var GuarantorRecordSchema =
|
|
1926
|
-
id:
|
|
1927
|
-
github_login:
|
|
1928
|
-
agent_count:
|
|
1929
|
-
credit_pool:
|
|
1930
|
-
created_at:
|
|
1849
|
+
var GuarantorRecordSchema = z.object({
|
|
1850
|
+
id: z.string().uuid(),
|
|
1851
|
+
github_login: z.string().min(1),
|
|
1852
|
+
agent_count: z.number().int().nonnegative(),
|
|
1853
|
+
credit_pool: z.number().int().nonnegative(),
|
|
1854
|
+
created_at: z.string().datetime()
|
|
1931
1855
|
});
|
|
1932
1856
|
var GUARANTOR_SCHEMA = `
|
|
1933
1857
|
CREATE TABLE IF NOT EXISTS guarantors (
|
|
@@ -1958,7 +1882,7 @@ function registerGuarantor(db, githubLogin) {
|
|
|
1958
1882
|
);
|
|
1959
1883
|
}
|
|
1960
1884
|
const record = {
|
|
1961
|
-
id:
|
|
1885
|
+
id: randomUUID5(),
|
|
1962
1886
|
github_login: githubLogin,
|
|
1963
1887
|
agent_count: 0,
|
|
1964
1888
|
credit_pool: GUARANTOR_CREDIT_POOL,
|
|
@@ -2032,7 +1956,7 @@ function getAgentGuarantor(db, agentId) {
|
|
|
2032
1956
|
function initiateGithubAuth() {
|
|
2033
1957
|
return {
|
|
2034
1958
|
auth_url: "https://github.com/login/oauth/authorize?client_id=PLACEHOLDER&scope=read:user",
|
|
2035
|
-
state:
|
|
1959
|
+
state: randomUUID5()
|
|
2036
1960
|
};
|
|
2037
1961
|
}
|
|
2038
1962
|
|
|
@@ -2459,38 +2383,38 @@ var HubAgentExecutor = class {
|
|
|
2459
2383
|
};
|
|
2460
2384
|
|
|
2461
2385
|
// src/hub-agent/types.ts
|
|
2462
|
-
import { z as
|
|
2463
|
-
var SkillRouteSchema =
|
|
2464
|
-
|
|
2465
|
-
skill_id:
|
|
2466
|
-
mode:
|
|
2386
|
+
import { z as z2 } from "zod";
|
|
2387
|
+
var SkillRouteSchema = z2.discriminatedUnion("mode", [
|
|
2388
|
+
z2.object({
|
|
2389
|
+
skill_id: z2.string().min(1),
|
|
2390
|
+
mode: z2.literal("direct_api"),
|
|
2467
2391
|
config: ApiSkillConfigSchema
|
|
2468
2392
|
}),
|
|
2469
|
-
|
|
2470
|
-
skill_id:
|
|
2471
|
-
mode:
|
|
2472
|
-
config:
|
|
2393
|
+
z2.object({
|
|
2394
|
+
skill_id: z2.string().min(1),
|
|
2395
|
+
mode: z2.literal("relay"),
|
|
2396
|
+
config: z2.object({ relay_owner: z2.string().min(1) })
|
|
2473
2397
|
}),
|
|
2474
|
-
|
|
2475
|
-
skill_id:
|
|
2476
|
-
mode:
|
|
2477
|
-
config:
|
|
2398
|
+
z2.object({
|
|
2399
|
+
skill_id: z2.string().min(1),
|
|
2400
|
+
mode: z2.literal("queue"),
|
|
2401
|
+
config: z2.object({ relay_owner: z2.string().min(1) }).passthrough()
|
|
2478
2402
|
})
|
|
2479
2403
|
]);
|
|
2480
|
-
var HubAgentSchema =
|
|
2481
|
-
agent_id:
|
|
2482
|
-
name:
|
|
2483
|
-
owner_public_key:
|
|
2484
|
-
public_key:
|
|
2485
|
-
skill_routes:
|
|
2486
|
-
status:
|
|
2487
|
-
created_at:
|
|
2488
|
-
updated_at:
|
|
2404
|
+
var HubAgentSchema = z2.object({
|
|
2405
|
+
agent_id: z2.string().min(1),
|
|
2406
|
+
name: z2.string().min(1),
|
|
2407
|
+
owner_public_key: z2.string().min(1),
|
|
2408
|
+
public_key: z2.string().min(1),
|
|
2409
|
+
skill_routes: z2.array(SkillRouteSchema),
|
|
2410
|
+
status: z2.enum(["active", "paused"]),
|
|
2411
|
+
created_at: z2.string(),
|
|
2412
|
+
updated_at: z2.string()
|
|
2489
2413
|
});
|
|
2490
|
-
var CreateAgentRequestSchema =
|
|
2491
|
-
name:
|
|
2492
|
-
skill_routes:
|
|
2493
|
-
secrets:
|
|
2414
|
+
var CreateAgentRequestSchema = z2.object({
|
|
2415
|
+
name: z2.string().min(1),
|
|
2416
|
+
skill_routes: z2.array(SkillRouteSchema),
|
|
2417
|
+
secrets: z2.record(z2.string()).optional()
|
|
2494
2418
|
});
|
|
2495
2419
|
|
|
2496
2420
|
// src/hub-agent/routes.ts
|
|
@@ -3037,28 +2961,28 @@ var feedbackPlugin = async (fastify, opts) => {
|
|
|
3037
2961
|
var api_default = feedbackPlugin;
|
|
3038
2962
|
|
|
3039
2963
|
// src/evolution/schema.ts
|
|
3040
|
-
import { z as
|
|
3041
|
-
var CoreMemoryEntrySchema =
|
|
3042
|
-
category:
|
|
3043
|
-
importance:
|
|
3044
|
-
content:
|
|
3045
|
-
scope:
|
|
2964
|
+
import { z as z3 } from "zod";
|
|
2965
|
+
var CoreMemoryEntrySchema = z3.object({
|
|
2966
|
+
category: z3.string(),
|
|
2967
|
+
importance: z3.number().min(0).max(1),
|
|
2968
|
+
content: z3.string(),
|
|
2969
|
+
scope: z3.string().optional()
|
|
3046
2970
|
});
|
|
3047
|
-
var TemplateEvolutionSchema =
|
|
2971
|
+
var TemplateEvolutionSchema = z3.object({
|
|
3048
2972
|
/** e.g. "genesis-template" */
|
|
3049
|
-
template_name:
|
|
2973
|
+
template_name: z3.string().min(1),
|
|
3050
2974
|
/** Semantic version string, e.g. "1.2.3" */
|
|
3051
|
-
template_version:
|
|
2975
|
+
template_version: z3.string().regex(/^\d+\.\d+\.\d+$/, "Must be a valid semver string (e.g. 1.2.3)"),
|
|
3052
2976
|
/** Identifier of the agent publishing this evolution */
|
|
3053
|
-
publisher_agent:
|
|
2977
|
+
publisher_agent: z3.string().min(1),
|
|
3054
2978
|
/** Human-readable description of what changed in this evolution */
|
|
3055
|
-
changelog:
|
|
2979
|
+
changelog: z3.string().max(1e3),
|
|
3056
2980
|
/** Snapshot of the agent's core memory at the time of evolution (max 50 entries) */
|
|
3057
|
-
core_memory_snapshot:
|
|
2981
|
+
core_memory_snapshot: z3.array(CoreMemoryEntrySchema).max(50),
|
|
3058
2982
|
/** Delta in fitness score from before evolution (range -1 to 1) */
|
|
3059
|
-
fitness_improvement:
|
|
2983
|
+
fitness_improvement: z3.number().min(-1).max(1),
|
|
3060
2984
|
/** ISO 8601 datetime string */
|
|
3061
|
-
timestamp:
|
|
2985
|
+
timestamp: z3.string().datetime()
|
|
3062
2986
|
});
|
|
3063
2987
|
|
|
3064
2988
|
// src/evolution/api.ts
|
|
@@ -3295,6 +3219,7 @@ function createRegistryServer(opts) {
|
|
|
3295
3219
|
min_success_rate: { type: "number", description: "Minimum success rate (0-1)" },
|
|
3296
3220
|
max_latency_ms: { type: "number", description: "Maximum average latency in ms" },
|
|
3297
3221
|
min_reputation: { type: "number", description: "Minimum reputation score (0-1) based on peer feedback" },
|
|
3222
|
+
capability_type: { type: "string", description: "Filter cards whose skills declare this capability_type (e.g. tts, code_gen)" },
|
|
3298
3223
|
sort: { type: "string", enum: ["popular", "rated", "success_rate", "cheapest", "newest", "latency", "reputation_desc", "reputation_asc"], description: "Sort order" },
|
|
3299
3224
|
limit: { type: "integer", default: 20, description: "Max items per page (max 100)" },
|
|
3300
3225
|
offset: { type: "integer", default: 0, description: "Pagination offset" }
|
|
@@ -3321,6 +3246,7 @@ function createRegistryServer(opts) {
|
|
|
3321
3246
|
const onlineRaw = query.online;
|
|
3322
3247
|
const online = onlineRaw === "true" ? true : onlineRaw === "false" ? false : void 0;
|
|
3323
3248
|
const tag = query.tag?.trim();
|
|
3249
|
+
const capabilityType = query.capability_type?.trim() || void 0;
|
|
3324
3250
|
const minSuccessRate = query.min_success_rate !== void 0 ? parseFloat(query.min_success_rate) : void 0;
|
|
3325
3251
|
const maxLatencyMs = query.max_latency_ms !== void 0 ? parseFloat(query.max_latency_ms) : void 0;
|
|
3326
3252
|
const minReputation = query.min_reputation !== void 0 ? parseFloat(query.min_reputation) : void 0;
|
|
@@ -3336,6 +3262,12 @@ function createRegistryServer(opts) {
|
|
|
3336
3262
|
cards = filterCards(db, { level, online, min_reputation: minReputation });
|
|
3337
3263
|
}
|
|
3338
3264
|
cards = cards.filter((c) => !c.owner.includes(":req:"));
|
|
3265
|
+
if (capabilityType !== void 0) {
|
|
3266
|
+
const capTypeIds = new Set(
|
|
3267
|
+
getCardsBySkillCapability(db, capabilityType).map((c) => c.id)
|
|
3268
|
+
);
|
|
3269
|
+
cards = cards.filter((c) => capTypeIds.has(c.id));
|
|
3270
|
+
}
|
|
3339
3271
|
if (tag !== void 0 && tag.length > 0) {
|
|
3340
3272
|
cards = cards.filter((c) => {
|
|
3341
3273
|
const rootTags = c.metadata?.tags ?? [];
|
|
@@ -4032,16 +3964,16 @@ function createRegistryServer(opts) {
|
|
|
4032
3964
|
const gptActions = convertToGptActions(openapiSpec, serverUrl);
|
|
4033
3965
|
return reply.send(gptActions);
|
|
4034
3966
|
});
|
|
4035
|
-
const BatchRequestBodySchema =
|
|
4036
|
-
requests:
|
|
4037
|
-
|
|
4038
|
-
skill_id:
|
|
4039
|
-
params:
|
|
4040
|
-
max_credits:
|
|
3967
|
+
const BatchRequestBodySchema = z4.object({
|
|
3968
|
+
requests: z4.array(
|
|
3969
|
+
z4.object({
|
|
3970
|
+
skill_id: z4.string().min(1),
|
|
3971
|
+
params: z4.record(z4.unknown()).default({}),
|
|
3972
|
+
max_credits: z4.number().positive()
|
|
4041
3973
|
})
|
|
4042
3974
|
).min(1),
|
|
4043
|
-
strategy:
|
|
4044
|
-
total_budget:
|
|
3975
|
+
strategy: z4.enum(["parallel", "sequential", "best_effort"]),
|
|
3976
|
+
total_budget: z4.number().positive()
|
|
4045
3977
|
});
|
|
4046
3978
|
api.post("/api/request/batch", {
|
|
4047
3979
|
schema: {
|
|
@@ -4400,7 +4332,7 @@ import { createRequire } from "module";
|
|
|
4400
4332
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
4401
4333
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4402
4334
|
import { dirname as dirname2, join as join2, resolve } from "path";
|
|
4403
|
-
import { randomUUID as
|
|
4335
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
4404
4336
|
var ServiceCoordinator = class {
|
|
4405
4337
|
config;
|
|
4406
4338
|
guard;
|
|
@@ -4541,7 +4473,7 @@ var ServiceCoordinator = class {
|
|
|
4541
4473
|
console.log("Conductor mode enabled \u2014 orchestrate/plan skills available via gateway");
|
|
4542
4474
|
}
|
|
4543
4475
|
if (opts.conductorEnabled && this.config.conductor?.public) {
|
|
4544
|
-
const { buildConductorCard } = await import("./card-
|
|
4476
|
+
const { buildConductorCard } = await import("./card-REW7BSWW.js");
|
|
4545
4477
|
const conductorCard = buildConductorCard(this.config.owner);
|
|
4546
4478
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4547
4479
|
const existing = this.runtime.registryDb.prepare("SELECT id FROM capability_cards WHERE id = ?").get(conductorCard.id);
|
|
@@ -4599,10 +4531,10 @@ var ServiceCoordinator = class {
|
|
|
4599
4531
|
}
|
|
4600
4532
|
if (opts.registryUrl && opts.relay) {
|
|
4601
4533
|
const { RelayClient } = await import("./websocket-client-6IIDGXKB.js");
|
|
4602
|
-
const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-
|
|
4534
|
+
const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-PNJFABVJ.js");
|
|
4603
4535
|
const cards = listCards(this.runtime.registryDb, this.config.owner);
|
|
4604
4536
|
const card = cards[0] ?? {
|
|
4605
|
-
id:
|
|
4537
|
+
id: randomUUID6(),
|
|
4606
4538
|
owner: this.config.owner,
|
|
4607
4539
|
name: this.config.owner,
|
|
4608
4540
|
description: "Agent registered via CLI",
|
|
@@ -4615,7 +4547,7 @@ var ServiceCoordinator = class {
|
|
|
4615
4547
|
};
|
|
4616
4548
|
const additionalCards = [];
|
|
4617
4549
|
if (this.config.conductor?.public) {
|
|
4618
|
-
const { buildConductorCard } = await import("./card-
|
|
4550
|
+
const { buildConductorCard } = await import("./card-REW7BSWW.js");
|
|
4619
4551
|
additionalCards.push(
|
|
4620
4552
|
buildConductorCard(this.config.owner)
|
|
4621
4553
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApiSkillConfigSchema,
|
|
3
|
+
CommandSkillConfigSchema,
|
|
4
|
+
ConductorSkillConfigSchema,
|
|
5
|
+
OpenClawSkillConfigSchema,
|
|
6
|
+
PipelineSkillConfigSchema,
|
|
7
|
+
SkillConfigSchema,
|
|
8
|
+
SkillsFileSchema,
|
|
9
|
+
expandEnvVars,
|
|
10
|
+
parseSkillsFile
|
|
11
|
+
} from "./chunk-NQTE577Q.js";
|
|
12
|
+
export {
|
|
13
|
+
ApiSkillConfigSchema,
|
|
14
|
+
CommandSkillConfigSchema,
|
|
15
|
+
ConductorSkillConfigSchema,
|
|
16
|
+
OpenClawSkillConfigSchema,
|
|
17
|
+
PipelineSkillConfigSchema,
|
|
18
|
+
SkillConfigSchema,
|
|
19
|
+
SkillsFileSchema,
|
|
20
|
+
expandEnvVars,
|
|
21
|
+
parseSkillsFile
|
|
22
|
+
};
|