@borgee/agents-host 0.1.4 → 0.1.5

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Minimal local runtime host: connects a local **Claude Code CLI** (`claude`) or
4
4
  **GitHub Copilot CLI** (`copilot`) process to a single Borgee agent over
5
- [`@borgee/plugin-sdk`](../../sdk/plugin-ts) — the same BPP (`/ws/plugin`)
5
+ [`@borgee/plugin-sdk`](../sdk/plugin-ts) — the same BPP (`/ws/plugin`)
6
6
  protocol the official OpenClaw plugin uses.
7
7
 
8
8
  ## What this is (and isn't)
@@ -19,8 +19,8 @@ Borgee channel message
19
19
  → Borgee channel
20
20
  ```
21
21
 
22
- **In scope:** one agent per process, mention-only gating (with a DM bypass),
23
- per-channel conversation memory via each CLI's own native session resume
22
+ **In scope:** one agent per process, per-channel conversation memory via each
23
+ CLI's own native session resume
24
24
  (Claude `--resume`, Copilot `--session-id`), and dispatching to a local CLI
25
25
  provider.
26
26
 
@@ -51,11 +51,10 @@ pnpm --filter @borgee/agents-host dev
51
51
  | --- | --- | --- | --- |
52
52
  | `BORGEE_BASE_URL` | yes | — | Borgee server base URL (e.g. `https://borgee.example.com`) |
53
53
  | `BORGEE_AGENT_API_KEY` | yes | — | The agent's API key, revealed from the web UI |
54
- | `BORGEE_AGENT_NAME` | no | `Assistant` | Display name used for mention matching and prompts |
54
+ | `BORGEE_AGENT_NAME` | no | `Assistant` | Display name used in prompts |
55
55
  | `RUNTIME_PROVIDER` | no | `claude` | `claude` or `copilot` |
56
56
  | `CLAUDE_COMMAND` / `CLAUDE_ARGS` | no | `claude` / `--print` | Local Claude CLI command + args |
57
57
  | `COPILOT_COMMAND` / `COPILOT_ARGS` | no | `copilot` / `-s --no-color --allow-all-tools --output-format text` | Local Copilot CLI command + args |
58
- | `RESPOND_ON_MENTION_ONLY` | no | `true` | If `true`, only replies in non-DM channels when @mentioned; DMs always get a reply |
59
58
 
60
59
  ## Conversation memory
61
60
 
@@ -14,6 +14,10 @@ import type { AgentsHostConfig } from './types.js';
14
14
  * node provisioning, multi-agent discovery, systemd install, and scheduled
15
15
  * (periodic) prompts. Running several agents means running several
16
16
  * processes, each with its own `BORGEE_AGENT_API_KEY`.
17
+ *
18
+ * Message gating (mention-only / DM rules) is NOT done here: the server
19
+ * enforces per-agent + per-channel `require_mention` at BPP fan-out, so this
20
+ * host simply replies to every message it is handed (minus its own).
17
21
  */
18
22
  export declare class AgentsHost {
19
23
  private readonly config;
@@ -28,20 +32,4 @@ export declare class AgentsHost {
28
32
  start(): Promise<void>;
29
33
  stop(): Promise<void>;
30
34
  private handleMessage;
31
- /**
32
- * Whether `msg` mentions this agent: either via the SDK's structured
33
- * mention event kind, or a plain-text substring match on the configured
34
- * agent name.
35
- */
36
- isLikelyMention(message: {
37
- type?: string;
38
- mentions?: string[];
39
- }, content: string): boolean;
40
- /**
41
- * Channel-type check, based solely on the `channel_type` hint the SDK
42
- * derives from the inbound BPP event. There is no REST fallback here (that
43
- * would require the excluded control-plane SDK) — an absent hint is
44
- * treated as "not a DM".
45
- */
46
- private isDirectMessage;
47
35
  }
@@ -13,6 +13,10 @@ import { createProvider } from './providers/create-provider.js';
13
13
  * node provisioning, multi-agent discovery, systemd install, and scheduled
14
14
  * (periodic) prompts. Running several agents means running several
15
15
  * processes, each with its own `BORGEE_AGENT_API_KEY`.
16
+ *
17
+ * Message gating (mention-only / DM rules) is NOT done here: the server
18
+ * enforces per-agent + per-channel `require_mention` at BPP fan-out, so this
19
+ * host simply replies to every message it is handed (minus its own).
16
20
  */
17
21
  export class AgentsHost {
18
22
  config;
@@ -70,11 +74,10 @@ export class AgentsHost {
70
74
  const content = String(msg.content ?? msg.body ?? '').trim();
71
75
  if (!content)
72
76
  return;
73
- const isDm = this.isDirectMessage(msg.channel_type);
74
- if (this.config.agent.respondOnMentionOnly && !isDm) {
75
- if (!this.isLikelyMention(msg, content))
76
- return;
77
- }
77
+ // No client-side mention/DM gating here: the server already decides which
78
+ // messages an agent receives (per-agent + per-channel require_mention is
79
+ // enforced at BPP fan-out via AgentReceivesChannelMessage). If a channel
80
+ // message reaches this host at all, the agent is meant to handle it.
78
81
  try {
79
82
  const reply = await this.provider.generateReply({
80
83
  agentName: this.config.agent.agentName,
@@ -93,30 +96,4 @@ export class AgentsHost {
93
96
  });
94
97
  }
95
98
  }
96
- /**
97
- * Whether `msg` mentions this agent: either via the SDK's structured
98
- * mention event kind, or a plain-text substring match on the configured
99
- * agent name.
100
- */
101
- isLikelyMention(message, content) {
102
- if (message.type === 'mention') {
103
- return true;
104
- }
105
- if (Array.isArray(message.mentions) && this.selfAgentId) {
106
- if (message.mentions.some((mention) => mention === this.selfAgentId)) {
107
- return true;
108
- }
109
- }
110
- return this.config.agent.agentName.trim().length > 0
111
- && content.toLowerCase().includes(this.config.agent.agentName.toLowerCase());
112
- }
113
- /**
114
- * Channel-type check, based solely on the `channel_type` hint the SDK
115
- * derives from the inbound BPP event. There is no REST fallback here (that
116
- * would require the excluded control-plane SDK) — an absent hint is
117
- * treated as "not a DM".
118
- */
119
- isDirectMessage(hintedType) {
120
- return hintedType === 'dm';
121
- }
122
99
  }
@@ -65,7 +65,6 @@ export function mapInboundToChannelMessage(event) {
65
65
  sender_id: event.message?.authorId ?? event.reaction?.userId,
66
66
  content: event.message?.body,
67
67
  body: event.message?.body,
68
- mentions: event.message?.mentions,
69
68
  content_type: event.message?.contentType,
70
69
  created_at: event.createdAt,
71
70
  };
@@ -19,4 +19,4 @@ export declare class CliUsageError extends Error {
19
19
  * process, so callers (and tests) can decide how to report it.
20
20
  */
21
21
  export declare function parseStartArgs(argv: string[]): ParsedStartArgs;
22
- export declare const USAGE = "Usage: agents-host start <serverUrl> <apiKey> [options]\n\nOptions:\n --name <name> Display name (default: Assistant)\n --provider <claude|copilot> Runtime provider (default: claude)\n --claude-command <cmd> Local Claude CLI command (default: claude)\n --claude-args <args> Local Claude CLI args (default: --print)\n --copilot-command <cmd> Local Copilot CLI command (default: copilot)\n --copilot-args <args> Local Copilot CLI args\n --mention-only <true|false> Reply only when @mentioned outside DMs (default: true)\n\nExample:\n agents-host start https://borgee.example.com bgr_xxxxxxxx --provider copilot\n";
22
+ export declare const USAGE = "Usage: agents-host start <serverUrl> <apiKey> [options]\n\nOptions:\n --name <name> Display name (default: Assistant)\n --provider <claude|copilot> Runtime provider (default: claude)\n --claude-command <cmd> Local Claude CLI command (default: claude)\n --claude-args <args> Local Claude CLI args (default: --print)\n --copilot-command <cmd> Local Copilot CLI command (default: copilot)\n --copilot-args <args> Local Copilot CLI args\n\nExample:\n agents-host start https://borgee.example.com bgr_xxxxxxxx --provider copilot\n";
package/dist/cli-args.js CHANGED
@@ -11,7 +11,6 @@ export const CLI_FLAG_TO_ENV = {
11
11
  'claude-args': 'CLAUDE_ARGS',
12
12
  'copilot-command': 'COPILOT_COMMAND',
13
13
  'copilot-args': 'COPILOT_ARGS',
14
- 'mention-only': 'RESPOND_ON_MENTION_ONLY',
15
14
  };
16
15
  export class CliUsageError extends Error {
17
16
  }
@@ -59,9 +58,8 @@ Options:
59
58
  --provider <claude|copilot> Runtime provider (default: claude)
60
59
  --claude-command <cmd> Local Claude CLI command (default: claude)
61
60
  --claude-args <args> Local Claude CLI args (default: --print)
62
- --copilot-command <cmd> Local Copilot CLI command (default: copilot)
63
- --copilot-args <args> Local Copilot CLI args
64
- --mention-only <true|false> Reply only when @mentioned outside DMs (default: true)
61
+ --copilot-command <cmd> Local Copilot CLI command (default: copilot)
62
+ --copilot-args <args> Local Copilot CLI args
65
63
 
66
64
  Example:
67
65
  agents-host start https://borgee.example.com bgr_xxxxxxxx --provider copilot
package/dist/cli.js CHANGED
File without changes
package/dist/config.js CHANGED
@@ -9,12 +9,6 @@ function envOr(name, fallback) {
9
9
  const value = process.env[name];
10
10
  return value && value.trim().length > 0 ? value.trim() : fallback;
11
11
  }
12
- function envBoolOr(name, fallback) {
13
- const value = process.env[name];
14
- if (value === undefined || value.trim().length === 0)
15
- return fallback;
16
- return ['1', 'true', 'yes', 'on'].includes(value.trim().toLowerCase());
17
- }
18
12
  function parseArgs(value) {
19
13
  return value.trim().length > 0 ? value.trim().split(/\s+/) : [];
20
14
  }
@@ -39,7 +33,6 @@ export function loadConfigFromEnv() {
39
33
  agent: {
40
34
  agentApiKey: requireEnv('BORGEE_AGENT_API_KEY'),
41
35
  agentName: envOr('BORGEE_AGENT_NAME', 'Assistant'),
42
- respondOnMentionOnly: envBoolOr('RESPOND_ON_MENTION_ONLY', true),
43
36
  provider: resolveProvider(),
44
37
  },
45
38
  };
package/dist/types.d.ts CHANGED
@@ -16,7 +16,6 @@ export interface ProviderRuntimeConfig extends ProviderCommandConfig {
16
16
  export interface HostedAgentConfig {
17
17
  agentApiKey: string;
18
18
  agentName: string;
19
- respondOnMentionOnly: boolean;
20
19
  provider: ProviderKind;
21
20
  }
22
21
  export interface AgentsHostConfig extends ProviderCommandConfig {
@@ -34,7 +33,6 @@ export interface ChannelMessageEvent {
34
33
  body?: string;
35
34
  content_type?: string;
36
35
  created_at?: number;
37
- mentions?: string[];
38
36
  [key: string]: unknown;
39
37
  }
40
38
  export interface MeResponseUser {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@borgee/agents-host",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,11 +17,31 @@
17
17
  "repository": {
18
18
  "type": "git",
19
19
  "url": "https://github.com/codetreker/borgee.git",
20
- "directory": "packages/runtimes/agents-host"
20
+ "directory": "packages/agents-host"
21
21
  },
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@borgee/plugin-sdk": "0.1.1",
25
- "cross-spawn": "^7.0.6"
24
+ "cross-spawn": "^7.0.6",
25
+ "@borgee/plugin-sdk": "0.1.1"
26
+ },
27
+ "devDependencies": {
28
+ "@types/cross-spawn": "^6.0.6",
29
+ "@types/node": "^24.3.0",
30
+ "tsx": "^4.20.5",
31
+ "typescript": "^5.9.3",
32
+ "vitest": "^4.1.5"
33
+ },
34
+ "scripts": {
35
+ "predev": "pnpm --filter @borgee/plugin-sdk build",
36
+ "dev": "tsx src/index.ts",
37
+ "precli": "pnpm --filter @borgee/plugin-sdk build",
38
+ "cli": "tsx src/cli.ts",
39
+ "prestart": "pnpm --filter @borgee/plugin-sdk build",
40
+ "start": "node dist/index.js",
41
+ "prebuild": "pnpm --filter @borgee/plugin-sdk build",
42
+ "build": "tsc",
43
+ "typecheck": "tsc --noEmit",
44
+ "pretest": "pnpm --filter @borgee/plugin-sdk build",
45
+ "test": "vitest run"
26
46
  }
27
- }
47
+ }