@fosenai/cord 0.1.0-alpha.5 → 0.1.0-alpha.52
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 +51 -0
- package/bin/cord.js +44 -24
- package/package.json +11 -40
- package/scripts/install.js +11 -8
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @fosenai/cord
|
|
2
|
+
|
|
3
|
+
Cord Rust CLI — installed via npm, runs as a native binary.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @fosenai/cord
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
npm picks the right prebuilt binary for your OS/arch automatically
|
|
12
|
+
(`@fosenai/cord-darwin-arm64` / `-darwin-x64` / `-linux-x64` / `-linux-arm64`).
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cord # first run: interactive setup wizard
|
|
18
|
+
cord cmd "<what you want>" # natural-language → cord subcommand
|
|
19
|
+
# (router-only, no daemon needed)
|
|
20
|
+
cord status # is the daemon running?
|
|
21
|
+
cord install-skill claude # teach claude (or codex) to use cord during chat
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Common commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cord find "Chinese-to-English translation" # search the network for a cap
|
|
28
|
+
cord call --peer-id 12D3KooW... --capability translator \
|
|
29
|
+
--input '{"text":"hello"}' # invoke a remote cap
|
|
30
|
+
cord publish agent claude # expose your claude to friends
|
|
31
|
+
cord chat # interactive cap roster + chat
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Type `cord help` for the full verb list, or `cord cmd "<phrase>"` if you
|
|
35
|
+
forget the exact verb.
|
|
36
|
+
|
|
37
|
+
## Build from source
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/YapengTeng/blockchain-multi-agent.git
|
|
41
|
+
cd blockchain-multi-agent/rust
|
|
42
|
+
cargo install --path crates/cord-cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
With ONNX bge-m3 model support (for running your own embed-server):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cargo install --path crates/cord-embed-server --features embed-onnx
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
See https://github.com/YapengTeng/blockchain-multi-agent/tree/rust for details.
|
package/bin/cord.js
CHANGED
|
@@ -1,34 +1,54 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
2
|
+
// cord —— shim:找当前平台的 native binary 然后透传 argv
|
|
3
|
+
// optionalDependencies 装了 @fosenai/cord-<os>-<arch>,binary 在它的包里
|
|
4
|
+
|
|
3
5
|
const { spawnSync } = require('node:child_process')
|
|
6
|
+
const { existsSync } = require('node:fs')
|
|
4
7
|
const path = require('node:path')
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
'darwin
|
|
8
|
-
'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function platformPkg() {
|
|
10
|
+
const os = process.platform // 'darwin' | 'linux' | 'win32'
|
|
11
|
+
const arch = process.arch // 'arm64' | 'x64'
|
|
12
|
+
const map = {
|
|
13
|
+
'darwin-arm64': '@fosenai/cord-darwin-arm64',
|
|
14
|
+
'darwin-x64': '@fosenai/cord-darwin-x64',
|
|
15
|
+
'linux-x64': '@fosenai/cord-linux-x64',
|
|
16
|
+
'linux-arm64': '@fosenai/cord-linux-arm64',
|
|
17
|
+
'win32-x64': '@fosenai/cord-win32-x64',
|
|
18
|
+
}
|
|
19
|
+
const key = `${os}-${arch}`
|
|
20
|
+
return map[key]
|
|
12
21
|
}
|
|
13
22
|
|
|
14
|
-
|
|
15
|
-
const pkg =
|
|
16
|
-
if (!pkg) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
function findBinary() {
|
|
24
|
+
const pkg = platformPkg()
|
|
25
|
+
if (!pkg) {
|
|
26
|
+
console.error(`[cord] no prebuilt binary for ${process.platform}-${process.arch}`)
|
|
27
|
+
console.error(`[cord] supported: darwin-arm64 / darwin-x64 / linux-x64 / linux-arm64 / win32-x64`)
|
|
28
|
+
console.error(`[cord] build from source: cargo install --git https://github.com/your-org/cord cord-cli`)
|
|
29
|
+
process.exit(1)
|
|
30
|
+
}
|
|
31
|
+
let pkgRoot
|
|
32
|
+
try {
|
|
33
|
+
pkgRoot = path.dirname(require.resolve(`${pkg}/package.json`))
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.error(`[cord] platform package ${pkg} not installed`)
|
|
36
|
+
console.error(`[cord] try: npm install ${pkg}`)
|
|
37
|
+
process.exit(1)
|
|
38
|
+
}
|
|
39
|
+
const ext = process.platform === 'win32' ? '.exe' : ''
|
|
40
|
+
const bin = path.join(pkgRoot, `cord${ext}`)
|
|
41
|
+
if (!existsSync(bin)) {
|
|
42
|
+
console.error(`[cord] binary not found at ${bin}`)
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
return bin
|
|
20
46
|
}
|
|
21
47
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
binPath = path.join(root, `cord${ext}`)
|
|
27
|
-
} catch {
|
|
28
|
-
console.error(`cord: platform package ${pkg} not installed`)
|
|
29
|
-
console.error(`cord: try: npm install ${pkg}`)
|
|
48
|
+
const bin = findBinary()
|
|
49
|
+
const r = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' })
|
|
50
|
+
if (r.error) {
|
|
51
|
+
console.error(`[cord] failed to spawn: ${r.error.message}`)
|
|
30
52
|
process.exit(1)
|
|
31
53
|
}
|
|
32
|
-
|
|
33
|
-
const result = spawnSync(binPath, process.argv.slice(2), { stdio: 'inherit' })
|
|
34
|
-
process.exit(result.status ?? 1)
|
|
54
|
+
process.exit(r.status ?? 0)
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fosenai/cord",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "Cord
|
|
5
|
-
"license": "
|
|
3
|
+
"version": "0.1.0-alpha.52",
|
|
4
|
+
"description": "Cord Rust CLI — install via npm, runs as native binary",
|
|
5
|
+
"license": "BUSL-1.1",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cord": "bin/cord.js"
|
|
8
8
|
},
|
|
@@ -15,52 +15,23 @@
|
|
|
15
15
|
"postinstall": "node scripts/install.js"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@fosenai/cord-darwin-arm64": "0.1.0-alpha.
|
|
19
|
-
"@fosenai/cord-darwin-x64": "0.1.0-alpha.
|
|
20
|
-
"@fosenai/cord-
|
|
21
|
-
"@fosenai/cord-linux-
|
|
22
|
-
"@fosenai/cord-
|
|
18
|
+
"@fosenai/cord-darwin-arm64": "0.1.0-alpha.52",
|
|
19
|
+
"@fosenai/cord-darwin-x64": "0.1.0-alpha.52",
|
|
20
|
+
"@fosenai/cord-win32-x64": "0.1.0-alpha.52",
|
|
21
|
+
"@fosenai/cord-linux-x64": "0.1.0-alpha.52",
|
|
22
|
+
"@fosenai/cord-linux-arm64": "0.1.0-alpha.52"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://github.com/fosenai/cord",
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "https://github.com/fosenai/cord/issues"
|
|
29
|
+
"url": "git+https://github.com/your-org/cord.git"
|
|
34
30
|
},
|
|
35
31
|
"keywords": [
|
|
36
|
-
"
|
|
32
|
+
"p2p",
|
|
37
33
|
"agent",
|
|
38
|
-
"
|
|
39
|
-
"ai-agents",
|
|
40
|
-
"multi-agent",
|
|
41
|
-
"multi-agent-systems",
|
|
42
|
-
"multi-agent-collaboration",
|
|
43
|
-
"autonomous-agents",
|
|
44
|
-
"agent-network",
|
|
45
|
-
"agent-mesh",
|
|
46
|
-
"agent-discovery",
|
|
47
|
-
"agent-orchestration",
|
|
48
|
-
"decentralized",
|
|
49
|
-
"distributed",
|
|
50
|
-
"mcp",
|
|
51
|
-
"mcp-server",
|
|
52
|
-
"mcp-client",
|
|
53
|
-
"model-context-protocol",
|
|
54
|
-
"llm",
|
|
55
|
-
"llm-agent",
|
|
56
|
-
"llm-cli",
|
|
57
|
-
"claude",
|
|
58
|
-
"claude-code",
|
|
59
|
-
"codex",
|
|
60
|
-
"ollama",
|
|
61
|
-
"anthropic",
|
|
62
|
-
"openai",
|
|
63
|
-
"cli",
|
|
34
|
+
"libp2p",
|
|
64
35
|
"rust"
|
|
65
36
|
]
|
|
66
37
|
}
|
package/scripts/install.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
2
|
+
// 装完 @fosenai/cord 后跑这个脚本检查平台 binary 是否拿到。
|
|
3
|
+
// optionalDependencies 不会因为某个平台拉失败而 break 整个 install。
|
|
4
|
+
|
|
3
5
|
const { existsSync } = require('node:fs')
|
|
4
6
|
const path = require('node:path')
|
|
5
7
|
|
|
@@ -8,14 +10,15 @@ const map = {
|
|
|
8
10
|
'darwin-x64': '@fosenai/cord-darwin-x64',
|
|
9
11
|
'linux-x64': '@fosenai/cord-linux-x64',
|
|
10
12
|
'linux-arm64': '@fosenai/cord-linux-arm64',
|
|
11
|
-
'win32-x64': '@fosenai/cord-
|
|
13
|
+
'win32-x64': '@fosenai/cord-win32-x64',
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const key = `${process.platform}-${process.arch}`
|
|
15
17
|
const pkg = map[key]
|
|
16
18
|
if (!pkg) {
|
|
17
|
-
console.warn(`[cord] no prebuilt binary for ${key}
|
|
18
|
-
console.warn(`[cord]
|
|
19
|
+
console.warn(`[cord postinstall] no prebuilt binary for ${key}`)
|
|
20
|
+
console.warn(`[cord postinstall] you can build from source:`)
|
|
21
|
+
console.warn(`[cord postinstall] cargo install --git https://github.com/your-org/cord cord-cli`)
|
|
19
22
|
process.exit(0)
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -24,11 +27,11 @@ try {
|
|
|
24
27
|
const ext = process.platform === 'win32' ? '.exe' : ''
|
|
25
28
|
const bin = path.join(root, `cord${ext}`)
|
|
26
29
|
if (existsSync(bin)) {
|
|
27
|
-
console.log(`[cord] ok: ${pkg}`)
|
|
30
|
+
console.log(`[cord postinstall] ok: ${pkg} (${bin})`)
|
|
28
31
|
} else {
|
|
29
|
-
console.warn(`[cord] ${pkg} installed but binary missing at ${bin}`)
|
|
32
|
+
console.warn(`[cord postinstall] ${pkg} installed but binary missing at ${bin}`)
|
|
30
33
|
}
|
|
31
34
|
} catch {
|
|
32
|
-
console.warn(`[cord] platform package ${pkg} not installed
|
|
33
|
-
console.warn(`[cord] try: npm install ${pkg}`)
|
|
35
|
+
console.warn(`[cord postinstall] platform package ${pkg} not installed`)
|
|
36
|
+
console.warn(`[cord postinstall] try manually: npm install ${pkg}`)
|
|
34
37
|
}
|