@band-ai/sdk 0.1.6 → 0.2.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 (85) hide show
  1. package/README.md +372 -0
  2. package/dist/{ClaudeSDKAdapter-CRq4R-WB.d.cts → ClaudeSDKAdapter-BY4zEbCl.d.cts} +14 -10
  3. package/dist/{ClaudeSDKAdapter-BHOkjN3X.d.ts → ClaudeSDKAdapter-Cna5P1dR.d.ts} +14 -10
  4. package/dist/{acp-server-B1Da7L6u.d.ts → acp-server-CiUqN3G3.d.ts} +2 -2
  5. package/dist/{acp-server-BdRz9_UN.d.cts → acp-server-Dlj7D563.d.cts} +2 -2
  6. package/dist/adapters.cjs +734 -279
  7. package/dist/adapters.d.cts +21 -19
  8. package/dist/adapters.d.ts +21 -19
  9. package/dist/adapters.js +65 -44
  10. package/dist/backends-D-dBdDm-.d.ts +27 -0
  11. package/dist/backends-ZLxmQrTZ.d.cts +27 -0
  12. package/dist/{chunk-MSL6CWHY.js → chunk-4IAXZBXX.js} +77 -37
  13. package/dist/{chunk-SG4WLD2H.js → chunk-EAI2M3WM.js} +38 -94
  14. package/dist/{chunk-YR3BOQNW.js → chunk-JY75VSQK.js} +7 -7
  15. package/dist/{chunk-INA6YZTZ.js → chunk-LBWKISBS.js} +51 -31
  16. package/dist/{chunk-I5EZG52P.js → chunk-N2QTUMGO.js} +532 -327
  17. package/dist/{chunk-RHVH2GZR.js → chunk-NMZLX7TP.js} +110 -56
  18. package/dist/{chunk-EDPKUUJL.js → chunk-NT7TBFX2.js} +9 -1
  19. package/dist/{chunk-GVEQ3RAH.js → chunk-RV76SKFT.js} +169 -54
  20. package/dist/{chunk-W5NDZSYE.js → chunk-TLBCKDQO.js} +23 -23
  21. package/dist/chunk-US226AS4.js +130 -0
  22. package/dist/{chunk-IZPV6QS6.js → chunk-WL2HNJZ6.js} +38 -11
  23. package/dist/chunk-WLCM2OXG.js +181 -0
  24. package/dist/config.cjs +40 -13
  25. package/dist/config.d.cts +7 -1
  26. package/dist/config.d.ts +7 -1
  27. package/dist/config.js +2 -2
  28. package/dist/converters.cjs +491 -35
  29. package/dist/converters.d.cts +5 -5
  30. package/dist/converters.d.ts +5 -5
  31. package/dist/converters.js +4 -3
  32. package/dist/core.cjs +53 -10
  33. package/dist/core.d.cts +10 -9
  34. package/dist/core.d.ts +10 -9
  35. package/dist/core.js +8 -4
  36. package/dist/disconnectReason-IuADl6TH.d.cts +34 -0
  37. package/dist/disconnectReason-IuADl6TH.d.ts +34 -0
  38. package/dist/{dtos-DUpbIu8k.d.ts → dtos-B8KU_q4d.d.cts} +26 -6
  39. package/dist/{dtos-DUpbIu8k.d.cts → dtos-B8KU_q4d.d.ts} +26 -6
  40. package/dist/index.cjs +1510 -735
  41. package/dist/index.d.cts +18 -16
  42. package/dist/index.d.ts +18 -16
  43. package/dist/index.js +21 -13
  44. package/dist/linear.cjs +1044 -112
  45. package/dist/linear.d.cts +146 -16
  46. package/dist/linear.d.ts +146 -16
  47. package/dist/linear.js +1031 -110
  48. package/dist/mcp-claude.cjs +338 -66
  49. package/dist/mcp-claude.d.cts +3 -3
  50. package/dist/mcp-claude.d.ts +3 -3
  51. package/dist/mcp-claude.js +215 -16
  52. package/dist/mcp.cjs +414 -105
  53. package/dist/mcp.d.cts +29 -16
  54. package/dist/mcp.d.ts +29 -16
  55. package/dist/mcp.js +14 -14
  56. package/dist/{opencode-BBcDchcN.d.cts → opencode-2YdscIc1.d.cts} +5 -5
  57. package/dist/{opencode-DthQQUsZ.d.ts → opencode-Bld62x5t.d.ts} +5 -5
  58. package/dist/{pagination-CcDkVFxK.d.ts → pagination-BgEx-HeL.d.ts} +2 -2
  59. package/dist/{pagination-BPiys10t.d.cts → pagination-DqdkQArT.d.cts} +2 -2
  60. package/dist/{protocols-DrhzOH6K.d.ts → protocols-Bwwcql0h.d.ts} +1 -1
  61. package/dist/{protocols-CInhtFpA.d.cts → protocols-Bz1rxcUg.d.cts} +1 -1
  62. package/dist/rest.cjs +41 -97
  63. package/dist/rest.d.cts +7 -7
  64. package/dist/rest.d.ts +7 -7
  65. package/dist/rest.js +2 -2
  66. package/dist/runtime.cjs +998 -620
  67. package/dist/runtime.d.cts +22 -29
  68. package/dist/runtime.d.ts +22 -29
  69. package/dist/runtime.js +19 -67
  70. package/dist/{schemas-BpEBkq5V.d.cts → schemas-BotL3ZLH.d.cts} +51 -56
  71. package/dist/{schemas-vos1AaBc.d.ts → schemas-DBsC4J1g.d.ts} +51 -56
  72. package/dist/{sdk-CwTAxhwI.d.cts → sdk-BTciSLRQ.d.cts} +35 -5
  73. package/dist/{sdk-CcnQ5OUC.d.ts → sdk-qKJtMma_.d.ts} +35 -5
  74. package/dist/{simpleAdapter-9OE_p6QW.d.ts → simpleAdapter--wznuoOw.d.ts} +1 -1
  75. package/dist/{simpleAdapter-DqhvjsGr.d.cts → simpleAdapter-BpT4XbZC.d.cts} +1 -1
  76. package/dist/testing.d.cts +3 -3
  77. package/dist/testing.d.ts +3 -3
  78. package/dist/{types-7jVzOeOP.d.ts → types-BTN_ZETM.d.ts} +2 -2
  79. package/dist/{types-CxII3XkA.d.ts → types-BgYFd_Yw.d.cts} +5 -5
  80. package/dist/{types-CSHFipIc.d.cts → types-BivGO7I9.d.ts} +5 -5
  81. package/dist/{types-CovcHpYf.d.cts → types-D958TC71.d.cts} +2 -2
  82. package/package.json +25 -23
  83. package/dist/backends-CzDbiQar.d.ts +0 -20
  84. package/dist/backends-SVMT-7l4.d.cts +0 -20
  85. package/dist/chunk-SFVKOEQH.js +0 -103
@@ -492,26 +492,25 @@ var import_node_crypto2 = require("crypto");
492
492
  var DEFAULT_PORT = 1e4;
493
493
  var DEFAULT_GATEWAY_URL = `http://localhost:${DEFAULT_PORT}`;
494
494
 
495
- // src/runtime/prompts.ts
496
- var BASE_INSTRUCTIONS = `
495
+ // src/runtime/prompts/base.ts
496
+ var ENVIRONMENT_SECTION = `
497
497
  ## Environment
498
498
 
499
499
  Multi-participant chat. Messages show sender: [Name]: content.
500
500
  Messages prefixed with [System]: are platform updates (participant changes, contact updates, etc.) \u2014 not messages from users.
501
- Use \`thenvoi_send_message(content, mentions)\` to respond. Plain text output is not delivered.
502
- Mentions use handles: @<username> for users, @<username>/<agent-name> for agents.
503
-
504
- ## CRITICAL: Delegate When You Cannot Help Directly
501
+ Use \`band_send_message(content, mentions)\` to respond. Plain text output is not delivered.
502
+ Mentions use handles: @<username> for users, @<username>/<agent-name> for agents.`;
503
+ var MULTI_AGENT_RULES_SECTION = `## CRITICAL: Delegate When You Cannot Help Directly
505
504
 
506
505
  You have NO internet access and NO real-time data. When asked about weather, news, stock prices,
507
506
  or any current information you cannot answer directly:
508
507
 
509
- 1. Call \`thenvoi_lookup_peers()\` to find available specialized agents
510
- 2. If a relevant agent exists, call \`thenvoi_add_participant(name)\` to add them
511
- 3. Ask that agent using \`thenvoi_send_message(question, mentions=[agent_handle])\`
508
+ 1. Call \`band_lookup_peers()\` to find available specialized agents
509
+ 2. If a relevant agent exists, call \`band_add_participant(name)\` to add them
510
+ 3. Ask that agent using \`band_send_message(question, mentions=[agent_handle])\`
512
511
  4. Wait for their response and relay it back to the user
513
512
 
514
- NEVER say "I can't do that" without first checking if another agent can help via \`thenvoi_lookup_peers()\`.
513
+ NEVER say "I can't do that" without first checking if another agent can help via \`band_lookup_peers()\`.
515
514
 
516
515
  ## CRITICAL: Do NOT Remove Agents Automatically
517
516
 
@@ -527,48 +526,505 @@ Only remove agents if the user explicitly requests it.
527
526
  When someone asks you to get information from another agent:
528
527
  1. Ask the other agent for the information
529
528
  2. When you receive the response, IMMEDIATELY relay it back to the ORIGINAL REQUESTER
530
- 3. Do NOT just thank the helper agent - the requester is waiting for their answer!
531
-
532
- ## IMPORTANT: Always Share Your Thinking
533
-
534
- You MUST call \`thenvoi_send_event(content, message_type="thought")\` BEFORE every action.
535
- This is required so users can see your reasoning process.
529
+ 3. Do NOT just thank the helper agent - the requester is waiting for their answer!`;
530
+ var THINKING_SECTION = `## IMPORTANT: Always Share Your Thinking
536
531
 
537
- ## Examples
532
+ You MUST call \`band_send_event(content, message_type="thought")\` BEFORE every action.
533
+ This is required so users can see your reasoning process.`;
534
+ var EXAMPLES_SECTION = `## Examples
538
535
 
539
536
  ### Simple question - answer directly
540
537
  [John Doe]: What's 2+2?
541
- -> thenvoi_send_event("Simple arithmetic, answering directly.", message_type="thought")
542
- -> thenvoi_send_message("4", mentions=["@john"])
538
+ -> band_send_event("Simple arithmetic, answering directly.", message_type="thought")
539
+ -> band_send_message("4", mentions=["@john"])
543
540
 
544
541
  ### User asks about weather (you cannot answer directly)
545
542
  [John Doe]: What's the weather in Tokyo?
546
- -> thenvoi_send_event("I can't check weather directly. Looking for a Weather Agent.", message_type="thought")
547
- -> thenvoi_lookup_peers()
548
- -> thenvoi_send_event("Found Weather Agent. Adding to room.", message_type="thought")
549
- -> thenvoi_add_participant("Weather Agent")
550
- -> thenvoi_send_message("What's the weather in Tokyo?", mentions=["@john/weather-agent"])
543
+ -> band_send_event("I can't check weather directly. Looking for a Weather Agent.", message_type="thought")
544
+ -> band_lookup_peers()
545
+ -> band_send_event("Found Weather Agent. Adding to room.", message_type="thought")
546
+ -> band_add_participant("Weather Agent")
547
+ -> band_send_message("What's the weather in Tokyo?", mentions=["@john/weather-agent"])
551
548
 
552
549
  [Weather Agent]: Tokyo is 15\xB0C and cloudy.
553
- -> thenvoi_send_event("Got weather response. Relaying back to John Doe.", message_type="thought")
554
- -> thenvoi_send_message("The weather in Tokyo is 15\xB0C and cloudy.", mentions=["@john"])
550
+ -> band_send_event("Got weather response. Relaying back to John Doe.", message_type="thought")
551
+ -> band_send_message("The weather in Tokyo is 15\xB0C and cloudy.", mentions=["@john"])
555
552
 
556
553
  ### No suitable agent available
557
554
  [John Doe]: What's the stock price of AAPL?
558
- -> thenvoi_send_event("I can't check stock prices. Looking for a Stock Agent.", message_type="thought")
559
- -> thenvoi_lookup_peers()
560
- -> thenvoi_send_event("No stock agent available. Must inform user.", message_type="thought")
561
- -> thenvoi_send_message("I don't have access to stock prices, and there's no specialized agent available to help with that.", mentions=["@john"])
555
+ -> band_send_event("I can't check stock prices. Looking for a Stock Agent.", message_type="thought")
556
+ -> band_lookup_peers()
557
+ -> band_send_event("No stock agent available. Must inform user.", message_type="thought")
558
+ -> band_send_message("I don't have access to stock prices, and there's no specialized agent available to help with that.", mentions=["@john"])
562
559
 
563
560
  ### Follow-up question in same conversation
564
561
  [John Doe]: What about London?
565
- -> thenvoi_send_event("Follow-up weather question. Asking Weather Agent.", message_type="thought")
566
- -> thenvoi_send_message("What's the weather in London?", mentions=["@john/weather-agent"])
562
+ -> band_send_event("Follow-up weather question. Asking Weather Agent.", message_type="thought")
563
+ -> band_send_message("What's the weather in London?", mentions=["@john/weather-agent"])
567
564
 
568
565
  [Weather Agent]: London is 8\xB0C and rainy.
569
- -> thenvoi_send_event("Got London weather. Relaying to John Doe.", message_type="thought")
570
- -> thenvoi_send_message("London is 8\xB0C and rainy.", mentions=["@john"])
571
- `;
566
+ -> band_send_event("Got London weather. Relaying to John Doe.", message_type="thought")
567
+ -> band_send_message("London is 8\xB0C and rainy.", mentions=["@john"])`;
568
+ var BASE_INSTRUCTIONS = [
569
+ ENVIRONMENT_SECTION,
570
+ MULTI_AGENT_RULES_SECTION,
571
+ THINKING_SECTION,
572
+ EXAMPLES_SECTION
573
+ ].join("\n\n") + "\n";
574
+
575
+ // src/contracts/memory.ts
576
+ var SENSORY_MEMORY_TYPES = [
577
+ "iconic",
578
+ // Visual input
579
+ "echoic",
580
+ // Auditory input
581
+ "haptic"
582
+ // Tactile input
583
+ ];
584
+ var COGNITIVE_MEMORY_TYPES = [
585
+ "episodic",
586
+ // Events that occurred
587
+ "semantic",
588
+ // Facts, preferences, learned knowledge
589
+ "procedural"
590
+ // How to perform tasks
591
+ ];
592
+ function namedValues(values) {
593
+ return Object.fromEntries(values.map((value) => [value, value]));
594
+ }
595
+ var MEMORY_SYSTEM_TYPES = {
596
+ sensory: SENSORY_MEMORY_TYPES,
597
+ // Brief sensory inputs
598
+ working: COGNITIVE_MEMORY_TYPES,
599
+ // Short-term session context
600
+ long_term: COGNITIVE_MEMORY_TYPES
601
+ // Persistent cross-conversation memory
602
+ };
603
+ var MEMORY_SYSTEMS = Object.keys(MEMORY_SYSTEM_TYPES);
604
+ var MEMORY_TYPES = [
605
+ ...SENSORY_MEMORY_TYPES,
606
+ ...COGNITIVE_MEMORY_TYPES
607
+ ];
608
+ var MEMORY_SEGMENTS = [
609
+ "user",
610
+ // User preferences or profile info
611
+ "agent",
612
+ // Facts or events about agents/entities
613
+ "tool",
614
+ // Tool usage or task procedures
615
+ "guideline"
616
+ // Behavioral rules or policies
617
+ ];
618
+ var MEMORY_STORE_SCOPES = [
619
+ "subject",
620
+ // About one person/agent; requires subject_id
621
+ "organization"
622
+ // Shared org-wide
623
+ ];
624
+ var MEMORY_LIST_SCOPES = [
625
+ "subject",
626
+ // Subject-scoped memories only
627
+ "organization",
628
+ // Organization-scoped memories only
629
+ "all"
630
+ // Both scopes (no scope filter)
631
+ ];
632
+ var MEMORY_STATUSES = [
633
+ "active",
634
+ // Normal, visible memories
635
+ "superseded",
636
+ // Outdated; soft-deleted via band_supersede_memory
637
+ "archived",
638
+ // Hidden but preserved via band_archive_memory
639
+ "all"
640
+ // Any status (no filter)
641
+ ];
642
+ var MEMORY_SYSTEM = namedValues(MEMORY_SYSTEMS);
643
+ var MEMORY_TYPE = namedValues(MEMORY_TYPES);
644
+ var MEMORY_SEGMENT = namedValues(MEMORY_SEGMENTS);
645
+ var MEMORY_STORE_SCOPE = namedValues(MEMORY_STORE_SCOPES);
646
+
647
+ // src/contracts/chatEvents.ts
648
+ var CHAT_EVENT_TYPES = ["tool_call", "tool_result", "thought", "error", "task"];
649
+ var CHAT_MESSAGE_TYPES = ["text", ...CHAT_EVENT_TYPES];
650
+
651
+ // src/runtime/tools/schemas.ts
652
+ var TOOL_MODELS = {
653
+ band_send_message: {
654
+ description: "Send a message to the chat room. Use this to respond to users or other agents. Messages require at least one @mention in the mentions array. You MUST use this tool to communicate \u2014 plain text responses won't reach users. When delegating, send the full task context in this message instead of assuming hidden state.",
655
+ properties: {
656
+ content: {
657
+ type: "string",
658
+ description: "The message content to send."
659
+ },
660
+ mentions: {
661
+ type: "array",
662
+ items: { type: "string" },
663
+ minItems: 1,
664
+ description: "List of participant handles to @mention. At least one required. For users: @<username> (e.g., '@john'). For agents: @<username>/<agent-name> (e.g., '@john/weather-agent'). Use the handle of someone already in the room."
665
+ }
666
+ },
667
+ required: ["content", "mentions"]
668
+ },
669
+ band_send_event: {
670
+ description: "Send an event to the chat room. No mentions required. 'thought': Share your reasoning or plan BEFORE taking actions. Explain what you're about to do and why. 'error': Report an error or problem that occurred. 'task': Report task progress or completion status. Always send a thought before complex actions to keep users informed.",
671
+ properties: {
672
+ content: {
673
+ type: "string",
674
+ description: "Human-readable event content."
675
+ },
676
+ message_type: {
677
+ type: "string",
678
+ enum: [...CHAT_EVENT_TYPES],
679
+ description: "Type of event."
680
+ },
681
+ metadata: {
682
+ type: "object",
683
+ description: "Optional structured data for the event."
684
+ }
685
+ },
686
+ required: ["content", "message_type"]
687
+ },
688
+ band_add_participant: {
689
+ description: "Add a participant (agent or user) to the chat room by name. IMPORTANT: Use band_lookup_peers() first to find available agents. Pass the exact peer name from band_lookup_peers, not the handle. For normal delegation, omit role or use 'member'.",
690
+ properties: {
691
+ name: {
692
+ type: "string",
693
+ description: "Name of participant to add (must match a name from band_lookup_peers)."
694
+ },
695
+ role: {
696
+ type: "string",
697
+ enum: ["owner", "admin", "member"],
698
+ description: "Role for the participant in this room."
699
+ }
700
+ },
701
+ required: ["name"]
702
+ },
703
+ band_remove_participant: {
704
+ description: "Remove a participant from the chat room by name.",
705
+ properties: {
706
+ name: {
707
+ type: "string",
708
+ description: "Name of the participant to remove."
709
+ }
710
+ },
711
+ required: ["name"]
712
+ },
713
+ band_get_participants: {
714
+ description: "Get a list of all participants in the current chat room.",
715
+ properties: {},
716
+ required: []
717
+ },
718
+ band_lookup_peers: {
719
+ description: "List available peers (agents and users) that can be added to this room. Automatically excludes peers already in the room. Returns dict with 'peers' list and 'metadata' (page, page_size, total_count, total_pages). Use this to find specialized agents (e.g., Weather Agent) when you cannot answer a question directly.",
720
+ properties: {
721
+ page: {
722
+ type: "integer",
723
+ description: "Page number."
724
+ },
725
+ page_size: {
726
+ type: "integer",
727
+ description: "Items per page (max 100).",
728
+ maximum: 100
729
+ }
730
+ },
731
+ required: []
732
+ },
733
+ band_create_chatroom: {
734
+ description: "Create a new chat room for a specific task or conversation.",
735
+ properties: {
736
+ task_id: {
737
+ type: "string",
738
+ description: "Associated task ID (optional)."
739
+ }
740
+ },
741
+ required: []
742
+ },
743
+ band_list_contacts: {
744
+ description: "List agent's contacts with pagination.",
745
+ properties: {
746
+ page: {
747
+ type: "integer",
748
+ description: "Page number.",
749
+ minimum: 1
750
+ },
751
+ page_size: {
752
+ type: "integer",
753
+ description: "Items per page.",
754
+ minimum: 1,
755
+ maximum: 100
756
+ }
757
+ },
758
+ required: []
759
+ },
760
+ band_add_contact: {
761
+ description: "Send a contact request to add someone as a contact. Returns 'pending' when request is created. Returns 'approved' when inverse request existed and was auto-accepted.",
762
+ properties: {
763
+ handle: {
764
+ type: "string",
765
+ description: "Handle of user/agent to add (e.g., '@john' or '@john/agent-name')."
766
+ },
767
+ message: {
768
+ type: "string",
769
+ description: "Optional message with the request."
770
+ }
771
+ },
772
+ required: ["handle"]
773
+ },
774
+ band_remove_contact: {
775
+ description: "Remove an existing contact by handle or ID.",
776
+ properties: {
777
+ handle: {
778
+ type: "string",
779
+ description: "Contact's handle."
780
+ },
781
+ contact_id: {
782
+ type: "string",
783
+ description: "Or contact record ID (UUID)."
784
+ }
785
+ },
786
+ required: []
787
+ },
788
+ band_list_contact_requests: {
789
+ description: "List both received and sent contact requests. Received requests are always filtered to pending status. Sent requests can be filtered by status.",
790
+ properties: {
791
+ page: {
792
+ type: "integer",
793
+ description: "Page number.",
794
+ minimum: 1
795
+ },
796
+ page_size: {
797
+ type: "integer",
798
+ description: "Items per page per direction (max 100).",
799
+ minimum: 1,
800
+ maximum: 100
801
+ },
802
+ sent_status: {
803
+ type: "string",
804
+ enum: ["pending", "approved", "rejected", "cancelled", "all"],
805
+ description: "Filter sent requests by status."
806
+ }
807
+ },
808
+ required: []
809
+ },
810
+ band_respond_contact_request: {
811
+ description: "Respond to a contact request. 'approve'/'reject': For requests you RECEIVED (handle = requester's handle). 'cancel': For requests you SENT (handle = recipient's handle).",
812
+ properties: {
813
+ action: {
814
+ type: "string",
815
+ enum: ["approve", "reject", "cancel"],
816
+ description: "Action to take."
817
+ },
818
+ handle: {
819
+ type: "string",
820
+ description: "Other party's handle."
821
+ },
822
+ request_id: {
823
+ type: "string",
824
+ description: "Or request ID (UUID)."
825
+ }
826
+ },
827
+ required: ["action"]
828
+ },
829
+ band_list_memories: {
830
+ description: "List memories accessible to the agent. Returns memories about the specified subject (cross-agent sharing) and organization-wide shared memories.",
831
+ properties: {
832
+ subject_id: {
833
+ type: "string",
834
+ description: "Filter by subject UUID (required for subject-scoped queries)."
835
+ },
836
+ scope: {
837
+ type: "string",
838
+ enum: [...MEMORY_LIST_SCOPES],
839
+ description: "Filter by scope."
840
+ },
841
+ system: {
842
+ type: "string",
843
+ enum: [...MEMORY_SYSTEMS],
844
+ description: "Filter by memory system."
845
+ },
846
+ type: {
847
+ type: "string",
848
+ enum: [...MEMORY_TYPES],
849
+ description: "Filter by memory type."
850
+ },
851
+ segment: {
852
+ type: "string",
853
+ enum: [...MEMORY_SEGMENTS],
854
+ description: "Filter by segment."
855
+ },
856
+ content_query: {
857
+ type: "string",
858
+ description: "Full-text search query."
859
+ },
860
+ page_size: {
861
+ type: "integer",
862
+ description: "Number of results per page.",
863
+ minimum: 1,
864
+ maximum: 50
865
+ },
866
+ status: {
867
+ type: "string",
868
+ enum: [...MEMORY_STATUSES],
869
+ description: "Filter by status."
870
+ }
871
+ },
872
+ required: []
873
+ },
874
+ band_store_memory: {
875
+ description: "Store a new memory entry. The memory will be associated with the authenticated agent as the source. For subject-scoped memories, provide a subject_id. For organization-scoped memories, omit subject_id.",
876
+ properties: {
877
+ content: {
878
+ type: "string",
879
+ description: "The memory content."
880
+ },
881
+ system: {
882
+ type: "string",
883
+ enum: [...MEMORY_SYSTEMS],
884
+ description: "Memory system tier."
885
+ },
886
+ type: {
887
+ type: "string",
888
+ enum: [...MEMORY_TYPES],
889
+ description: "Memory type (must be valid for selected system)."
890
+ },
891
+ segment: {
892
+ type: "string",
893
+ enum: [...MEMORY_SEGMENTS],
894
+ description: "Logical segment."
895
+ },
896
+ thought: {
897
+ type: "string",
898
+ description: "Agent's reasoning for storing this memory."
899
+ },
900
+ scope: {
901
+ type: "string",
902
+ enum: [...MEMORY_STORE_SCOPES],
903
+ description: "Visibility scope."
904
+ },
905
+ subject_id: {
906
+ type: "string",
907
+ description: "UUID of the subject this memory is about (required for subject scope)."
908
+ },
909
+ metadata: {
910
+ type: "object",
911
+ description: "Additional metadata (tags, references)."
912
+ }
913
+ },
914
+ required: ["content", "system", "type", "segment", "thought"]
915
+ },
916
+ band_get_memory: {
917
+ description: "Retrieve a specific memory by ID.",
918
+ properties: {
919
+ memory_id: {
920
+ type: "string",
921
+ description: "Memory ID (UUID)."
922
+ }
923
+ },
924
+ required: ["memory_id"]
925
+ },
926
+ band_supersede_memory: {
927
+ description: "Mark a memory as superseded (soft delete). Use when information is outdated or incorrect. The memory remains for audit trail but won't appear in normal queries. Only the source agent can supersede.",
928
+ properties: {
929
+ memory_id: {
930
+ type: "string",
931
+ description: "Memory ID (UUID)."
932
+ }
933
+ },
934
+ required: ["memory_id"]
935
+ },
936
+ band_archive_memory: {
937
+ description: "Archive a memory (hide but preserve). Use when memory is valid but not currently needed. Archived memories can be restored later by humans. Only the source agent can archive.",
938
+ properties: {
939
+ memory_id: {
940
+ type: "string",
941
+ description: "Memory ID (UUID)."
942
+ }
943
+ },
944
+ required: ["memory_id"]
945
+ }
946
+ };
947
+ var ALL_TOOL_NAMES = new Set(Object.keys(TOOL_MODELS));
948
+ var MEMORY_TOOL_NAMES = /* @__PURE__ */ new Set([
949
+ "band_list_memories",
950
+ "band_store_memory",
951
+ "band_get_memory",
952
+ "band_supersede_memory",
953
+ "band_archive_memory"
954
+ ]);
955
+ var CONTACT_TOOL_NAMES = /* @__PURE__ */ new Set([
956
+ "band_list_contacts",
957
+ "band_add_contact",
958
+ "band_remove_contact",
959
+ "band_list_contact_requests",
960
+ "band_respond_contact_request"
961
+ ]);
962
+ var BASE_TOOL_NAMES = new Set(
963
+ [...ALL_TOOL_NAMES].filter((name) => !MEMORY_TOOL_NAMES.has(name))
964
+ );
965
+ var CHAT_TOOL_NAMES = new Set(
966
+ [...BASE_TOOL_NAMES].filter((name) => !CONTACT_TOOL_NAMES.has(name))
967
+ );
968
+
969
+ // src/runtime/prompts/memory.ts
970
+ var MEMORY_INTRO = `## Memory Tools
971
+
972
+ You have access to memory tools for storing and retrieving information
973
+ across conversations. Use \`band_store_memory\` to persist important
974
+ information and \`band_list_memories\` / \`band_get_memory\` to recall it.
975
+ Use \`band_supersede_memory\` to mark outdated memories and
976
+ \`band_archive_memory\` to hide memories that should be preserved.`;
977
+ function longTermPattern(label, type, segment, scope) {
978
+ return {
979
+ label,
980
+ system: MEMORY_SYSTEM.long_term,
981
+ type,
982
+ segment,
983
+ scope
984
+ };
985
+ }
986
+ var COMMON_MEMORY_PATTERNS = [
987
+ longTermPattern("Facts learned about a specific agent/entity", MEMORY_TYPE.semantic, MEMORY_SEGMENT.agent, MEMORY_STORE_SCOPE.subject),
988
+ longTermPattern("Events involving a specific person/agent", MEMORY_TYPE.episodic, MEMORY_SEGMENT.agent, MEMORY_STORE_SCOPE.subject),
989
+ longTermPattern("A user's preferences or profile info", MEMORY_TYPE.semantic, MEMORY_SEGMENT.user, MEMORY_STORE_SCOPE.subject),
990
+ longTermPattern("Org-wide knowledge or how to perform a task", MEMORY_TYPE.procedural, MEMORY_SEGMENT.tool, MEMORY_STORE_SCOPE.organization)
991
+ ];
992
+ function renderMemoryPattern(pattern) {
993
+ return `- ${pattern.label}: \`system="${pattern.system}"\`, \`type="${pattern.type}"\`, \`segment="${pattern.segment}"\`, \`scope="${pattern.scope}"\``;
994
+ }
995
+ var MEMORY_COMMON_PATTERNS = [
996
+ "Common patterns:",
997
+ ...COMMON_MEMORY_PATTERNS.map(renderMemoryPattern)
998
+ ].join("\n");
999
+ var MEMORY_SCOPE_GUIDANCE = `Prefer \`scope="${MEMORY_STORE_SCOPE.subject}"\` whenever the memory is about a specific person or agent, so it
1000
+ stays attached to that subject rather than leaking org-wide. Storing with \`scope="${MEMORY_STORE_SCOPE.subject}"\` requires a
1001
+ real \`subject_id\` UUID, so resolve it first via \`band_lookup_peers\` or the participant list.
1002
+ Reserve \`scope="${MEMORY_STORE_SCOPE.organization}"\` for knowledge that is genuinely shared across the whole organization and
1003
+ is not about any one subject.`;
1004
+ function quoteChoices(values) {
1005
+ return values.map((value) => `\`"${value}"\``).join(" | ");
1006
+ }
1007
+ function memoryTypeLines() {
1008
+ return Object.entries(MEMORY_SYSTEM_TYPES).map(([system, types]) => ` - ${system}: ${quoteChoices(types)}`).join("\n");
1009
+ }
1010
+ function buildMemorySection() {
1011
+ const storeMemoryProps = TOOL_MODELS.band_store_memory.properties;
1012
+ const systems = storeMemoryProps.system.enum;
1013
+ const segments = storeMemoryProps.segment.enum;
1014
+ const scopes = storeMemoryProps.scope.enum;
1015
+ const fieldRules = `When calling \`band_store_memory\`, the \`system\`, \`type\`, \`segment\`, and \`scope\` fields
1016
+ must use these exact values (case-sensitive):
1017
+
1018
+ - **system**: ${quoteChoices(systems)}
1019
+ - **type** (must match the chosen system):
1020
+ ${memoryTypeLines()}
1021
+ - **segment**: ${quoteChoices(segments)}
1022
+ - **scope**: ${quoteChoices(scopes)}`;
1023
+ return [MEMORY_INTRO, fieldRules, MEMORY_COMMON_PATTERNS, MEMORY_SCOPE_GUIDANCE].join("\n\n");
1024
+ }
1025
+ var MEMORY_SECTION = buildMemorySection();
1026
+
1027
+ // src/runtime/prompts/templates.ts
572
1028
  var TEMPLATES = {
573
1029
  default: `You are {agent_name}, {agent_description}.
574
1030
 
@@ -1,8 +1,8 @@
1
- export { b as ACPClientHistoryConverter, A as ACPClientSessionState, c as ACPServerHistoryConverter, a as ACPServerSessionState, G as GatewayHistoryConverter } from './acp-server-BdRz9_UN.cjs';
2
- import { H as HistoryConverter } from './protocols-CInhtFpA.cjs';
3
- export { A as A2AAuth, d as A2AHistoryConverter, e as A2ASessionState, G as GatewaySessionState, q as GoogleADKHistoryConverter, r as GoogleADKMessage, s as GoogleADKMessages, O as OpencodeHistoryConverter, t as OpencodeSessionState, P as ParlantHistoryConverter, m as ParlantMessage, n as ParlantMessages, p as buildA2AAuthHeaders, u as extractGoogleAdkSessionId, v as extractOpencodeSessionId } from './opencode-BBcDchcN.cjs';
4
- import './dtos-DUpbIu8k.cjs';
5
- import './types-CSHFipIc.cjs';
1
+ export { b as ACPClientHistoryConverter, A as ACPClientSessionState, c as ACPServerHistoryConverter, a as ACPServerSessionState, G as GatewayHistoryConverter } from './acp-server-Dlj7D563.cjs';
2
+ import { H as HistoryConverter } from './protocols-Bz1rxcUg.cjs';
3
+ export { A as A2AAuth, d as A2AHistoryConverter, e as A2ASessionState, G as GatewaySessionState, q as GoogleADKHistoryConverter, r as GoogleADKMessage, s as GoogleADKMessages, O as OpencodeHistoryConverter, t as OpencodeSessionState, P as ParlantHistoryConverter, m as ParlantMessage, n as ParlantMessages, p as buildA2AAuthHeaders, u as extractGoogleAdkSessionId, v as extractOpencodeSessionId } from './opencode-2YdscIc1.cjs';
4
+ import './dtos-B8KU_q4d.cjs';
5
+ import './types-BgYFd_Yw.cjs';
6
6
 
7
7
  type VercelAISDKMessage = {
8
8
  role: "system";
@@ -1,8 +1,8 @@
1
- export { b as ACPClientHistoryConverter, A as ACPClientSessionState, c as ACPServerHistoryConverter, a as ACPServerSessionState, G as GatewayHistoryConverter } from './acp-server-B1Da7L6u.js';
2
- import { H as HistoryConverter } from './protocols-DrhzOH6K.js';
3
- export { A as A2AAuth, d as A2AHistoryConverter, e as A2ASessionState, G as GatewaySessionState, q as GoogleADKHistoryConverter, r as GoogleADKMessage, s as GoogleADKMessages, O as OpencodeHistoryConverter, t as OpencodeSessionState, P as ParlantHistoryConverter, m as ParlantMessage, n as ParlantMessages, p as buildA2AAuthHeaders, u as extractGoogleAdkSessionId, v as extractOpencodeSessionId } from './opencode-DthQQUsZ.js';
4
- import './dtos-DUpbIu8k.js';
5
- import './types-CxII3XkA.js';
1
+ export { b as ACPClientHistoryConverter, A as ACPClientSessionState, c as ACPServerHistoryConverter, a as ACPServerSessionState, G as GatewayHistoryConverter } from './acp-server-CiUqN3G3.js';
2
+ import { H as HistoryConverter } from './protocols-Bwwcql0h.js';
3
+ export { A as A2AAuth, d as A2AHistoryConverter, e as A2ASessionState, G as GatewaySessionState, q as GoogleADKHistoryConverter, r as GoogleADKMessage, s as GoogleADKMessages, O as OpencodeHistoryConverter, t as OpencodeSessionState, P as ParlantHistoryConverter, m as ParlantMessage, n as ParlantMessages, p as buildA2AAuthHeaders, u as extractGoogleAdkSessionId, v as extractOpencodeSessionId } from './opencode-Bld62x5t.js';
4
+ import './dtos-B8KU_q4d.js';
5
+ import './types-BivGO7I9.js';
6
6
 
7
7
  type VercelAISDKMessage = {
8
8
  role: "system";
@@ -18,13 +18,14 @@ import {
18
18
  parseDate,
19
19
  parseToolCall,
20
20
  parseToolResult
21
- } from "./chunk-W5NDZSYE.js";
21
+ } from "./chunk-TLBCKDQO.js";
22
22
  import "./chunk-AVVDPXP4.js";
23
- import "./chunk-SFVKOEQH.js";
23
+ import "./chunk-WLCM2OXG.js";
24
+ import "./chunk-RV76SKFT.js";
24
25
  import "./chunk-ZZJRRBPQ.js";
25
26
  import "./chunk-3BKAC4OZ.js";
26
27
  import "./chunk-OD2G5LFQ.js";
27
- import "./chunk-YR3BOQNW.js";
28
+ import "./chunk-JY75VSQK.js";
28
29
 
29
30
  // src/converters/vercel-ai-sdk.ts
30
31
  function flushPendingToolCalls(messages, pendingToolCalls) {