agentbnb 8.2.2 → 8.3.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 (62) hide show
  1. package/dist/{card-EX2EYGCZ.js → card-BN643ZOY.js} +6 -2
  2. package/dist/card-T2XJZA5A.js +92 -0
  3. package/dist/{chunk-3LWBH7P3.js → chunk-4NFJ3VYZ.js} +20 -1
  4. package/dist/chunk-5AIYALBX.js +857 -0
  5. package/dist/chunk-6QMDJVMS.js +238 -0
  6. package/dist/{chunk-LKLKYXLV.js → chunk-74LZDEDT.js} +6 -4
  7. package/dist/{chunk-GKVTD4EZ.js → chunk-77KGEDH4.js} +1 -1
  8. package/dist/{chunk-QCGIG7WW.js → chunk-7IQE34QK.js} +14 -7
  9. package/dist/{chunk-QHZGOG3O.js → chunk-D242QZCR.js} +168 -41
  10. package/dist/chunk-EE3V3DXK.js +60 -0
  11. package/dist/{chunk-RYISHSHB.js → chunk-F3KIEVJ2.js} +207 -265
  12. package/dist/{chunk-XBGVQMQJ.js → chunk-FELGHDCA.js} +16 -39
  13. package/dist/{chunk-EJKW57ZV.js → chunk-GIEJVKZZ.js} +1 -1
  14. package/dist/{chunk-WVY2W7AA.js → chunk-I7KWA7OB.js} +20 -0
  15. package/dist/{chunk-4IPJJRTP.js → chunk-IGQNP3ZO.js} +5 -2
  16. package/dist/chunk-NQANA6WH.js +797 -0
  17. package/dist/{chunk-Z4MCGKTL.js → chunk-NX27AFPA.js} +15 -2
  18. package/dist/{chunk-Z2GEFFDO.js → chunk-O4Q7BRG6.js} +2 -2
  19. package/dist/{chunk-SSK653A6.js → chunk-PQIP7EXY.js} +6 -0
  20. package/dist/{chunk-EG6RS4JC.js → chunk-QFPXZITP.js} +20 -65
  21. package/dist/chunk-R4F4XII4.js +264 -0
  22. package/dist/{chunk-DYQOFGGI.js → chunk-RVBW2QXU.js} +178 -49
  23. package/dist/{chunk-CQFBNTGT.js → chunk-S7DZHKCG.js} +25 -12
  24. package/dist/chunk-U6LP4KWN.js +238 -0
  25. package/dist/{chunk-MWOXW7JQ.js → chunk-VJ7XBEY6.js} +24 -16
  26. package/dist/chunk-WTHMHNKC.js +129 -0
  27. package/dist/{chunk-OCSU2S6W.js → chunk-WX3GZVFG.js} +2 -1
  28. package/dist/{chunk-CKOOVZOI.js → chunk-YKMBFQC2.js} +37 -5
  29. package/dist/{chunk-S3V6R3EN.js → chunk-ZU2TP7CN.js} +70 -27
  30. package/dist/cli/index.js +211 -278
  31. package/dist/client-OKJJ3UP2.js +19 -0
  32. package/dist/client-UQBGCIPA.js +20 -0
  33. package/dist/conduct-4JDMWBQD.js +22 -0
  34. package/dist/{conduct-AZFLNUX3.js → conduct-VYYBCPHA.js} +14 -13
  35. package/dist/{conductor-mode-WKB42PYM.js → conductor-mode-OPGQJFLA.js} +12 -8
  36. package/dist/{conductor-mode-PLTB6MS3.js → conductor-mode-SBDCRIX6.js} +16 -11
  37. package/dist/execute-FZLQGIXB.js +14 -0
  38. package/dist/execute-TEZPQ5WP.js +15 -0
  39. package/dist/index.d.ts +172 -11
  40. package/dist/index.js +1529 -433
  41. package/dist/{process-guard-GH5LRNWO.js → process-guard-TNSUNHSR.js} +1 -1
  42. package/dist/{publish-capability-QDR2QIZ2.js → publish-capability-HVYILTPR.js} +4 -3
  43. package/dist/{reliability-metrics-QG7WC5QK.js → reliability-metrics-G7LPUYJD.js} +3 -1
  44. package/dist/reliability-metrics-RRUKJ4ME.js +20 -0
  45. package/dist/{request-NX7GSPIG.js → request-KJNKR27T.js} +96 -43
  46. package/dist/{serve-skill-E6EJQYAK.js → serve-skill-GC6NIQ5T.js} +10 -11
  47. package/dist/{server-VBCT32FC.js → server-YV3XPTX5.js} +11 -10
  48. package/dist/{service-coordinator-KMSA6BST.js → service-coordinator-RY5AKUZS.js} +420 -171
  49. package/dist/{skill-config-FETXPNVP.js → skill-config-5O2VR546.js} +1 -1
  50. package/dist/skills/agentbnb/bootstrap.js +550 -231
  51. package/dist/websocket-client-3U27WJUU.js +7 -0
  52. package/dist/{websocket-client-4Z5P54RU.js → websocket-client-SNDF3B6N.js} +1 -1
  53. package/package.json +18 -12
  54. package/skills/agentbnb/install.sh +0 -0
  55. package/dist/chunk-MCED4GDW.js +0 -1572
  56. package/dist/chunk-NWIQJ2CL.js +0 -108
  57. package/dist/chunk-WNXXLCV5.js +0 -32
  58. package/dist/client-XOLP5IUZ.js +0 -12
  59. package/dist/conduct-VPUYTNEA.js +0 -21
  60. package/dist/execute-NNDCXTN4.js +0 -13
  61. package/dist/execute-RIRHTIBU.js +0 -16
  62. package/dist/websocket-client-QOVARTRN.js +0 -7
@@ -1,8 +1,12 @@
1
+ import {
2
+ ensureAgentsTable,
3
+ resolveCanonicalIdentity
4
+ } from "./chunk-EE3V3DXK.js";
1
5
  import {
2
6
  AgentBnBError,
3
7
  AnyCardSchema,
4
8
  CapabilityCardSchema
5
- } from "./chunk-WVY2W7AA.js";
9
+ } from "./chunk-I7KWA7OB.js";
6
10
 
7
11
  // src/registry/request-log.ts
8
12
  var SINCE_MS = {
@@ -521,6 +525,7 @@ function openDatabase(path = ":memory:") {
521
525
  ON capability_cards(owner);
522
526
  `);
523
527
  createRequestLogTable(db);
528
+ ensureAgentsTable(db);
524
529
  initFeedbackTable(db);
525
530
  initEvolutionTable(db);
526
531
  runMigrations(db);
@@ -626,7 +631,11 @@ function rebuildCardsFts(db) {
626
631
  }
627
632
  function insertCard(db, card) {
628
633
  const now = (/* @__PURE__ */ new Date()).toISOString();
629
- const withTimestamps = { ...card, created_at: card.created_at ?? now, updated_at: now };
634
+ const withTimestamps = attachCanonicalAgentId(db, {
635
+ ...card,
636
+ created_at: card.created_at ?? now,
637
+ updated_at: now
638
+ });
630
639
  const parsed = CapabilityCardSchema.safeParse(withTimestamps);
631
640
  if (!parsed.success) {
632
641
  throw new AgentBnBError(
@@ -652,16 +661,41 @@ function getCard(db, id) {
652
661
  if (!row) return null;
653
662
  return JSON.parse(row.data);
654
663
  }
664
+ function attachCanonicalAgentId(db, card) {
665
+ const resolved = resolveCanonicalIdentity(db, card.owner);
666
+ if (!resolved.resolved) {
667
+ return card;
668
+ }
669
+ if (card.agent_id === resolved.agent_id) {
670
+ return card;
671
+ }
672
+ return {
673
+ ...card,
674
+ agent_id: resolved.agent_id
675
+ };
676
+ }
677
+ function canManageCardByIdentifier(db, card, identifier) {
678
+ if (card.owner === identifier) return true;
679
+ const requester = resolveCanonicalIdentity(db, identifier);
680
+ if (!requester.resolved) {
681
+ return typeof card.agent_id === "string" && card.agent_id.length > 0 && card.agent_id === identifier;
682
+ }
683
+ if (typeof card.agent_id === "string" && card.agent_id.length > 0) {
684
+ return requester.agent_id === card.agent_id;
685
+ }
686
+ const cardOwnerIdentity = resolveCanonicalIdentity(db, card.owner);
687
+ return cardOwnerIdentity.resolved && cardOwnerIdentity.agent_id === requester.agent_id;
688
+ }
655
689
  function updateCard(db, id, owner, updates) {
656
690
  const existing = getCard(db, id);
657
691
  if (!existing) {
658
692
  throw new AgentBnBError(`Card not found: ${id}`, "NOT_FOUND");
659
693
  }
660
- if (existing.owner !== owner) {
694
+ if (!canManageCardByIdentifier(db, existing, owner)) {
661
695
  throw new AgentBnBError("Forbidden: you do not own this card", "FORBIDDEN");
662
696
  }
663
697
  const now = (/* @__PURE__ */ new Date()).toISOString();
664
- const merged = { ...existing, ...updates, updated_at: now };
698
+ const merged = attachCanonicalAgentId(db, { ...existing, ...updates, updated_at: now });
665
699
  const parsed = AnyCardSchema.safeParse(merged);
666
700
  if (!parsed.success) {
667
701
  throw new AgentBnBError(
@@ -676,16 +710,6 @@ function updateCard(db, id, owner, updates) {
676
710
  `);
677
711
  stmt.run(JSON.stringify(parsed.data), now, id);
678
712
  }
679
- function deleteCard(db, id, owner) {
680
- const existing = getCard(db, id);
681
- if (!existing) {
682
- throw new AgentBnBError(`Card not found: ${id}`, "NOT_FOUND");
683
- }
684
- if (existing.owner !== owner) {
685
- throw new AgentBnBError("Forbidden: you do not own this card", "FORBIDDEN");
686
- }
687
- db.prepare("DELETE FROM capability_cards WHERE id = ?").run(id);
688
- }
689
713
  function updateReputation(db, cardId, success, latencyMs) {
690
714
  const existing = getCard(db, cardId);
691
715
  if (!existing) return;
@@ -748,16 +772,35 @@ function updateSkillIdleRate(db, cardId, skillId, idleRate) {
748
772
  );
749
773
  }
750
774
  function listCards(db, owner) {
751
- let stmt;
752
- let rows;
753
- if (owner !== void 0) {
754
- stmt = db.prepare("SELECT data FROM capability_cards WHERE owner = ?");
755
- rows = stmt.all(owner);
756
- } else {
757
- stmt = db.prepare("SELECT data FROM capability_cards");
758
- rows = stmt.all();
775
+ if (owner === void 0) {
776
+ const rows = db.prepare("SELECT data FROM capability_cards").all();
777
+ return rows.map((row) => JSON.parse(row.data));
759
778
  }
760
- return rows.map((row) => JSON.parse(row.data));
779
+ const filtered = /* @__PURE__ */ new Map();
780
+ const resolved = resolveCanonicalIdentity(db, owner);
781
+ const ownerAliases = /* @__PURE__ */ new Set([owner]);
782
+ if (resolved.legacy_owner) {
783
+ ownerAliases.add(resolved.legacy_owner);
784
+ }
785
+ for (const alias of ownerAliases) {
786
+ const aliasRows = db.prepare("SELECT data FROM capability_cards WHERE owner = ?").all(alias);
787
+ for (const row of aliasRows) {
788
+ const parsed = JSON.parse(row.data);
789
+ filtered.set(parsed.id, parsed);
790
+ }
791
+ }
792
+ const agentIdentifiers = /* @__PURE__ */ new Set([owner]);
793
+ if (resolved.resolved) {
794
+ agentIdentifiers.add(resolved.agent_id);
795
+ }
796
+ for (const agentIdentifier of agentIdentifiers) {
797
+ const agentRows = db.prepare("SELECT data FROM capability_cards WHERE json_extract(data, '$.agent_id') = ?").all(agentIdentifier);
798
+ for (const row of agentRows) {
799
+ const parsed = JSON.parse(row.data);
800
+ filtered.set(parsed.id, parsed);
801
+ }
802
+ }
803
+ return [...filtered.values()];
761
804
  }
762
805
  function getCardsByCapabilityType(db, capabilityType) {
763
806
  const rows = db.prepare(
@@ -779,21 +822,21 @@ function getCardsBySkillCapability(db, capabilityType) {
779
822
  }
780
823
 
781
824
  export {
782
- insertFeedback,
783
- getFeedbackForSkill,
784
- getFeedbackForProvider,
785
825
  insertRequestLog,
786
826
  getSkillRequestCount,
787
827
  getActivityFeed,
788
828
  getRequestLog,
829
+ insertFeedback,
830
+ getFeedbackForSkill,
831
+ getFeedbackForProvider,
789
832
  insertEvolution,
790
833
  getLatestEvolution,
791
834
  getEvolutionHistory,
792
835
  openDatabase,
793
836
  insertCard,
794
837
  getCard,
838
+ attachCanonicalAgentId,
795
839
  updateCard,
796
- deleteCard,
797
840
  updateReputation,
798
841
  updateSkillAvailability,
799
842
  updateSkillIdleRate,