@band-ai/sdk 0.1.10 → 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.
- package/README.md +54 -54
- package/dist/{ClaudeSDKAdapter-DfjaI5ke.d.cts → ClaudeSDKAdapter-BY4zEbCl.d.cts} +12 -10
- package/dist/{ClaudeSDKAdapter-DonPGJ43.d.ts → ClaudeSDKAdapter-Cna5P1dR.d.ts} +12 -10
- package/dist/{acp-server-NZAeg-WO.d.ts → acp-server-CiUqN3G3.d.ts} +2 -2
- package/dist/{acp-server-CUBXIiG6.d.cts → acp-server-Dlj7D563.d.cts} +2 -2
- package/dist/adapters.cjs +250 -183
- package/dist/adapters.d.cts +21 -19
- package/dist/adapters.d.ts +21 -19
- package/dist/adapters.js +65 -44
- package/dist/backends-D-dBdDm-.d.ts +27 -0
- package/dist/backends-ZLxmQrTZ.d.cts +27 -0
- package/dist/{chunk-2BHHR6YW.js → chunk-4IAXZBXX.js} +62 -23
- package/dist/{chunk-SG4WLD2H.js → chunk-EAI2M3WM.js} +38 -94
- package/dist/{chunk-YR3BOQNW.js → chunk-JY75VSQK.js} +7 -7
- package/dist/{chunk-RDM4TE4B.js → chunk-LBWKISBS.js} +19 -1
- package/dist/{chunk-FP237EAG.js → chunk-N2QTUMGO.js} +112 -195
- package/dist/{chunk-J3M3PFFY.js → chunk-NMZLX7TP.js} +35 -31
- package/dist/{chunk-6RXWL6TC.js → chunk-NT7TBFX2.js} +1 -1
- package/dist/{chunk-MLROFDKR.js → chunk-RV76SKFT.js} +39 -33
- package/dist/{chunk-XA4N2JPH.js → chunk-TLBCKDQO.js} +23 -23
- package/dist/{chunk-IZPV6QS6.js → chunk-WL2HNJZ6.js} +38 -11
- package/dist/{chunk-DNPVCR3S.js → chunk-WLCM2OXG.js} +31 -31
- package/dist/config.cjs +40 -13
- package/dist/config.d.cts +7 -1
- package/dist/config.d.ts +7 -1
- package/dist/config.js +2 -2
- package/dist/converters.cjs +61 -61
- package/dist/converters.d.cts +5 -5
- package/dist/converters.d.ts +5 -5
- package/dist/converters.js +4 -4
- package/dist/core.cjs +8 -8
- package/dist/core.d.cts +9 -9
- package/dist/core.d.ts +9 -9
- package/dist/core.js +3 -3
- package/dist/{dtos-Dd_fTfLn.d.cts → dtos-B8KU_q4d.d.cts} +2 -2
- package/dist/{dtos-Dd_fTfLn.d.ts → dtos-B8KU_q4d.d.ts} +2 -2
- package/dist/index.cjs +459 -504
- package/dist/index.d.cts +16 -15
- package/dist/index.d.ts +16 -15
- package/dist/index.js +15 -13
- package/dist/linear.cjs +74 -74
- package/dist/linear.d.cts +14 -14
- package/dist/linear.d.ts +14 -14
- package/dist/linear.js +72 -72
- package/dist/mcp-claude.cjs +37 -36
- package/dist/mcp-claude.d.cts +3 -3
- package/dist/mcp-claude.d.ts +3 -3
- package/dist/mcp-claude.js +7 -6
- package/dist/mcp.cjs +103 -62
- package/dist/mcp.d.cts +29 -16
- package/dist/mcp.d.ts +29 -16
- package/dist/mcp.js +14 -14
- package/dist/{opencode--iA5-KYk.d.cts → opencode-2YdscIc1.d.cts} +5 -5
- package/dist/{opencode-YNacv-eJ.d.ts → opencode-Bld62x5t.d.ts} +5 -5
- package/dist/{pagination-BBLsYLhT.d.ts → pagination-BgEx-HeL.d.ts} +2 -2
- package/dist/{pagination-CqidD-L_.d.cts → pagination-DqdkQArT.d.cts} +2 -2
- package/dist/{protocols-BF6jamIl.d.ts → protocols-Bwwcql0h.d.ts} +1 -1
- package/dist/{protocols-D2bTrQ_t.d.cts → protocols-Bz1rxcUg.d.cts} +1 -1
- package/dist/rest.cjs +41 -97
- package/dist/rest.d.cts +7 -7
- package/dist/rest.d.ts +7 -7
- package/dist/rest.js +2 -2
- package/dist/runtime.cjs +293 -464
- package/dist/runtime.d.cts +16 -28
- package/dist/runtime.d.ts +16 -28
- package/dist/runtime.js +12 -63
- package/dist/{schemas-CI0qgcp_.d.cts → schemas-BotL3ZLH.d.cts} +40 -54
- package/dist/{schemas-B1Fd3oUM.d.ts → schemas-DBsC4J1g.d.ts} +40 -54
- package/dist/{sdk-D2rTDU_o.d.cts → sdk-BTciSLRQ.d.cts} +5 -5
- package/dist/{sdk-CyqN1W5g.d.ts → sdk-qKJtMma_.d.ts} +5 -5
- package/dist/{simpleAdapter-qQt-tSz4.d.ts → simpleAdapter--wznuoOw.d.ts} +1 -1
- package/dist/{simpleAdapter-C_f-01Cu.d.cts → simpleAdapter-BpT4XbZC.d.cts} +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/{types-DNySTI_8.d.ts → types-BTN_ZETM.d.ts} +2 -2
- package/dist/{types-D3AsUnd0.d.ts → types-BgYFd_Yw.d.cts} +5 -5
- package/dist/{types-DtMms5Fi.d.cts → types-BivGO7I9.d.ts} +5 -5
- package/dist/{types-CKqrhGB1.d.cts → types-D958TC71.d.cts} +2 -2
- package/package.json +6 -5
- package/dist/backends-DYtEhCZG.d.cts +0 -25
- package/dist/backends-oYAb7EU-.d.ts +0 -25
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
MEMORY_SYSTEM_TYPES,
|
|
6
6
|
MEMORY_TYPE,
|
|
7
7
|
TOOL_MODELS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RV76SKFT.js";
|
|
9
9
|
|
|
10
10
|
// src/runtime/prompts/base.ts
|
|
11
11
|
var ENVIRONMENT_SECTION = `
|
|
@@ -13,19 +13,19 @@ var ENVIRONMENT_SECTION = `
|
|
|
13
13
|
|
|
14
14
|
Multi-participant chat. Messages show sender: [Name]: content.
|
|
15
15
|
Messages prefixed with [System]: are platform updates (participant changes, contact updates, etc.) \u2014 not messages from users.
|
|
16
|
-
Use \`
|
|
16
|
+
Use \`band_send_message(content, mentions)\` to respond. Plain text output is not delivered.
|
|
17
17
|
Mentions use handles: @<username> for users, @<username>/<agent-name> for agents.`;
|
|
18
18
|
var MULTI_AGENT_RULES_SECTION = `## CRITICAL: Delegate When You Cannot Help Directly
|
|
19
19
|
|
|
20
20
|
You have NO internet access and NO real-time data. When asked about weather, news, stock prices,
|
|
21
21
|
or any current information you cannot answer directly:
|
|
22
22
|
|
|
23
|
-
1. Call \`
|
|
24
|
-
2. If a relevant agent exists, call \`
|
|
25
|
-
3. Ask that agent using \`
|
|
23
|
+
1. Call \`band_lookup_peers()\` to find available specialized agents
|
|
24
|
+
2. If a relevant agent exists, call \`band_add_participant(name)\` to add them
|
|
25
|
+
3. Ask that agent using \`band_send_message(question, mentions=[agent_handle])\`
|
|
26
26
|
4. Wait for their response and relay it back to the user
|
|
27
27
|
|
|
28
|
-
NEVER say "I can't do that" without first checking if another agent can help via \`
|
|
28
|
+
NEVER say "I can't do that" without first checking if another agent can help via \`band_lookup_peers()\`.
|
|
29
29
|
|
|
30
30
|
## CRITICAL: Do NOT Remove Agents Automatically
|
|
31
31
|
|
|
@@ -44,42 +44,42 @@ When someone asks you to get information from another agent:
|
|
|
44
44
|
3. Do NOT just thank the helper agent - the requester is waiting for their answer!`;
|
|
45
45
|
var THINKING_SECTION = `## IMPORTANT: Always Share Your Thinking
|
|
46
46
|
|
|
47
|
-
You MUST call \`
|
|
47
|
+
You MUST call \`band_send_event(content, message_type="thought")\` BEFORE every action.
|
|
48
48
|
This is required so users can see your reasoning process.`;
|
|
49
49
|
var EXAMPLES_SECTION = `## Examples
|
|
50
50
|
|
|
51
51
|
### Simple question - answer directly
|
|
52
52
|
[John Doe]: What's 2+2?
|
|
53
|
-
->
|
|
54
|
-
->
|
|
53
|
+
-> band_send_event("Simple arithmetic, answering directly.", message_type="thought")
|
|
54
|
+
-> band_send_message("4", mentions=["@john"])
|
|
55
55
|
|
|
56
56
|
### User asks about weather (you cannot answer directly)
|
|
57
57
|
[John Doe]: What's the weather in Tokyo?
|
|
58
|
-
->
|
|
59
|
-
->
|
|
60
|
-
->
|
|
61
|
-
->
|
|
62
|
-
->
|
|
58
|
+
-> band_send_event("I can't check weather directly. Looking for a Weather Agent.", message_type="thought")
|
|
59
|
+
-> band_lookup_peers()
|
|
60
|
+
-> band_send_event("Found Weather Agent. Adding to room.", message_type="thought")
|
|
61
|
+
-> band_add_participant("Weather Agent")
|
|
62
|
+
-> band_send_message("What's the weather in Tokyo?", mentions=["@john/weather-agent"])
|
|
63
63
|
|
|
64
64
|
[Weather Agent]: Tokyo is 15\xB0C and cloudy.
|
|
65
|
-
->
|
|
66
|
-
->
|
|
65
|
+
-> band_send_event("Got weather response. Relaying back to John Doe.", message_type="thought")
|
|
66
|
+
-> band_send_message("The weather in Tokyo is 15\xB0C and cloudy.", mentions=["@john"])
|
|
67
67
|
|
|
68
68
|
### No suitable agent available
|
|
69
69
|
[John Doe]: What's the stock price of AAPL?
|
|
70
|
-
->
|
|
71
|
-
->
|
|
72
|
-
->
|
|
73
|
-
->
|
|
70
|
+
-> band_send_event("I can't check stock prices. Looking for a Stock Agent.", message_type="thought")
|
|
71
|
+
-> band_lookup_peers()
|
|
72
|
+
-> band_send_event("No stock agent available. Must inform user.", message_type="thought")
|
|
73
|
+
-> band_send_message("I don't have access to stock prices, and there's no specialized agent available to help with that.", mentions=["@john"])
|
|
74
74
|
|
|
75
75
|
### Follow-up question in same conversation
|
|
76
76
|
[John Doe]: What about London?
|
|
77
|
-
->
|
|
78
|
-
->
|
|
77
|
+
-> band_send_event("Follow-up weather question. Asking Weather Agent.", message_type="thought")
|
|
78
|
+
-> band_send_message("What's the weather in London?", mentions=["@john/weather-agent"])
|
|
79
79
|
|
|
80
80
|
[Weather Agent]: London is 8\xB0C and rainy.
|
|
81
|
-
->
|
|
82
|
-
->
|
|
81
|
+
-> band_send_event("Got London weather. Relaying to John Doe.", message_type="thought")
|
|
82
|
+
-> band_send_message("London is 8\xB0C and rainy.", mentions=["@john"])`;
|
|
83
83
|
var BASE_INSTRUCTIONS = [
|
|
84
84
|
ENVIRONMENT_SECTION,
|
|
85
85
|
MULTI_AGENT_RULES_SECTION,
|
|
@@ -91,10 +91,10 @@ var BASE_INSTRUCTIONS = [
|
|
|
91
91
|
var MEMORY_INTRO = `## Memory Tools
|
|
92
92
|
|
|
93
93
|
You have access to memory tools for storing and retrieving information
|
|
94
|
-
across conversations. Use \`
|
|
95
|
-
information and \`
|
|
96
|
-
Use \`
|
|
97
|
-
\`
|
|
94
|
+
across conversations. Use \`band_store_memory\` to persist important
|
|
95
|
+
information and \`band_list_memories\` / \`band_get_memory\` to recall it.
|
|
96
|
+
Use \`band_supersede_memory\` to mark outdated memories and
|
|
97
|
+
\`band_archive_memory\` to hide memories that should be preserved.`;
|
|
98
98
|
function longTermPattern(label, type, segment, scope) {
|
|
99
99
|
return {
|
|
100
100
|
label,
|
|
@@ -119,7 +119,7 @@ var MEMORY_COMMON_PATTERNS = [
|
|
|
119
119
|
].join("\n");
|
|
120
120
|
var MEMORY_SCOPE_GUIDANCE = `Prefer \`scope="${MEMORY_STORE_SCOPE.subject}"\` whenever the memory is about a specific person or agent, so it
|
|
121
121
|
stays attached to that subject rather than leaking org-wide. Storing with \`scope="${MEMORY_STORE_SCOPE.subject}"\` requires a
|
|
122
|
-
real \`subject_id\` UUID, so resolve it first via \`
|
|
122
|
+
real \`subject_id\` UUID, so resolve it first via \`band_lookup_peers\` or the participant list.
|
|
123
123
|
Reserve \`scope="${MEMORY_STORE_SCOPE.organization}"\` for knowledge that is genuinely shared across the whole organization and
|
|
124
124
|
is not about any one subject.`;
|
|
125
125
|
function quoteChoices(values) {
|
|
@@ -129,11 +129,11 @@ function memoryTypeLines() {
|
|
|
129
129
|
return Object.entries(MEMORY_SYSTEM_TYPES).map(([system, types]) => ` - ${system}: ${quoteChoices(types)}`).join("\n");
|
|
130
130
|
}
|
|
131
131
|
function buildMemorySection() {
|
|
132
|
-
const storeMemoryProps = TOOL_MODELS.
|
|
132
|
+
const storeMemoryProps = TOOL_MODELS.band_store_memory.properties;
|
|
133
133
|
const systems = storeMemoryProps.system.enum;
|
|
134
134
|
const segments = storeMemoryProps.segment.enum;
|
|
135
135
|
const scopes = storeMemoryProps.scope.enum;
|
|
136
|
-
const fieldRules = `When calling \`
|
|
136
|
+
const fieldRules = `When calling \`band_store_memory\`, the \`system\`, \`type\`, \`segment\`, and \`scope\` fields
|
|
137
137
|
must use these exact values (case-sensitive):
|
|
138
138
|
|
|
139
139
|
- **system**: ${quoteChoices(systems)}
|
package/dist/config.cjs
CHANGED
|
@@ -40,13 +40,13 @@ var import_node_fs = require("fs");
|
|
|
40
40
|
var import_js_yaml = __toESM(require("js-yaml"), 1);
|
|
41
41
|
|
|
42
42
|
// src/core/errors.ts
|
|
43
|
-
var
|
|
43
|
+
var BandSdkError = class extends Error {
|
|
44
44
|
constructor(message, cause) {
|
|
45
45
|
super(message, cause !== void 0 ? { cause } : void 0);
|
|
46
|
-
this.name = "
|
|
46
|
+
this.name = "BandSdkError";
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
var ValidationError = class extends
|
|
49
|
+
var ValidationError = class extends BandSdkError {
|
|
50
50
|
constructor(message, cause) {
|
|
51
51
|
super(message, cause);
|
|
52
52
|
this.name = "ValidationError";
|
|
@@ -55,7 +55,21 @@ var ValidationError = class extends ThenvoiSdkError {
|
|
|
55
55
|
|
|
56
56
|
// src/config/loader.ts
|
|
57
57
|
var DEFAULT_CONFIG_PATH = "./agent_config.yaml";
|
|
58
|
-
var DEFAULT_ENV_PREFIX = "
|
|
58
|
+
var DEFAULT_ENV_PREFIX = "BAND_";
|
|
59
|
+
var LEGACY_ENV_PREFIX = "THENVOI_";
|
|
60
|
+
var _warnedLegacyEnvVars = /* @__PURE__ */ new Set();
|
|
61
|
+
function readBandFirstEnv(env, field) {
|
|
62
|
+
const bandVar = `${DEFAULT_ENV_PREFIX}${field}`;
|
|
63
|
+
const bandValue = env[bandVar];
|
|
64
|
+
if (bandValue !== void 0) return bandValue;
|
|
65
|
+
const legacyVar = `${LEGACY_ENV_PREFIX}${field}`;
|
|
66
|
+
const legacyValue = env[legacyVar];
|
|
67
|
+
if (legacyValue !== void 0 && !_warnedLegacyEnvVars.has(legacyVar)) {
|
|
68
|
+
_warnedLegacyEnvVars.add(legacyVar);
|
|
69
|
+
console.warn(`[band] ${legacyVar} is deprecated; use ${bandVar} instead`);
|
|
70
|
+
}
|
|
71
|
+
return legacyValue;
|
|
72
|
+
}
|
|
59
73
|
var REQUIRED_FIELDS = ["agent_id", "api_key"];
|
|
60
74
|
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype", "toString", "valueOf"]);
|
|
61
75
|
function toSnakeCase(key) {
|
|
@@ -139,19 +153,32 @@ function loadAgentConfig(agentKey, configPath) {
|
|
|
139
153
|
}
|
|
140
154
|
function loadAgentConfigFromEnv(options) {
|
|
141
155
|
const env = options?.env ?? process.env;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
156
|
+
let section;
|
|
157
|
+
let requiredHint;
|
|
158
|
+
if (options?.prefix === void 0) {
|
|
159
|
+
section = normalizeKeys({
|
|
160
|
+
agent_id: readBandFirstEnv(env, "AGENT_ID"),
|
|
161
|
+
api_key: readBandFirstEnv(env, "API_KEY"),
|
|
162
|
+
ws_url: readBandFirstEnv(env, "WS_URL"),
|
|
163
|
+
rest_url: readBandFirstEnv(env, "REST_URL")
|
|
164
|
+
});
|
|
165
|
+
requiredHint = `${DEFAULT_ENV_PREFIX}AGENT_ID and ${DEFAULT_ENV_PREFIX}API_KEY (legacy ${LEGACY_ENV_PREFIX}* still accepted)`;
|
|
166
|
+
} else {
|
|
167
|
+
const prefix = options.prefix === "" || options.prefix.endsWith("_") ? options.prefix : `${options.prefix}_`;
|
|
168
|
+
section = normalizeKeys({
|
|
169
|
+
agent_id: env[`${prefix}AGENT_ID`],
|
|
170
|
+
api_key: env[`${prefix}API_KEY`],
|
|
171
|
+
ws_url: env[`${prefix}WS_URL`],
|
|
172
|
+
rest_url: env[`${prefix}REST_URL`]
|
|
173
|
+
});
|
|
174
|
+
requiredHint = `${prefix}AGENT_ID and ${prefix}API_KEY`;
|
|
175
|
+
}
|
|
149
176
|
try {
|
|
150
|
-
return toAgentConfigResult(section, `environment variables (${
|
|
177
|
+
return toAgentConfigResult(section, `environment variables (${requiredHint})`);
|
|
151
178
|
} catch (error) {
|
|
152
179
|
if (error instanceof ValidationError) {
|
|
153
180
|
throw new ValidationError(
|
|
154
|
-
`${error.message}. Set ${
|
|
181
|
+
`${error.message}. Set ${requiredHint}, or use loadAgentConfig() for agent_config.yaml.`
|
|
155
182
|
);
|
|
156
183
|
}
|
|
157
184
|
throw error;
|
package/dist/config.d.cts
CHANGED
|
@@ -13,7 +13,13 @@ interface LoadAgentConfigFromEnvOptions {
|
|
|
13
13
|
}
|
|
14
14
|
/** Load agent credentials from a YAML config file (defaults to `./agent_config.yaml`). */
|
|
15
15
|
declare function loadAgentConfig(agentKey?: string, configPath?: string): AgentConfigResult;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Load agent credentials from environment variables. With no explicit prefix the
|
|
18
|
+
* default is `BAND_` with a per-field fallback to the legacy `THENVOI_` variable
|
|
19
|
+
* (Band wins independently for each of AGENT_ID/API_KEY/WS_URL/REST_URL, and each
|
|
20
|
+
* legacy variable used warns once per process). An explicit prefix — including an
|
|
21
|
+
* empty string — is used exactly, with no fallback or warning.
|
|
22
|
+
*/
|
|
17
23
|
declare function loadAgentConfigFromEnv(options?: LoadAgentConfigFromEnvOptions): AgentCredentials;
|
|
18
24
|
|
|
19
25
|
export { type AgentConfigResult, type AgentCredentials, type LoadAgentConfigFromEnvOptions, loadAgentConfig, loadAgentConfigFromEnv };
|
package/dist/config.d.ts
CHANGED
|
@@ -13,7 +13,13 @@ interface LoadAgentConfigFromEnvOptions {
|
|
|
13
13
|
}
|
|
14
14
|
/** Load agent credentials from a YAML config file (defaults to `./agent_config.yaml`). */
|
|
15
15
|
declare function loadAgentConfig(agentKey?: string, configPath?: string): AgentConfigResult;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Load agent credentials from environment variables. With no explicit prefix the
|
|
18
|
+
* default is `BAND_` with a per-field fallback to the legacy `THENVOI_` variable
|
|
19
|
+
* (Band wins independently for each of AGENT_ID/API_KEY/WS_URL/REST_URL, and each
|
|
20
|
+
* legacy variable used warns once per process). An explicit prefix — including an
|
|
21
|
+
* empty string — is used exactly, with no fallback or warning.
|
|
22
|
+
*/
|
|
17
23
|
declare function loadAgentConfigFromEnv(options?: LoadAgentConfigFromEnvOptions): AgentCredentials;
|
|
18
24
|
|
|
19
25
|
export { type AgentConfigResult, type AgentCredentials, type LoadAgentConfigFromEnvOptions, loadAgentConfig, loadAgentConfigFromEnv };
|
package/dist/config.js
CHANGED
package/dist/converters.cjs
CHANGED
|
@@ -498,19 +498,19 @@ var ENVIRONMENT_SECTION = `
|
|
|
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 \`
|
|
501
|
+
Use \`band_send_message(content, mentions)\` to respond. Plain text output is not delivered.
|
|
502
502
|
Mentions use handles: @<username> for users, @<username>/<agent-name> for agents.`;
|
|
503
503
|
var MULTI_AGENT_RULES_SECTION = `## CRITICAL: Delegate When You Cannot Help Directly
|
|
504
504
|
|
|
505
505
|
You have NO internet access and NO real-time data. When asked about weather, news, stock prices,
|
|
506
506
|
or any current information you cannot answer directly:
|
|
507
507
|
|
|
508
|
-
1. Call \`
|
|
509
|
-
2. If a relevant agent exists, call \`
|
|
510
|
-
3. Ask that agent using \`
|
|
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])\`
|
|
511
511
|
4. Wait for their response and relay it back to the user
|
|
512
512
|
|
|
513
|
-
NEVER say "I can't do that" without first checking if another agent can help via \`
|
|
513
|
+
NEVER say "I can't do that" without first checking if another agent can help via \`band_lookup_peers()\`.
|
|
514
514
|
|
|
515
515
|
## CRITICAL: Do NOT Remove Agents Automatically
|
|
516
516
|
|
|
@@ -529,42 +529,42 @@ When someone asks you to get information from another agent:
|
|
|
529
529
|
3. Do NOT just thank the helper agent - the requester is waiting for their answer!`;
|
|
530
530
|
var THINKING_SECTION = `## IMPORTANT: Always Share Your Thinking
|
|
531
531
|
|
|
532
|
-
You MUST call \`
|
|
532
|
+
You MUST call \`band_send_event(content, message_type="thought")\` BEFORE every action.
|
|
533
533
|
This is required so users can see your reasoning process.`;
|
|
534
534
|
var EXAMPLES_SECTION = `## Examples
|
|
535
535
|
|
|
536
536
|
### Simple question - answer directly
|
|
537
537
|
[John Doe]: What's 2+2?
|
|
538
|
-
->
|
|
539
|
-
->
|
|
538
|
+
-> band_send_event("Simple arithmetic, answering directly.", message_type="thought")
|
|
539
|
+
-> band_send_message("4", mentions=["@john"])
|
|
540
540
|
|
|
541
541
|
### User asks about weather (you cannot answer directly)
|
|
542
542
|
[John Doe]: What's the weather in Tokyo?
|
|
543
|
-
->
|
|
544
|
-
->
|
|
545
|
-
->
|
|
546
|
-
->
|
|
547
|
-
->
|
|
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"])
|
|
548
548
|
|
|
549
549
|
[Weather Agent]: Tokyo is 15\xB0C and cloudy.
|
|
550
|
-
->
|
|
551
|
-
->
|
|
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"])
|
|
552
552
|
|
|
553
553
|
### No suitable agent available
|
|
554
554
|
[John Doe]: What's the stock price of AAPL?
|
|
555
|
-
->
|
|
556
|
-
->
|
|
557
|
-
->
|
|
558
|
-
->
|
|
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"])
|
|
559
559
|
|
|
560
560
|
### Follow-up question in same conversation
|
|
561
561
|
[John Doe]: What about London?
|
|
562
|
-
->
|
|
563
|
-
->
|
|
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"])
|
|
564
564
|
|
|
565
565
|
[Weather Agent]: London is 8\xB0C and rainy.
|
|
566
|
-
->
|
|
567
|
-
->
|
|
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
568
|
var BASE_INSTRUCTIONS = [
|
|
569
569
|
ENVIRONMENT_SECTION,
|
|
570
570
|
MULTI_AGENT_RULES_SECTION,
|
|
@@ -633,9 +633,9 @@ var MEMORY_STATUSES = [
|
|
|
633
633
|
"active",
|
|
634
634
|
// Normal, visible memories
|
|
635
635
|
"superseded",
|
|
636
|
-
// Outdated; soft-deleted via
|
|
636
|
+
// Outdated; soft-deleted via band_supersede_memory
|
|
637
637
|
"archived",
|
|
638
|
-
// Hidden but preserved via
|
|
638
|
+
// Hidden but preserved via band_archive_memory
|
|
639
639
|
"all"
|
|
640
640
|
// Any status (no filter)
|
|
641
641
|
];
|
|
@@ -650,7 +650,7 @@ var CHAT_MESSAGE_TYPES = ["text", ...CHAT_EVENT_TYPES];
|
|
|
650
650
|
|
|
651
651
|
// src/runtime/tools/schemas.ts
|
|
652
652
|
var TOOL_MODELS = {
|
|
653
|
-
|
|
653
|
+
band_send_message: {
|
|
654
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
655
|
properties: {
|
|
656
656
|
content: {
|
|
@@ -666,7 +666,7 @@ var TOOL_MODELS = {
|
|
|
666
666
|
},
|
|
667
667
|
required: ["content", "mentions"]
|
|
668
668
|
},
|
|
669
|
-
|
|
669
|
+
band_send_event: {
|
|
670
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
671
|
properties: {
|
|
672
672
|
content: {
|
|
@@ -685,12 +685,12 @@ var TOOL_MODELS = {
|
|
|
685
685
|
},
|
|
686
686
|
required: ["content", "message_type"]
|
|
687
687
|
},
|
|
688
|
-
|
|
689
|
-
description: "Add a participant (agent or user) to the chat room by name. IMPORTANT: Use
|
|
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
690
|
properties: {
|
|
691
691
|
name: {
|
|
692
692
|
type: "string",
|
|
693
|
-
description: "Name of participant to add (must match a name from
|
|
693
|
+
description: "Name of participant to add (must match a name from band_lookup_peers)."
|
|
694
694
|
},
|
|
695
695
|
role: {
|
|
696
696
|
type: "string",
|
|
@@ -700,7 +700,7 @@ var TOOL_MODELS = {
|
|
|
700
700
|
},
|
|
701
701
|
required: ["name"]
|
|
702
702
|
},
|
|
703
|
-
|
|
703
|
+
band_remove_participant: {
|
|
704
704
|
description: "Remove a participant from the chat room by name.",
|
|
705
705
|
properties: {
|
|
706
706
|
name: {
|
|
@@ -710,12 +710,12 @@ var TOOL_MODELS = {
|
|
|
710
710
|
},
|
|
711
711
|
required: ["name"]
|
|
712
712
|
},
|
|
713
|
-
|
|
713
|
+
band_get_participants: {
|
|
714
714
|
description: "Get a list of all participants in the current chat room.",
|
|
715
715
|
properties: {},
|
|
716
716
|
required: []
|
|
717
717
|
},
|
|
718
|
-
|
|
718
|
+
band_lookup_peers: {
|
|
719
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
720
|
properties: {
|
|
721
721
|
page: {
|
|
@@ -730,7 +730,7 @@ var TOOL_MODELS = {
|
|
|
730
730
|
},
|
|
731
731
|
required: []
|
|
732
732
|
},
|
|
733
|
-
|
|
733
|
+
band_create_chatroom: {
|
|
734
734
|
description: "Create a new chat room for a specific task or conversation.",
|
|
735
735
|
properties: {
|
|
736
736
|
task_id: {
|
|
@@ -740,7 +740,7 @@ var TOOL_MODELS = {
|
|
|
740
740
|
},
|
|
741
741
|
required: []
|
|
742
742
|
},
|
|
743
|
-
|
|
743
|
+
band_list_contacts: {
|
|
744
744
|
description: "List agent's contacts with pagination.",
|
|
745
745
|
properties: {
|
|
746
746
|
page: {
|
|
@@ -757,7 +757,7 @@ var TOOL_MODELS = {
|
|
|
757
757
|
},
|
|
758
758
|
required: []
|
|
759
759
|
},
|
|
760
|
-
|
|
760
|
+
band_add_contact: {
|
|
761
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
762
|
properties: {
|
|
763
763
|
handle: {
|
|
@@ -771,7 +771,7 @@ var TOOL_MODELS = {
|
|
|
771
771
|
},
|
|
772
772
|
required: ["handle"]
|
|
773
773
|
},
|
|
774
|
-
|
|
774
|
+
band_remove_contact: {
|
|
775
775
|
description: "Remove an existing contact by handle or ID.",
|
|
776
776
|
properties: {
|
|
777
777
|
handle: {
|
|
@@ -785,7 +785,7 @@ var TOOL_MODELS = {
|
|
|
785
785
|
},
|
|
786
786
|
required: []
|
|
787
787
|
},
|
|
788
|
-
|
|
788
|
+
band_list_contact_requests: {
|
|
789
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
790
|
properties: {
|
|
791
791
|
page: {
|
|
@@ -807,7 +807,7 @@ var TOOL_MODELS = {
|
|
|
807
807
|
},
|
|
808
808
|
required: []
|
|
809
809
|
},
|
|
810
|
-
|
|
810
|
+
band_respond_contact_request: {
|
|
811
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
812
|
properties: {
|
|
813
813
|
action: {
|
|
@@ -826,7 +826,7 @@ var TOOL_MODELS = {
|
|
|
826
826
|
},
|
|
827
827
|
required: ["action"]
|
|
828
828
|
},
|
|
829
|
-
|
|
829
|
+
band_list_memories: {
|
|
830
830
|
description: "List memories accessible to the agent. Returns memories about the specified subject (cross-agent sharing) and organization-wide shared memories.",
|
|
831
831
|
properties: {
|
|
832
832
|
subject_id: {
|
|
@@ -871,7 +871,7 @@ var TOOL_MODELS = {
|
|
|
871
871
|
},
|
|
872
872
|
required: []
|
|
873
873
|
},
|
|
874
|
-
|
|
874
|
+
band_store_memory: {
|
|
875
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
876
|
properties: {
|
|
877
877
|
content: {
|
|
@@ -913,7 +913,7 @@ var TOOL_MODELS = {
|
|
|
913
913
|
},
|
|
914
914
|
required: ["content", "system", "type", "segment", "thought"]
|
|
915
915
|
},
|
|
916
|
-
|
|
916
|
+
band_get_memory: {
|
|
917
917
|
description: "Retrieve a specific memory by ID.",
|
|
918
918
|
properties: {
|
|
919
919
|
memory_id: {
|
|
@@ -923,7 +923,7 @@ var TOOL_MODELS = {
|
|
|
923
923
|
},
|
|
924
924
|
required: ["memory_id"]
|
|
925
925
|
},
|
|
926
|
-
|
|
926
|
+
band_supersede_memory: {
|
|
927
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
928
|
properties: {
|
|
929
929
|
memory_id: {
|
|
@@ -933,7 +933,7 @@ var TOOL_MODELS = {
|
|
|
933
933
|
},
|
|
934
934
|
required: ["memory_id"]
|
|
935
935
|
},
|
|
936
|
-
|
|
936
|
+
band_archive_memory: {
|
|
937
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
938
|
properties: {
|
|
939
939
|
memory_id: {
|
|
@@ -946,18 +946,18 @@ var TOOL_MODELS = {
|
|
|
946
946
|
};
|
|
947
947
|
var ALL_TOOL_NAMES = new Set(Object.keys(TOOL_MODELS));
|
|
948
948
|
var MEMORY_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
949
|
-
"
|
|
950
|
-
"
|
|
951
|
-
"
|
|
952
|
-
"
|
|
953
|
-
"
|
|
949
|
+
"band_list_memories",
|
|
950
|
+
"band_store_memory",
|
|
951
|
+
"band_get_memory",
|
|
952
|
+
"band_supersede_memory",
|
|
953
|
+
"band_archive_memory"
|
|
954
954
|
]);
|
|
955
955
|
var CONTACT_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
956
|
-
"
|
|
957
|
-
"
|
|
958
|
-
"
|
|
959
|
-
"
|
|
960
|
-
"
|
|
956
|
+
"band_list_contacts",
|
|
957
|
+
"band_add_contact",
|
|
958
|
+
"band_remove_contact",
|
|
959
|
+
"band_list_contact_requests",
|
|
960
|
+
"band_respond_contact_request"
|
|
961
961
|
]);
|
|
962
962
|
var BASE_TOOL_NAMES = new Set(
|
|
963
963
|
[...ALL_TOOL_NAMES].filter((name) => !MEMORY_TOOL_NAMES.has(name))
|
|
@@ -970,10 +970,10 @@ var CHAT_TOOL_NAMES = new Set(
|
|
|
970
970
|
var MEMORY_INTRO = `## Memory Tools
|
|
971
971
|
|
|
972
972
|
You have access to memory tools for storing and retrieving information
|
|
973
|
-
across conversations. Use \`
|
|
974
|
-
information and \`
|
|
975
|
-
Use \`
|
|
976
|
-
\`
|
|
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
977
|
function longTermPattern(label, type, segment, scope) {
|
|
978
978
|
return {
|
|
979
979
|
label,
|
|
@@ -998,7 +998,7 @@ var MEMORY_COMMON_PATTERNS = [
|
|
|
998
998
|
].join("\n");
|
|
999
999
|
var MEMORY_SCOPE_GUIDANCE = `Prefer \`scope="${MEMORY_STORE_SCOPE.subject}"\` whenever the memory is about a specific person or agent, so it
|
|
1000
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 \`
|
|
1001
|
+
real \`subject_id\` UUID, so resolve it first via \`band_lookup_peers\` or the participant list.
|
|
1002
1002
|
Reserve \`scope="${MEMORY_STORE_SCOPE.organization}"\` for knowledge that is genuinely shared across the whole organization and
|
|
1003
1003
|
is not about any one subject.`;
|
|
1004
1004
|
function quoteChoices(values) {
|
|
@@ -1008,11 +1008,11 @@ function memoryTypeLines() {
|
|
|
1008
1008
|
return Object.entries(MEMORY_SYSTEM_TYPES).map(([system, types]) => ` - ${system}: ${quoteChoices(types)}`).join("\n");
|
|
1009
1009
|
}
|
|
1010
1010
|
function buildMemorySection() {
|
|
1011
|
-
const storeMemoryProps = TOOL_MODELS.
|
|
1011
|
+
const storeMemoryProps = TOOL_MODELS.band_store_memory.properties;
|
|
1012
1012
|
const systems = storeMemoryProps.system.enum;
|
|
1013
1013
|
const segments = storeMemoryProps.segment.enum;
|
|
1014
1014
|
const scopes = storeMemoryProps.scope.enum;
|
|
1015
|
-
const fieldRules = `When calling \`
|
|
1015
|
+
const fieldRules = `When calling \`band_store_memory\`, the \`system\`, \`type\`, \`segment\`, and \`scope\` fields
|
|
1016
1016
|
must use these exact values (case-sensitive):
|
|
1017
1017
|
|
|
1018
1018
|
- **system**: ${quoteChoices(systems)}
|
package/dist/converters.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { b as ACPClientHistoryConverter, A as ACPClientSessionState, c as ACPServerHistoryConverter, a as ACPServerSessionState, G as GatewayHistoryConverter } from './acp-server-
|
|
2
|
-
import { H as HistoryConverter } from './protocols-
|
|
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
|
|
4
|
-
import './dtos-
|
|
5
|
-
import './types-
|
|
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";
|
package/dist/converters.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { b as ACPClientHistoryConverter, A as ACPClientSessionState, c as ACPServerHistoryConverter, a as ACPServerSessionState, G as GatewayHistoryConverter } from './acp-server-
|
|
2
|
-
import { H as HistoryConverter } from './protocols-
|
|
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-
|
|
4
|
-
import './dtos-
|
|
5
|
-
import './types-
|
|
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";
|
package/dist/converters.js
CHANGED
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
parseDate,
|
|
19
19
|
parseToolCall,
|
|
20
20
|
parseToolResult
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TLBCKDQO.js";
|
|
22
22
|
import "./chunk-AVVDPXP4.js";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-WLCM2OXG.js";
|
|
24
|
+
import "./chunk-RV76SKFT.js";
|
|
25
25
|
import "./chunk-ZZJRRBPQ.js";
|
|
26
26
|
import "./chunk-3BKAC4OZ.js";
|
|
27
27
|
import "./chunk-OD2G5LFQ.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-JY75VSQK.js";
|
|
29
29
|
|
|
30
30
|
// src/converters/vercel-ai-sdk.ts
|
|
31
31
|
function flushPendingToolCalls(messages, pendingToolCalls) {
|