devzone 7.2.0 → 7.4.0
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/.devcontainer/catalog/catalog-watcher.sh +2 -5
- package/.devcontainer/catalog.sh +4 -27
- package/.devcontainer/cluster.sh +1 -4
- package/.devcontainer/devcontainer.json +1 -1
- package/.devcontainer/devzone +26 -15
- package/.devcontainer/devzone-modules.sh +9 -20
- package/.devcontainer/devzone-status.sh +1 -1
- package/.devcontainer/ports.sh +2 -5
- package/.devcontainer/services-admin.sh +3 -6
- package/README.md +1 -1
- package/bin/SHA256SUMS +6 -6
- package/bin/devzone-darwin-amd64 +0 -0
- package/bin/devzone-darwin-arm64 +0 -0
- package/bin/devzone-linux-amd64 +0 -0
- package/bin/devzone-linux-arm64 +0 -0
- package/bin/devzone-windows-amd64.exe +0 -0
- package/bin/devzone-windows-arm64.exe +0 -0
- package/manage/devzone +3 -1
- package/package.json +1 -1
- package/.devcontainer/agent-errors.sh +0 -156
- package/.devcontainer/agent-local.sh +0 -63
- package/.devcontainer/agent-model.sh +0 -113
- package/.devcontainer/agent-pod-egress.sh +0 -36
- package/.devcontainer/agent-pod-manifest.sh +0 -250
- package/.devcontainer/agent-pod.sh +0 -243
- package/.devcontainer/agent-session.sh +0 -242
- package/.devcontainer/agent-state-json.sh +0 -117
- package/.devcontainer/agent-workspace.sh +0 -97
- package/.devcontainer/agent.sh +0 -247
- package/.devcontainer/state-gitops.sh +0 -23
- package/.devcontainer/state-json.sh +0 -282
- package/.devcontainer/state-lock.sh +0 -53
- package/.devcontainer/state.sh +0 -219
|
@@ -7,9 +7,6 @@ set -euo pipefail
|
|
|
7
7
|
ICI="$(cd "$(dirname "$0")" && pwd)"
|
|
8
8
|
RACINE="${DEVZONE_ROOT:-$(cd "$ICI/../.." && pwd)}"
|
|
9
9
|
ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
10
|
-
# shellcheck source=SCRIPTDIR/state.sh
|
|
11
|
-
# shellcheck disable=SC1091
|
|
12
|
-
. "$(dirname "$ICI")/state.sh"
|
|
13
10
|
BASE="${DEVZONE_CATALOG_WATCHER_DIR:-$RACINE/.devzone.catalog-watcher}"
|
|
14
11
|
LOCK_DIR="$BASE/lock"
|
|
15
12
|
LAST_FILE="$BASE/dernier"
|
|
@@ -54,8 +51,8 @@ tick() {
|
|
|
54
51
|
[ -f "$ETAT" ] || return 0
|
|
55
52
|
# Restored or rebuilt state: the watcher does not follow a doubtful state,
|
|
56
53
|
# and never uninstalls until devzone apply has confirmed it
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "$ICI")}/devzone" state recovery-wait && return 0
|
|
55
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "$ICI")}/devzone" state recovery-pending && return 0
|
|
59
56
|
mkdir -p "$BASE"
|
|
60
57
|
now="$(stat -c %Y "$ETAT" 2>/dev/null || stat -f %m "$ETAT" 2>/dev/null || true)"
|
|
61
58
|
[ -n "$now" ] || return 0
|
package/.devcontainer/catalog.sh
CHANGED
|
@@ -12,9 +12,6 @@ ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
|
12
12
|
# shellcheck source=SCRIPTDIR/cluster.sh
|
|
13
13
|
# shellcheck disable=SC1091
|
|
14
14
|
. "$ICI/cluster.sh"
|
|
15
|
-
# shellcheck source=SCRIPTDIR/state.sh
|
|
16
|
-
# shellcheck disable=SC1091
|
|
17
|
-
. "$ICI/state.sh"
|
|
18
15
|
# shellcheck source=SCRIPTDIR/password.sh
|
|
19
16
|
# shellcheck disable=SC1091
|
|
20
17
|
. "$ICI/password.sh"
|
|
@@ -92,30 +89,10 @@ app_ready() {
|
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
# Adds to the state the <app>=off lines of the absent applications (once each,
|
|
95
|
-
# an existing line is never changed),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[ -f "$ETAT" ] || return 0
|
|
100
|
-
header="# Catalog applications: set to on to install (devzone catalog)"
|
|
101
|
-
state_lock_take || return 1
|
|
102
|
-
# The lock is released on exit, including on an error under set -e
|
|
103
|
-
trap 'state_lock_release' EXIT
|
|
104
|
-
while IFS= read -r app; do
|
|
105
|
-
[ -n "$app" ] || continue
|
|
106
|
-
grep -qE "^${app}=" "$ETAT" 2>/dev/null && continue
|
|
107
|
-
missing="${missing}${missing:+$'\n'}${app}=off"
|
|
108
|
-
done <<<"$(catalog_apps)"
|
|
109
|
-
[ -n "$missing" ] || return 0
|
|
110
|
-
tmp="$(mktemp)"
|
|
111
|
-
{
|
|
112
|
-
cat "$ETAT"
|
|
113
|
-
grep -qF -e "$header" "$ETAT" || echo "$header"
|
|
114
|
-
echo "$missing"
|
|
115
|
-
} >"$tmp"
|
|
116
|
-
state_replace "$tmp"
|
|
117
|
-
rm -f "$tmp"
|
|
118
|
-
)
|
|
92
|
+
# an existing line is never changed), under the Go state lock (#879).
|
|
93
|
+
catalog_sync() {
|
|
94
|
+
DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state catalog-sync
|
|
95
|
+
}
|
|
119
96
|
|
|
120
97
|
# Real state of an application: available, expected, installed, failed. These
|
|
121
98
|
# values are the etat field of devzone status --json: keep them
|
package/.devcontainer/cluster.sh
CHANGED
|
@@ -29,9 +29,6 @@ export KUBECONFIG
|
|
|
29
29
|
|
|
30
30
|
# Safe state write (#417): lock, temporary file in the state folder, backup copy
|
|
31
31
|
# .prev — shared by devzone, ports
|
|
32
|
-
# shellcheck source=SCRIPTDIR/state.sh
|
|
33
|
-
# shellcheck disable=SC1091
|
|
34
|
-
. "$(dirname "${BASH_SOURCE[0]}")/state.sh"
|
|
35
32
|
|
|
36
33
|
# Instance name: empty or « devzone » = default instance (no suffix)
|
|
37
34
|
: "${DEVZONE_INSTANCE:=}"
|
|
@@ -57,7 +54,7 @@ cluster_saved() {
|
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
cluster_save() {
|
|
60
|
-
|
|
57
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state write cluster "$1"
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
cluster_is_dedicated() {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-opencode-config,target=/home/vscode/.config/opencode,type=volume",
|
|
45
45
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-opencode-data,target=/home/vscode/.local/share/opencode,type=volume",
|
|
46
46
|
// devzone agent (#377): state (discarded models, rank, lock, snapshots of the
|
|
47
|
-
// rights) at the path where agent
|
|
47
|
+
// rights) at the path where devzone agent writes it; shared like the logins
|
|
48
48
|
"source=${localEnv:DEVZONE_VOLUMES:devzone}-agent,target=/home/vscode/.local/state/oc-lancer,type=volume",
|
|
49
49
|
// Connexion gh et identité git (~/.config/git/config, lu par git comme
|
|
50
50
|
// config globale) : le conteneur reconstruit peut commiter et pousser
|
package/.devcontainer/devzone
CHANGED
|
@@ -32,7 +32,7 @@ if [ -z "${DEVZONE_NO_GO:-}" ] && [ -z "$FROM_GO" ]; then
|
|
|
32
32
|
aarch64 | arm64) POD_GO_ARCH=arm64 ;;
|
|
33
33
|
*) POD_GO_ARCH="" ;;
|
|
34
34
|
esac
|
|
35
|
-
POD_GO="$ICI/bin/devzone-pod-
|
|
35
|
+
POD_GO="$ICI/bin/devzone-pod-$(uname -s | tr '[:upper:]' '[:lower:]')-$POD_GO_ARCH"
|
|
36
36
|
if [ -n "$POD_GO_ARCH" ] && [ -x "$POD_GO" ] && "$POD_GO" handles "${1:-}" >/dev/null 2>&1; then
|
|
37
37
|
DEVZONE_POD_SCRIPT="$ICI/devzone" exec "$POD_GO" "$@"
|
|
38
38
|
fi
|
|
@@ -58,9 +58,6 @@ if [ -f "$ICI/argocd/conf.sh" ]; then
|
|
|
58
58
|
. "$ICI/argocd/conf.sh"
|
|
59
59
|
fi
|
|
60
60
|
# GitOps repository line in the Kubernetes workspace pod (#639)
|
|
61
|
-
# shellcheck source=SCRIPTDIR/state-gitops.sh
|
|
62
|
-
# shellcheck disable=SC1091
|
|
63
|
-
. "$ICI/state-gitops.sh"
|
|
64
61
|
# Detection of the host (Ollama) models and the devzone-host opencode provider (#665).
|
|
65
62
|
# shellcheck source=SCRIPTDIR/ai/host-models.sh
|
|
66
63
|
# shellcheck disable=SC1091
|
|
@@ -125,21 +122,38 @@ GITLAB_URL_MODULE=http://gitlab.localhost:8929
|
|
|
125
122
|
# shellcheck disable=SC1091
|
|
126
123
|
. "$ICI/devzone-status.sh"
|
|
127
124
|
|
|
128
|
-
# shellcheck source=state-json.sh
|
|
129
|
-
# shellcheck disable=SC1091
|
|
130
|
-
if [ -f "$ICI/state-json.sh" ]; then
|
|
131
|
-
. "$ICI/state-json.sh"
|
|
132
|
-
fi
|
|
133
125
|
|
|
134
126
|
case "${1:-}" in
|
|
135
|
-
"" | status | modules) if [ "${2:-}" = "--json" ]; then
|
|
127
|
+
"" | status | modules) if [ "${2:-}" = "--json" ]; then DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state json; else show_state; fi ;;
|
|
128
|
+
state)
|
|
129
|
+
export DEVZONE_STATE="$ETAT"
|
|
130
|
+
case "${2:-}" in
|
|
131
|
+
write|remove|replace|init|recovery-mark|recovery-wait|recovery-pending|recovery-confirm|catalog-sync|gitops-line|json)
|
|
132
|
+
# shellcheck disable=SC2034 # DEVZONE_STATE used by state helpers
|
|
133
|
+
ETAT="$DEVZONE_STATE"
|
|
134
|
+
;;
|
|
135
|
+
*) echo "devzone state: write|remove|replace|init|recovery-mark|recovery-wait|recovery-pending|recovery-confirm|catalog-sync|gitops-line|json" >&2; exit 1 ;;
|
|
136
|
+
esac
|
|
137
|
+
ici_state="$ICI"
|
|
138
|
+
pod_state=""
|
|
139
|
+
case "$(uname -m)" in
|
|
140
|
+
x86_64) pod_state="$ici_state/bin/devzone-pod-linux-amd64" ;;
|
|
141
|
+
aarch64 | arm64) pod_state="$ici_state/bin/devzone-pod-linux-arm64" ;;
|
|
142
|
+
esac
|
|
143
|
+
if [ -n "$pod_state" ] && [ -x "$pod_state" ]; then
|
|
144
|
+
"$pod_state" "$@"
|
|
145
|
+
else
|
|
146
|
+
echo "devzone : state: Go pod binary unavailable" >&2
|
|
147
|
+
exit 127
|
|
148
|
+
fi
|
|
149
|
+
;;
|
|
136
150
|
enable) change_module on "${2:-}" "${@:3}" ;;
|
|
137
151
|
disable) change_module off "${2:-}" "${@:3}" ;;
|
|
138
152
|
apply)
|
|
139
153
|
migrate_llm
|
|
140
154
|
# The user confirms the current state (#417, step 4): the watchers
|
|
141
155
|
# may uninstall again
|
|
142
|
-
|
|
156
|
+
DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state recovery-confirm
|
|
143
157
|
apply_repowarden
|
|
144
158
|
[ "$(value_of ai)" = off ] || apply_ai on
|
|
145
159
|
# gitlab, postgres, argocd: installed from the workstation in the
|
|
@@ -155,9 +169,6 @@ case "${1:-}" in
|
|
|
155
169
|
# writing anything
|
|
156
170
|
[ "$(value_of "$2")" = on ]
|
|
157
171
|
;;
|
|
158
|
-
agent)
|
|
159
|
-
bash "$ICI/agent.sh" "${@:2}"
|
|
160
|
-
;;
|
|
161
172
|
ai)
|
|
162
173
|
case "${2:-}" in
|
|
163
174
|
check)
|
|
@@ -194,7 +205,7 @@ case "${1:-}" in
|
|
|
194
205
|
cluster) change_cluster "${@:2}" ;;
|
|
195
206
|
# Go only: reached when the binary did not take the call. Never call
|
|
196
207
|
# "devzone" again from here, it would loop forever, see #864
|
|
197
|
-
postgres | mysql | gitlab | test-gitlab)
|
|
208
|
+
agent | postgres | mysql | gitlab | test-gitlab)
|
|
198
209
|
echo "devzone $1: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
199
210
|
exit 1
|
|
200
211
|
;;
|
|
@@ -21,11 +21,11 @@ is_known() {
|
|
|
21
21
|
return 1
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
# First start (no state): the state is created by state
|
|
24
|
+
# First start (no state): the state is created by Go state command (#879): old global
|
|
25
25
|
# state taken over, backup copy restored, state rebuilt from the services
|
|
26
26
|
# cluster, otherwise first installation
|
|
27
27
|
init_state() {
|
|
28
|
-
|
|
28
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state init "${MODULES[@]}"
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
value_of() {
|
|
@@ -35,28 +35,17 @@ value_of() {
|
|
|
35
35
|
[ "$v" = on ] && echo on || echo off
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
# State-file
|
|
39
|
-
# recreated empty between the two
|
|
38
|
+
# State-file write delegated to Go (#879): lock, backup and atomic replace.
|
|
40
39
|
write_value() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
state_lock_release
|
|
44
|
-
return 1
|
|
45
|
-
fi
|
|
46
|
-
state_lock_release
|
|
47
|
-
return 0
|
|
40
|
+
init_state || return 1
|
|
41
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state write "$1" "$2"
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
# Removes a key from the state file: the configuration of a service only exists
|
|
51
45
|
# while it is chosen (#242)
|
|
52
46
|
remove_key() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
state_lock_release
|
|
56
|
-
return 1
|
|
57
|
-
fi
|
|
58
|
-
state_lock_release
|
|
59
|
-
return 0
|
|
47
|
+
init_state || return 1
|
|
48
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state remove "$1"
|
|
60
49
|
}
|
|
61
50
|
|
|
62
51
|
# True if the file only holds the $schema key (created by opencode by default)
|
|
@@ -75,7 +64,7 @@ llm_removed_msg() {
|
|
|
75
64
|
migrate_llm() {
|
|
76
65
|
[ -f "$ETAT" ] || return 0
|
|
77
66
|
grep -qE '^llm=' "$ETAT" 2>/dev/null || return 0
|
|
78
|
-
|
|
67
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state remove llm
|
|
79
68
|
llm_removed_msg
|
|
80
69
|
}
|
|
81
70
|
|
|
@@ -89,7 +78,7 @@ change_module() {
|
|
|
89
78
|
if [ "$m" = llm ]; then
|
|
90
79
|
init_state 2>/dev/null || true
|
|
91
80
|
if [ -f "$ETAT" ] && grep -qE '^llm=' "$ETAT" 2>/dev/null; then
|
|
92
|
-
|
|
81
|
+
DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state remove llm
|
|
93
82
|
fi
|
|
94
83
|
llm_removed_msg
|
|
95
84
|
return 1
|
|
@@ -81,7 +81,7 @@ show_state() {
|
|
|
81
81
|
if [ -n "$argocd_repo" ] && [ "$argocd_repo" != none ]; then
|
|
82
82
|
printf ' ○ argocd GitOps repository: %s\n' "$argocd_repo"
|
|
83
83
|
elif in_pod; then
|
|
84
|
-
|
|
84
|
+
DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state gitops-line
|
|
85
85
|
else
|
|
86
86
|
printf ' ○ argocd no GitOps repository: devzone argocd init\n'
|
|
87
87
|
fi
|
package/.devcontainer/ports.sh
CHANGED
|
@@ -14,9 +14,6 @@ ETAT="${DEVZONE_STATE:-$ROOT/.devzone.modules}"
|
|
|
14
14
|
INSTANCE="${DEVZONE_INSTANCE:-devzone}"
|
|
15
15
|
|
|
16
16
|
# Safe state write (#417): lock, temporary file in the state folder, backup copy
|
|
17
|
-
# shellcheck source=SCRIPTDIR/state.sh
|
|
18
|
-
# shellcheck disable=SC1091
|
|
19
|
-
. "$HERE/state.sh"
|
|
20
17
|
|
|
21
18
|
refuse() { echo "devzone : port : $*" >&2; exit 1; }
|
|
22
19
|
|
|
@@ -41,9 +38,9 @@ sort_ports() {
|
|
|
41
38
|
printf '%s\n' "${1:-}" | tr ',' '\n' | awk 'NF && $0 ~ /^[0-9]+$/ { print }' | sort -n -u | paste -sd, -
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
# Writes the ports= line of the state (#417: never mv outside state
|
|
41
|
+
# Writes the ports= line of the state (#417: never mv outside Go state command)
|
|
45
42
|
write_ports() {
|
|
46
|
-
|
|
43
|
+
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write ports "${1:-}" || { echo "devzone : port : state not saved : $ETAT" >&2; exit 1; }
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
add_port() {
|
|
@@ -34,9 +34,6 @@ refuse() {
|
|
|
34
34
|
exit 2
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
# shellcheck source=SCRIPTDIR/state.sh
|
|
38
|
-
# shellcheck disable=SC1091
|
|
39
|
-
. "$HERE/state.sh"
|
|
40
37
|
|
|
41
38
|
action="${1:-}"
|
|
42
39
|
service="${2:-}"
|
|
@@ -73,9 +70,9 @@ cleanup() {
|
|
|
73
70
|
rm -f "$kubeconfig"
|
|
74
71
|
"$DEVZONE_CMD" "$service" relay-stop >/dev/null 2>&1 || true
|
|
75
72
|
if [ -n "$cluster_before" ]; then
|
|
76
|
-
|
|
73
|
+
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write cluster "$cluster_before" || true
|
|
77
74
|
else
|
|
78
|
-
|
|
75
|
+
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state remove cluster || true
|
|
79
76
|
fi
|
|
80
77
|
}
|
|
81
78
|
trap cleanup EXIT
|
|
@@ -109,7 +106,7 @@ unset token ca_data
|
|
|
109
106
|
export KUBECONFIG="$kubeconfig"
|
|
110
107
|
export DEVZONE_KUBE_CONFIG="$kubeconfig"
|
|
111
108
|
export DEVZONE_SERVICES_ADMIN=1
|
|
112
|
-
|
|
109
|
+
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write cluster "$ADMIN_CONTEXT" || refuse "cannot write the state: $ETAT"
|
|
113
110
|
echo "devzone services: $action $service in the cluster of the pod (temporary administrator)"
|
|
114
111
|
case "$action" in
|
|
115
112
|
# The seed is a module command: devzone gitlab seed (#538)
|
package/README.md
CHANGED
|
@@ -357,7 +357,7 @@ A project's user owns **its** database (it creates tables, indexes, data in it)
|
|
|
357
357
|
|
|
358
358
|
## See my application in the browser
|
|
359
359
|
|
|
360
|
-
On the Kubernetes workstation, `devzone workspace start` starts a port watcher: each TCP port ≥ 1024 that listens in the pod is relayed to `127.0.0.1` of the workstation, at the same number, by `kubectl port-forward`. A server started in the pod (`npm run dev`, port 5173) therefore answers at `http://localhost:5173`, without a command. The enabled services (PostgreSQL, MySQL, Argo CD) are relayed too, on their usual port. The Services of applications deployed in the cluster are relayed the same way, each on a local port (80 → 8080; a port already taken elsewhere becomes another port): `devzone workspace ports status` shows their URL `http://127.0.0.1:<port>`. A Service can be excluded with the annotation `devzone.io/relay: "false"`. The watcher is driven with `devzone workspace ports start|stop|status`; details in the [reference](manage/docs/reference.md#applications-and-services-on-the-workstations-localhost).
|
|
360
|
+
On the Kubernetes workstation, `devzone workspace start` starts a port watcher: each TCP port ≥ 1024 that listens in the pod is relayed to `127.0.0.1` of the workstation, at the same number, by `kubectl port-forward`. A server started in the pod (`npm run dev`, port 5173) therefore answers at `http://localhost:5173`, without a command. The enabled services (PostgreSQL, MySQL, Argo CD) are relayed too, on their usual port. The Services of applications deployed in the cluster are relayed the same way, each on a local port (80 → 8080; a port already taken elsewhere becomes another port): `devzone workspace ports status` shows their URL `http://127.0.0.1:<port>`. A Service can be excluded with the annotation `devzone.io/relay: "false"`. The watcher is driven with `devzone workspace ports start|stop|status`; details in the [reference](manage/docs/reference.md#applications-and-services-on-the-workstations-localhost). Its automatic start needs no command: the Go program installs or repairs it after a folder creation, an update or any successful devzone command from a devzone folder, silently once it is current. `devzone workspace ports disable` and `devzone uninstall` remember the refusal in `.devzone.ports-disabled` in that folder; `devzone workspace ports enable` removes the marker.
|
|
361
361
|
|
|
362
362
|
The relays kept in the state of a workstation instance are listed and closed with `devzone port`:
|
|
363
363
|
|
package/bin/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
9b7d99ffa3a8420bca697c1c568f04ae4a282a71ea3d9f37202a02fc46601050 devzone-linux-amd64
|
|
2
|
+
d2e87e6498668026ad8591475cb0336af72a8aef845f235fb5466ca121cd50ff devzone-linux-arm64
|
|
3
|
+
c2a71b049e542c41ec627cd773f5ebdea676c4d2a5e3f02271fe04610245e3b9 devzone-darwin-amd64
|
|
4
|
+
e615af41aba2eb1e4b3d4a9d7bd7e7423f793bb72319c5fe7e96ff0e3221eb2d devzone-darwin-arm64
|
|
5
|
+
d6a3251e678bd5a35239d175ef7024be585602118cb85dc78d91ba3e94d74224 devzone-windows-amd64.exe
|
|
6
|
+
e82d667af1d00c9e8eebc96fa1a039b8032fa0d20ab51eea95dbc8abf75328e9 devzone-windows-arm64.exe
|
package/bin/devzone-darwin-amd64
CHANGED
|
Binary file
|
package/bin/devzone-darwin-arm64
CHANGED
|
Binary file
|
package/bin/devzone-linux-amd64
CHANGED
|
Binary file
|
package/bin/devzone-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/manage/devzone
CHANGED
|
@@ -171,6 +171,8 @@ devzone $(version): development workspace in a Kubernetes cluster
|
|
|
171
171
|
(start installs it, stop removes it from the cluster)
|
|
172
172
|
devzone workspace services enable|disable <service>|status
|
|
173
173
|
services (gitlab, postgres, argocd) of the Kubernetes workspace
|
|
174
|
+
devzone workspace ports enable|disable
|
|
175
|
+
automatic start of the port watcher on the workstation
|
|
174
176
|
devzone workspace argocd status|init|apply|app add|list|remove
|
|
175
177
|
Argo CD of the workspace: GitOps repository, .argocd.conf, projects
|
|
176
178
|
devzone --version
|
|
@@ -183,7 +185,7 @@ container_command() {
|
|
|
183
185
|
case "$1" in
|
|
184
186
|
ai | agent | apply | argocd | build | catalog | cluster | clusters | disable | \
|
|
185
187
|
enable | gitlab | is-enabled | llm | metrics | modules | mysql | packages | \
|
|
186
|
-
passwords | platform | port | postgres | repair | start | status | \
|
|
188
|
+
passwords | platform | port | postgres | repair | start | state | status | \
|
|
187
189
|
test-bash32 | test-gitlab | ticket | use) return 0 ;;
|
|
188
190
|
*) return 1 ;;
|
|
189
191
|
esac
|
package/package.json
CHANGED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck disable=SC2034
|
|
3
|
-
# Model exclusions and network wait of the agent supervisor (#328).
|
|
4
|
-
# Library sourced by agent.sh: no command is launched here.
|
|
5
|
-
|
|
6
|
-
# Known opencode error texts (grep -E); error_cause takes the cause from them.
|
|
7
|
-
ERRORS='not available in your country|Free usage limit|content filter|Model is unavailable|Upstream request failed|ProviderHeaderTimeout|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ECONNRESET|fetch failed|network'
|
|
8
|
-
# Prefix of an opencode error line. Erreur: stays so that French output still matches.
|
|
9
|
-
ERROR_LINE='(^|[[:space:]])(Error|ERROR|Erreur):'
|
|
10
|
-
|
|
11
|
-
# Cause of a failure: pays (country, lasting), quota, filtre (filter), reseau
|
|
12
|
-
# (network, no exclusion) or autre (other). The stored names stay as they are:
|
|
13
|
-
# they are written to the state files and to devzone agent state --json.
|
|
14
|
-
error_cause() {
|
|
15
|
-
local t="$1"
|
|
16
|
-
case "$t" in
|
|
17
|
-
*"not available in your country"*) echo "pays" ;;
|
|
18
|
-
*"Free usage limit"*) echo "quota" ;;
|
|
19
|
-
*"content filter"*) echo "filtre" ;;
|
|
20
|
-
*"ENOTFOUND"* | *"ECONNREFUSED"* | *"ETIMEDOUT"* | *"EAI_AGAIN"* | *"ECONNRESET"* | *"fetch failed"* | *"network"*)
|
|
21
|
-
echo "reseau" ;;
|
|
22
|
-
*) echo "autre" ;;
|
|
23
|
-
esac
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
# Cause name shown to the user, from a stored cause (mute and muet are both silent).
|
|
27
|
-
cause_label() {
|
|
28
|
-
case "$1" in
|
|
29
|
-
pays) echo "country" ;;
|
|
30
|
-
quota) echo "quota" ;;
|
|
31
|
-
filtre) echo "filter" ;;
|
|
32
|
-
reseau) echo "network" ;;
|
|
33
|
-
mute | muet) echo "silent" ;;
|
|
34
|
-
*) echo "other" ;;
|
|
35
|
-
esac
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Duration of an exclusion in seconds: country 7 days (DEVZONE_AGENT_COUNTRY_EXCLUSION), the others 1 h.
|
|
39
|
-
exclusion_duration() {
|
|
40
|
-
case "$1" in
|
|
41
|
-
pays) echo "${DEVZONE_AGENT_COUNTRY_EXCLUSION:-604800}" ;;
|
|
42
|
-
*) echo 3600 ;;
|
|
43
|
-
esac
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# Readable duration of an exclusion for the journal: "7 d", "1 h" or "30 s".
|
|
47
|
-
exclusion_label() {
|
|
48
|
-
local d
|
|
49
|
-
d="$(exclusion_duration "$1")"
|
|
50
|
-
if [ "$d" -ge 86400 ]; then
|
|
51
|
-
echo "$(( d / 86400 )) d"
|
|
52
|
-
elif [ "$d" -ge 3600 ]; then
|
|
53
|
-
echo "$(( d / 3600 )) h"
|
|
54
|
-
else
|
|
55
|
-
echo "${d} s"
|
|
56
|
-
fi
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
# Writes the exclusion of the model: "<start> <cause> <duration>" in $AGENT_STATE/ecart-<model>
|
|
60
|
-
# (the state file keeps its name on disk).
|
|
61
|
-
model_exclude() {
|
|
62
|
-
printf '%s %s %s\n' "$(date +%s)" "$2" "$(exclusion_duration "$2")" >"$AGENT_STATE/ecart-$1"
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
# True (0) when the model is excluded right now. Also reads the old muet-<model>
|
|
66
|
-
# format (timestamp only, 1 h).
|
|
67
|
-
model_excluded() {
|
|
68
|
-
local f e cause d
|
|
69
|
-
f="$AGENT_STATE/ecart-$1"
|
|
70
|
-
if [ ! -f "$f" ]; then f="$AGENT_STATE/muet-$1"; fi
|
|
71
|
-
if [ ! -f "$f" ]; then return 1; fi
|
|
72
|
-
read -r e cause d <<<"$(cat "$f")"
|
|
73
|
-
[ "$(date +%s)" -lt $(( e + ${d:-3600} )) ]
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
# True (0) when opencode.ai resolves and answers over HTTPS: one try, no wait.
|
|
77
|
-
network_reachable() {
|
|
78
|
-
getent hosts opencode.ai >/dev/null 2>&1 && curl -sI --max-time 5 https://opencode.ai >/dev/null 2>&1
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# Waits for the network to come back: a try every DEVZONE_AGENT_NETWORK_STEP s, for
|
|
82
|
-
# DEVZONE_AGENT_NETWORK_MAX s at most. Returns 0 when it is back.
|
|
83
|
-
network_wait() {
|
|
84
|
-
local end
|
|
85
|
-
end=$(( $(date +%s) + ${DEVZONE_AGENT_NETWORK_MAX:-1800} ))
|
|
86
|
-
echo "=== network down, waiting" >>"$AGENT_JOURNAL"
|
|
87
|
-
while [ "$(date +%s)" -lt "$end" ]; do
|
|
88
|
-
if network_reachable; then
|
|
89
|
-
echo "=== network back" >>"$AGENT_JOURNAL"
|
|
90
|
-
return 0
|
|
91
|
-
fi
|
|
92
|
-
sleep "${DEVZONE_AGENT_NETWORK_STEP:-30}"
|
|
93
|
-
done
|
|
94
|
-
return 1
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
# Lists the current exclusions for devzone agent state (muet- too, without cause).
|
|
98
|
-
agent_exclusions() {
|
|
99
|
-
local f m e cause d end now
|
|
100
|
-
now="$(date +%s)"
|
|
101
|
-
for f in "$AGENT_STATE"/ecart-*; do
|
|
102
|
-
[ -e "$f" ] || continue
|
|
103
|
-
m="${f##*/ecart-}"
|
|
104
|
-
read -r e cause d <<<"$(cat "$f")"
|
|
105
|
-
end=$(( e + ${d:-3600} ))
|
|
106
|
-
[ "$now" -lt "$end" ] || continue
|
|
107
|
-
echo " model $m excluded ($(cause_label "$cause")) until $(utc_time "$end")"
|
|
108
|
-
done
|
|
109
|
-
for f in "$AGENT_STATE"/muet-*; do
|
|
110
|
-
[ -e "$f" ] || continue
|
|
111
|
-
m="${f##*/muet-}"
|
|
112
|
-
e="$(cat "$f" 2>/dev/null || true)"
|
|
113
|
-
[ -n "$e" ] || continue
|
|
114
|
-
end=$(( e + 3600 ))
|
|
115
|
-
[ "$now" -lt "$end" ] || continue
|
|
116
|
-
echo " model $m excluded (silent) until $(utc_time "$end")"
|
|
117
|
-
done
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
# Lifts the exclusion of a model, or of all (--all): devzone agent release.
|
|
121
|
-
exclusion_clear() {
|
|
122
|
-
case "$1" in
|
|
123
|
-
--all) rm -f "$AGENT_STATE"/ecart-* "$AGENT_STATE"/muet-* ;;
|
|
124
|
-
*) rm -f "$AGENT_STATE/ecart-$1" "$AGENT_STATE/muet-$1" ;;
|
|
125
|
-
esac
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
# Keeps the opencode log lines of the session written by --print-logs: only the
|
|
129
|
-
# "timestamp=... level=ERROR ..." lines of a failure declare an exclusion, not the
|
|
130
|
-
# rest of the text read or written by the model.
|
|
131
|
-
# Errors from the title model (agent=title) are ignored, as they say nothing about
|
|
132
|
-
# the model that is working.
|
|
133
|
-
error_lines() {
|
|
134
|
-
printf '%s\n' "$1" | sed -e $'s/\033\[[0-9;]*m//g' | grep -a -E '^timestamp=.* level=ERROR ' | grep -a -v ' agent=title ' || true
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
# Stops the current session when the journal holds quota, country or filter since
|
|
138
|
-
# its start: the model is excluded and the session is killed (process and children).
|
|
139
|
-
session_fatal_error() {
|
|
140
|
-
local pid="$1" journal="$2" offset="$3" m="$4" folder="$5"
|
|
141
|
-
local output cause
|
|
142
|
-
output="$(tail -c "+$(( offset + 1 ))" "$journal" 2>/dev/null || true)"
|
|
143
|
-
cause="$(error_cause "$(error_lines "$output")")"
|
|
144
|
-
case "$cause" in
|
|
145
|
-
quota | pays | filtre) ;;
|
|
146
|
-
*) return 1 ;;
|
|
147
|
-
esac
|
|
148
|
-
pkill -P "$pid" 2>/dev/null || true
|
|
149
|
-
kill "$pid" 2>/dev/null || true
|
|
150
|
-
wait "$pid" 2>/dev/null || true
|
|
151
|
-
rights_verify "$folder"
|
|
152
|
-
model_exclude "$m" "$cause"
|
|
153
|
-
model_requested_excluded "$m" "$cause" "$journal"
|
|
154
|
-
printf '%s\n' "=== opencode/$m excluded ($(cause_label "$cause")): next model" >>"$journal"
|
|
155
|
-
return 0
|
|
156
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Local model in the rotation of devzone agent (#586), sourced by agent.sh.
|
|
3
|
-
# The local slot is the host model when Ollama answers /api/tags with at least
|
|
4
|
-
# one model (reference devzone-host/<model>). It always comes after every online
|
|
5
|
-
# model; its internal name has no slash (an ecart-<name> file is written for it);
|
|
6
|
-
# opencode gets the reference.
|
|
7
|
-
# Real host model name (Ollama) chosen for this attempt, empty otherwise.
|
|
8
|
-
LOCAL_HOST_REAL=""
|
|
9
|
-
# Internal (slash-free) name of the host model chosen for this attempt.
|
|
10
|
-
LOCAL_HOST_INTERNAL=""
|
|
11
|
-
|
|
12
|
-
# shellcheck source=SCRIPTDIR/ai/host-models.sh
|
|
13
|
-
# shellcheck disable=SC1091
|
|
14
|
-
. "$ICI/ai/host-models.sh"
|
|
15
|
-
|
|
16
|
-
# Sanitizes a model name into an internal name: every character outside
|
|
17
|
-
# [A-Za-z0-9._-] becomes '_'. Used for ecart-<name> files, the journal and
|
|
18
|
-
# the rotation, so a host model such as hf.co/org/model:tag never creates a
|
|
19
|
-
# nested or invalid path.
|
|
20
|
-
internal_name() {
|
|
21
|
-
printf '%s' "$1" | sed 's/[^A-Za-z0-9._-]/_/g'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
# Sets LOCAL_MODEL for this attempt, read by model_at_rank and
|
|
25
|
-
# models_total. Also records the real host model name when the host is chosen.
|
|
26
|
-
local_charge() {
|
|
27
|
-
local nom
|
|
28
|
-
LOCAL_MODEL=""
|
|
29
|
-
LOCAL_HOST_REAL=""
|
|
30
|
-
LOCAL_HOST_INTERNAL=""
|
|
31
|
-
nom="$(premier 2>/dev/null || true)"
|
|
32
|
-
[ -n "$nom" ] || return 0
|
|
33
|
-
LOCAL_HOST_REAL="$nom"
|
|
34
|
-
LOCAL_HOST_INTERNAL="$(internal_name "$nom")"
|
|
35
|
-
LOCAL_MODEL="$LOCAL_HOST_INTERNAL"
|
|
36
|
-
return 0
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# Model reference given to opencode -m
|
|
40
|
-
model_ref() {
|
|
41
|
-
if [ -n "$LOCAL_HOST_INTERNAL" ] && [ "$1" = "$LOCAL_HOST_INTERNAL" ]; then
|
|
42
|
-
echo "devzone-host/$LOCAL_HOST_REAL"
|
|
43
|
-
else
|
|
44
|
-
echo "opencode/$1"
|
|
45
|
-
fi
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# Model of rank $1 in the attempt that starts at $2: online ones in rotation,
|
|
49
|
-
# then the local host model
|
|
50
|
-
model_at_rank() {
|
|
51
|
-
if [ "$1" -lt "${#FREE_MODELS[@]}" ]; then
|
|
52
|
-
echo "${FREE_MODELS[$(( ($2 + $1) % ${#FREE_MODELS[@]} ))]}"
|
|
53
|
-
else
|
|
54
|
-
echo "$LOCAL_MODEL"
|
|
55
|
-
fi
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# Number of models to try: the online ones, plus the local host model if ready
|
|
59
|
-
models_total() {
|
|
60
|
-
local total="${#FREE_MODELS[@]}"
|
|
61
|
-
[ -n "$LOCAL_MODEL" ] && total=$((total + 1))
|
|
62
|
-
echo "$total"
|
|
63
|
-
}
|