agentbnb 8.3.0 → 8.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-74LZDEDT.js → chunk-BARHNIKG.js} +4 -3
- package/dist/{chunk-O4Q7BRG6.js → chunk-NHVHLUYS.js} +14 -3
- package/dist/cli/index.js +27 -16
- package/dist/{server-YV3XPTX5.js → server-6I7GU2OZ.js} +2 -2
- package/dist/{service-coordinator-RY5AKUZS.js → service-coordinator-LZJCAQSJ.js} +2 -2
- package/dist/skills/agentbnb/bootstrap.js +33 -24
- package/package.json +1 -1
- package/skills/agentbnb/bootstrap.ts +13 -14
|
@@ -328,10 +328,11 @@ async function verifyIdentity(request, reply, options) {
|
|
|
328
328
|
return false;
|
|
329
329
|
}
|
|
330
330
|
const claimedRequester = extractClaimedRequester(request);
|
|
331
|
-
if (claimedRequester) {
|
|
331
|
+
if (claimedRequester && knownAgent !== null) {
|
|
332
332
|
const matchesAgentId = claimedRequester === agentId;
|
|
333
|
-
const
|
|
334
|
-
|
|
333
|
+
const matchesDisplayName = knownAgent.display_name === claimedRequester;
|
|
334
|
+
const matchesLegacyOwner = knownAgent.legacy_owner === claimedRequester;
|
|
335
|
+
if (!matchesAgentId && !matchesDisplayName && !matchesLegacyOwner) {
|
|
335
336
|
await reply.code(401).send({ error: "Identity does not match requester" });
|
|
336
337
|
return false;
|
|
337
338
|
}
|
|
@@ -121,7 +121,7 @@ import { execFileSync } from "child_process";
|
|
|
121
121
|
import { existsSync, realpathSync } from "fs";
|
|
122
122
|
import { createRequire } from "module";
|
|
123
123
|
import { homedir } from "os";
|
|
124
|
-
import { basename, isAbsolute, join, resolve } from "path";
|
|
124
|
+
import { basename, dirname, isAbsolute, join, resolve } from "path";
|
|
125
125
|
function resolveSelfCli() {
|
|
126
126
|
const require2 = createRequire(import.meta.url);
|
|
127
127
|
return resolveSelfCliWithDeps({
|
|
@@ -130,6 +130,7 @@ function resolveSelfCli() {
|
|
|
130
130
|
platform: process.platform,
|
|
131
131
|
homeDir: homedir(),
|
|
132
132
|
envPath: process.env["PATH"],
|
|
133
|
+
nodeExecDir: dirname(process.execPath),
|
|
133
134
|
exists: existsSync,
|
|
134
135
|
realpath: realpathSync,
|
|
135
136
|
runWhich: (pathEnv) => execFileSync("which", ["agentbnb"], {
|
|
@@ -155,7 +156,7 @@ function resolveSelfCliWithDeps(deps) {
|
|
|
155
156
|
};
|
|
156
157
|
const argvPath = tryCandidate(deps.argv1, "process.argv[1]", true);
|
|
157
158
|
if (argvPath) return argvPath;
|
|
158
|
-
const fullPathEnv = buildFullPathEnv(deps.envPath, deps.homeDir);
|
|
159
|
+
const fullPathEnv = buildFullPathEnv(deps.envPath, deps.homeDir, deps.nodeExecDir);
|
|
159
160
|
tried.push(`which agentbnb PATH=${fullPathEnv}`);
|
|
160
161
|
try {
|
|
161
162
|
const whichPath = tryCandidate(deps.runWhich(fullPathEnv), "which agentbnb");
|
|
@@ -173,6 +174,13 @@ function resolveSelfCliWithDeps(deps) {
|
|
|
173
174
|
const resolvedPath = tryCandidate(candidate, "pnpm-global");
|
|
174
175
|
if (resolvedPath) return resolvedPath;
|
|
175
176
|
}
|
|
177
|
+
if (deps.nodeExecDir) {
|
|
178
|
+
const execDirCandidate = tryCandidate(
|
|
179
|
+
join(deps.nodeExecDir, "agentbnb"),
|
|
180
|
+
"node-execpath-dir"
|
|
181
|
+
);
|
|
182
|
+
if (execDirCandidate) return execDirCandidate;
|
|
183
|
+
}
|
|
176
184
|
try {
|
|
177
185
|
const requireResolved = deps.requireResolve("agentbnb/dist/cli/index.js");
|
|
178
186
|
const resolvedPath = tryCandidate(requireResolved, "require.resolve(agentbnb/dist/cli/index.js)");
|
|
@@ -187,7 +195,7 @@ ${tried.map((item) => `- ${item}`).join("\n")}`,
|
|
|
187
195
|
"CLI_ENTRY_NOT_FOUND"
|
|
188
196
|
);
|
|
189
197
|
}
|
|
190
|
-
function buildFullPathEnv(pathEnv, homeDir) {
|
|
198
|
+
function buildFullPathEnv(pathEnv, homeDir, nodeExecDir) {
|
|
191
199
|
const values = /* @__PURE__ */ new Set();
|
|
192
200
|
for (const item of (pathEnv ?? "").split(":")) {
|
|
193
201
|
if (item.trim()) values.add(item.trim());
|
|
@@ -205,6 +213,9 @@ function buildFullPathEnv(pathEnv, homeDir) {
|
|
|
205
213
|
]) {
|
|
206
214
|
values.add(extra);
|
|
207
215
|
}
|
|
216
|
+
if (nodeExecDir) {
|
|
217
|
+
values.add(nodeExecDir);
|
|
218
|
+
}
|
|
208
219
|
return [...values].join(":");
|
|
209
220
|
}
|
|
210
221
|
function safeRealpath(realpath, path) {
|
package/dist/cli/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
discoverLocalAgents,
|
|
8
8
|
getPricingStats,
|
|
9
9
|
resolveSelfCli
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-NHVHLUYS.js";
|
|
11
11
|
import {
|
|
12
12
|
createLedger,
|
|
13
13
|
ensureIdentity,
|
|
14
14
|
loadOrRepairIdentity
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-BARHNIKG.js";
|
|
16
16
|
import {
|
|
17
17
|
AutoRequestor,
|
|
18
18
|
BudgetManager,
|
|
@@ -839,27 +839,30 @@ function generateSkillsYaml(configDir) {
|
|
|
839
839
|
}
|
|
840
840
|
function registerMcpWithClaudeCode() {
|
|
841
841
|
const claudeDir = join3(homedir(), ".claude");
|
|
842
|
-
|
|
842
|
+
const claudeJsonPath = join3(homedir(), ".claude.json");
|
|
843
|
+
const legacySettingsPath = join3(claudeDir, "settings.json");
|
|
844
|
+
const useLegacy = !existsSync3(claudeJsonPath) && existsSync3(legacySettingsPath);
|
|
845
|
+
const targetPath = useLegacy ? legacySettingsPath : claudeJsonPath;
|
|
846
|
+
if (!existsSync3(claudeJsonPath) && !existsSync3(claudeDir)) {
|
|
843
847
|
return {
|
|
844
848
|
registered: false,
|
|
845
849
|
reason: "Claude Code not detected. Add MCP manually: claude mcp add agentbnb -- agentbnb mcp-server"
|
|
846
850
|
};
|
|
847
851
|
}
|
|
848
|
-
const settingsPath = join3(claudeDir, "settings.json");
|
|
849
852
|
let agentbnbCommand;
|
|
850
853
|
try {
|
|
851
854
|
agentbnbCommand = resolveSelfCli();
|
|
852
855
|
} catch (err) {
|
|
853
856
|
const reason = err instanceof Error ? err.message : String(err);
|
|
854
|
-
return { registered: false, path:
|
|
857
|
+
return { registered: false, path: targetPath, reason: `MCP registration skipped: ${reason}` };
|
|
855
858
|
}
|
|
856
859
|
let settings = {};
|
|
857
|
-
if (existsSync3(
|
|
860
|
+
if (existsSync3(targetPath)) {
|
|
858
861
|
try {
|
|
859
|
-
settings = JSON.parse(readFileSync3(
|
|
862
|
+
settings = JSON.parse(readFileSync3(targetPath, "utf-8"));
|
|
860
863
|
} catch {
|
|
861
864
|
try {
|
|
862
|
-
writeFileSync2(`${
|
|
865
|
+
writeFileSync2(`${targetPath}.bak`, readFileSync3(targetPath, "utf-8"), "utf-8");
|
|
863
866
|
} catch {
|
|
864
867
|
}
|
|
865
868
|
settings = {};
|
|
@@ -870,15 +873,17 @@ function registerMcpWithClaudeCode() {
|
|
|
870
873
|
const existingCommand = typeof existingEntry?.command === "string" ? existingEntry.command : void 0;
|
|
871
874
|
const existingArgs = Array.isArray(existingEntry?.args) ? existingEntry.args : void 0;
|
|
872
875
|
if (existingCommand === agentbnbCommand && existingArgs?.length === 1 && existingArgs[0] === "mcp-server") {
|
|
873
|
-
return { registered: false, path:
|
|
876
|
+
return { registered: false, path: targetPath, reason: "already registered" };
|
|
874
877
|
}
|
|
875
878
|
mcpServers.agentbnb = {
|
|
879
|
+
type: "stdio",
|
|
876
880
|
command: agentbnbCommand,
|
|
877
|
-
args: ["mcp-server"]
|
|
881
|
+
args: ["mcp-server"],
|
|
882
|
+
env: {}
|
|
878
883
|
};
|
|
879
884
|
settings.mcpServers = mcpServers;
|
|
880
|
-
writeFileSync2(
|
|
881
|
-
return { registered: true, path:
|
|
885
|
+
writeFileSync2(targetPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
886
|
+
return { registered: true, path: targetPath };
|
|
882
887
|
}
|
|
883
888
|
async function runQuickstart(opts) {
|
|
884
889
|
const jsonMode = opts.json ?? false;
|
|
@@ -920,7 +925,7 @@ Skills: ${skills.skillCount} skill(s) in ${skills.path}`);
|
|
|
920
925
|
if (!skipServe) {
|
|
921
926
|
try {
|
|
922
927
|
const { ProcessGuard } = await import("../process-guard-TNSUNHSR.js");
|
|
923
|
-
const { ServiceCoordinator } = await import("../service-coordinator-
|
|
928
|
+
const { ServiceCoordinator } = await import("../service-coordinator-LZJCAQSJ.js");
|
|
924
929
|
const guard = new ProcessGuard(join3(initResult.configDir, ".pid"));
|
|
925
930
|
const coordinator = new ServiceCoordinator(initResult.config, guard);
|
|
926
931
|
const result = await coordinator.ensureRunning({
|
|
@@ -982,7 +987,7 @@ Skills: ${skills.skillCount} skill(s) in ${skills.path}`);
|
|
|
982
987
|
}
|
|
983
988
|
|
|
984
989
|
// src/cli/index.ts
|
|
985
|
-
var VERSION = true ? "8.3.
|
|
990
|
+
var VERSION = true ? "8.3.2" : "0.0.0-dev";
|
|
986
991
|
function loadIdentityAuth2(owner) {
|
|
987
992
|
const configDir = getConfigDir();
|
|
988
993
|
let keys;
|
|
@@ -1717,6 +1722,12 @@ program.command("status").description("Show credit balance and recent transactio
|
|
|
1717
1722
|
balance = await statusLedger.getBalance(config.owner);
|
|
1718
1723
|
transactions = await statusLedger.getHistory(config.owner, 5);
|
|
1719
1724
|
heldEscrows = creditDb.prepare("SELECT id, amount, card_id, created_at FROM credit_escrow WHERE owner = ? AND status = ?").all(config.owner, "held");
|
|
1725
|
+
} catch (err) {
|
|
1726
|
+
balance = 0;
|
|
1727
|
+
transactions = [];
|
|
1728
|
+
heldEscrows = [];
|
|
1729
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1730
|
+
console.warn(`Note: could not fetch balance from registry (${msg}). Run \`agentbnb init\` if this is a new agent.`);
|
|
1720
1731
|
} finally {
|
|
1721
1732
|
creditDb.close();
|
|
1722
1733
|
}
|
|
@@ -1759,7 +1770,7 @@ program.command("serve").description("Start the AgentBnB gateway server").option
|
|
|
1759
1770
|
process.exit(1);
|
|
1760
1771
|
}
|
|
1761
1772
|
const { ProcessGuard } = await import("../process-guard-TNSUNHSR.js");
|
|
1762
|
-
const { ServiceCoordinator } = await import("../service-coordinator-
|
|
1773
|
+
const { ServiceCoordinator } = await import("../service-coordinator-LZJCAQSJ.js");
|
|
1763
1774
|
const port = opts.port ? parseInt(opts.port, 10) : config.gateway_port;
|
|
1764
1775
|
const registryPort = parseInt(opts.registryPort, 10);
|
|
1765
1776
|
if (!Number.isFinite(port) || !Number.isFinite(registryPort)) {
|
|
@@ -2245,7 +2256,7 @@ Feedback for skill: ${opts.skill} (${feedbacks.length} entries)
|
|
|
2245
2256
|
});
|
|
2246
2257
|
program.command("quickstart").alias("qs").description("One-command setup: init + skills.yaml + MCP registration + serve daemon").option("--owner <name>", "Agent owner name").option("--port <port>", "Gateway port", "7700").option("--no-serve", "Skip starting background daemon").option("--no-mcp", "Skip MCP registration with Claude Code").option("--json", "Output as JSON").action(runQuickstart);
|
|
2247
2258
|
program.command("mcp-server").description("Start an MCP (Model Context Protocol) server for IDE integration").action(async () => {
|
|
2248
|
-
const { startMcpServer } = await import("../server-
|
|
2259
|
+
const { startMcpServer } = await import("../server-6I7GU2OZ.js");
|
|
2249
2260
|
await startMcpServer();
|
|
2250
2261
|
});
|
|
2251
2262
|
await program.parseAsync(process.argv);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLedger,
|
|
3
3
|
ensureIdentity
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BARHNIKG.js";
|
|
5
5
|
import {
|
|
6
6
|
fetchRemoteCards,
|
|
7
7
|
getBalance,
|
|
@@ -248,7 +248,7 @@ function registerPublishTool(server, ctx) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// src/mcp/server.ts
|
|
251
|
-
var VERSION = true ? "8.3.
|
|
251
|
+
var VERSION = true ? "8.3.2" : "0.0.0-dev";
|
|
252
252
|
async function startMcpServer() {
|
|
253
253
|
const config = loadConfig();
|
|
254
254
|
if (!config) {
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
getPricingStats,
|
|
17
17
|
resolveSelfCli,
|
|
18
18
|
stopAnnouncement
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NHVHLUYS.js";
|
|
20
20
|
import {
|
|
21
21
|
createLedger,
|
|
22
22
|
deriveAgentId,
|
|
23
23
|
identityAuthPlugin
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BARHNIKG.js";
|
|
25
25
|
import {
|
|
26
26
|
DEFAULT_AUTONOMY_CONFIG,
|
|
27
27
|
getAutonomyTier,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
} from "../../chunk-I7KWA7OB.js";
|
|
91
91
|
|
|
92
92
|
// skills/agentbnb/bootstrap.ts
|
|
93
|
-
import { join as join7, basename as basename2, dirname as
|
|
93
|
+
import { join as join7, basename as basename2, dirname as dirname4 } from "path";
|
|
94
94
|
import { homedir as homedir4 } from "os";
|
|
95
95
|
import { exec } from "child_process";
|
|
96
96
|
import { promisify as promisify2 } from "util";
|
|
@@ -2042,10 +2042,11 @@ async function verifyIdentity(request, reply, options) {
|
|
|
2042
2042
|
return false;
|
|
2043
2043
|
}
|
|
2044
2044
|
const claimedRequester = extractClaimedRequester(request);
|
|
2045
|
-
if (claimedRequester) {
|
|
2045
|
+
if (claimedRequester && knownAgent !== null) {
|
|
2046
2046
|
const matchesAgentId = claimedRequester === agentId;
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2047
|
+
const matchesDisplayName = knownAgent.display_name === claimedRequester;
|
|
2048
|
+
const matchesLegacyOwner = knownAgent.legacy_owner === claimedRequester;
|
|
2049
|
+
if (!matchesAgentId && !matchesDisplayName && !matchesLegacyOwner) {
|
|
2049
2050
|
await reply.code(401).send({ error: "Identity does not match requester" });
|
|
2050
2051
|
return false;
|
|
2051
2052
|
}
|
|
@@ -6288,7 +6289,7 @@ import { execFileSync as execFileSync2 } from "child_process";
|
|
|
6288
6289
|
import { existsSync as existsSync5, realpathSync } from "fs";
|
|
6289
6290
|
import { createRequire } from "module";
|
|
6290
6291
|
import { homedir as homedir2 } from "os";
|
|
6291
|
-
import { basename, isAbsolute, join as join4, resolve } from "path";
|
|
6292
|
+
import { basename, dirname as dirname3, isAbsolute, join as join4, resolve } from "path";
|
|
6292
6293
|
function resolveSelfCli() {
|
|
6293
6294
|
const require2 = createRequire(import.meta.url);
|
|
6294
6295
|
return resolveSelfCliWithDeps({
|
|
@@ -6297,6 +6298,7 @@ function resolveSelfCli() {
|
|
|
6297
6298
|
platform: process.platform,
|
|
6298
6299
|
homeDir: homedir2(),
|
|
6299
6300
|
envPath: process.env["PATH"],
|
|
6301
|
+
nodeExecDir: dirname3(process.execPath),
|
|
6300
6302
|
exists: existsSync5,
|
|
6301
6303
|
realpath: realpathSync,
|
|
6302
6304
|
runWhich: (pathEnv) => execFileSync2("which", ["agentbnb"], {
|
|
@@ -6322,7 +6324,7 @@ function resolveSelfCliWithDeps(deps) {
|
|
|
6322
6324
|
};
|
|
6323
6325
|
const argvPath = tryCandidate(deps.argv1, "process.argv[1]", true);
|
|
6324
6326
|
if (argvPath) return argvPath;
|
|
6325
|
-
const fullPathEnv = buildFullPathEnv(deps.envPath, deps.homeDir);
|
|
6327
|
+
const fullPathEnv = buildFullPathEnv(deps.envPath, deps.homeDir, deps.nodeExecDir);
|
|
6326
6328
|
tried.push(`which agentbnb PATH=${fullPathEnv}`);
|
|
6327
6329
|
try {
|
|
6328
6330
|
const whichPath = tryCandidate(deps.runWhich(fullPathEnv), "which agentbnb");
|
|
@@ -6340,6 +6342,13 @@ function resolveSelfCliWithDeps(deps) {
|
|
|
6340
6342
|
const resolvedPath = tryCandidate(candidate, "pnpm-global");
|
|
6341
6343
|
if (resolvedPath) return resolvedPath;
|
|
6342
6344
|
}
|
|
6345
|
+
if (deps.nodeExecDir) {
|
|
6346
|
+
const execDirCandidate = tryCandidate(
|
|
6347
|
+
join4(deps.nodeExecDir, "agentbnb"),
|
|
6348
|
+
"node-execpath-dir"
|
|
6349
|
+
);
|
|
6350
|
+
if (execDirCandidate) return execDirCandidate;
|
|
6351
|
+
}
|
|
6343
6352
|
try {
|
|
6344
6353
|
const requireResolved = deps.requireResolve("agentbnb/dist/cli/index.js");
|
|
6345
6354
|
const resolvedPath = tryCandidate(requireResolved, "require.resolve(agentbnb/dist/cli/index.js)");
|
|
@@ -6354,7 +6363,7 @@ ${tried.map((item) => `- ${item}`).join("\n")}`,
|
|
|
6354
6363
|
"CLI_ENTRY_NOT_FOUND"
|
|
6355
6364
|
);
|
|
6356
6365
|
}
|
|
6357
|
-
function buildFullPathEnv(pathEnv, homeDir) {
|
|
6366
|
+
function buildFullPathEnv(pathEnv, homeDir, nodeExecDir) {
|
|
6358
6367
|
const values = /* @__PURE__ */ new Set();
|
|
6359
6368
|
for (const item of (pathEnv ?? "").split(":")) {
|
|
6360
6369
|
if (item.trim()) values.add(item.trim());
|
|
@@ -6372,6 +6381,9 @@ function buildFullPathEnv(pathEnv, homeDir) {
|
|
|
6372
6381
|
]) {
|
|
6373
6382
|
values.add(extra);
|
|
6374
6383
|
}
|
|
6384
|
+
if (nodeExecDir) {
|
|
6385
|
+
values.add(nodeExecDir);
|
|
6386
|
+
}
|
|
6375
6387
|
return [...values].join(":");
|
|
6376
6388
|
}
|
|
6377
6389
|
function safeRealpath(realpath, path) {
|
|
@@ -8140,7 +8152,7 @@ async function runCommand(cmd, env) {
|
|
|
8140
8152
|
return execAsync(cmd, { env });
|
|
8141
8153
|
}
|
|
8142
8154
|
function deriveAgentName(configDir) {
|
|
8143
|
-
const parent = basename2(
|
|
8155
|
+
const parent = basename2(dirname4(configDir));
|
|
8144
8156
|
if (parent && parent !== "." && parent !== ".agentbnb" && parent !== homedir4().split("/").pop()) {
|
|
8145
8157
|
return parent;
|
|
8146
8158
|
}
|
|
@@ -8187,31 +8199,26 @@ function quoteShellArg(input) {
|
|
|
8187
8199
|
return `'${input.replace(/'/g, `'\\''`)}'`;
|
|
8188
8200
|
}
|
|
8189
8201
|
async function activate(config = {}, _onboardDeps) {
|
|
8202
|
+
const debug = process.env["AGENTBNB_DEBUG"] === "1";
|
|
8190
8203
|
if (config.agentDir) {
|
|
8191
8204
|
process.env["AGENTBNB_DIR"] = config.agentDir;
|
|
8192
|
-
process.stderr.write(
|
|
8193
|
-
|
|
8194
|
-
`
|
|
8195
|
-
);
|
|
8205
|
+
if (debug) process.stderr.write(`[agentbnb] AGENTBNB_DIR set from config.agentDir: ${config.agentDir}
|
|
8206
|
+
`);
|
|
8196
8207
|
} else if (config.workspaceDir) {
|
|
8197
8208
|
const derived = join7(config.workspaceDir, ".agentbnb");
|
|
8198
8209
|
process.env["AGENTBNB_DIR"] = derived;
|
|
8199
|
-
process.stderr.write(
|
|
8200
|
-
|
|
8201
|
-
`
|
|
8202
|
-
);
|
|
8210
|
+
if (debug) process.stderr.write(`[agentbnb] AGENTBNB_DIR derived from config.workspaceDir: ${derived}
|
|
8211
|
+
`);
|
|
8203
8212
|
} else if (!process.env["AGENTBNB_DIR"]) {
|
|
8204
8213
|
const workspaceDir = resolveWorkspaceDir();
|
|
8205
8214
|
process.env["AGENTBNB_DIR"] = workspaceDir;
|
|
8206
|
-
process.stderr.write(
|
|
8207
|
-
|
|
8208
|
-
`
|
|
8209
|
-
);
|
|
8215
|
+
if (debug) process.stderr.write(`[agentbnb] AGENTBNB_DIR auto-configured to ${workspaceDir}
|
|
8216
|
+
`);
|
|
8210
8217
|
}
|
|
8211
8218
|
const configDir = getConfigDir();
|
|
8212
8219
|
if (process.env["AGENTBNB_DIR"] !== configDir) {
|
|
8213
8220
|
process.stderr.write(
|
|
8214
|
-
`[agentbnb]
|
|
8221
|
+
`[agentbnb] config dir mismatch: env=${process.env["AGENTBNB_DIR"]} resolved=${configDir}
|
|
8215
8222
|
`
|
|
8216
8223
|
);
|
|
8217
8224
|
}
|
|
@@ -8219,10 +8226,12 @@ async function activate(config = {}, _onboardDeps) {
|
|
|
8219
8226
|
if (!agentConfig) {
|
|
8220
8227
|
agentConfig = await autoOnboard(configDir, _onboardDeps);
|
|
8221
8228
|
}
|
|
8222
|
-
|
|
8223
|
-
|
|
8229
|
+
if (debug) {
|
|
8230
|
+
process.stderr.write(
|
|
8231
|
+
`[agentbnb] activate: owner=${agentConfig.owner} config=${configDir}/config.json
|
|
8224
8232
|
`
|
|
8225
|
-
|
|
8233
|
+
);
|
|
8234
|
+
}
|
|
8226
8235
|
const guard = new ProcessGuard(join7(configDir, ".pid"));
|
|
8227
8236
|
const coordinator = new ServiceCoordinator(agentConfig, guard);
|
|
8228
8237
|
const service = new AgentBnBService(coordinator, agentConfig);
|
package/package.json
CHANGED
|
@@ -294,32 +294,29 @@ function quoteShellArg(input: string): string {
|
|
|
294
294
|
* registered here to avoid double-handler conflicts. Track in Layer A implementation.
|
|
295
295
|
*/
|
|
296
296
|
export async function activate(config: BootstrapConfig = {}, _onboardDeps?: OnboardDeps): Promise<BootstrapContext> {
|
|
297
|
+
const debug = process.env['AGENTBNB_DEBUG'] === '1';
|
|
298
|
+
|
|
297
299
|
// Per-workspace isolation: determine the correct config directory.
|
|
298
300
|
// Priority: config.agentDir > config.workspaceDir/.agentbnb > AGENTBNB_DIR env > resolveWorkspaceDir()
|
|
299
301
|
if (config.agentDir) {
|
|
300
302
|
process.env['AGENTBNB_DIR'] = config.agentDir;
|
|
301
|
-
process.stderr.write(
|
|
302
|
-
`[agentbnb] AGENTBNB_DIR set from config.agentDir: ${config.agentDir}\n`
|
|
303
|
-
);
|
|
303
|
+
if (debug) process.stderr.write(`[agentbnb] AGENTBNB_DIR set from config.agentDir: ${config.agentDir}\n`);
|
|
304
304
|
} else if (config.workspaceDir) {
|
|
305
305
|
const derived = join(config.workspaceDir, '.agentbnb');
|
|
306
306
|
process.env['AGENTBNB_DIR'] = derived;
|
|
307
|
-
process.stderr.write(
|
|
308
|
-
`[agentbnb] AGENTBNB_DIR derived from config.workspaceDir: ${derived}\n`
|
|
309
|
-
);
|
|
307
|
+
if (debug) process.stderr.write(`[agentbnb] AGENTBNB_DIR derived from config.workspaceDir: ${derived}\n`);
|
|
310
308
|
} else if (!process.env['AGENTBNB_DIR']) {
|
|
311
309
|
const workspaceDir = resolveWorkspaceDir();
|
|
312
310
|
process.env['AGENTBNB_DIR'] = workspaceDir;
|
|
313
|
-
process.stderr.write(
|
|
314
|
-
`[agentbnb] AGENTBNB_DIR auto-configured to ${workspaceDir} for workspace isolation.\n`
|
|
315
|
-
);
|
|
311
|
+
if (debug) process.stderr.write(`[agentbnb] AGENTBNB_DIR auto-configured to ${workspaceDir}\n`);
|
|
316
312
|
}
|
|
317
313
|
|
|
318
314
|
const configDir = getConfigDir();
|
|
319
315
|
|
|
320
316
|
if (process.env['AGENTBNB_DIR'] !== configDir) {
|
|
317
|
+
// Unexpected: env was just set above, so this indicates a resolution conflict.
|
|
321
318
|
process.stderr.write(
|
|
322
|
-
`[agentbnb]
|
|
319
|
+
`[agentbnb] config dir mismatch: env=${process.env['AGENTBNB_DIR']} resolved=${configDir}\n`
|
|
323
320
|
);
|
|
324
321
|
}
|
|
325
322
|
|
|
@@ -329,10 +326,12 @@ export async function activate(config: BootstrapConfig = {}, _onboardDeps?: Onbo
|
|
|
329
326
|
agentConfig = await autoOnboard(configDir, _onboardDeps);
|
|
330
327
|
}
|
|
331
328
|
|
|
332
|
-
//
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
329
|
+
// Startup diagnostic — only emit when debug mode is on or first-time setup.
|
|
330
|
+
if (debug) {
|
|
331
|
+
process.stderr.write(
|
|
332
|
+
`[agentbnb] activate: owner=${agentConfig.owner} config=${configDir}/config.json\n`
|
|
333
|
+
);
|
|
334
|
+
}
|
|
336
335
|
|
|
337
336
|
// Use configDir for PID file — previously hardcoded to homedir()/.agentbnb which meant
|
|
338
337
|
// multiple agents on the same machine would fight over the same PID file.
|