-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-bundled-plugins.sh
More file actions
executable file
·137 lines (118 loc) · 4.02 KB
/
Copy pathinstall-bundled-plugins.sh
File metadata and controls
executable file
·137 lines (118 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
install_root="${1:-${root}/target/debug/plugins}"
cd "${root}"
cargo build --quiet \
-p bcode_filesystem_plugin \
-p bcode_shell_plugin \
-p bcode_openai_compatible_provider_plugin \
-p bcode_default_agents_plugin
case "$(uname -s)" in
Darwin)
fs_dylib_name="libbcode_filesystem_plugin.dylib"
shell_dylib_name="libbcode_shell_plugin.dylib"
openai_dylib_name="libbcode_openai_compatible_provider_plugin.dylib"
default_agents_dylib_name="libbcode_default_agents_plugin.dylib"
;;
Linux)
fs_dylib_name="libbcode_filesystem_plugin.so"
shell_dylib_name="libbcode_shell_plugin.so"
openai_dylib_name="libbcode_openai_compatible_provider_plugin.so"
default_agents_dylib_name="libbcode_default_agents_plugin.so"
;;
MINGW*|MSYS*|CYGWIN*)
fs_dylib_name="bcode_filesystem_plugin.dll"
shell_dylib_name="bcode_shell_plugin.dll"
openai_dylib_name="bcode_openai_compatible_provider_plugin.dll"
default_agents_dylib_name="bcode_default_agents_plugin.dll"
;;
*)
echo "unsupported platform: $(uname -s)" >&2
exit 1
;;
esac
install_plugin_library() {
local plugin_dir="$1"
local dylib_name="$2"
local built_dylib="${root}/target/debug/${dylib_name}"
if [[ ! -f "${built_dylib}" ]]; then
echo "plugin library was not built: ${built_dylib}" >&2
exit 1
fi
mkdir -p "${plugin_dir}"
cp "${built_dylib}" "${plugin_dir}/${dylib_name}"
}
fs_plugin_dir="${install_root}/bcode.filesystem"
install_plugin_library "${fs_plugin_dir}" "${fs_dylib_name}"
cat >"${fs_plugin_dir}/bcode-plugin.toml" <<EOF
id = "bcode.filesystem"
name = "Bcode Filesystem Plugin"
version = "0.0.1"
[[services]]
description = "Filesystem read/write utility service"
interface_id = "bcode.filesystem/v1"
name = "Filesystem"
[[services]]
description = "Model-callable filesystem tools"
interface_id = "bcode.tool/v1"
name = "Filesystem Tools"
[runtime]
type = "native"
abi_version = 1
library = "${fs_dylib_name}"
event_symbol = "bcode_plugin_handle_event_v1"
service_symbol = "bcode_plugin_invoke_service_v1"
EOF
openai_plugin_dir="${install_root}/bcode.openai-compatible"
install_plugin_library "${openai_plugin_dir}" "${openai_dylib_name}"
cat >"${openai_plugin_dir}/bcode-plugin.toml" <<EOF
id = "bcode.openai-compatible"
name = "Bcode OpenAI-Compatible Provider"
version = "0.0.1"
[[services]]
description = "OpenAI-compatible chat-completions model provider"
interface_id = "bcode.model-provider/v1"
name = "OpenAI-Compatible Model Provider"
[runtime]
type = "native"
abi_version = 1
library = "${openai_dylib_name}"
event_symbol = "bcode_plugin_handle_event_v1"
service_symbol = "bcode_plugin_invoke_service_v1"
EOF
default_agents_plugin_dir="${install_root}/bcode.default-agents"
install_plugin_library "${default_agents_plugin_dir}" "${default_agents_dylib_name}"
cat >"${default_agents_plugin_dir}/bcode-plugin.toml" <<EOF
id = "bcode.default-agents"
name = "Bcode Default Agents"
version = "0.0.1"
[[services]]
description = "Default plan/build agent profile policy provider"
interface_id = "bcode.agent-profile/v1"
name = "Default Agent Profiles"
[runtime]
type = "native"
abi_version = 1
library = "${default_agents_dylib_name}"
event_symbol = "bcode_plugin_handle_event_v1"
service_symbol = "bcode_plugin_invoke_service_v1"
EOF
shell_plugin_dir="${install_root}/bcode.shell"
install_plugin_library "${shell_plugin_dir}" "${shell_dylib_name}"
cat >"${shell_plugin_dir}/bcode-plugin.toml" <<EOF
id = "bcode.shell"
name = "Bcode Shell Plugin"
version = "0.0.1"
[[services]]
description = "Permissioned model-callable shell execution tools"
interface_id = "bcode.tool/v1"
name = "Shell Tools"
[runtime]
type = "native"
abi_version = 1
library = "${shell_dylib_name}"
event_symbol = "bcode_plugin_handle_event_v1"
service_symbol = "bcode_plugin_invoke_service_v1"
EOF
printf 'installed bundled plugins to %s\n' "${install_root}"