agents-bridge 0.1.21 → 0.1.23

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.
@@ -52,76 +52,76 @@ function launchDetachedUpdateWorker(restartPlan) {
52
52
  child.unref();
53
53
  }
54
54
  function createDetachedUpdateWorkerScript() {
55
- return `
56
- const { spawn } = require('node:child_process')
57
- const parentPid = Number(process.argv[1])
58
- const nodeExec = process.argv[2]
59
- const entryPath = process.argv[3]
60
- const restartPlan = JSON.parse(process.argv[4])
61
- const childEnv = JSON.parse(process.argv[5])
62
- const packageName = 'agents-bridge'
63
- const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'
64
-
65
- function isParentRunning(pid) {
66
- try {
67
- process.kill(pid, 0)
68
- return true
69
- } catch {
70
- return false
71
- }
72
- }
73
-
74
- function wait(ms) {
75
- return new Promise(resolve => setTimeout(resolve, ms))
76
- }
77
-
78
- async function main() {
79
- const deadline = Date.now() + 120000
80
- while (isParentRunning(parentPid)) {
81
- if (Date.now() > deadline) {
82
- throw new Error('Timed out waiting for the old process to exit before update')
83
- }
84
- await wait(500)
85
- }
86
-
87
- const installChild = spawn(
88
- npmCommand,
89
- ['install', '-g', packageName + '@latest'],
90
- { stdio: 'inherit', windowsHide: false },
91
- )
92
-
93
- const installCode = await new Promise(resolve => {
94
- installChild.on('error', () => resolve(1))
95
- installChild.on('exit', code => resolve(code ?? 1))
96
- })
97
-
98
- if (installCode !== 0) {
99
- process.exit(Number(installCode) || 1)
100
- }
101
-
102
- if (!restartPlan) {
103
- return
104
- }
105
-
106
- const restartChild = spawn(
107
- nodeExec,
108
- [entryPath, ...restartPlan.argv],
109
- {
110
- detached: true,
111
- stdio: 'inherit',
112
- env: childEnv,
113
- cwd: restartPlan.cwd,
114
- windowsHide: false,
115
- },
116
- )
117
-
118
- restartChild.unref()
119
- }
120
-
121
- main().catch(error => {
122
- console.error('\\nSelf-update failed:', error instanceof Error ? error.message : String(error))
123
- process.exit(1)
124
- })
55
+ return `
56
+ const { spawn } = require('node:child_process')
57
+ const parentPid = Number(process.argv[1])
58
+ const nodeExec = process.argv[2]
59
+ const entryPath = process.argv[3]
60
+ const restartPlan = JSON.parse(process.argv[4])
61
+ const childEnv = JSON.parse(process.argv[5])
62
+ const packageName = 'agents-bridge'
63
+ const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'
64
+
65
+ function isParentRunning(pid) {
66
+ try {
67
+ process.kill(pid, 0)
68
+ return true
69
+ } catch {
70
+ return false
71
+ }
72
+ }
73
+
74
+ function wait(ms) {
75
+ return new Promise(resolve => setTimeout(resolve, ms))
76
+ }
77
+
78
+ async function main() {
79
+ const deadline = Date.now() + 120000
80
+ while (isParentRunning(parentPid)) {
81
+ if (Date.now() > deadline) {
82
+ throw new Error('Timed out waiting for the old process to exit before update')
83
+ }
84
+ await wait(500)
85
+ }
86
+
87
+ const installChild = spawn(
88
+ npmCommand,
89
+ ['install', '-g', packageName + '@latest'],
90
+ { stdio: 'inherit', windowsHide: false },
91
+ )
92
+
93
+ const installCode = await new Promise(resolve => {
94
+ installChild.on('error', () => resolve(1))
95
+ installChild.on('exit', code => resolve(code ?? 1))
96
+ })
97
+
98
+ if (installCode !== 0) {
99
+ process.exit(Number(installCode) || 1)
100
+ }
101
+
102
+ if (!restartPlan) {
103
+ return
104
+ }
105
+
106
+ const restartChild = spawn(
107
+ nodeExec,
108
+ [entryPath, ...restartPlan.argv],
109
+ {
110
+ detached: true,
111
+ stdio: 'inherit',
112
+ env: childEnv,
113
+ cwd: restartPlan.cwd,
114
+ windowsHide: false,
115
+ },
116
+ )
117
+
118
+ restartChild.unref()
119
+ }
120
+
121
+ main().catch(error => {
122
+ console.error('\\nSelf-update failed:', error instanceof Error ? error.message : String(error))
123
+ process.exit(1)
124
+ })
125
125
  `.trim();
126
126
  }
127
127
  //# sourceMappingURL=cmd-update.js.map
@@ -68,47 +68,47 @@ export function parseCliArgs(argv = process.argv.slice(2)) {
68
68
  };
69
69
  }
70
70
  export function printHelp() {
71
- console.log(`
72
- agents-bridge - Local Agent Gateway for botlink
73
-
74
- Usage:
75
- agents-bridge <command> [options]
76
-
77
- Commands:
78
- start Start the gateway (foreground by default)
79
- stop Stop a running daemon
80
- restart Restart the gateway
81
- status Show connection and runtime status
82
- onboard Interactive setup wizard
83
- add-agent Add an agent to the current config
84
- doctor Diagnose environment (network, CLI tools, API keys)
85
- logs View recent logs
86
- config Show current configuration
87
- update Update the installed CLI
88
- version Show package version
89
- help Show this help
90
-
91
- Options:
92
- -c, --config <path> Path to config.json
93
- -d, --daemon Run as background daemon (with 'start')
94
- -h, --help Show this help
95
- -v, --version Show package version
96
- --account-id <id> Bind add-agent to an existing botlink account
97
- --create-account <id> Create a new botlink account while adding an agent
98
- --account-gateway-url <url> Gateway URL for --create-account
99
- --account-bot-token <token> Bot token for --create-account
100
-
101
- Examples:
102
- agents-bridge start # Start in foreground
103
- agents-bridge start --daemon # Start as daemon
104
- agents-bridge start -c ./my-config.json # Start with custom config
105
- agents-bridge restart --daemon # Restart in daemon mode
106
- agents-bridge onboard # Interactive setup
107
- agents-bridge add-agent # Add a named agent
108
- agents-bridge update # Update the installed CLI
109
- agents-bridge add-agent --account-id office-bot
110
- agents-bridge add-agent --create-account office-bot --account-gateway-url https://botlink.example.com --account-bot-token bot_xxx
111
- agents-bridge doctor # Check environment
71
+ console.log(`
72
+ agents-bridge - Local Agent Gateway for botlink
73
+
74
+ Usage:
75
+ agents-bridge <command> [options]
76
+
77
+ Commands:
78
+ start Start the gateway (foreground by default)
79
+ stop Stop a running daemon
80
+ restart Restart the gateway
81
+ status Show connection and runtime status
82
+ onboard Interactive setup wizard
83
+ add-agent Add an agent to the current config
84
+ doctor Diagnose environment (network, CLI tools, API keys)
85
+ logs View recent logs
86
+ config Show current configuration
87
+ update Update the installed CLI
88
+ version Show package version
89
+ help Show this help
90
+
91
+ Options:
92
+ -c, --config <path> Path to config.json
93
+ -d, --daemon Run as background daemon (with 'start')
94
+ -h, --help Show this help
95
+ -v, --version Show package version
96
+ --account-id <id> Bind add-agent to an existing botlink account
97
+ --create-account <id> Create a new botlink account while adding an agent
98
+ --account-gateway-url <url> Gateway URL for --create-account
99
+ --account-bot-token <token> Bot token for --create-account
100
+
101
+ Examples:
102
+ agents-bridge start # Start in foreground
103
+ agents-bridge start --daemon # Start as daemon
104
+ agents-bridge start -c ./my-config.json # Start with custom config
105
+ agents-bridge restart --daemon # Restart in daemon mode
106
+ agents-bridge onboard # Interactive setup
107
+ agents-bridge add-agent # Add a named agent
108
+ agents-bridge update # Update the installed CLI
109
+ agents-bridge add-agent --account-id office-bot
110
+ agents-bridge add-agent --create-account office-bot --account-gateway-url https://botlink.example.com --account-bot-token bot_xxx
111
+ agents-bridge doctor # Check environment
112
112
  `.trim());
113
113
  }
114
114
  //# sourceMappingURL=run-main.js.map
@@ -9,7 +9,7 @@ export function mergeWithEnv(raw, env) {
9
9
  const channels = (merged.channels ?? {});
10
10
  const botlink = (channels.botlink ?? {});
11
11
  const botlinkAccounts = botlink.accounts;
12
- if (botlinkAccounts && Object.keys(botlinkAccounts).length > 0) {
12
+ if (botlinkAccounts) {
13
13
  const defaultAccount = (botlinkAccounts.default ?? {});
14
14
  if (env.gatewayUrl)
15
15
  defaultAccount.gateway_url = env.gatewayUrl;
@@ -1 +1 @@
1
- {"version":3,"file":"merge-config.js","sourceRoot":"","sources":["../../src/config/merge-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAA4B,EAAE,GAAiB;IAC1E,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;IAEnC,6BAA6B;IAC7B,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAA4B,CAAA;QACnE,MAAM,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,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B,CAAC;IAED,yBAAyB;IACzB,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAA4B,CAAA;QACjE,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC5B,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,CAAC;IAED,0BAA0B;IAC1B,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAA4B,CAAA;QAC7D,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAA;QAC5B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;IACtB,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json CHANGED
@@ -1,69 +1,69 @@
1
- {
2
- "name": "agents-bridge",
3
- "version": "0.1.21",
4
- "description": "Local Agent Gateway for botlink platform",
5
- "homepage": "http://git.51baiwang.com/sk-spec-driven/agent-bridge",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+http://git.51baiwang.com/sk-spec-driven/agent-bridge.git"
9
- },
10
- "bugs": {
11
- "url": "http://git.51baiwang.com/sk-spec-driven/agent-bridge/issues"
12
- },
13
- "keywords": [
14
- "agent",
15
- "bridge",
16
- "gateway",
17
- "cli",
18
- "botlink",
19
- "codex",
20
- "claude"
21
- ],
22
- "type": "module",
23
- "license": "MIT",
24
- "main": "dist/entry.js",
25
- "bin": {
26
- "agents-bridge": "bin/agent-bridge.mjs"
27
- },
28
- "files": [
29
- "dist",
30
- "!dist/**/*.test.js",
31
- "!dist/**/*.test.js.map",
32
- "!dist/**/*.test.d.ts",
33
- "!dist/**/*.test.d.ts.map",
34
- "bin",
35
- "config.example.json",
36
- "config.multi-agent.example.json",
37
- ".env.example"
38
- ],
39
- "scripts": {
40
- "build": "node ./scripts/build.mjs",
41
- "dev": "tsx watch src/entry.ts",
42
- "start": "node dist/entry.js start",
43
- "typecheck": "tsc --noEmit",
44
- "prepack": "node ./scripts/build.mjs && tsc --noEmit",
45
- "prepublishOnly": "npm run prepack"
46
- },
47
- "workspaces": [
48
- "packages/*",
49
- "extensions/*"
50
- ],
51
- "dependencies": {
52
- "pino": "^9.0.0",
53
- "pino-pretty": "^11.0.0",
54
- "zod": "^3.24.0"
55
- },
56
- "devDependencies": {
57
- "@types/node": "^22.0.0",
58
- "tsx": "^4.21.0",
59
- "typescript": "^5.9.3"
60
- },
61
- "engines": {
62
- "node": ">=22.0.0",
63
- "pnpm": ">=9.0.0"
64
- },
65
- "publishConfig": {
66
- "registry": "https://registry.npmjs.org/"
67
- },
68
- "packageManager": "pnpm@10.32.1"
69
- }
1
+ {
2
+ "name": "agents-bridge",
3
+ "version": "0.1.23",
4
+ "description": "Local Agent Gateway for botlink platform",
5
+ "homepage": "http://git.51baiwang.com/sk-spec-driven/agent-bridge",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+http://git.51baiwang.com/sk-spec-driven/agent-bridge.git"
9
+ },
10
+ "bugs": {
11
+ "url": "http://git.51baiwang.com/sk-spec-driven/agent-bridge/issues"
12
+ },
13
+ "keywords": [
14
+ "agent",
15
+ "bridge",
16
+ "gateway",
17
+ "cli",
18
+ "botlink",
19
+ "codex",
20
+ "claude"
21
+ ],
22
+ "type": "module",
23
+ "license": "MIT",
24
+ "main": "dist/entry.js",
25
+ "bin": {
26
+ "agents-bridge": "bin/agent-bridge.mjs"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "!dist/**/*.test.js",
31
+ "!dist/**/*.test.js.map",
32
+ "!dist/**/*.test.d.ts",
33
+ "!dist/**/*.test.d.ts.map",
34
+ "bin",
35
+ "config.example.json",
36
+ "config.multi-agent.example.json",
37
+ ".env.example"
38
+ ],
39
+ "scripts": {
40
+ "build": "node ./scripts/build.mjs",
41
+ "dev": "tsx watch src/entry.ts",
42
+ "start": "node dist/entry.js start",
43
+ "typecheck": "tsc --noEmit",
44
+ "prepack": "node ./scripts/build.mjs && tsc --noEmit",
45
+ "prepublishOnly": "npm run prepack"
46
+ },
47
+ "workspaces": [
48
+ "packages/*",
49
+ "extensions/*"
50
+ ],
51
+ "dependencies": {
52
+ "pino": "^9.0.0",
53
+ "pino-pretty": "^11.0.0",
54
+ "zod": "^3.24.0"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^22.0.0",
58
+ "tsx": "^4.21.0",
59
+ "typescript": "^5.9.3"
60
+ },
61
+ "engines": {
62
+ "node": ">=22.0.0",
63
+ "pnpm": ">=9.0.0"
64
+ },
65
+ "publishConfig": {
66
+ "registry": "https://registry.npmjs.org/"
67
+ },
68
+ "packageManager": "pnpm@10.32.1"
69
+ }