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.
Files changed (48) hide show
  1. package/dist/{card-RSGDCHCV.js → card-REW7BSWW.js} +1 -1
  2. package/dist/{chunk-EPIWHNB2.js → chunk-2TLZ6G2B.js} +446 -373
  3. package/dist/{chunk-WGZ5AGOX.js → chunk-3CIMVISQ.js} +24 -1
  4. package/dist/{chunk-NH2FIERR.js → chunk-574W3HHE.js} +1 -1
  5. package/dist/{chunk-B5FTAGFN.js → chunk-7XHDSWRD.js} +75 -75
  6. package/dist/{chunk-NLAWT4DT.js → chunk-7YLFLC5C.js} +6 -6
  7. package/dist/chunk-BP3L2TET.js +148 -0
  8. package/dist/{chunk-EGUOAHCW.js → chunk-C2T4BMRW.js} +12 -12
  9. package/dist/{chunk-5KFI5X7B.js → chunk-F53QQIM2.js} +1 -1
  10. package/dist/chunk-JR6TJDIF.js +425 -0
  11. package/dist/{chunk-DFBX3BBD.js → chunk-KA2VIEGM.js} +211 -16
  12. package/dist/chunk-NQTE577Q.js +159 -0
  13. package/dist/{chunk-WTXRY7R2.js → chunk-NYV3NE5Z.js} +157 -9
  14. package/dist/{chunk-UKT6H7YT.js → chunk-OZXCRLP3.js} +1 -1
  15. package/dist/{chunk-QITOPASZ.js → chunk-PSQHUZ7X.js} +1 -1
  16. package/dist/{chunk-EANI2N2V.js → chunk-RVYQSC6L.js} +2 -99
  17. package/dist/{chunk-MLS6IGGG.js → chunk-TQDV254A.js} +1 -1
  18. package/dist/{chunk-QQFBFV4V.js → chunk-TR6UZDNX.js} +57 -18
  19. package/dist/{chunk-ZX5623ER.js → chunk-VMH2YS2I.js} +1 -1
  20. package/dist/{chunk-XND2DWTZ.js → chunk-VPQ44XKE.js} +2 -2
  21. package/dist/{chunk-CSATDXZC.js → chunk-Y7T6IMM3.js} +1 -1
  22. package/dist/{chunk-FLY3WIQR.js → chunk-YRRVFTDR.js} +3 -3
  23. package/dist/cli/index.js +261 -125
  24. package/dist/{client-T5MTY3CS.js → client-HRYRJKSA.js} +3 -3
  25. package/dist/{conduct-WU3VEXB6.js → conduct-LF6FYPLD.js} +11 -11
  26. package/dist/conduct-QAFZIEY6.js +21 -0
  27. package/dist/{conductor-mode-ZMTFZGJP.js → conductor-mode-NUDQLZFM.js} +309 -13
  28. package/dist/conductor-mode-YQ6QSPPT.js +275 -0
  29. package/dist/{execute-4D4ITQCL.js → execute-ITHIYYOX.js} +4 -3
  30. package/dist/execute-PNJFABVJ.js +14 -0
  31. package/dist/index.d.ts +555 -0
  32. package/dist/index.js +592 -83
  33. package/dist/{process-guard-CC7CNRQJ.js → process-guard-QCCBGILS.js} +1 -1
  34. package/dist/publish-capability-TS6CNR5G.js +12 -0
  35. package/dist/{request-VOXBFUOG.js → request-P6QCTCCG.js} +14 -14
  36. package/dist/{serve-skill-IH7UAJNR.js → serve-skill-EZOL7UYN.js} +10 -9
  37. package/dist/{server-JVQW2TID.js → server-3G6ZTASA.js} +16 -16
  38. package/dist/{service-coordinator-EYRDTHL5.js → service-coordinator-CRSE4GWC.js} +174 -242
  39. package/dist/skill-config-4W5W5O6T.js +22 -0
  40. package/dist/skills/agentbnb/bootstrap.js +227 -67
  41. package/package.json +1 -1
  42. package/skills/agentbnb/SKILL.md +35 -0
  43. package/skills/agentbnb/bootstrap.ts +126 -8
  44. package/skills/agentbnb/install.sh +49 -9
  45. package/dist/chunk-CRFCWD6V.js +0 -366
  46. package/dist/conduct-6LKIJJKQ.js +0 -21
  47. package/dist/conductor-mode-Q4IIDY5E.js +0 -123
  48. package/dist/execute-T7Y6RKSW.js +0 -13
@@ -1,11 +1,8 @@
1
- import {
2
- initFeedbackTable
3
- } from "./chunk-EANI2N2V.js";
4
1
  import {
5
2
  AgentBnBError,
6
3
  AnyCardSchema,
7
4
  CapabilityCardSchema
8
- } from "./chunk-WGZ5AGOX.js";
5
+ } from "./chunk-3CIMVISQ.js";
9
6
 
10
7
  // src/registry/request-log.ts
11
8
  var SINCE_MS = {
@@ -41,11 +38,27 @@ function createRequestLogTable(db) {
41
38
  db.exec("ALTER TABLE request_log ADD COLUMN tier_invoked INTEGER");
42
39
  } catch {
43
40
  }
41
+ try {
42
+ db.exec("ALTER TABLE request_log ADD COLUMN failure_reason TEXT");
43
+ } catch {
44
+ }
45
+ try {
46
+ db.exec("ALTER TABLE request_log ADD COLUMN team_id TEXT");
47
+ } catch {
48
+ }
49
+ try {
50
+ db.exec("ALTER TABLE request_log ADD COLUMN role TEXT");
51
+ } catch {
52
+ }
53
+ try {
54
+ db.exec("ALTER TABLE request_log ADD COLUMN capability_type TEXT");
55
+ } catch {
56
+ }
44
57
  }
45
58
  function insertRequestLog(db, entry) {
46
59
  const stmt = db.prepare(`
47
- INSERT INTO request_log (id, card_id, card_name, requester, status, latency_ms, credits_charged, created_at, skill_id, action_type, tier_invoked)
48
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
60
+ INSERT INTO request_log (id, card_id, card_name, requester, status, latency_ms, credits_charged, created_at, skill_id, action_type, tier_invoked, failure_reason, team_id, role, capability_type)
61
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
49
62
  `);
50
63
  stmt.run(
51
64
  entry.id,
@@ -58,7 +71,11 @@ function insertRequestLog(db, entry) {
58
71
  entry.created_at,
59
72
  entry.skill_id ?? null,
60
73
  entry.action_type ?? null,
61
- entry.tier_invoked ?? null
74
+ entry.tier_invoked ?? null,
75
+ entry.failure_reason ?? null,
76
+ entry.team_id ?? null,
77
+ entry.role ?? null,
78
+ entry.capability_type ?? null
62
79
  );
63
80
  }
64
81
  function getSkillRequestCount(db, skillId, windowMs) {
@@ -100,7 +117,7 @@ function getRequestLog(db, limit = 10, since) {
100
117
  if (since !== void 0) {
101
118
  const cutoff = new Date(Date.now() - SINCE_MS[since]).toISOString();
102
119
  const stmt2 = db.prepare(`
103
- SELECT id, card_id, card_name, requester, status, latency_ms, credits_charged, created_at, skill_id, action_type, tier_invoked
120
+ SELECT id, card_id, card_name, requester, status, latency_ms, credits_charged, created_at, skill_id, action_type, tier_invoked, failure_reason, team_id, role, capability_type
104
121
  FROM request_log
105
122
  WHERE created_at >= ?
106
123
  ORDER BY created_at DESC
@@ -109,7 +126,7 @@ function getRequestLog(db, limit = 10, since) {
109
126
  return stmt2.all(cutoff, limit);
110
127
  }
111
128
  const stmt = db.prepare(`
112
- SELECT id, card_id, card_name, requester, status, latency_ms, credits_charged, created_at, skill_id, action_type, tier_invoked
129
+ SELECT id, card_id, card_name, requester, status, latency_ms, credits_charged, created_at, skill_id, action_type, tier_invoked, failure_reason, team_id, role
113
130
  FROM request_log
114
131
  ORDER BY created_at DESC
115
132
  LIMIT ?
@@ -120,8 +137,101 @@ function getRequestLog(db, limit = 10, since) {
120
137
  // src/registry/store.ts
121
138
  import Database from "better-sqlite3";
122
139
 
123
- // src/evolution/store.ts
140
+ // src/feedback/store.ts
124
141
  import { randomUUID } from "crypto";
142
+ function initFeedbackTable(db) {
143
+ db.exec(`
144
+ CREATE TABLE IF NOT EXISTS feedback (
145
+ id TEXT PRIMARY KEY,
146
+ transaction_id TEXT NOT NULL,
147
+ provider_agent TEXT NOT NULL,
148
+ skill_id TEXT NOT NULL,
149
+ requester_agent TEXT NOT NULL,
150
+ rating INTEGER NOT NULL,
151
+ latency_ms INTEGER NOT NULL,
152
+ result_quality TEXT NOT NULL,
153
+ quality_details TEXT,
154
+ would_reuse INTEGER NOT NULL,
155
+ cost_value_ratio TEXT NOT NULL,
156
+ timestamp TEXT NOT NULL,
157
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
158
+ );
159
+
160
+ CREATE INDEX IF NOT EXISTS feedback_provider_idx ON feedback(provider_agent);
161
+ CREATE INDEX IF NOT EXISTS feedback_skill_idx ON feedback(skill_id);
162
+ `);
163
+ }
164
+ function insertFeedback(db, feedback) {
165
+ const id = randomUUID();
166
+ const now = (/* @__PURE__ */ new Date()).toISOString();
167
+ db.prepare(`
168
+ INSERT INTO feedback (
169
+ id, transaction_id, provider_agent, skill_id, requester_agent,
170
+ rating, latency_ms, result_quality, quality_details,
171
+ would_reuse, cost_value_ratio, timestamp, created_at
172
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
173
+ `).run(
174
+ id,
175
+ feedback.transaction_id,
176
+ feedback.provider_agent,
177
+ feedback.skill_id,
178
+ feedback.requester_agent,
179
+ feedback.rating,
180
+ feedback.latency_ms,
181
+ feedback.result_quality,
182
+ feedback.quality_details ?? null,
183
+ feedback.would_reuse ? 1 : 0,
184
+ feedback.cost_value_ratio,
185
+ feedback.timestamp,
186
+ now
187
+ );
188
+ return id;
189
+ }
190
+ function getFeedbackForSkill(db, skillId, limit = 20) {
191
+ const rows = db.prepare(`
192
+ SELECT * FROM feedback
193
+ WHERE skill_id = ?
194
+ ORDER BY timestamp DESC
195
+ LIMIT ?
196
+ `).all(skillId, limit);
197
+ return rows.map(rowToFeedback);
198
+ }
199
+ function getFeedbackForProvider(db, providerAgent, sinceDays) {
200
+ let rows;
201
+ if (sinceDays !== void 0) {
202
+ rows = db.prepare(`
203
+ SELECT * FROM feedback
204
+ WHERE provider_agent = ?
205
+ AND timestamp >= datetime('now', ? || ' days')
206
+ ORDER BY timestamp DESC
207
+ `).all(providerAgent, `-${sinceDays}`);
208
+ } else {
209
+ rows = db.prepare(`
210
+ SELECT * FROM feedback
211
+ WHERE provider_agent = ?
212
+ ORDER BY timestamp DESC
213
+ `).all(providerAgent);
214
+ }
215
+ return rows.map(rowToFeedback);
216
+ }
217
+ function rowToFeedback(row) {
218
+ return {
219
+ transaction_id: row["transaction_id"],
220
+ provider_agent: row["provider_agent"],
221
+ skill_id: row["skill_id"],
222
+ requester_agent: row["requester_agent"],
223
+ rating: row["rating"],
224
+ latency_ms: row["latency_ms"],
225
+ result_quality: row["result_quality"],
226
+ quality_details: row["quality_details"] ?? void 0,
227
+ would_reuse: row["would_reuse"] === 1,
228
+ cost_value_ratio: row["cost_value_ratio"],
229
+ timestamp: row["timestamp"]
230
+ };
231
+ }
232
+
233
+ // src/evolution/store.ts
234
+ import { randomUUID as randomUUID2 } from "crypto";
125
235
  function initEvolutionTable(db) {
126
236
  db.exec(`
127
237
  CREATE TABLE IF NOT EXISTS evolution_versions (
@@ -141,7 +251,7 @@ function initEvolutionTable(db) {
141
251
  `);
142
252
  }
143
253
  function insertEvolution(db, ev) {
144
- const id = randomUUID();
254
+ const id = randomUUID2();
145
255
  const now = (/* @__PURE__ */ new Date()).toISOString();
146
256
  db.prepare(`
147
257
  INSERT INTO evolution_versions (
@@ -223,6 +333,17 @@ var V2_FTS_TRIGGERS = `
223
333
  FROM json_each(json_extract(new.data, '$.metadata.tags'))),
224
334
  ''
225
335
  )
336
+ || ' ' || COALESCE(
337
+ (SELECT group_concat(json_extract(skill.value, '$.capability_type'), ' ')
338
+ FROM json_each(json_extract(new.data, '$.skills')) AS skill),
339
+ ''
340
+ )
341
+ || ' ' || COALESCE(
342
+ (SELECT group_concat(cap_type.value, ' ')
343
+ FROM json_each(json_extract(new.data, '$.skills')) AS skill,
344
+ json_each(json_extract(skill.value, '$.capability_types')) AS cap_type),
345
+ ''
346
+ )
226
347
  );
227
348
  END;
228
349
 
@@ -252,6 +373,17 @@ var V2_FTS_TRIGGERS = `
252
373
  FROM json_each(json_extract(old.data, '$.metadata.tags'))),
253
374
  ''
254
375
  )
376
+ || ' ' || COALESCE(
377
+ (SELECT group_concat(json_extract(skill.value, '$.capability_type'), ' ')
378
+ FROM json_each(json_extract(old.data, '$.skills')) AS skill),
379
+ ''
380
+ )
381
+ || ' ' || COALESCE(
382
+ (SELECT group_concat(cap_type.value, ' ')
383
+ FROM json_each(json_extract(old.data, '$.skills')) AS skill,
384
+ json_each(json_extract(skill.value, '$.capability_types')) AS cap_type),
385
+ ''
386
+ )
255
387
  );
256
388
  INSERT INTO cards_fts(rowid, id, owner, name, description, tags)
257
389
  VALUES (
@@ -277,6 +409,17 @@ var V2_FTS_TRIGGERS = `
277
409
  FROM json_each(json_extract(new.data, '$.metadata.tags'))),
278
410
  ''
279
411
  )
412
+ || ' ' || COALESCE(
413
+ (SELECT group_concat(json_extract(skill.value, '$.capability_type'), ' ')
414
+ FROM json_each(json_extract(new.data, '$.skills')) AS skill),
415
+ ''
416
+ )
417
+ || ' ' || COALESCE(
418
+ (SELECT group_concat(cap_type.value, ' ')
419
+ FROM json_each(json_extract(new.data, '$.skills')) AS skill,
420
+ json_each(json_extract(skill.value, '$.capability_types')) AS cap_type),
421
+ ''
422
+ )
280
423
  );
281
424
  END;
282
425
 
@@ -306,6 +449,17 @@ var V2_FTS_TRIGGERS = `
306
449
  FROM json_each(json_extract(old.data, '$.metadata.tags'))),
307
450
  ''
308
451
  )
452
+ || ' ' || COALESCE(
453
+ (SELECT group_concat(json_extract(skill.value, '$.capability_type'), ' ')
454
+ FROM json_each(json_extract(old.data, '$.skills')) AS skill),
455
+ ''
456
+ )
457
+ || ' ' || COALESCE(
458
+ (SELECT group_concat(cap_type.value, ' ')
459
+ FROM json_each(json_extract(old.data, '$.skills')) AS skill,
460
+ json_each(json_extract(skill.value, '$.capability_types')) AS cap_type),
461
+ ''
462
+ )
309
463
  );
310
464
  END;
311
465
  `;
@@ -410,10 +564,17 @@ function migrateV1toV2(db) {
410
564
  if (skills.length > 0) {
411
565
  name = skills.map((s) => String(s["name"] ?? "")).join(" ");
412
566
  description = skills.map((s) => String(s["description"] ?? "")).join(" ");
413
- tags = skills.flatMap((s) => {
414
- const meta = s["metadata"];
415
- return meta?.["tags"] ?? [];
416
- }).join(" ");
567
+ tags = [
568
+ // tags from metadata.tags[]
569
+ ...skills.flatMap((s) => {
570
+ const meta = s["metadata"];
571
+ return meta?.["tags"] ?? [];
572
+ }),
573
+ // capability_type (singular)
574
+ ...skills.map((s) => s["capability_type"]).filter((v) => typeof v === "string" && v.length > 0),
575
+ // capability_types[] (plural)
576
+ ...skills.flatMap((s) => s["capability_types"] ?? [])
577
+ ].join(" ");
417
578
  } else {
418
579
  name = String(data["name"] ?? "");
419
580
  description = String(data["description"] ?? "");
@@ -479,6 +640,16 @@ function updateCard(db, id, owner, updates) {
479
640
  `);
480
641
  stmt.run(JSON.stringify(parsed.data), now, id);
481
642
  }
643
+ function deleteCard(db, id, owner) {
644
+ const existing = getCard(db, id);
645
+ if (!existing) {
646
+ throw new AgentBnBError(`Card not found: ${id}`, "NOT_FOUND");
647
+ }
648
+ if (existing.owner !== owner) {
649
+ throw new AgentBnBError("Forbidden: you do not own this card", "FORBIDDEN");
650
+ }
651
+ db.prepare("DELETE FROM capability_cards WHERE id = ?").run(id);
652
+ }
482
653
  function updateReputation(db, cardId, success, latencyMs) {
483
654
  const existing = getCard(db, cardId);
484
655
  if (!existing) return;
@@ -552,8 +723,29 @@ function listCards(db, owner) {
552
723
  }
553
724
  return rows.map((row) => JSON.parse(row.data));
554
725
  }
726
+ function getCardsByCapabilityType(db, capabilityType) {
727
+ const rows = db.prepare(
728
+ "SELECT data FROM capability_cards WHERE json_extract(data, '$.capability_type') = ?"
729
+ ).all(capabilityType);
730
+ return rows.map((row) => JSON.parse(row.data));
731
+ }
732
+ function getCardsBySkillCapability(db, capabilityType) {
733
+ const rows = db.prepare("SELECT data FROM capability_cards").all();
734
+ return rows.map((row) => JSON.parse(row.data)).filter((card) => {
735
+ const skills = card["skills"];
736
+ if (!skills) return false;
737
+ return skills.some((skill) => {
738
+ if (skill["capability_type"] === capabilityType) return true;
739
+ const types = skill["capability_types"];
740
+ return Array.isArray(types) && types.includes(capabilityType);
741
+ });
742
+ });
743
+ }
555
744
 
556
745
  export {
746
+ insertFeedback,
747
+ getFeedbackForSkill,
748
+ getFeedbackForProvider,
557
749
  insertRequestLog,
558
750
  getSkillRequestCount,
559
751
  getActivityFeed,
@@ -565,8 +757,11 @@ export {
565
757
  insertCard,
566
758
  getCard,
567
759
  updateCard,
760
+ deleteCard,
568
761
  updateReputation,
569
762
  updateSkillAvailability,
570
763
  updateSkillIdleRate,
571
- listCards
764
+ listCards,
765
+ getCardsByCapabilityType,
766
+ getCardsBySkillCapability
572
767
  };
@@ -0,0 +1,159 @@
1
+ // src/skills/skill-config.ts
2
+ import { z } from "zod";
3
+ import yaml from "js-yaml";
4
+ var CapacitySchema = z.object({
5
+ max_concurrent: z.number().positive().int().optional()
6
+ }).optional();
7
+ var PricingSchema = z.object({
8
+ credits_per_call: z.number().nonnegative(),
9
+ credits_per_minute: z.number().nonnegative().optional(),
10
+ free_tier: z.number().nonnegative().optional()
11
+ });
12
+ var ApiAuthSchema = z.discriminatedUnion("type", [
13
+ z.object({
14
+ type: z.literal("bearer"),
15
+ token: z.string()
16
+ }),
17
+ z.object({
18
+ type: z.literal("apikey"),
19
+ header: z.string().default("X-API-Key"),
20
+ key: z.string()
21
+ }),
22
+ z.object({
23
+ type: z.literal("basic"),
24
+ username: z.string(),
25
+ password: z.string()
26
+ })
27
+ ]);
28
+ var CapabilityDeclarationSchema = {
29
+ description: z.string().optional(),
30
+ capability_types: z.array(z.string()).optional(),
31
+ requires_capabilities: z.array(z.string()).optional(),
32
+ visibility: z.enum(["public", "private"]).optional()
33
+ };
34
+ var ApiSkillConfigSchema = z.object({
35
+ id: z.string().min(1),
36
+ type: z.literal("api"),
37
+ name: z.string().min(1),
38
+ endpoint: z.string().min(1),
39
+ method: z.enum(["GET", "POST", "PUT", "DELETE"]),
40
+ auth: ApiAuthSchema.optional(),
41
+ input_mapping: z.record(z.string()).default({}),
42
+ output_mapping: z.record(z.string()).default({}),
43
+ pricing: PricingSchema,
44
+ timeout_ms: z.number().positive().default(3e4),
45
+ retries: z.number().nonnegative().int().default(0),
46
+ provider: z.string().optional(),
47
+ capacity: CapacitySchema,
48
+ ...CapabilityDeclarationSchema
49
+ });
50
+ var PipelineStepSchema = z.union([
51
+ z.object({
52
+ skill_id: z.string().min(1),
53
+ input_mapping: z.record(z.string()).default({})
54
+ }),
55
+ z.object({
56
+ command: z.string().min(1),
57
+ input_mapping: z.record(z.string()).default({})
58
+ })
59
+ ]);
60
+ var PipelineSkillConfigSchema = z.object({
61
+ id: z.string().min(1),
62
+ type: z.literal("pipeline"),
63
+ name: z.string().min(1),
64
+ steps: z.array(PipelineStepSchema).min(1),
65
+ pricing: PricingSchema,
66
+ timeout_ms: z.number().positive().optional(),
67
+ capacity: CapacitySchema,
68
+ ...CapabilityDeclarationSchema
69
+ });
70
+ var OpenClawSkillConfigSchema = z.object({
71
+ id: z.string().min(1),
72
+ type: z.literal("openclaw"),
73
+ name: z.string().min(1),
74
+ agent_name: z.string().min(1),
75
+ channel: z.enum(["telegram", "webhook", "process"]),
76
+ pricing: PricingSchema,
77
+ timeout_ms: z.number().positive().optional(),
78
+ capacity: CapacitySchema,
79
+ ...CapabilityDeclarationSchema
80
+ });
81
+ var CommandSkillConfigSchema = z.object({
82
+ id: z.string().min(1),
83
+ type: z.literal("command"),
84
+ name: z.string().min(1),
85
+ command: z.string().min(1),
86
+ output_type: z.enum(["json", "text", "file"]),
87
+ allowed_commands: z.array(z.string()).optional(),
88
+ working_dir: z.string().optional(),
89
+ timeout_ms: z.number().positive().default(3e4),
90
+ pricing: PricingSchema,
91
+ capacity: CapacitySchema,
92
+ ...CapabilityDeclarationSchema
93
+ });
94
+ var ConductorSkillConfigSchema = z.object({
95
+ id: z.string().min(1),
96
+ type: z.literal("conductor"),
97
+ name: z.string().min(1),
98
+ conductor_skill: z.enum(["orchestrate", "plan"]),
99
+ pricing: PricingSchema,
100
+ timeout_ms: z.number().positive().optional(),
101
+ capacity: CapacitySchema,
102
+ ...CapabilityDeclarationSchema
103
+ });
104
+ var SkillConfigSchema = z.discriminatedUnion("type", [
105
+ ApiSkillConfigSchema,
106
+ PipelineSkillConfigSchema,
107
+ OpenClawSkillConfigSchema,
108
+ CommandSkillConfigSchema,
109
+ ConductorSkillConfigSchema
110
+ ]);
111
+ var SkillsFileSchema = z.object({
112
+ skills: z.array(SkillConfigSchema)
113
+ });
114
+ function expandEnvVars(value) {
115
+ return value.replace(/\$\{([^}]+)\}/g, (_match, varName) => {
116
+ if (/[.a-z]/.test(varName)) {
117
+ return _match;
118
+ }
119
+ const envValue = process.env[varName];
120
+ if (envValue === void 0) {
121
+ throw new Error(`Environment variable "${varName}" is not defined`);
122
+ }
123
+ return envValue;
124
+ });
125
+ }
126
+ function expandEnvVarsDeep(value) {
127
+ if (typeof value === "string") {
128
+ return expandEnvVars(value);
129
+ }
130
+ if (Array.isArray(value)) {
131
+ return value.map(expandEnvVarsDeep);
132
+ }
133
+ if (value !== null && typeof value === "object") {
134
+ const result = {};
135
+ for (const [k, v] of Object.entries(value)) {
136
+ result[k] = expandEnvVarsDeep(v);
137
+ }
138
+ return result;
139
+ }
140
+ return value;
141
+ }
142
+ function parseSkillsFile(yamlContent) {
143
+ const raw = yaml.load(yamlContent);
144
+ const expanded = expandEnvVarsDeep(raw);
145
+ const result = SkillsFileSchema.parse(expanded);
146
+ return result.skills;
147
+ }
148
+
149
+ export {
150
+ ApiSkillConfigSchema,
151
+ PipelineSkillConfigSchema,
152
+ OpenClawSkillConfigSchema,
153
+ CommandSkillConfigSchema,
154
+ ConductorSkillConfigSchema,
155
+ SkillConfigSchema,
156
+ SkillsFileSchema,
157
+ expandEnvVars,
158
+ parseSkillsFile
159
+ };