opencode-router 0.11.88 → 0.11.91
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/.env.example +3 -2
- package/README.md +16 -6
- package/dist/bridge.js +2 -1
- package/dist/cli.js +1 -1
- package/install.sh +12 -4
- package/package.json +1 -1
package/.env.example
CHANGED
|
@@ -13,9 +13,10 @@ SLACK_ENABLED=true
|
|
|
13
13
|
OPENCODE_ROUTER_DATA_DIR=~/.openwork/opencode-router
|
|
14
14
|
OPENCODE_ROUTER_DB_PATH=~/.openwork/opencode-router/opencode-router.db
|
|
15
15
|
OPENCODE_ROUTER_CONFIG_PATH=~/.openwork/opencode-router/opencode-router.json
|
|
16
|
-
#
|
|
17
|
-
OPENCODE_ROUTER_HEALTH_PORT=
|
|
16
|
+
# Preferred health server port override
|
|
18
17
|
OPENCODE_ROUTER_HEALTH_PORT=3005
|
|
18
|
+
# Alias for OPENCODE_ROUTER_HEALTH_PORT (optional)
|
|
19
|
+
PORT=
|
|
19
20
|
TOOL_UPDATES_ENABLED=false
|
|
20
21
|
GROUPS_ENABLED=false
|
|
21
22
|
TOOL_OUTPUT_LIMIT=1200
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Simple Slack + Telegram bridge + directory router for a running `opencode` server.
|
|
4
4
|
|
|
5
|
+
Runtime requirement: Bun 1.3+ (`bun --version`).
|
|
6
|
+
|
|
5
7
|
## Install + Run
|
|
6
8
|
|
|
7
9
|
One-command install (recommended):
|
|
@@ -10,19 +12,19 @@ One-command install (recommended):
|
|
|
10
12
|
curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/packages/opencode-router/install.sh | bash
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Install from npm:
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
18
|
npm install -g opencode-router
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
Quick run without install:
|
|
21
|
+
Quick run without global install:
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
|
-
npx opencode-router
|
|
24
|
+
npx --yes opencode-router --help
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
Then
|
|
27
|
+
Then configure identities and start.
|
|
26
28
|
|
|
27
29
|
1) One-command setup (installs deps, builds, creates `.env` if missing):
|
|
28
30
|
|
|
@@ -43,7 +45,7 @@ Recommended:
|
|
|
43
45
|
3) Run the router:
|
|
44
46
|
|
|
45
47
|
```bash
|
|
46
|
-
opencode-router
|
|
48
|
+
opencode-router start
|
|
47
49
|
```
|
|
48
50
|
|
|
49
51
|
## Telegram
|
|
@@ -136,9 +138,17 @@ opencode-router bindings set --channel telegram --identity default --peer <chatI
|
|
|
136
138
|
|
|
137
139
|
## Tests
|
|
138
140
|
|
|
141
|
+
`test:smoke` requires a running `opencode` server (default: `http://127.0.0.1:4096`).
|
|
142
|
+
|
|
139
143
|
```bash
|
|
140
|
-
|
|
144
|
+
opencode serve --port 4096 --hostname 127.0.0.1
|
|
141
145
|
pnpm -C packages/opencode-router test:smoke
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Other test suites:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
pnpm -C packages/opencode-router test:unit
|
|
142
152
|
pnpm -C packages/opencode-router test:cli
|
|
143
153
|
pnpm -C packages/opencode-router test:npx
|
|
144
154
|
```
|
package/dist/bridge.js
CHANGED
|
@@ -54,6 +54,7 @@ const DEFAULT_MESSAGING_AGENT_INSTRUCTIONS = [
|
|
|
54
54
|
"Respond for non-technical users first.",
|
|
55
55
|
"Do not tell users to run router commands; use tools on their behalf.",
|
|
56
56
|
"Never expose raw peer IDs or Telegram chat IDs unless the user explicitly asks for debug details.",
|
|
57
|
+
"Do not ask end users for peer IDs or identity IDs.",
|
|
57
58
|
"For Telegram send requests, try delivery immediately using existing bindings or direct tool calls.",
|
|
58
59
|
"If Telegram returns 'chat not found', explain that the recipient must message the bot first (for example with /start), then ask the user to retry.",
|
|
59
60
|
"Keep status updates concise and action-oriented.",
|
|
@@ -1218,7 +1219,7 @@ export async function startBridge(config, logger, reporter, deps = {}) {
|
|
|
1218
1219
|
try {
|
|
1219
1220
|
const effectiveModel = getUserModel(inbound.channel, inbound.identityId, peerKey, config.model);
|
|
1220
1221
|
const messagingAgent = await loadMessagingAgentConfig();
|
|
1221
|
-
const effectiveInstructions = [
|
|
1222
|
+
const effectiveInstructions = [messagingAgent.instructions, DEFAULT_MESSAGING_AGENT_INSTRUCTIONS]
|
|
1222
1223
|
.map((value) => value.trim())
|
|
1223
1224
|
.filter(Boolean)
|
|
1224
1225
|
.join("\n\n");
|
package/dist/cli.js
CHANGED
package/install.sh
CHANGED
|
@@ -11,6 +11,8 @@ usage() {
|
|
|
11
11
|
cat <<'EOF'
|
|
12
12
|
opencode-router installer
|
|
13
13
|
|
|
14
|
+
Requires: bun (runtime) and node/npm.
|
|
15
|
+
|
|
14
16
|
Environment variables:
|
|
15
17
|
OPENCODE_ROUTER_INSTALL_DIR Install directory (default: ~/.openwork/opencode-router/openwork)
|
|
16
18
|
OPENCODE_ROUTER_REPO Git repo (default: https://github.com/different-ai/openwork.git)
|
|
@@ -36,8 +38,12 @@ require_bin() {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
require_bin node
|
|
41
|
+
require_bin bun
|
|
42
|
+
|
|
43
|
+
CUSTOM_SHIM_CREATED=false
|
|
39
44
|
|
|
40
45
|
if [[ "$OPENCODE_ROUTER_INSTALL_METHOD" == "npm" ]]; then
|
|
46
|
+
require_bin npm
|
|
41
47
|
echo "Installing opencode-router via npm..."
|
|
42
48
|
npm install -g opencode-router
|
|
43
49
|
else
|
|
@@ -114,12 +120,13 @@ EOF
|
|
|
114
120
|
cat <<EOF > "$OPENCODE_ROUTER_BIN_DIR/opencode-router"
|
|
115
121
|
#!/usr/bin/env bash
|
|
116
122
|
set -euo pipefail
|
|
117
|
-
|
|
123
|
+
bun "$OPENCODE_ROUTER_INSTALL_DIR/packages/opencode-router/dist/cli.js" "$@"
|
|
118
124
|
EOF
|
|
119
125
|
chmod 755 "$OPENCODE_ROUTER_BIN_DIR/opencode-router"
|
|
126
|
+
CUSTOM_SHIM_CREATED=true
|
|
120
127
|
fi
|
|
121
128
|
|
|
122
|
-
if ! echo ":$PATH:" | grep -q ":$OPENCODE_ROUTER_BIN_DIR:"; then
|
|
129
|
+
if [[ "$CUSTOM_SHIM_CREATED" == "true" ]] && ! echo ":$PATH:" | grep -q ":$OPENCODE_ROUTER_BIN_DIR:"; then
|
|
123
130
|
shell_name="$(basename "${SHELL:-}" 2>/dev/null || true)"
|
|
124
131
|
case "$shell_name" in
|
|
125
132
|
fish)
|
|
@@ -142,6 +149,7 @@ cat <<EOF
|
|
|
142
149
|
opencode-router installed.
|
|
143
150
|
|
|
144
151
|
Next steps:
|
|
145
|
-
1)
|
|
146
|
-
2)
|
|
152
|
+
1) Verify install: opencode-router --help
|
|
153
|
+
2) Add Telegram identity: opencode-router telegram add <token> --id default
|
|
154
|
+
3) Start router: opencode-router start
|
|
147
155
|
EOF
|