agentbnb 7.0.0-beta.1 → 7.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 (49) hide show
  1. package/dist/{card-REW7BSWW.js → card-EX2EYGCZ.js} +1 -1
  2. package/dist/{chunk-PU7LXOQ3.js → chunk-3LWBH7P3.js} +72 -3
  3. package/dist/{chunk-2HSUPCBT.js → chunk-5AAFG2V2.js} +3 -3
  4. package/dist/{chunk-GO4FVRVN.js → chunk-5GME4KJZ.js} +5 -5
  5. package/dist/{chunk-VPQ44XKE.js → chunk-64AK4FJM.js} +2 -2
  6. package/dist/{chunk-K5FO42YF.js → chunk-7EF3HYVZ.js} +24 -1
  7. package/dist/{chunk-EAD4A4KG.js → chunk-ALX4WS3A.js} +2 -2
  8. package/dist/{chunk-ETGOKDFR.js → chunk-B2VJTKO5.js} +2 -2
  9. package/dist/{chunk-PGDBUUGR.js → chunk-C537SFHV.js} +5 -5
  10. package/dist/{chunk-F53QQIM2.js → chunk-CUONY5TO.js} +1 -1
  11. package/dist/{chunk-J2K5S5MX.js → chunk-D6RKW2XG.js} +67 -1
  12. package/dist/{chunk-APEG4QIN.js → chunk-E2OKP5CY.js} +4 -4
  13. package/dist/{chunk-FK2MDNTB.js → chunk-FTZTEHYG.js} +1 -1
  14. package/dist/{chunk-Y7T6IMM3.js → chunk-GKVTD4EZ.js} +1 -1
  15. package/dist/{chunk-VMH2YS2I.js → chunk-KF3TZHA5.js} +1 -1
  16. package/dist/{chunk-574W3HHE.js → chunk-LJM7FHPM.js} +1 -1
  17. package/dist/{chunk-KA2VIEGM.js → chunk-O2OYBAVR.js} +1 -1
  18. package/dist/{chunk-PSQHUZ7X.js → chunk-OH7BP5NP.js} +1 -1
  19. package/dist/{chunk-EHSHB7TY.js → chunk-SSK653A6.js} +67 -2
  20. package/dist/{chunk-BP3L2TET.js → chunk-TBJ3FZKZ.js} +2 -2
  21. package/dist/{chunk-3CIMVISQ.js → chunk-WVY2W7AA.js} +4 -0
  22. package/dist/{chunk-DUW6RX6I.js → chunk-X32NE6V4.js} +1 -1
  23. package/dist/{chunk-CWYPTQRQ.js → chunk-YHY7OG6S.js} +5 -5
  24. package/dist/{chunk-TW65F5EU.js → chunk-Z4MCGKTL.js} +6 -2
  25. package/dist/cli/index.js +44 -23
  26. package/dist/{client-HRYRJKSA.js → client-HKV3QWZ3.js} +3 -3
  27. package/dist/{conduct-JNYJCDHQ.js → conduct-W6XF6DJW.js} +13 -13
  28. package/dist/conduct-YB64OHI6.js +22 -0
  29. package/dist/{conductor-mode-2VVFMKVE.js → conductor-mode-2GSLHVN6.js} +3 -3
  30. package/dist/{conductor-mode-VGUU54QI.js → conductor-mode-AKREGDIU.js} +10 -10
  31. package/dist/{execute-MOXSSA3Q.js → execute-AYQWORVH.js} +6 -6
  32. package/dist/{execute-I4PKSNJM.js → execute-EPE6MZLT.js} +3 -3
  33. package/dist/index.d.ts +262 -10
  34. package/dist/index.js +438 -26
  35. package/dist/{process-guard-QCCBGILS.js → process-guard-GH5LRNWO.js} +1 -1
  36. package/dist/{publish-capability-TS6CNR5G.js → publish-capability-AH2HDW54.js} +3 -3
  37. package/dist/{request-E7TA7COA.js → request-HCCXSKAY.js} +12 -12
  38. package/dist/{serve-skill-HIOWYKRU.js → serve-skill-SZAQT5T5.js} +8 -8
  39. package/dist/{server-I63CXFX3.js → server-MHMAYXWZ.js} +11 -11
  40. package/dist/{service-coordinator-XBNT3SMU.js → service-coordinator-WGH6B2VT.js} +375 -48
  41. package/dist/skills/agentbnb/bootstrap.js +393 -58
  42. package/dist/{websocket-client-PFGVTXNE.js → websocket-client-4Z5P54RU.js} +1 -1
  43. package/dist/websocket-client-QOVARTRN.js +7 -0
  44. package/package.json +17 -11
  45. package/skills/agentbnb/bootstrap.test.ts +9 -0
  46. package/skills/agentbnb/bootstrap.ts +51 -26
  47. package/skills/agentbnb/install.sh +0 -0
  48. package/dist/conduct-KJUD2RTB.js +0 -22
  49. package/dist/websocket-client-5MH6QRJK.js +0 -7
package/dist/index.d.ts CHANGED
@@ -13,6 +13,8 @@ declare const CapabilityCardSchema: z.ZodObject<{
13
13
  spec_version: z.ZodDefault<z.ZodLiteral<"1.0">>;
14
14
  id: z.ZodString;
15
15
  owner: z.ZodString;
16
+ /** V8: Cryptographic agent identity (Ed25519 public key hash). */
17
+ agent_id: z.ZodOptional<z.ZodString>;
16
18
  name: z.ZodString;
17
19
  description: z.ZodString;
18
20
  level: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
@@ -148,6 +150,7 @@ declare const CapabilityCardSchema: z.ZodObject<{
148
150
  online: boolean;
149
151
  schedule?: string | undefined;
150
152
  };
153
+ agent_id?: string | undefined;
151
154
  powered_by?: {
152
155
  provider: string;
153
156
  model?: string | undefined;
@@ -194,6 +197,7 @@ declare const CapabilityCardSchema: z.ZodObject<{
194
197
  schedule?: string | undefined;
195
198
  };
196
199
  spec_version?: "1.0" | undefined;
200
+ agent_id?: string | undefined;
197
201
  powered_by?: {
198
202
  provider: string;
199
203
  model?: string | undefined;
@@ -222,6 +226,8 @@ declare const CapabilityCardV2Schema: z.ZodObject<{
222
226
  spec_version: z.ZodLiteral<"2.0">;
223
227
  id: z.ZodString;
224
228
  owner: z.ZodString;
229
+ /** V8: Cryptographic agent identity (Ed25519 public key hash). */
230
+ agent_id: z.ZodOptional<z.ZodString>;
225
231
  /** Agent display name — was 'name' in v1.0. */
226
232
  agent_name: z.ZodString;
227
233
  /** Short one-liner shown in Hub v2 Identity Header. */
@@ -635,6 +641,7 @@ declare const CapabilityCardV2Schema: z.ZodObject<{
635
641
  requires_capabilities?: string[] | undefined;
636
642
  visibility?: "public" | "private" | undefined;
637
643
  }[];
644
+ agent_id?: string | undefined;
638
645
  _internal?: Record<string, unknown> | undefined;
639
646
  gateway_url?: string | undefined;
640
647
  created_at?: string | undefined;
@@ -724,6 +731,7 @@ declare const CapabilityCardV2Schema: z.ZodObject<{
724
731
  requires_capabilities?: string[] | undefined;
725
732
  visibility?: "public" | "private" | undefined;
726
733
  }[];
734
+ agent_id?: string | undefined;
727
735
  _internal?: Record<string, unknown> | undefined;
728
736
  gateway_url?: string | undefined;
729
737
  created_at?: string | undefined;
@@ -766,6 +774,8 @@ type CapabilityCardV2 = z.infer<typeof CapabilityCardV2Schema>;
766
774
  interface EscrowReceipt {
767
775
  /** Agent owner identifier of the requester. */
768
776
  requester_owner: string;
777
+ /** V8: Cryptographic agent identity of the requester. */
778
+ requester_agent_id?: string;
769
779
  /** Hex-encoded Ed25519 public key of the requester. */
770
780
  requester_public_key: string;
771
781
  /** Number of credits committed. */
@@ -2899,22 +2909,41 @@ declare class OpenClawBridge implements ExecutorMode {
2899
2909
  * - Three output types: text (raw stdout), json (parsed), file (path from stdout)
2900
2910
  * - Security allowlist via `allowed_commands` (base command checked against list)
2901
2911
  * - Configurable timeout and working directory
2912
+ * - SIGTERM → SIGKILL escalation on timeout (prevents zombie processes)
2913
+ * - Process registry for graceful shutdown of all active children
2914
+ * - Per-skill concurrency enforcement via capacity.max_concurrent
2902
2915
  */
2903
2916
  declare class CommandExecutor implements ExecutorMode {
2917
+ /** Active child processes — killed on shutdown(). */
2918
+ private readonly activeProcesses;
2919
+ /** In-flight execution count per skill ID for concurrency limiting. */
2920
+ private readonly inflight;
2904
2921
  /**
2905
2922
  * Execute a command skill with the provided parameters.
2906
2923
  *
2907
2924
  * Steps:
2908
- * 1. Security check: base command must be in `allowed_commands` if set.
2909
- * 2. Interpolate `config.command` using `{ params }` context.
2910
- * 3. Run via `child_process.exec` with timeout and cwd.
2911
- * 4. Parse stdout based on `output_type`: text | json | file.
2925
+ * 1. Concurrency check: reject if at capacity.max_concurrent limit.
2926
+ * 2. Security check: base command must be in `allowed_commands` if set.
2927
+ * 3. Interpolate `config.command` using `{ params }` context.
2928
+ * 4. Run via spawn with SIGTERM→SIGKILL timeout handling.
2929
+ * 5. Parse stdout based on `output_type`: text | json | file.
2912
2930
  *
2913
2931
  * @param config - Validated CommandSkillConfig.
2914
2932
  * @param params - Input parameters passed by the caller.
2915
2933
  * @returns Partial ExecutionResult (without latency_ms).
2916
2934
  */
2917
2935
  execute(config: SkillConfig, params: Record<string, unknown>): Promise<Omit<ExecutionResult, 'latency_ms'>>;
2936
+ /**
2937
+ * Kill all active child processes. Called during service shutdown
2938
+ * to prevent zombie processes.
2939
+ */
2940
+ shutdown(): void;
2941
+ /** Returns the number of currently active child processes. */
2942
+ get activeCount(): number;
2943
+ /** Returns the in-flight count for a specific skill ID. */
2944
+ getInflight(skillId: string): number;
2945
+ /** Decrement the inflight counter for a skill ID. */
2946
+ private decrementInflight;
2918
2947
  }
2919
2948
 
2920
2949
  /**
@@ -3281,21 +3310,58 @@ declare function registerConductorCard(db: Database.Database): CapabilityCardV2;
3281
3310
  declare const RegisterMessageSchema: z.ZodObject<{
3282
3311
  type: z.ZodLiteral<"register">;
3283
3312
  owner: z.ZodString;
3313
+ /** V8: Cryptographic agent identity. When present, used as the canonical key. */
3314
+ agent_id: z.ZodOptional<z.ZodString>;
3315
+ /** V8 Phase 3: Server identifier for multi-agent delegation. */
3316
+ server_id: z.ZodOptional<z.ZodString>;
3284
3317
  token: z.ZodString;
3285
3318
  card: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3286
3319
  cards: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
3320
+ /** V8 Phase 3: Additional agents served by this server (multi-agent registration). */
3321
+ agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
3322
+ agent_id: z.ZodString;
3323
+ display_name: z.ZodString;
3324
+ cards: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
3325
+ delegation_token: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3326
+ }, "strip", z.ZodTypeAny, {
3327
+ agent_id: string;
3328
+ display_name: string;
3329
+ cards: Record<string, unknown>[];
3330
+ delegation_token?: Record<string, unknown> | undefined;
3331
+ }, {
3332
+ agent_id: string;
3333
+ display_name: string;
3334
+ cards: Record<string, unknown>[];
3335
+ delegation_token?: Record<string, unknown> | undefined;
3336
+ }>, "many">>;
3287
3337
  }, "strip", z.ZodTypeAny, {
3288
3338
  type: "register";
3289
3339
  owner: string;
3290
3340
  token: string;
3291
3341
  card: Record<string, unknown>;
3342
+ agent_id?: string | undefined;
3343
+ server_id?: string | undefined;
3292
3344
  cards?: Record<string, unknown>[] | undefined;
3345
+ agents?: {
3346
+ agent_id: string;
3347
+ display_name: string;
3348
+ cards: Record<string, unknown>[];
3349
+ delegation_token?: Record<string, unknown> | undefined;
3350
+ }[] | undefined;
3293
3351
  }, {
3294
3352
  type: "register";
3295
3353
  owner: string;
3296
3354
  token: string;
3297
3355
  card: Record<string, unknown>;
3356
+ agent_id?: string | undefined;
3357
+ server_id?: string | undefined;
3298
3358
  cards?: Record<string, unknown>[] | undefined;
3359
+ agents?: {
3360
+ agent_id: string;
3361
+ display_name: string;
3362
+ cards: Record<string, unknown>[];
3363
+ delegation_token?: Record<string, unknown> | undefined;
3364
+ }[] | undefined;
3299
3365
  }>;
3300
3366
  /** Registry → Agent: Acknowledge registration */
3301
3367
  declare const RegisteredMessageSchema: z.ZodObject<{
@@ -3313,6 +3379,8 @@ declare const RelayRequestMessageSchema: z.ZodObject<{
3313
3379
  type: z.ZodLiteral<"relay_request">;
3314
3380
  id: z.ZodString;
3315
3381
  target_owner: z.ZodString;
3382
+ /** V8: Target agent's cryptographic identity. Preferred over target_owner. */
3383
+ target_agent_id: z.ZodOptional<z.ZodString>;
3316
3384
  card_id: z.ZodString;
3317
3385
  skill_id: z.ZodOptional<z.ZodString>;
3318
3386
  params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -3327,6 +3395,7 @@ declare const RelayRequestMessageSchema: z.ZodObject<{
3327
3395
  skill_id?: string | undefined;
3328
3396
  requester?: string | undefined;
3329
3397
  escrow_receipt?: Record<string, unknown> | undefined;
3398
+ target_agent_id?: string | undefined;
3330
3399
  }, {
3331
3400
  type: "relay_request";
3332
3401
  id: string;
@@ -3336,6 +3405,7 @@ declare const RelayRequestMessageSchema: z.ZodObject<{
3336
3405
  skill_id?: string | undefined;
3337
3406
  requester?: string | undefined;
3338
3407
  escrow_receipt?: Record<string, unknown> | undefined;
3408
+ target_agent_id?: string | undefined;
3339
3409
  }>;
3340
3410
  /** Registry → Agent B: Incoming request forwarded from Agent A */
3341
3411
  declare const IncomingRequestMessageSchema: z.ZodObject<{
@@ -3451,21 +3521,58 @@ declare const ErrorMessageSchema: z.ZodObject<{
3451
3521
  declare const RelayMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3452
3522
  type: z.ZodLiteral<"register">;
3453
3523
  owner: z.ZodString;
3524
+ /** V8: Cryptographic agent identity. When present, used as the canonical key. */
3525
+ agent_id: z.ZodOptional<z.ZodString>;
3526
+ /** V8 Phase 3: Server identifier for multi-agent delegation. */
3527
+ server_id: z.ZodOptional<z.ZodString>;
3454
3528
  token: z.ZodString;
3455
3529
  card: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3456
3530
  cards: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
3531
+ /** V8 Phase 3: Additional agents served by this server (multi-agent registration). */
3532
+ agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
3533
+ agent_id: z.ZodString;
3534
+ display_name: z.ZodString;
3535
+ cards: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
3536
+ delegation_token: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3537
+ }, "strip", z.ZodTypeAny, {
3538
+ agent_id: string;
3539
+ display_name: string;
3540
+ cards: Record<string, unknown>[];
3541
+ delegation_token?: Record<string, unknown> | undefined;
3542
+ }, {
3543
+ agent_id: string;
3544
+ display_name: string;
3545
+ cards: Record<string, unknown>[];
3546
+ delegation_token?: Record<string, unknown> | undefined;
3547
+ }>, "many">>;
3457
3548
  }, "strip", z.ZodTypeAny, {
3458
3549
  type: "register";
3459
3550
  owner: string;
3460
3551
  token: string;
3461
3552
  card: Record<string, unknown>;
3553
+ agent_id?: string | undefined;
3554
+ server_id?: string | undefined;
3462
3555
  cards?: Record<string, unknown>[] | undefined;
3556
+ agents?: {
3557
+ agent_id: string;
3558
+ display_name: string;
3559
+ cards: Record<string, unknown>[];
3560
+ delegation_token?: Record<string, unknown> | undefined;
3561
+ }[] | undefined;
3463
3562
  }, {
3464
3563
  type: "register";
3465
3564
  owner: string;
3466
3565
  token: string;
3467
3566
  card: Record<string, unknown>;
3567
+ agent_id?: string | undefined;
3568
+ server_id?: string | undefined;
3468
3569
  cards?: Record<string, unknown>[] | undefined;
3570
+ agents?: {
3571
+ agent_id: string;
3572
+ display_name: string;
3573
+ cards: Record<string, unknown>[];
3574
+ delegation_token?: Record<string, unknown> | undefined;
3575
+ }[] | undefined;
3469
3576
  }>, z.ZodObject<{
3470
3577
  type: z.ZodLiteral<"registered">;
3471
3578
  agent_id: z.ZodString;
@@ -3479,6 +3586,8 @@ declare const RelayMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3479
3586
  type: z.ZodLiteral<"relay_request">;
3480
3587
  id: z.ZodString;
3481
3588
  target_owner: z.ZodString;
3589
+ /** V8: Target agent's cryptographic identity. Preferred over target_owner. */
3590
+ target_agent_id: z.ZodOptional<z.ZodString>;
3482
3591
  card_id: z.ZodString;
3483
3592
  skill_id: z.ZodOptional<z.ZodString>;
3484
3593
  params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -3493,6 +3602,7 @@ declare const RelayMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3493
3602
  skill_id?: string | undefined;
3494
3603
  requester?: string | undefined;
3495
3604
  escrow_receipt?: Record<string, unknown> | undefined;
3605
+ target_agent_id?: string | undefined;
3496
3606
  }, {
3497
3607
  type: "relay_request";
3498
3608
  id: string;
@@ -3502,6 +3612,7 @@ declare const RelayMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3502
3612
  skill_id?: string | undefined;
3503
3613
  requester?: string | undefined;
3504
3614
  escrow_receipt?: Record<string, unknown> | undefined;
3615
+ target_agent_id?: string | undefined;
3505
3616
  }>, z.ZodObject<{
3506
3617
  type: z.ZodLiteral<"incoming_request">;
3507
3618
  id: z.ZodString;
@@ -3717,6 +3828,126 @@ declare const RelayMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3717
3828
  avg_feedback: number;
3718
3829
  };
3719
3830
  };
3831
+ }>, z.ZodObject<{
3832
+ type: z.ZodLiteral<"escrow_hold">;
3833
+ consumer_agent_id: z.ZodString;
3834
+ provider_agent_id: z.ZodString;
3835
+ skill_id: z.ZodString;
3836
+ amount: z.ZodNumber;
3837
+ request_id: z.ZodString;
3838
+ signature: z.ZodOptional<z.ZodString>;
3839
+ public_key: z.ZodOptional<z.ZodString>;
3840
+ }, "strip", z.ZodTypeAny, {
3841
+ type: "escrow_hold";
3842
+ skill_id: string;
3843
+ amount: number;
3844
+ request_id: string;
3845
+ consumer_agent_id: string;
3846
+ provider_agent_id: string;
3847
+ public_key?: string | undefined;
3848
+ signature?: string | undefined;
3849
+ }, {
3850
+ type: "escrow_hold";
3851
+ skill_id: string;
3852
+ amount: number;
3853
+ request_id: string;
3854
+ consumer_agent_id: string;
3855
+ provider_agent_id: string;
3856
+ public_key?: string | undefined;
3857
+ signature?: string | undefined;
3858
+ }>, z.ZodObject<{
3859
+ type: z.ZodLiteral<"escrow_hold_confirmed">;
3860
+ request_id: z.ZodString;
3861
+ escrow_id: z.ZodString;
3862
+ hold_amount: z.ZodNumber;
3863
+ consumer_remaining: z.ZodNumber;
3864
+ }, "strip", z.ZodTypeAny, {
3865
+ type: "escrow_hold_confirmed";
3866
+ request_id: string;
3867
+ escrow_id: string;
3868
+ hold_amount: number;
3869
+ consumer_remaining: number;
3870
+ }, {
3871
+ type: "escrow_hold_confirmed";
3872
+ request_id: string;
3873
+ escrow_id: string;
3874
+ hold_amount: number;
3875
+ consumer_remaining: number;
3876
+ }>, z.ZodObject<{
3877
+ type: z.ZodLiteral<"escrow_settle">;
3878
+ escrow_id: z.ZodString;
3879
+ request_id: z.ZodString;
3880
+ success: z.ZodBoolean;
3881
+ failure_reason: z.ZodOptional<z.ZodEnum<["bad_execution", "overload", "timeout", "auth_error", "not_found"]>>;
3882
+ result_hash: z.ZodOptional<z.ZodString>;
3883
+ signature: z.ZodOptional<z.ZodString>;
3884
+ public_key: z.ZodOptional<z.ZodString>;
3885
+ consumer_agent_id: z.ZodOptional<z.ZodString>;
3886
+ }, "strip", z.ZodTypeAny, {
3887
+ type: "escrow_settle";
3888
+ success: boolean;
3889
+ request_id: string;
3890
+ escrow_id: string;
3891
+ public_key?: string | undefined;
3892
+ failure_reason?: "timeout" | "bad_execution" | "overload" | "auth_error" | "not_found" | undefined;
3893
+ signature?: string | undefined;
3894
+ consumer_agent_id?: string | undefined;
3895
+ result_hash?: string | undefined;
3896
+ }, {
3897
+ type: "escrow_settle";
3898
+ success: boolean;
3899
+ request_id: string;
3900
+ escrow_id: string;
3901
+ public_key?: string | undefined;
3902
+ failure_reason?: "timeout" | "bad_execution" | "overload" | "auth_error" | "not_found" | undefined;
3903
+ signature?: string | undefined;
3904
+ consumer_agent_id?: string | undefined;
3905
+ result_hash?: string | undefined;
3906
+ }>, z.ZodObject<{
3907
+ type: z.ZodLiteral<"escrow_settled">;
3908
+ escrow_id: z.ZodString;
3909
+ request_id: z.ZodString;
3910
+ provider_earned: z.ZodNumber;
3911
+ network_fee: z.ZodNumber;
3912
+ consumer_remaining: z.ZodNumber;
3913
+ provider_balance: z.ZodNumber;
3914
+ }, "strip", z.ZodTypeAny, {
3915
+ type: "escrow_settled";
3916
+ network_fee: number;
3917
+ request_id: string;
3918
+ escrow_id: string;
3919
+ consumer_remaining: number;
3920
+ provider_earned: number;
3921
+ provider_balance: number;
3922
+ }, {
3923
+ type: "escrow_settled";
3924
+ network_fee: number;
3925
+ request_id: string;
3926
+ escrow_id: string;
3927
+ consumer_remaining: number;
3928
+ provider_earned: number;
3929
+ provider_balance: number;
3930
+ }>, z.ZodObject<{
3931
+ type: z.ZodLiteral<"balance_sync">;
3932
+ agent_id: z.ZodString;
3933
+ }, "strip", z.ZodTypeAny, {
3934
+ type: "balance_sync";
3935
+ agent_id: string;
3936
+ }, {
3937
+ type: "balance_sync";
3938
+ agent_id: string;
3939
+ }>, z.ZodObject<{
3940
+ type: z.ZodLiteral<"balance_sync_response">;
3941
+ agent_id: z.ZodString;
3942
+ balance: z.ZodNumber;
3943
+ }, "strip", z.ZodTypeAny, {
3944
+ type: "balance_sync_response";
3945
+ agent_id: string;
3946
+ balance: number;
3947
+ }, {
3948
+ type: "balance_sync_response";
3949
+ agent_id: string;
3950
+ balance: number;
3720
3951
  }>]>;
3721
3952
  type RegisterMessage = z.infer<typeof RegisterMessageSchema>;
3722
3953
  type RegisteredMessage = z.infer<typeof RegisteredMessageSchema>;
@@ -3777,17 +4008,31 @@ interface RelayHandlerResult {
3777
4008
  };
3778
4009
  }
3779
4010
  /** Options for the RelayClient constructor */
4011
+ /** V8 Phase 3: Additional agent to register on the same connection */
4012
+ interface DelegatedAgent {
4013
+ agent_id: string;
4014
+ display_name: string;
4015
+ cards: Record<string, unknown>[];
4016
+ delegation_token?: Record<string, unknown>;
4017
+ }
4018
+ /** Options for the RelayClient constructor */
3780
4019
  interface RelayClientOptions {
3781
4020
  /** Registry WebSocket URL (e.g., "wss://hub.agentbnb.dev/ws") */
3782
4021
  registryUrl: string;
3783
4022
  /** Agent owner identifier */
3784
4023
  owner: string;
4024
+ /** V8: Cryptographic agent identity */
4025
+ agent_id?: string;
4026
+ /** V8 Phase 3: Server identifier for multi-agent delegation */
4027
+ server_id?: string;
3785
4028
  /** Authentication token */
3786
4029
  token: string;
3787
4030
  /** Capability card data to register */
3788
4031
  card: Record<string, unknown>;
3789
4032
  /** Additional cards to register alongside the primary card (e.g., conductor card) */
3790
4033
  cards?: Record<string, unknown>[];
4034
+ /** V8 Phase 3: Additional agents served by this connection */
4035
+ agents?: DelegatedAgent[];
3791
4036
  /** Handler for incoming relay requests from other agents */
3792
4037
  onRequest: (req: IncomingRequestMessage) => Promise<RelayHandlerResult>;
3793
4038
  /** Suppress logging. Default false. */
@@ -3796,6 +4041,8 @@ interface RelayClientOptions {
3796
4041
  /** Options for making a relay request to another agent */
3797
4042
  interface RelayRequestOptions$1 {
3798
4043
  targetOwner: string;
4044
+ /** V8: Target agent's cryptographic identity. Preferred for routing. */
4045
+ targetAgentId?: string;
3799
4046
  cardId: string;
3800
4047
  skillId?: string;
3801
4048
  params: Record<string, unknown>;
@@ -4090,6 +4337,7 @@ declare function verifyEscrowReceipt(data: Record<string, unknown>, signature: s
4090
4337
  */
4091
4338
  declare const EscrowReceiptSchema: z.ZodObject<{
4092
4339
  requester_owner: z.ZodString;
4340
+ requester_agent_id: z.ZodOptional<z.ZodString>;
4093
4341
  requester_public_key: z.ZodString;
4094
4342
  amount: z.ZodNumber;
4095
4343
  card_id: z.ZodString;
@@ -4106,6 +4354,7 @@ declare const EscrowReceiptSchema: z.ZodObject<{
4106
4354
  card_id: string;
4107
4355
  nonce: string;
4108
4356
  skill_id?: string | undefined;
4357
+ requester_agent_id?: string | undefined;
4109
4358
  }, {
4110
4359
  timestamp: string;
4111
4360
  signature: string;
@@ -4115,6 +4364,7 @@ declare const EscrowReceiptSchema: z.ZodObject<{
4115
4364
  card_id: string;
4116
4365
  nonce: string;
4117
4366
  skill_id?: string | undefined;
4367
+ requester_agent_id?: string | undefined;
4118
4368
  }>;
4119
4369
  /**
4120
4370
  * Options for creating a signed escrow receipt.
@@ -4122,6 +4372,8 @@ declare const EscrowReceiptSchema: z.ZodObject<{
4122
4372
  interface CreateReceiptOpts {
4123
4373
  /** Agent owner identifier (requester). */
4124
4374
  owner: string;
4375
+ /** V8: Cryptographic agent identity (preferred over owner). */
4376
+ agent_id?: string;
4125
4377
  /** Number of credits to commit. */
4126
4378
  amount: number;
4127
4379
  /** Capability Card ID being requested. */
@@ -4206,8 +4458,8 @@ declare const AgentIdentitySchema: z.ZodObject<{
4206
4458
  }>>;
4207
4459
  }, "strip", z.ZodTypeAny, {
4208
4460
  owner: string;
4209
- created_at: string;
4210
4461
  agent_id: string;
4462
+ created_at: string;
4211
4463
  public_key: string;
4212
4464
  guarantor?: {
4213
4465
  github_login: string;
@@ -4215,8 +4467,8 @@ declare const AgentIdentitySchema: z.ZodObject<{
4215
4467
  } | undefined;
4216
4468
  }, {
4217
4469
  owner: string;
4218
- created_at: string;
4219
4470
  agent_id: string;
4471
+ created_at: string;
4220
4472
  public_key: string;
4221
4473
  guarantor?: {
4222
4474
  github_login: string;
@@ -4251,8 +4503,8 @@ declare const AgentCertificateSchema: z.ZodObject<{
4251
4503
  }>>;
4252
4504
  }, "strip", z.ZodTypeAny, {
4253
4505
  owner: string;
4254
- created_at: string;
4255
4506
  agent_id: string;
4507
+ created_at: string;
4256
4508
  public_key: string;
4257
4509
  guarantor?: {
4258
4510
  github_login: string;
@@ -4260,8 +4512,8 @@ declare const AgentCertificateSchema: z.ZodObject<{
4260
4512
  } | undefined;
4261
4513
  }, {
4262
4514
  owner: string;
4263
- created_at: string;
4264
4515
  agent_id: string;
4516
+ created_at: string;
4265
4517
  public_key: string;
4266
4518
  guarantor?: {
4267
4519
  github_login: string;
@@ -4280,8 +4532,8 @@ declare const AgentCertificateSchema: z.ZodObject<{
4280
4532
  signature: string;
4281
4533
  identity: {
4282
4534
  owner: string;
4283
- created_at: string;
4284
4535
  agent_id: string;
4536
+ created_at: string;
4285
4537
  public_key: string;
4286
4538
  guarantor?: {
4287
4539
  github_login: string;
@@ -4295,8 +4547,8 @@ declare const AgentCertificateSchema: z.ZodObject<{
4295
4547
  signature: string;
4296
4548
  identity: {
4297
4549
  owner: string;
4298
- created_at: string;
4299
4550
  agent_id: string;
4551
+ created_at: string;
4300
4552
  public_key: string;
4301
4553
  guarantor?: {
4302
4554
  github_login: string;