diff --git a/src/distrib/sets/lists/etc/mi b/src/distrib/sets/lists/etc/mi index 1b645269e4..ef73b165b3 100644 --- a/src/distrib/sets/lists/etc/mi +++ b/src/distrib/sets/lists/etc/mi @@ -92,6 +92,7 @@ ./etc/iscsi/auths etc-iscsi-etc iscsi ./etc/iscsi/targets etc-iscsi-etc iscsi ./etc/iscsi/volumes etc-iscsi-etc +./etc/junction/junction.conf etc-sys-etc ./etc/kyua/kyua.conf etc-kyua-etc kyua ./etc/lkm.conf etc-obsolete obsolete ./etc/localtime etc-sys-etc @@ -253,6 +254,7 @@ ./etc/rc.d/iscsid_volumes etc-iscsi-rc ./etc/rc.d/isdnd etc-obsolete obsolete ./etc/rc.d/isibootd etc-bootserver-rc +./etc/rc.d/junction etc-sys-rc ./etc/rc.d/kdc etc-krb5-rc ./etc/rc.d/kerberos etc-obsolete obsolete ./etc/rc.d/ldconfig etc-sys-rc @@ -267,6 +269,7 @@ ./etc/rc.d/lvmlockdir etc-sys-rc ./etc/rc.d/makemandb etc-man-rc ./etc/rc.d/mdnsd etc-mdns-rc +./etc/rc.d/memoryd etc-sys-rc ./etc/rc.d/mixerctl etc-audio-rc ./etc/rc.d/modules etc-sys-rc ./etc/rc.d/mopd etc-bootserver-rc @@ -320,7 +323,9 @@ ./etc/rc.d/screenblank etc-sys-rc ./etc/rc.d/sdpd etc-obsolete obsolete ./etc/rc.d/securelevel etc-sys-rc +./etc/rc.d/skilld etc-sys-rc ./etc/rc.d/smtoff etc-sys-rc +./etc/rc.d/splinter etc-sys-rc ./etc/rc.d/sshd etc-secsh-rc ./etc/rc.d/staticroute etc-sys-rc ./etc/rc.d/swap1 etc-sys-rc @@ -329,6 +334,7 @@ ./etc/rc.d/sysdb etc-sys-rc ./etc/rc.d/syslogd etc-sys-rc ./etc/rc.d/systemfs etc-obsolete obsolete +./etc/rc.d/tasksd etc-sys-rc ./etc/rc.d/timed etc-timed-rc ./etc/rc.d/tpctl etc-sys-rc ./etc/rc.d/ttys etc-sys-rc @@ -336,6 +342,7 @@ ./etc/rc.d/veriexec etc-sys-rc ./etc/rc.d/virecover etc-sys-rc ./etc/rc.d/wdogctl etc-sysutil-rc +./etc/rc.d/wikid etc-sys-rc ./etc/rc.d/wpa_supplicant etc-net-rc ./etc/rc.d/wscons etc-sys-rc ./etc/rc.d/wsmoused etc-sys-rc @@ -369,6 +376,7 @@ ./etc/signify/makronix-0.99.pub etc-sys-etc ./etc/signify/makronix-0.99.pub.sig etc-sys-etc ./etc/signify/makronix-root.pub etc-sys-etc +./etc/splinter/splinter.conf etc-sys-etc ./etc/skel/.cshrc etc-sys-etc ./etc/skel/.login etc-sys-etc ./etc/skel/.logout etc-sys-etc diff --git a/src/etc/Makefile b/src/etc/Makefile index 445964de58..8079b9ac30 100644 --- a/src/etc/Makefile +++ b/src/etc/Makefile @@ -356,7 +356,7 @@ install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV /dev/null ${DESTDIR}${file}; \ else true; fi .endfor -.for subdir in . defaults autofs bluetooth iscsi mtree namedb pam.d powerd rc.d root signify skel ssh unbound +.for subdir in . defaults autofs bluetooth iscsi junction mtree namedb pam.d powerd rc.d root signify skel ssh splinter unbound ${MAKEDIRTARGET} ${subdir} configinstall .endfor ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall diff --git a/src/etc/junction/Makefile b/src/etc/junction/Makefile new file mode 100644 index 0000000000..6825d03fe2 --- /dev/null +++ b/src/etc/junction/Makefile @@ -0,0 +1,14 @@ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# The default junction configuration: a loopback listener, no endpoints and no +# rules. A request that no rule matches is answered 503, naming why; the +# commented example below is the smallest working setup. +# + +.include + +CONFIGFILES= junction.conf +FILESDIR= /etc/junction +FILESMODE= 644 + +.include diff --git a/src/etc/junction/junction.conf b/src/etc/junction/junction.conf new file mode 100644 index 0000000000..3a01849217 --- /dev/null +++ b/src/etc/junction/junction.conf @@ -0,0 +1,28 @@ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# junction.conf -- the policy router for OpenAI-compatible endpoints. +# +# pf.conf-style grammar: one keyword per line, braces group. This default +# listens on the loopback only and routes nothing; add an endpoint and a rule +# (a worked example is /usr/pkg/share/junction/examples/olivia.conf) and +# start the service with junction=YES in /etc/rc.conf. + +listen 127.0.0.1:8090 + +connect_timeout_ms 1500 +offline_hold_s 20 +max_body_bytes 67108864 +max_inflight 4 +queue_timeout 300 + +# A local model server and the rule that sends every request to it: +# +# endpoint local { +# base http://127.0.0.1:11434/v1 +# kind local +# context 32768 +# timeout 900 +# idle_timeout 45 +# cooldown 60 +# } +# +# req * pass local diff --git a/src/etc/mtree/NetBSD.dist.base b/src/etc/mtree/NetBSD.dist.base index 73607df60e..f11f598a7c 100644 --- a/src/etc/mtree/NetBSD.dist.base +++ b/src/etc/mtree/NetBSD.dist.base @@ -39,6 +39,7 @@ ./etc/fonts/conf.avail ./etc/fonts/conf.d ./etc/iscsi +./etc/junction ./etc/kerberosV ./etc/kyua ./etc/mail @@ -55,6 +56,7 @@ ./etc/openssl/private mode=0700 ./etc/pam.d ./etc/signify +./etc/splinter ./etc/postfix ./etc/powerd ./etc/powerd/scripts diff --git a/src/etc/rc.d/Makefile b/src/etc/rc.d/Makefile index 24b2d259ed..e85c203de2 100755 --- a/src/etc/rc.d/Makefile +++ b/src/etc/rc.d/Makefile @@ -25,10 +25,10 @@ CONFIGFILES=\ gpio \ hostapd httpd \ identd ifwatchd inetd ip6addrctl ipfilter ipfs ipmon ipnat \ - ipsec irdaattach iscsi_target iscsid iscsid_volumes isibootd \ + ipsec irdaattach iscsi_target iscsid iscsid_volumes isibootd junction \ kdc \ ldconfig ldpd lvmlockdir local lpd lvm \ - makemandb mdnsd mixerctl modules mopd motd mountall \ + makemandb mdnsd memoryd mixerctl modules mopd motd mountall \ mountcritlocal mountcritremote mountd moused mrouted \ named ndbootd network newsyslog nfsd nfslocking npf npf_boot \ npfd ntpd ntpdate \ @@ -37,10 +37,10 @@ CONFIGFILES=\ racoon rpcbind raidframe raidframeparity random_seed rarpd \ rbootd rcorder_cache resize_root rndctl root route6d routed \ rtadvd rtclocaltime rwho \ - savecore screenblank securelevel smtoff sshd \ - staticroute swap1 swap2 sysctl sysdb syslogd \ + savecore screenblank securelevel skilld smtoff splinter sshd \ + staticroute swap1 swap2 sysctl sysdb syslogd tasksd \ timed tpctl ttys \ - veriexec virecover wdogctl wpa_supplicant wscons wsmoused + veriexec virecover wdogctl wikid wpa_supplicant wscons wsmoused FILESDIR= /etc/rc.d FILESMODE= ${BINMODE} diff --git a/src/etc/rc.d/junction b/src/etc/rc.d/junction new file mode 100644 index 0000000000..e2c53f73cc --- /dev/null +++ b/src/etc/rc.d/junction @@ -0,0 +1,29 @@ +#!/bin/sh +# +# $NetBSD$ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# junction -- policy router for OpenAI-compatible model endpoints. +# +# Off until junction=YES in /etc/rc.conf. Endpoints and rules live in +# /etc/junction/junction.conf. + +# PROVIDE: junction +# REQUIRE: NETWORKING +# KEYWORD: shutdown + +$_rc_subr_loaded . /etc/rc.subr + +name="junction" +rcvar=$name +command="/usr/pkg/bin/junction" +command_args="--config /etc/junction/junction.conf &" +required_files="/etc/junction/junction.conf" + +load_rc_config $name +: ${junction:=NO} +: ${junction_flags:=""} + +# The program runs in the foreground; the "&" in command_args puts it in the +# background, and stop finds it by its command (it writes no pid file). +run_rc_command "$1" diff --git a/src/etc/rc.d/memoryd b/src/etc/rc.d/memoryd new file mode 100644 index 0000000000..d8f8316144 --- /dev/null +++ b/src/etc/rc.d/memoryd @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $NetBSD$ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# memoryd -- long-term memory, served over MCP. +# +# Off until memoryd=YES in /etc/rc.conf. The memories live in /var/db/memoryd +# and the embeddings come from the local junction (127.0.0.1:8090). + +# PROVIDE: memoryd +# REQUIRE: junction +# KEYWORD: shutdown + +$_rc_subr_loaded . /etc/rc.subr + +name="memoryd" +rcvar=$name +command="/usr/pkg/bin/memoryd" +memoryd_env="MEMORYD_HOME=/var/db/memoryd EMBED_URL=http://127.0.0.1:8090/v1/embeddings EMBED_MODEL=nomic-embed-text" +command_args="--http 127.0.0.1:8795 &" +start_precmd="memoryd_precmd" + +memoryd_precmd() +{ + mkdir -p /var/db/memoryd +} + +load_rc_config $name +: ${memoryd:=NO} +: ${memoryd_flags:=""} + +# The program runs in the foreground; the "&" in command_args puts it in the +# background, and stop finds it by its command (it writes no pid file). +run_rc_command "$1" diff --git a/src/etc/rc.d/skilld b/src/etc/rc.d/skilld new file mode 100644 index 0000000000..fa2605e7f3 --- /dev/null +++ b/src/etc/rc.d/skilld @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $NetBSD$ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# skilld -- the shared skill library, served over MCP. +# +# Off until skilld=YES in /etc/rc.conf. The library lives in /var/db/skilld. + +# PROVIDE: skilld +# REQUIRE: NETWORKING +# KEYWORD: shutdown + +$_rc_subr_loaded . /etc/rc.subr + +name="skilld" +rcvar=$name +command="/usr/pkg/bin/skilld" +skilld_env="SKILLD_HOME=/var/db/skilld" +command_args="--http 127.0.0.1:8790 &" +start_precmd="skilld_precmd" + +skilld_precmd() +{ + mkdir -p /var/db/skilld +} + +load_rc_config $name +: ${skilld:=NO} +: ${skilld_flags:=""} + +# The program runs in the foreground; the "&" in command_args puts it in the +# background, and stop finds it by its command (it writes no pid file). +run_rc_command "$1" diff --git a/src/etc/rc.d/splinter b/src/etc/rc.d/splinter new file mode 100644 index 0000000000..58bb559f3c --- /dev/null +++ b/src/etc/rc.d/splinter @@ -0,0 +1,31 @@ +#!/bin/sh +# +# $NetBSD$ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# splinter -- the agent harness, here as its MCP registry server. +# +# Off until splinter=YES in /etc/rc.conf. The provider in +# /etc/splinter/splinter.conf is the local junction, so the routing decision +# stays in /etc/junction/junction.conf. The gateway mode (--daemon, Telegram) +# is a matter of splinter_flags in /etc/rc.conf, not the default. + +# PROVIDE: splinter +# REQUIRE: junction +# KEYWORD: shutdown + +$_rc_subr_loaded . /etc/rc.subr + +name="splinter" +rcvar=$name +command="/usr/pkg/bin/splinter" +command_args="--config /etc/splinter/splinter.conf --mcp-server-listen 127.0.0.1 --mcp-listen-port 8098 &" +required_files="/etc/splinter/splinter.conf" + +load_rc_config $name +: ${splinter:=NO} +: ${splinter_flags:=""} + +# The program runs in the foreground; the "&" in command_args puts it in the +# background, and stop finds it by its command (it writes no pid file). +run_rc_command "$1" diff --git a/src/etc/rc.d/tasksd b/src/etc/rc.d/tasksd new file mode 100644 index 0000000000..d5584969eb --- /dev/null +++ b/src/etc/rc.d/tasksd @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $NetBSD$ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# tasksd -- the task board, served over MCP. +# +# Off until tasksd=YES in /etc/rc.conf. The tasks live in /var/db/tasksd. + +# PROVIDE: tasksd +# REQUIRE: NETWORKING +# KEYWORD: shutdown + +$_rc_subr_loaded . /etc/rc.subr + +name="tasksd" +rcvar=$name +command="/usr/pkg/bin/tasksd" +tasksd_env="TASKD_HOME=/var/db/tasksd" +command_args="--http 127.0.0.1:8781 &" +start_precmd="tasksd_precmd" + +tasksd_precmd() +{ + mkdir -p /var/db/tasksd +} + +load_rc_config $name +: ${tasksd:=NO} +: ${tasksd_flags:=""} + +# The program runs in the foreground; the "&" in command_args puts it in the +# background, and stop finds it by its command (it writes no pid file). +run_rc_command "$1" diff --git a/src/etc/rc.d/wikid b/src/etc/rc.d/wikid new file mode 100644 index 0000000000..c5f1127751 --- /dev/null +++ b/src/etc/rc.d/wikid @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $NetBSD$ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# wikid -- named knowledge bases, served over MCP. +# +# Off until wikid=YES in /etc/rc.conf. The pages live in /var/db/wikid and +# the embeddings come from the local junction (127.0.0.1:8090). + +# PROVIDE: wikid +# REQUIRE: junction +# KEYWORD: shutdown + +$_rc_subr_loaded . /etc/rc.subr + +name="wikid" +rcvar=$name +command="/usr/pkg/bin/wikid" +wikid_env="WIKID_HOME=/var/db/wikid EMBED_URL=http://127.0.0.1:8090/v1/embeddings EMBED_MODEL=nomic-embed-text" +command_args="--http 127.0.0.1:8796 &" +start_precmd="wikid_precmd" + +wikid_precmd() +{ + mkdir -p /var/db/wikid +} + +load_rc_config $name +: ${wikid:=NO} +: ${wikid_flags:=""} + +# The program runs in the foreground; the "&" in command_args puts it in the +# background, and stop finds it by its command (it writes no pid file). +run_rc_command "$1" diff --git a/src/etc/splinter/Makefile b/src/etc/splinter/Makefile new file mode 100644 index 0000000000..0098d9ca9f --- /dev/null +++ b/src/etc/splinter/Makefile @@ -0,0 +1,14 @@ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# The default splinter configuration: one provider, the local junction. The +# service passes --config /etc/splinter/splinter.conf, and every +# splinter.conf.d/*.conf beside it is read too. +# + +.include + +CONFIGFILES= splinter.conf +FILESDIR= /etc/splinter +FILESMODE= 644 + +.include diff --git a/src/etc/splinter/splinter.conf b/src/etc/splinter/splinter.conf new file mode 100644 index 0000000000..6ee4e513a0 --- /dev/null +++ b/src/etc/splinter/splinter.conf @@ -0,0 +1,18 @@ +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# splinter.conf -- the default of the Makronix install. +# +# splinter reads this one file (the service passes --config) plus every +# splinter.conf.d/*.conf beside it. The provider is the local junction, so +# where a request goes is decided in /etc/junction/junction.conf, not here. +# `splinter --init-config` writes the full commented example. + +core { + default = local +} + +provider local { + about = "the local junction (see /etc/junction/junction.conf)" + kind = openai + endpoint = http://127.0.0.1:8090/v1 + model = default +}