agentbnb 3.1.1 → 3.1.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CapabilityCardV2Schema
3
- } from "./chunk-7RU5INZI.js";
3
+ } from "./chunk-XA63SD4T.js";
4
4
 
5
5
  // src/conductor/card.ts
6
6
  var CONDUCTOR_OWNER = "agentbnb-conductor";
@@ -6,10 +6,10 @@ import {
6
6
  holdEscrow,
7
7
  releaseEscrow,
8
8
  settleEscrow
9
- } from "./chunk-MZCNJ5PY.js";
9
+ } from "./chunk-QVV2P3FN.js";
10
10
  import {
11
11
  AgentBnBError
12
- } from "./chunk-7RU5INZI.js";
12
+ } from "./chunk-XA63SD4T.js";
13
13
 
14
14
  // src/autonomy/tiers.ts
15
15
  import { randomUUID } from "crypto";
@@ -3,7 +3,7 @@ import {
3
3
  requestCapability,
4
4
  scorePeers,
5
5
  searchCards
6
- } from "./chunk-2ETVQXP7.js";
6
+ } from "./chunk-KTHJ5F3X.js";
7
7
 
8
8
  // src/conductor/task-decomposer.ts
9
9
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-7RU5INZI.js";
3
+ } from "./chunk-XA63SD4T.js";
4
4
 
5
5
  // src/credit/escrow.ts
6
6
  import { randomUUID } from "crypto";
@@ -2,7 +2,7 @@ import {
2
2
  getCard,
3
3
  insertRequestLog,
4
4
  updateReputation
5
- } from "./chunk-QAY6XTT7.js";
5
+ } from "./chunk-UOGDK2S2.js";
6
6
  import {
7
7
  confirmEscrowDebit,
8
8
  getBalance,
@@ -10,10 +10,10 @@ import {
10
10
  recordEarning,
11
11
  releaseEscrow,
12
12
  settleEscrow
13
- } from "./chunk-MZCNJ5PY.js";
13
+ } from "./chunk-QVV2P3FN.js";
14
14
  import {
15
15
  AgentBnBError
16
- } from "./chunk-7RU5INZI.js";
16
+ } from "./chunk-XA63SD4T.js";
17
17
 
18
18
  // src/gateway/execute.ts
19
19
  import { randomUUID } from "crypto";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AgentBnBError,
3
3
  CapabilityCardSchema
4
- } from "./chunk-7RU5INZI.js";
4
+ } from "./chunk-XA63SD4T.js";
5
5
 
6
6
  // src/registry/request-log.ts
7
7
  var SINCE_MS = {
@@ -39,6 +39,8 @@ var CapabilityCardSchema = z.object({
39
39
  * never transmitted beyond the local store.
40
40
  */
41
41
  _internal: z.record(z.unknown()).optional(),
42
+ /** Public gateway URL where this agent accepts requests. Populated on remote publish. */
43
+ gateway_url: z.string().url().optional(),
42
44
  metadata: z.object({
43
45
  apis_used: z.array(z.string()).optional(),
44
46
  avg_latency_ms: z.number().nonnegative().optional(),
@@ -103,6 +105,8 @@ var CapabilityCardV2Schema = z.object({
103
105
  * never transmitted beyond the local store.
104
106
  */
105
107
  _internal: z.record(z.unknown()).optional(),
108
+ /** Public gateway URL where this agent accepts requests. Populated on remote publish. */
109
+ gateway_url: z.string().url().optional(),
106
110
  created_at: z.string().datetime().optional(),
107
111
  updated_at: z.string().datetime().optional()
108
112
  });
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  saveKeyPair,
8
8
  settleRequesterEscrow,
9
9
  signEscrowReceipt
10
- } from "../chunk-MGHI67GR.js";
10
+ } from "../chunk-SVEZBIGE.js";
11
11
  import {
12
12
  RelayMessageSchema
13
13
  } from "../chunk-3Y36WQDV.js";
@@ -24,7 +24,7 @@ import {
24
24
  requestCapability,
25
25
  resolvePendingRequest,
26
26
  searchCards
27
- } from "../chunk-2ETVQXP7.js";
27
+ } from "../chunk-KTHJ5F3X.js";
28
28
  import {
29
29
  findPeer,
30
30
  getConfigDir,
@@ -46,7 +46,7 @@ import {
46
46
  updateCard,
47
47
  updateSkillAvailability,
48
48
  updateSkillIdleRate
49
- } from "../chunk-QAY6XTT7.js";
49
+ } from "../chunk-UOGDK2S2.js";
50
50
  import {
51
51
  bootstrapAgent,
52
52
  getBalance,
@@ -54,12 +54,12 @@ import {
54
54
  holdEscrow,
55
55
  openCreditDb,
56
56
  releaseEscrow
57
- } from "../chunk-MZCNJ5PY.js";
57
+ } from "../chunk-QVV2P3FN.js";
58
58
  import {
59
59
  AgentBnBError,
60
60
  AnyCardSchema,
61
61
  CapabilityCardV2Schema
62
- } from "../chunk-7RU5INZI.js";
62
+ } from "../chunk-XA63SD4T.js";
63
63
 
64
64
  // src/cli/index.ts
65
65
  import { Command } from "commander";
@@ -1525,8 +1525,8 @@ var AgentRuntime = class {
1525
1525
  }
1526
1526
  const modes = /* @__PURE__ */ new Map();
1527
1527
  if (this.conductorEnabled) {
1528
- const { ConductorMode } = await import("../conductor-mode-GPLAM2XO.js");
1529
- const { registerConductorCard, CONDUCTOR_OWNER } = await import("../card-EWIXC377.js");
1528
+ const { ConductorMode } = await import("../conductor-mode-6MIVMFBC.js");
1529
+ const { registerConductorCard, CONDUCTOR_OWNER } = await import("../card-IE5UV5QX.js");
1530
1530
  const { loadPeers: loadPeers2 } = await import("../peers-G36URZYB.js");
1531
1531
  registerConductorCard(this.registryDb);
1532
1532
  const resolveAgentUrl = (owner) => {
@@ -3161,11 +3161,12 @@ program.command("publish <card.json>").description("Publish a Capability Card to
3161
3161
  let remoteSuccess = false;
3162
3162
  if (registryUrl) {
3163
3163
  const url = `${registryUrl.replace(/\/$/, "")}/cards`;
3164
+ const remoteCard = { ...card, gateway_url: config.gateway_url };
3164
3165
  try {
3165
3166
  const response = await fetch(url, {
3166
3167
  method: "POST",
3167
3168
  headers: { "Content-Type": "application/json" },
3168
- body: JSON.stringify(card)
3169
+ body: JSON.stringify(remoteCard)
3169
3170
  });
3170
3171
  if (!response.ok) {
3171
3172
  const body = await response.text();
@@ -3190,6 +3191,77 @@ program.command("publish <card.json>").description("Publish a Capability Card to
3190
3191
  } else if (!registryUrl) {
3191
3192
  }
3192
3193
  });
3194
+ program.command("sync").description("Push all local capability cards to the configured remote registry").option("--registry <url>", "Remote registry URL (overrides config.registry)").option("--json", "Output as JSON").action(async (opts) => {
3195
+ const config = loadConfig();
3196
+ if (!config) {
3197
+ console.error("Error: not initialized. Run `agentbnb init` first.");
3198
+ process.exit(1);
3199
+ }
3200
+ const registryUrl = opts.registry ?? config.registry;
3201
+ if (!registryUrl) {
3202
+ console.error("Error: no remote registry configured.");
3203
+ console.error("Set one with: agentbnb config set registry <url>");
3204
+ process.exit(1);
3205
+ }
3206
+ const db = openDatabase(config.db_path);
3207
+ let localCards;
3208
+ try {
3209
+ localCards = listCards(db);
3210
+ } finally {
3211
+ db.close();
3212
+ }
3213
+ if (localCards.length === 0) {
3214
+ if (opts.json) {
3215
+ console.log(JSON.stringify({ synced: 0, failed: 0, registry: registryUrl }));
3216
+ } else {
3217
+ console.log("No local cards to sync.");
3218
+ }
3219
+ return;
3220
+ }
3221
+ const url = `${registryUrl.replace(/\/$/, "")}/cards`;
3222
+ let synced = 0;
3223
+ let failed = 0;
3224
+ const results = [];
3225
+ for (const card of localCards) {
3226
+ const { _internal: _, ...publicCard } = card;
3227
+ const remoteCard = { ...publicCard, gateway_url: config.gateway_url };
3228
+ const displayName = card.name ?? card.agent_name ?? card.id;
3229
+ try {
3230
+ const response = await fetch(url, {
3231
+ method: "POST",
3232
+ headers: { "Content-Type": "application/json" },
3233
+ body: JSON.stringify(remoteCard)
3234
+ });
3235
+ if (response.ok) {
3236
+ synced++;
3237
+ results.push({ id: card.id, name: displayName, ok: true });
3238
+ if (!opts.json) {
3239
+ console.log(` Synced: ${displayName} (${card.id.slice(0, 8)}...)`);
3240
+ }
3241
+ } else {
3242
+ const body = await response.text();
3243
+ failed++;
3244
+ results.push({ id: card.id, name: displayName, ok: false, error: `${response.status}: ${body}` });
3245
+ if (!opts.json) {
3246
+ console.error(` Failed: ${displayName} \u2014 ${response.status}`);
3247
+ }
3248
+ }
3249
+ } catch (err) {
3250
+ failed++;
3251
+ const msg = err instanceof Error ? err.message : String(err);
3252
+ results.push({ id: card.id, name: displayName, ok: false, error: msg });
3253
+ if (!opts.json) {
3254
+ console.error(` Failed: ${displayName} \u2014 ${msg}`);
3255
+ }
3256
+ }
3257
+ }
3258
+ if (opts.json) {
3259
+ console.log(JSON.stringify({ synced, failed, registry: registryUrl, results }, null, 2));
3260
+ } else {
3261
+ console.log(`
3262
+ Synced ${synced}/${localCards.length} cards to ${registryUrl}${failed > 0 ? ` (${failed} failed)` : ""}`);
3263
+ }
3264
+ });
3193
3265
  program.command("discover [query]").description("Search available capabilities in the registry").option("--level <level>", "Filter by level (1, 2, or 3)").option("--online", "Only show online capabilities").option("--local", "Browse for agents on the local network via mDNS").option("--registry <url>", "Remote registry URL to query (e.g., http://host:7701)").option("--tag <tag>", "Filter by metadata tag").option("--json", "Output as JSON").action(async (query, opts) => {
3194
3266
  if (opts.local) {
3195
3267
  const discovered = [];
@@ -3361,7 +3433,7 @@ program.command("request [card-id]").description("Request a capability from anot
3361
3433
  }
3362
3434
  let gatewayUrl;
3363
3435
  let token;
3364
- const isPeerRequest = !!opts.peer;
3436
+ let isRemoteRequest = false;
3365
3437
  if (opts.peer) {
3366
3438
  const peer = findPeer(opts.peer);
3367
3439
  if (!peer) {
@@ -3370,13 +3442,54 @@ program.command("request [card-id]").description("Request a capability from anot
3370
3442
  }
3371
3443
  gatewayUrl = peer.url;
3372
3444
  token = peer.token;
3445
+ isRemoteRequest = true;
3373
3446
  } else {
3374
- gatewayUrl = config.gateway_url;
3375
- token = config.token;
3447
+ const db = openDatabase(config.db_path);
3448
+ let localCard;
3449
+ try {
3450
+ localCard = db.prepare("SELECT data FROM capability_cards WHERE id = ?").get(cardId) ? JSON.parse(db.prepare("SELECT data FROM capability_cards WHERE id = ?").get(cardId).data) : void 0;
3451
+ } finally {
3452
+ db.close();
3453
+ }
3454
+ if (localCard) {
3455
+ gatewayUrl = config.gateway_url;
3456
+ token = config.token;
3457
+ } else {
3458
+ const registryUrl = config.registry;
3459
+ if (!registryUrl) {
3460
+ console.error("Error: card not found locally and no remote registry configured.");
3461
+ console.error("Set one with: agentbnb config set registry <url>");
3462
+ process.exit(1);
3463
+ }
3464
+ const cardUrl = `${registryUrl.replace(/\/$/, "")}/cards/${cardId}`;
3465
+ let remoteCard;
3466
+ try {
3467
+ const resp = await fetch(cardUrl);
3468
+ if (!resp.ok) {
3469
+ console.error(`Error: card ${cardId} not found on remote registry (${resp.status}).`);
3470
+ process.exit(1);
3471
+ }
3472
+ remoteCard = await resp.json();
3473
+ } catch (err) {
3474
+ console.error(`Error: cannot reach registry: ${err.message}`);
3475
+ process.exit(1);
3476
+ }
3477
+ if (!remoteCard.gateway_url || typeof remoteCard.gateway_url !== "string") {
3478
+ console.error("Error: remote card has no gateway_url. The provider needs to re-publish with `agentbnb sync`.");
3479
+ process.exit(1);
3480
+ }
3481
+ gatewayUrl = remoteCard.gateway_url;
3482
+ token = "";
3483
+ isRemoteRequest = true;
3484
+ if (!opts.json) {
3485
+ const displayName = remoteCard.name ?? remoteCard.agent_name ?? cardId;
3486
+ console.log(`Found remote card: ${displayName} @ ${gatewayUrl}`);
3487
+ }
3488
+ }
3376
3489
  }
3377
- const useReceipt = isPeerRequest && opts.receipt !== false;
3490
+ const useReceipt = isRemoteRequest && opts.receipt !== false;
3378
3491
  if (useReceipt && !opts.cost) {
3379
- console.error("Error: --cost <credits> is required for peer requests. Specify the credits to commit.");
3492
+ console.error("Error: --cost <credits> is required for remote requests. Specify the credits to commit.");
3380
3493
  process.exit(1);
3381
3494
  }
3382
3495
  let escrowId;
@@ -3591,7 +3704,7 @@ program.command("serve").description("Start the AgentBnB gateway server").option
3591
3704
  }
3592
3705
  if (opts.registry) {
3593
3706
  const { RelayClient } = await import("../websocket-client-5TIQDYQ4.js");
3594
- const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("../execute-NZXTSSVV.js");
3707
+ const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("../execute-HM25IOG7.js");
3595
3708
  const cards = listCards(runtime.registryDb, config.owner);
3596
3709
  const card = cards[0] ?? {
3597
3710
  id: config.owner,
@@ -3860,7 +3973,7 @@ openclaw.command("rules").description("Print HEARTBEAT.md rules block (or inject
3860
3973
  }
3861
3974
  });
3862
3975
  program.command("conduct <task>").description("Orchestrate a complex task across the AgentBnB network").option("--plan-only", "Show execution plan without executing").option("--max-budget <credits>", "Maximum credits to spend", "100").option("--json", "Output as JSON").action(async (task, opts) => {
3863
- const { conductAction } = await import("../conduct-5T3LGXMF.js");
3976
+ const { conductAction } = await import("../conduct-5XKKALNX.js");
3864
3977
  const result = await conductAction(task, opts);
3865
3978
  if (opts.json) {
3866
3979
  console.log(JSON.stringify(result, null, 2));
@@ -4,21 +4,21 @@ import {
4
4
  decompose,
5
5
  matchSubTasks,
6
6
  orchestrate
7
- } from "./chunk-VCW7IDJM.js";
7
+ } from "./chunk-P35546JW.js";
8
8
  import {
9
9
  BudgetManager
10
- } from "./chunk-2ETVQXP7.js";
10
+ } from "./chunk-KTHJ5F3X.js";
11
11
  import {
12
12
  loadConfig,
13
13
  loadPeers
14
14
  } from "./chunk-BEI5MTNZ.js";
15
15
  import {
16
16
  openDatabase
17
- } from "./chunk-QAY6XTT7.js";
17
+ } from "./chunk-UOGDK2S2.js";
18
18
  import {
19
19
  openCreditDb
20
- } from "./chunk-MZCNJ5PY.js";
21
- import "./chunk-7RU5INZI.js";
20
+ } from "./chunk-QVV2P3FN.js";
21
+ import "./chunk-XA63SD4T.js";
22
22
 
23
23
  // src/cli/conduct.ts
24
24
  async function conductAction(task, opts) {
@@ -3,13 +3,13 @@ import {
3
3
  decompose,
4
4
  matchSubTasks,
5
5
  orchestrate
6
- } from "./chunk-VCW7IDJM.js";
6
+ } from "./chunk-P35546JW.js";
7
7
  import {
8
8
  BudgetManager
9
- } from "./chunk-2ETVQXP7.js";
9
+ } from "./chunk-KTHJ5F3X.js";
10
10
  import "./chunk-BEI5MTNZ.js";
11
- import "./chunk-MZCNJ5PY.js";
12
- import "./chunk-7RU5INZI.js";
11
+ import "./chunk-QVV2P3FN.js";
12
+ import "./chunk-XA63SD4T.js";
13
13
 
14
14
  // src/conductor/conductor-mode.ts
15
15
  var ConductorMode = class {
@@ -0,0 +1,9 @@
1
+ import {
2
+ executeCapabilityRequest
3
+ } from "./chunk-SVEZBIGE.js";
4
+ import "./chunk-UOGDK2S2.js";
5
+ import "./chunk-QVV2P3FN.js";
6
+ import "./chunk-XA63SD4T.js";
7
+ export {
8
+ executeCapabilityRequest
9
+ };
package/dist/index.d.ts CHANGED
@@ -96,6 +96,8 @@ declare const CapabilityCardSchema: z.ZodObject<{
96
96
  * never transmitted beyond the local store.
97
97
  */
98
98
  _internal: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
99
+ /** Public gateway URL where this agent accepts requests. Populated on remote publish. */
100
+ gateway_url: z.ZodOptional<z.ZodString>;
99
101
  metadata: z.ZodOptional<z.ZodObject<{
100
102
  apis_used: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
101
103
  avg_latency_ms: z.ZodOptional<z.ZodNumber>;
@@ -150,6 +152,7 @@ declare const CapabilityCardSchema: z.ZodObject<{
150
152
  tier?: string | undefined;
151
153
  }[] | undefined;
152
154
  _internal?: Record<string, unknown> | undefined;
155
+ gateway_url?: string | undefined;
153
156
  metadata?: {
154
157
  apis_used?: string[] | undefined;
155
158
  avg_latency_ms?: number | undefined;
@@ -194,6 +197,7 @@ declare const CapabilityCardSchema: z.ZodObject<{
194
197
  tier?: string | undefined;
195
198
  }[] | undefined;
196
199
  _internal?: Record<string, unknown> | undefined;
200
+ gateway_url?: string | undefined;
197
201
  metadata?: {
198
202
  apis_used?: string[] | undefined;
199
203
  avg_latency_ms?: number | undefined;
@@ -444,6 +448,8 @@ declare const CapabilityCardV2Schema: z.ZodObject<{
444
448
  * never transmitted beyond the local store.
445
449
  */
446
450
  _internal: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
451
+ /** Public gateway URL where this agent accepts requests. Populated on remote publish. */
452
+ gateway_url: z.ZodOptional<z.ZodString>;
447
453
  created_at: z.ZodOptional<z.ZodString>;
448
454
  updated_at: z.ZodOptional<z.ZodString>;
449
455
  }, "strip", z.ZodTypeAny, {
@@ -500,6 +506,7 @@ declare const CapabilityCardV2Schema: z.ZodObject<{
500
506
  category?: string | undefined;
501
507
  }[];
502
508
  _internal?: Record<string, unknown> | undefined;
509
+ gateway_url?: string | undefined;
503
510
  created_at?: string | undefined;
504
511
  updated_at?: string | undefined;
505
512
  environment?: {
@@ -560,6 +567,7 @@ declare const CapabilityCardV2Schema: z.ZodObject<{
560
567
  category?: string | undefined;
561
568
  }[];
562
569
  _internal?: Record<string, unknown> | undefined;
570
+ gateway_url?: string | undefined;
563
571
  created_at?: string | undefined;
564
572
  updated_at?: string | undefined;
565
573
  environment?: {
package/dist/index.js CHANGED
@@ -39,6 +39,8 @@ var CapabilityCardSchema = z.object({
39
39
  * never transmitted beyond the local store.
40
40
  */
41
41
  _internal: z.record(z.unknown()).optional(),
42
+ /** Public gateway URL where this agent accepts requests. Populated on remote publish. */
43
+ gateway_url: z.string().url().optional(),
42
44
  metadata: z.object({
43
45
  apis_used: z.array(z.string()).optional(),
44
46
  avg_latency_ms: z.number().nonnegative().optional(),
@@ -103,6 +105,8 @@ var CapabilityCardV2Schema = z.object({
103
105
  * never transmitted beyond the local store.
104
106
  */
105
107
  _internal: z.record(z.unknown()).optional(),
108
+ /** Public gateway URL where this agent accepts requests. Populated on remote publish. */
109
+ gateway_url: z.string().url().optional(),
106
110
  created_at: z.string().datetime().optional(),
107
111
  updated_at: z.string().datetime().optional()
108
112
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentbnb",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "P2P Agent Capability Sharing Protocol — Airbnb for AI agent pipelines",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,9 +0,0 @@
1
- import {
2
- executeCapabilityRequest
3
- } from "./chunk-MGHI67GR.js";
4
- import "./chunk-QAY6XTT7.js";
5
- import "./chunk-MZCNJ5PY.js";
6
- import "./chunk-7RU5INZI.js";
7
- export {
8
- executeCapabilityRequest
9
- };