agentbnb 7.0.0-beta.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{card-REW7BSWW.js → card-EX2EYGCZ.js} +1 -1
  2. package/dist/{chunk-PU7LXOQ3.js → chunk-3LWBH7P3.js} +72 -3
  3. package/dist/{chunk-2HSUPCBT.js → chunk-5AAFG2V2.js} +3 -3
  4. package/dist/{chunk-GO4FVRVN.js → chunk-5GME4KJZ.js} +5 -5
  5. package/dist/{chunk-VPQ44XKE.js → chunk-64AK4FJM.js} +2 -2
  6. package/dist/{chunk-K5FO42YF.js → chunk-7EF3HYVZ.js} +24 -1
  7. package/dist/{chunk-EAD4A4KG.js → chunk-ALX4WS3A.js} +2 -2
  8. package/dist/{chunk-ETGOKDFR.js → chunk-B2VJTKO5.js} +2 -2
  9. package/dist/{chunk-PGDBUUGR.js → chunk-C537SFHV.js} +5 -5
  10. package/dist/{chunk-F53QQIM2.js → chunk-CUONY5TO.js} +1 -1
  11. package/dist/{chunk-J2K5S5MX.js → chunk-D6RKW2XG.js} +67 -1
  12. package/dist/{chunk-APEG4QIN.js → chunk-E2OKP5CY.js} +4 -4
  13. package/dist/{chunk-FK2MDNTB.js → chunk-FTZTEHYG.js} +1 -1
  14. package/dist/{chunk-Y7T6IMM3.js → chunk-GKVTD4EZ.js} +1 -1
  15. package/dist/{chunk-VMH2YS2I.js → chunk-KF3TZHA5.js} +1 -1
  16. package/dist/{chunk-574W3HHE.js → chunk-LJM7FHPM.js} +1 -1
  17. package/dist/{chunk-KA2VIEGM.js → chunk-O2OYBAVR.js} +1 -1
  18. package/dist/{chunk-PSQHUZ7X.js → chunk-OH7BP5NP.js} +1 -1
  19. package/dist/{chunk-EHSHB7TY.js → chunk-SSK653A6.js} +67 -2
  20. package/dist/{chunk-BP3L2TET.js → chunk-TBJ3FZKZ.js} +2 -2
  21. package/dist/{chunk-3CIMVISQ.js → chunk-WVY2W7AA.js} +4 -0
  22. package/dist/{chunk-DUW6RX6I.js → chunk-X32NE6V4.js} +1 -1
  23. package/dist/{chunk-CWYPTQRQ.js → chunk-YHY7OG6S.js} +5 -5
  24. package/dist/{chunk-TW65F5EU.js → chunk-Z4MCGKTL.js} +6 -2
  25. package/dist/cli/index.js +44 -23
  26. package/dist/{client-HRYRJKSA.js → client-HKV3QWZ3.js} +3 -3
  27. package/dist/{conduct-JNYJCDHQ.js → conduct-W6XF6DJW.js} +13 -13
  28. package/dist/conduct-YB64OHI6.js +22 -0
  29. package/dist/{conductor-mode-2VVFMKVE.js → conductor-mode-2GSLHVN6.js} +3 -3
  30. package/dist/{conductor-mode-VGUU54QI.js → conductor-mode-AKREGDIU.js} +10 -10
  31. package/dist/{execute-MOXSSA3Q.js → execute-AYQWORVH.js} +6 -6
  32. package/dist/{execute-I4PKSNJM.js → execute-EPE6MZLT.js} +3 -3
  33. package/dist/index.d.ts +262 -10
  34. package/dist/index.js +438 -26
  35. package/dist/{process-guard-QCCBGILS.js → process-guard-GH5LRNWO.js} +1 -1
  36. package/dist/{publish-capability-TS6CNR5G.js → publish-capability-AH2HDW54.js} +3 -3
  37. package/dist/{request-E7TA7COA.js → request-HCCXSKAY.js} +12 -12
  38. package/dist/{serve-skill-HIOWYKRU.js → serve-skill-SZAQT5T5.js} +8 -8
  39. package/dist/{server-I63CXFX3.js → server-MHMAYXWZ.js} +11 -11
  40. package/dist/{service-coordinator-XBNT3SMU.js → service-coordinator-WGH6B2VT.js} +375 -48
  41. package/dist/skills/agentbnb/bootstrap.js +393 -58
  42. package/dist/{websocket-client-PFGVTXNE.js → websocket-client-4Z5P54RU.js} +1 -1
  43. package/dist/websocket-client-QOVARTRN.js +7 -0
  44. package/package.json +17 -11
  45. package/skills/agentbnb/bootstrap.test.ts +9 -0
  46. package/skills/agentbnb/bootstrap.ts +51 -26
  47. package/skills/agentbnb/install.sh +0 -0
  48. package/dist/conduct-KJUD2RTB.js +0 -22
  49. package/dist/websocket-client-5MH6QRJK.js +0 -7
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RelayClient
3
- } from "./chunk-PU7LXOQ3.js";
3
+ } from "./chunk-3LWBH7P3.js";
4
4
  export {
5
5
  RelayClient
6
6
  };
@@ -0,0 +1,7 @@
1
+ import {
2
+ RelayClient
3
+ } from "./chunk-Z4MCGKTL.js";
4
+ import "./chunk-SSK653A6.js";
5
+ export {
6
+ RelayClient
7
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "workspaces": [
4
4
  "packages/*"
5
5
  ],
6
- "version": "7.0.0-beta.1",
6
+ "version": "7.0.0",
7
7
  "description": "P2P Agent Capability Sharing Protocol — Airbnb for AI agent pipelines",
8
8
  "type": "module",
9
9
  "main": "dist/index.js",
@@ -32,6 +32,17 @@
32
32
  "import": "./dist/identity/index.js"
33
33
  }
34
34
  },
35
+ "scripts": {
36
+ "build": "tsup",
37
+ "build:hub": "cd hub && pnpm install && pnpm build",
38
+ "build:all": "pnpm build && pnpm build:hub",
39
+ "dev": "tsx watch src/cli/index.ts",
40
+ "test": "vitest",
41
+ "test:run": "vitest run",
42
+ "lint": "eslint src/",
43
+ "typecheck": "tsc --noEmit",
44
+ "prepublishOnly": "pnpm run build && pnpm run typecheck && pnpm run test:run"
45
+ },
35
46
  "keywords": [
36
47
  "ai",
37
48
  "agent",
@@ -81,14 +92,9 @@
81
92
  "engines": {
82
93
  "node": ">=20.0.0"
83
94
  },
84
- "scripts": {
85
- "build": "tsup",
86
- "build:hub": "cd hub && pnpm install && pnpm build",
87
- "build:all": "pnpm build && pnpm build:hub",
88
- "dev": "tsx watch src/cli/index.ts",
89
- "test": "vitest",
90
- "test:run": "vitest run",
91
- "lint": "eslint src/",
92
- "typecheck": "tsc --noEmit"
95
+ "pnpm": {
96
+ "onlyBuiltDependencies": [
97
+ "better-sqlite3"
98
+ ]
93
99
  }
94
- }
100
+ }
@@ -44,6 +44,15 @@ vi.mock('../../src/cli/config.js', () => ({
44
44
  getConfigDir: vi.fn(() => join(homedir(), '.agentbnb')),
45
45
  }));
46
46
 
47
+ vi.mock('../../src/registry/store.js', () => ({
48
+ openDatabase: vi.fn(() => ({
49
+ prepare: vi.fn(() => ({
50
+ get: vi.fn(() => ({ id: 'existing-card' })),
51
+ run: vi.fn(),
52
+ })),
53
+ })),
54
+ }));
55
+
47
56
  import { loadConfig } from '../../src/cli/config.js';
48
57
  import { activate, deactivate } from './bootstrap.js';
49
58
  import type { BootstrapContext } from './bootstrap.js';
@@ -9,38 +9,38 @@
9
9
  */
10
10
 
11
11
  import { join } from 'node:path';
12
- import { dirname, basename } from 'node:path';
13
12
  import { existsSync } from 'node:fs';
14
13
  import { homedir } from 'node:os';
15
14
  import { spawnSync } from 'node:child_process';
16
15
  import { randomUUID } from 'node:crypto';
17
16
 
18
17
  /**
19
- * Walks up from `startDir` looking for a SOUL.md file.
20
- * Returns the absolute path to the first SOUL.md found, or null.
18
+ * Derives a workspace-specific AGENTBNB_DIR using a priority chain:
19
+ *
20
+ * 1. AGENTBNB_DIR env var (already works for CLI — defensive check)
21
+ * 2. cwd is inside ~/.openclaw/agents/<name>/ → use <agent-dir>/.agentbnb/
22
+ * 3. Fallback to the global ~/.agentbnb/
23
+ *
24
+ * NOTE: The primary fix for the daemon cwd bug is in activate(), which reads
25
+ * OpenClaw's context.workspaceDir / context.agentDir before reaching this function.
26
+ * This function is defense-in-depth for cases where context is not available.
21
27
  */
22
- function findSoulMd(startDir: string): string | null {
23
- let dir = startDir;
24
- while (true) {
25
- const candidate = join(dir, 'SOUL.md');
26
- if (existsSync(candidate)) return candidate;
27
- const parent = dirname(dir);
28
- if (parent === dir) return null; // filesystem root
29
- dir = parent;
28
+ function resolveWorkspaceDir(): string {
29
+ // 1. AGENTBNB_DIR env var (set by CLI or parent process)
30
+ if (process.env['AGENTBNB_DIR']) {
31
+ return process.env['AGENTBNB_DIR'];
30
32
  }
31
- }
32
33
 
33
- /**
34
- * Derives a workspace-specific AGENTBNB_DIR from SOUL.md location.
35
- * Uses the name of the directory containing SOUL.md as the workspace identifier.
36
- * Falls back to the global ~/.agentbnb if SOUL.md is not found.
37
- */
38
- function resolveWorkspaceDir(): string {
39
- const soulPath = findSoulMd(process.cwd());
40
- if (soulPath) {
41
- const workspaceName = basename(dirname(soulPath));
42
- return join(homedir(), '.agentbnb', workspaceName);
34
+ // 2. Check if cwd is inside an OpenClaw agent directory — derive from agent name
35
+ const openclawAgentsDir = join(homedir(), '.openclaw', 'agents');
36
+ const cwd = process.cwd();
37
+ if (cwd.startsWith(openclawAgentsDir + '/')) {
38
+ const relative = cwd.slice(openclawAgentsDir.length + 1);
39
+ const agentName = relative.split('/')[0];
40
+ return join(openclawAgentsDir, agentName, '.agentbnb');
43
41
  }
42
+
43
+ // 3. Global fallback
44
44
  return join(homedir(), '.agentbnb');
45
45
  }
46
46
 
@@ -60,6 +60,21 @@ export interface BootstrapConfig {
60
60
  registryUrl?: string;
61
61
  /** Enable WebSocket relay. Defaults to true. */
62
62
  relay?: boolean;
63
+ /**
64
+ * Explicit agent config directory override.
65
+ * When set, used as AGENTBNB_DIR instead of auto-detection.
66
+ *
67
+ * Example: `~/.openclaw/agents/genesis-bot/.agentbnb`
68
+ */
69
+ agentDir?: string;
70
+ /**
71
+ * OpenClaw workspace directory passthrough.
72
+ * When OpenClaw calls activate(context), context.workspaceDir lands here.
73
+ * Derives AGENTBNB_DIR as `<workspaceDir>/.agentbnb`.
74
+ *
75
+ * Example: `~/.openclaw/agents/genesis-bot`
76
+ */
77
+ workspaceDir?: string;
63
78
  }
64
79
 
65
80
  /** Context returned by activate(). Pass to deactivate() for conditional teardown. */
@@ -165,10 +180,20 @@ function registerDecomposerCard(configDir: string, owner: string): void {
165
180
  * registered here to avoid double-handler conflicts. Track in Layer A implementation.
166
181
  */
167
182
  export async function activate(config: BootstrapConfig = {}): Promise<BootstrapContext> {
168
- // Per-workspace isolation: if AGENTBNB_DIR is not already set, derive it from
169
- // the SOUL.md location in the current working directory. This ensures each
170
- // OpenClaw workspace uses its own isolated ~/.agentbnb/<workspace-name>/ directory.
171
- if (!process.env['AGENTBNB_DIR']) {
183
+ // Per-workspace isolation: determine the correct config directory.
184
+ // Priority: config.agentDir > config.workspaceDir/.agentbnb > AGENTBNB_DIR env > resolveWorkspaceDir()
185
+ if (config.agentDir) {
186
+ process.env['AGENTBNB_DIR'] = config.agentDir;
187
+ process.stderr.write(
188
+ `[agentbnb] AGENTBNB_DIR set from config.agentDir: ${config.agentDir}\n`
189
+ );
190
+ } else if (config.workspaceDir) {
191
+ const derived = join(config.workspaceDir, '.agentbnb');
192
+ process.env['AGENTBNB_DIR'] = derived;
193
+ process.stderr.write(
194
+ `[agentbnb] AGENTBNB_DIR derived from config.workspaceDir: ${derived}\n`
195
+ );
196
+ } else if (!process.env['AGENTBNB_DIR']) {
172
197
  const workspaceDir = resolveWorkspaceDir();
173
198
  process.env['AGENTBNB_DIR'] = workspaceDir;
174
199
  process.stderr.write(
File without changes
@@ -1,22 +0,0 @@
1
- import {
2
- conductAction
3
- } from "./chunk-CWYPTQRQ.js";
4
- import "./chunk-TW65F5EU.js";
5
- import "./chunk-EHSHB7TY.js";
6
- import "./chunk-APEG4QIN.js";
7
- import "./chunk-3MJT4PZG.js";
8
- import "./chunk-GO4FVRVN.js";
9
- import "./chunk-VMH2YS2I.js";
10
- import "./chunk-Y7T6IMM3.js";
11
- import "./chunk-574W3HHE.js";
12
- import "./chunk-J2K5S5MX.js";
13
- import "./chunk-NWIQJ2CL.js";
14
- import "./chunk-VPQ44XKE.js";
15
- import "./chunk-F53QQIM2.js";
16
- import "./chunk-5AH3CMOX.js";
17
- import "./chunk-75OC6E4F.js";
18
- import "./chunk-KA2VIEGM.js";
19
- import "./chunk-3CIMVISQ.js";
20
- export {
21
- conductAction
22
- };
@@ -1,7 +0,0 @@
1
- import {
2
- RelayClient
3
- } from "./chunk-TW65F5EU.js";
4
- import "./chunk-EHSHB7TY.js";
5
- export {
6
- RelayClient
7
- };