devzone 1.1.0 → 3.0.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/Dockerfile +4 -4
- package/.devcontainer/{agent-erreurs.sh → agent-errors.sh} +6 -6
- package/.devcontainer/agent-local.sh +2 -2
- package/.devcontainer/{agent-modele.messages → agent-model.messages} +1 -1
- package/.devcontainer/{agent-modele.sh → agent-model.sh} +5 -5
- package/.devcontainer/agent-pod-manifest.sh +4 -4
- package/.devcontainer/{agent-droits.sh → agent-rights.sh} +2 -2
- package/.devcontainer/agent-session.sh +3 -3
- package/.devcontainer/{agent-etat-json.sh → agent-state-json.sh} +6 -6
- package/.devcontainer/agent-workspace.sh +1 -1
- package/.devcontainer/agent.sh +14 -14
- package/.devcontainer/{ia/docker-garde.sh → ai/docker-guard.sh} +1 -1
- package/.devcontainer/{ia → ai}/host-models.sh +2 -2
- package/.devcontainer/{ia/plugins/devzone-garde-v2.js → ai/plugins/devzone-guard-v2.js} +7 -7
- package/.devcontainer/{ia/plugins/devzone-garde.js → ai/plugins/devzone-guard.js} +6 -6
- package/.devcontainer/argocd/argocd.sh +94 -93
- package/.devcontainer/argocd/{catalogue-argocd.sh → catalog-argocd.sh} +3 -3
- package/.devcontainer/argocd/services-hook.sh +8 -8
- package/.devcontainer/argocd/services.sh +1 -1
- package/.devcontainer/catalog/app.sh +209 -0
- package/.devcontainer/catalog/catalog-watcher.sh +130 -0
- package/.devcontainer/{catalogue → catalog}/mysql/app.conf +1 -1
- package/.devcontainer/catalog/mysql/install.sh +87 -0
- package/.devcontainer/catalog/mysql/mysql.sh +262 -0
- package/.devcontainer/catalog/mysql/volume.sh +71 -0
- package/.devcontainer/catalog.sh +231 -0
- package/.devcontainer/chart-direct.sh +1 -1
- package/.devcontainer/cluster.sh +222 -224
- package/.devcontainer/clusters.sh +41 -41
- package/.devcontainer/devcontainer.json +1 -1
- package/.devcontainer/devzone +103 -1506
- package/.devcontainer/devzone-ai-guard.sh +76 -0
- package/.devcontainer/devzone-ai.sh +201 -0
- package/.devcontainer/devzone-cluster.sh +210 -0
- package/.devcontainer/devzone-modules.sh +126 -0
- package/.devcontainer/devzone-platform.sh +189 -0
- package/.devcontainer/devzone-repair.sh +94 -0
- package/.devcontainer/devzone-services.sh +241 -0
- package/.devcontainer/devzone-skill.sh +97 -0
- package/.devcontainer/devzone-status.sh +140 -0
- package/.devcontainer/devzone-version.sh +78 -0
- package/.devcontainer/git-identity.sh +28 -0
- package/.devcontainer/gitlab/argocd.sh +2 -2
- package/.devcontainer/gitlab/chart.sh +2 -2
- package/.devcontainer/gitlab/gitlab.sh +83 -84
- package/.devcontainer/gitlab/installation.sh +111 -111
- package/.devcontainer/gitlab/secrets.sh +47 -47
- package/.devcontainer/gitlab/seed.sh +77 -77
- package/.devcontainer/gitlab/test-gitlab.sh +242 -243
- package/.devcontainer/help.sh +1 -1
- package/.devcontainer/isolation.sh +65 -0
- package/.devcontainer/kind-wrapper.sh +45 -0
- package/.devcontainer/kube-account.sh +199 -0
- package/.devcontainer/kube-config.sh +45 -46
- package/.devcontainer/{invite-kube.sh → kube-prompt.sh} +6 -6
- package/.devcontainer/kube-reachable.sh +64 -0
- package/.devcontainer/{memoire.sh → memory.sh} +1 -1
- package/.devcontainer/metrics-server.sh +2 -2
- package/.devcontainer/opencode.jsonc +2 -2
- package/.devcontainer/packages.sh +228 -0
- package/.devcontainer/password.sh +1 -1
- package/.devcontainer/ports-auto.sh +152 -153
- package/.devcontainer/ports-json.sh +16 -15
- package/.devcontainer/ports.sh +127 -123
- package/.devcontainer/post-create.sh +52 -52
- package/.devcontainer/postgres/postgres.sh +176 -176
- package/.devcontainer/rename-legacy-files.sh +103 -0
- package/.devcontainer/services-admin.sh +5 -5
- package/.devcontainer/skills/devzone/SKILL.md +40 -41
- package/.devcontainer/startup.sh +65 -0
- package/.devcontainer/{etat-gitops.sh → state-gitops.sh} +1 -1
- package/.devcontainer/{etat-json.sh → state-json.sh} +39 -65
- package/.devcontainer/{etat-verrou.sh → state-lock.sh} +1 -1
- package/.devcontainer/{etat.sh → state.sh} +4 -4
- package/.devcontainer/workspace-init.sh +17 -3
- package/Makefile +8 -8
- package/README.md +195 -194
- package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
- package/manage/devzone +8 -10
- package/manage/scripts/argocd-workspace.sh +1 -1
- package/manage/scripts/check-go-layout.sh +40 -0
- package/manage/scripts/check-names.sh +61 -0
- package/manage/scripts/create-cluster.sh +1 -1
- package/manage/scripts/create-mode.sh +2 -2
- package/manage/scripts/devzone-create.sh +5 -5
- package/manage/scripts/devzone-manifest.sh +3 -3
- package/manage/scripts/devzone-update.sh +12 -8
- package/manage/scripts/docker-workstation.sh +2 -2
- package/manage/scripts/docker.sh +2 -2
- package/manage/scripts/{lancer.sh → launch.sh} +10 -51
- package/manage/scripts/{migrer-retour.sh → migrate-revert.sh} +4 -4
- package/manage/scripts/{migrer.sh → migrate.sh} +8 -14
- package/manage/scripts/ports-apps.sh +1 -1
- package/manage/scripts/ports-workspace.sh +7 -7
- package/manage/scripts/{desinstaller.sh → uninstall.sh} +8 -8
- package/manage/scripts/workspace-egress.sh +2 -2
- package/manage/scripts/workspace-update.sh +5 -2
- package/manage/scripts/workspace-wait.sh +2 -2
- package/manage/workspace.sh +4 -4
- package/package.json +1 -1
- package/.devcontainer/catalogue/app.sh +0 -211
- package/.devcontainer/catalogue/catalogue-veilleur.sh +0 -130
- package/.devcontainer/catalogue/mysql/installer.sh +0 -87
- package/.devcontainer/catalogue/mysql/mysql.sh +0 -262
- package/.devcontainer/catalogue/mysql/volume.sh +0 -71
- package/.devcontainer/catalogue.sh +0 -231
- package/.devcontainer/demarrage.sh +0 -66
- package/.devcontainer/docker-relais.sh +0 -149
- package/.devcontainer/docker-sans-hote.sh +0 -12
- package/.devcontainer/git-identite.sh +0 -28
- package/.devcontainer/isolement.sh +0 -65
- package/.devcontainer/kind-enveloppe.sh +0 -45
- package/.devcontainer/kube-compte.sh +0 -200
- package/.devcontainer/kube-joignable.sh +0 -64
- package/.devcontainer/paquets.sh +0 -227
- /package/.devcontainer/{ia/docker-garde.message → ai/docker-guard.message} +0 -0
- /package/.devcontainer/{ia → ai}/host-check.message +0 -0
- /package/.devcontainer/{ia → ai}/host-check.sh +0 -0
package/.devcontainer/Dockerfile
CHANGED
|
@@ -108,10 +108,10 @@ RUN set -eu; \
|
|
|
108
108
|
rm -rf "$tmp"
|
|
109
109
|
|
|
110
110
|
# kind passe par une enveloppe (#291) : avec le Docker de l'hôte, un cluster
|
|
111
|
-
# créé à la main doit être rendu joignable depuis le conteneur (kube-
|
|
112
|
-
COPY kube-
|
|
113
|
-
COPY kind-
|
|
114
|
-
RUN chmod 0644 /usr/local/lib/devzone/kube-
|
|
111
|
+
# créé à la main doit être rendu joignable depuis le conteneur (kube-reachable.sh)
|
|
112
|
+
COPY kube-reachable.sh /usr/local/lib/devzone/kube-reachable.sh
|
|
113
|
+
COPY kind-wrapper.sh /usr/local/bin/kind
|
|
114
|
+
RUN chmod 0644 /usr/local/lib/devzone/kube-reachable.sh && chmod 0755 /usr/local/bin/kind
|
|
115
115
|
|
|
116
116
|
COPY --from=uv /uv /uvx /usr/local/bin/
|
|
117
117
|
|
|
@@ -35,10 +35,10 @@ cause_label() {
|
|
|
35
35
|
esac
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
# Duration of an exclusion in seconds: country 7 days (
|
|
38
|
+
# Duration of an exclusion in seconds: country 7 days (DEVZONE_AGENT_COUNTRY_EXCLUSION), the others 1 h.
|
|
39
39
|
exclusion_duration() {
|
|
40
40
|
case "$1" in
|
|
41
|
-
pays) echo "${
|
|
41
|
+
pays) echo "${DEVZONE_AGENT_COUNTRY_EXCLUSION:-604800}" ;;
|
|
42
42
|
*) echo 3600 ;;
|
|
43
43
|
esac
|
|
44
44
|
}
|
|
@@ -78,18 +78,18 @@ network_reachable() {
|
|
|
78
78
|
getent hosts opencode.ai >/dev/null 2>&1 && curl -sI --max-time 5 https://opencode.ai >/dev/null 2>&1
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
# Waits for the network to come back: a try every
|
|
82
|
-
#
|
|
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
83
|
network_wait() {
|
|
84
84
|
local end
|
|
85
|
-
end=$(( $(date +%s) + ${
|
|
85
|
+
end=$(( $(date +%s) + ${DEVZONE_AGENT_NETWORK_MAX:-1800} ))
|
|
86
86
|
echo "=== network down, waiting" >>"$AGENT_JOURNAL"
|
|
87
87
|
while [ "$(date +%s)" -lt "$end" ]; do
|
|
88
88
|
if network_reachable; then
|
|
89
89
|
echo "=== network back" >>"$AGENT_JOURNAL"
|
|
90
90
|
return 0
|
|
91
91
|
fi
|
|
92
|
-
sleep "${
|
|
92
|
+
sleep "${DEVZONE_AGENT_NETWORK_STEP:-30}"
|
|
93
93
|
done
|
|
94
94
|
return 1
|
|
95
95
|
}
|
|
@@ -9,9 +9,9 @@ LOCAL_HOTE_REEL=""
|
|
|
9
9
|
# Internal (slash-free) name of the host model chosen for this attempt.
|
|
10
10
|
LOCAL_HOTE_INTERNE=""
|
|
11
11
|
|
|
12
|
-
# shellcheck source=SCRIPTDIR/
|
|
12
|
+
# shellcheck source=SCRIPTDIR/ai/host-models.sh
|
|
13
13
|
# shellcheck disable=SC1091
|
|
14
|
-
. "$ICI/
|
|
14
|
+
. "$ICI/ai/host-models.sh"
|
|
15
15
|
|
|
16
16
|
# Sanitizes a model name into an internal name: every character outside
|
|
17
17
|
# [A-Za-z0-9._-] becomes '_'. Used for ecart-<name> files, the journal and
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Messages of devzone agent --modele (#420), in French like the journal they go to.
|
|
2
|
-
# Sourced by agent-
|
|
2
|
+
# Sourced by agent-model.sh. Kept out of .english on purpose: the accents are
|
|
3
3
|
# the point. Each %s is replaced by a model name or a cause (printf formats).
|
|
4
4
|
MSG_AUCUN_MODELE='aucun modèle gratuit disponible'
|
|
5
5
|
MSG_CHOISI='=== modèle choisi : %s (demandé)'
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# Library sourced by agent.sh: no command is launched here.
|
|
5
5
|
|
|
6
6
|
# Journal and refusal texts (French), printf formats.
|
|
7
|
-
# shellcheck source=SCRIPTDIR/agent-
|
|
8
|
-
. "$ICI/agent-
|
|
7
|
+
# shellcheck source=SCRIPTDIR/agent-model.messages disable=SC1091
|
|
8
|
+
. "$ICI/agent-model.messages"
|
|
9
9
|
|
|
10
10
|
# Option --modele as typed (comma-separated list), empty when absent.
|
|
11
11
|
MODELE_LISTE=""
|
|
@@ -16,7 +16,7 @@ ORDRE=()
|
|
|
16
16
|
|
|
17
17
|
# Refuses a name missing from the free models: nothing is launched (code 2).
|
|
18
18
|
refuse_modele() {
|
|
19
|
-
# shellcheck disable=SC2059 # the format comes from agent-
|
|
19
|
+
# shellcheck disable=SC2059 # the format comes from agent-model.messages
|
|
20
20
|
printf "$MSG_INCONNU\n" "$1" >&2
|
|
21
21
|
printf ' %s\n' "${FREE_MODELS[@]}" >&2
|
|
22
22
|
exit 2
|
|
@@ -54,7 +54,7 @@ modele_demande_p() {
|
|
|
54
54
|
# Journal line when requested model $1 starts; other models get no line.
|
|
55
55
|
modele_demande_choisi() {
|
|
56
56
|
if modele_demande_p "$1"; then
|
|
57
|
-
# shellcheck disable=SC2059 # the format comes from agent-
|
|
57
|
+
# shellcheck disable=SC2059 # the format comes from agent-model.messages
|
|
58
58
|
printf "$MSG_CHOISI\n" "$1" >>"$2"
|
|
59
59
|
fi
|
|
60
60
|
}
|
|
@@ -63,7 +63,7 @@ modele_demande_choisi() {
|
|
|
63
63
|
# journal $3. Other models keep their own lines.
|
|
64
64
|
modele_demande_ecart() {
|
|
65
65
|
if modele_demande_p "$1"; then
|
|
66
|
-
# shellcheck disable=SC2059 # the format comes from agent-
|
|
66
|
+
# shellcheck disable=SC2059 # the format comes from agent-model.messages
|
|
67
67
|
printf "$MSG_ECARTE\n" "$1" "$2" >>"$3"
|
|
68
68
|
fi
|
|
69
69
|
}
|
|
@@ -12,8 +12,8 @@ DEVZONE_AGENT_POD_CPU_LIMIT="${DEVZONE_AGENT_POD_CPU_LIMIT:-2}"
|
|
|
12
12
|
DEVZONE_AGENT_POD_MEM_LIMIT="${DEVZONE_AGENT_POD_MEM_LIMIT:-4Gi}"
|
|
13
13
|
DEVZONE_AGENT_POD_TIMEOUT="${DEVZONE_AGENT_POD_TIMEOUT:-$((DEVZONE_AGENT_POD_ACTIVE_DEADLINE_SECONDS + 120))}"
|
|
14
14
|
# Projects root, read by the launcher only (no trailing slash). The pod keeps
|
|
15
|
-
# /workspaces/projets in its own environment (
|
|
16
|
-
AGENT_POD_ROOT="${
|
|
15
|
+
# /workspaces/projets in its own environment (DEVZONE_ROOT in the manifest).
|
|
16
|
+
AGENT_POD_ROOT="${DEVZONE_ROOT:-/workspaces/projets}"
|
|
17
17
|
# Module state file on the workspace volume (subPath .devzone.modules, read-only in the pod).
|
|
18
18
|
# shellcheck disable=SC2034 # read by agent-pod.sh
|
|
19
19
|
AGENT_POD_MODULES_FILE="${DEVZONE_AGENT_POD_MODULES_FILE:-${AGENT_POD_ROOT}/.devzone.modules}"
|
|
@@ -193,7 +193,7 @@ agent_pod_build_manifest() {
|
|
|
193
193
|
printf '%s\n' " value: \"${ws_path}\""
|
|
194
194
|
printf '%s\n' " - name: DEVZONE_WORKSPACE"
|
|
195
195
|
printf '%s\n' " value: \"kubernetes\""
|
|
196
|
-
printf '%s\n' " - name:
|
|
196
|
+
printf '%s\n' " - name: DEVZONE_ROOT"
|
|
197
197
|
printf '%s\n' " value: \"/workspaces/projets\""; agent_pod_egress_manifest_lines "$egress_mode"
|
|
198
198
|
printf '%s\n' " resources:"
|
|
199
199
|
printf '%s\n' " limits:"
|
|
@@ -230,7 +230,7 @@ agent_pod_build_manifest() {
|
|
|
230
230
|
printf '%s\n' " mountPath: /workspaces/projets/workspace"
|
|
231
231
|
printf '%s\n' " command: [\"/bin/bash\", \"-lc\"]"
|
|
232
232
|
printf '%s\n' " args:"
|
|
233
|
-
printf '%s\n' " - 'devzone agent --local ${folder} /agent-consigne/consigne.md; code=\$?; cat \"\$
|
|
233
|
+
printf '%s\n' " - 'devzone agent --local ${folder} /agent-consigne/consigne.md; code=\$?; cat \"\$DEVZONE_ROOT/workspace/.agents/${AGENT_POD_SESSION_LABEL}.log\" 2>/dev/null; exit \$code'"
|
|
234
234
|
printf '%s\n' " volumes:"
|
|
235
235
|
printf '%s\n' " - name: workspace"
|
|
236
236
|
printf '%s\n' " persistentVolumeClaim:"
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
# Fichiers de droits, chemins relatifs à la racine du dossier de travail. Liste
|
|
6
6
|
# fixe : aucune variable d'environnement ne la change, un agent peut en poser.
|
|
7
|
-
# agent-
|
|
7
|
+
# agent-rights.sh y figure, sinon un agent pourrait vider la liste.
|
|
8
8
|
DROITS_AGENT=(
|
|
9
9
|
.devcontainer/opencode/agent.json
|
|
10
10
|
.devcontainer/opencode.jsonc
|
|
11
11
|
.repowarden.conf
|
|
12
|
-
.devcontainer/agent-
|
|
12
|
+
.devcontainer/agent-rights.sh
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
# Dossier de la photo des droits d'un projet, dans l'état de l'agent.
|
|
@@ -47,7 +47,7 @@ lock_trace() {
|
|
|
47
47
|
# which of the two launches succeeded in mkdir.
|
|
48
48
|
lock_take() {
|
|
49
49
|
local end age lock_pid
|
|
50
|
-
end=$(( $(date +%s) + ${
|
|
50
|
+
end=$(( $(date +%s) + ${DEVZONE_AGENT_LOCK_MAX:-10} ))
|
|
51
51
|
while ! mkdir "$AGENT_ETAT/verrou" 2>/dev/null; do
|
|
52
52
|
# A lock is orphaned only by its age: the rank is held for a few milliseconds,
|
|
53
53
|
# 30 s can only be a stop to take over; otherwise wait, then give up (code 1).
|
|
@@ -73,7 +73,7 @@ lock_take() {
|
|
|
73
73
|
if command -v flock >/dev/null 2>&1; then
|
|
74
74
|
# exec in an if makes a failure a condition instead of killing the shell
|
|
75
75
|
# (bash 3.2 and GNU alike); without flock, mkdir remains the only guard (macOS).
|
|
76
|
-
if { exec 9>"$AGENT_ETAT/rang.lock"; } && flock -w "${
|
|
76
|
+
if { exec 9>"$AGENT_ETAT/rang.lock"; } && flock -w "${DEVZONE_AGENT_LOCK_MAX:-10}" 9; then
|
|
77
77
|
AGENT_LOCK_FLOCK=1
|
|
78
78
|
else
|
|
79
79
|
lock_release
|
|
@@ -138,7 +138,7 @@ rights_edit_deny() {
|
|
|
138
138
|
# out of the merge, then added back at the end (the key order of a jq object is the
|
|
139
139
|
# insertion order), so the caller can add permissions but never remove a devzone deny.
|
|
140
140
|
# ~/bash32 is always protected: the container's bash 3.2 was already replaced by a
|
|
141
|
-
# link (#210). The name configurer is kept: agent-
|
|
141
|
+
# link (#210). The name configurer is kept: agent-rights-gh.bats calls it.
|
|
142
142
|
configurer() {
|
|
143
143
|
local def config
|
|
144
144
|
def="$ICI/opencode/agent.json"
|
|
@@ -14,19 +14,19 @@ while [ -L "$SOURCE" ]; do
|
|
|
14
14
|
esac
|
|
15
15
|
done
|
|
16
16
|
ICI="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
17
|
-
RACINE="${
|
|
17
|
+
RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
|
|
18
18
|
|
|
19
|
-
# shellcheck source=agent-
|
|
19
|
+
# shellcheck source=agent-errors.sh
|
|
20
20
|
# shellcheck disable=SC1091
|
|
21
|
-
. "$ICI/agent-
|
|
22
|
-
# shellcheck source=agent-
|
|
21
|
+
. "$ICI/agent-errors.sh"
|
|
22
|
+
# shellcheck source=agent-rights.sh
|
|
23
23
|
# shellcheck disable=SC1091
|
|
24
|
-
. "$ICI/agent-
|
|
24
|
+
. "$ICI/agent-rights.sh"
|
|
25
25
|
# shellcheck source=agent-session.sh
|
|
26
26
|
# shellcheck disable=SC1091
|
|
27
27
|
. "$ICI/agent-session.sh"
|
|
28
28
|
|
|
29
|
-
AGENT_ETAT="${
|
|
29
|
+
AGENT_ETAT="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
|
|
30
30
|
|
|
31
31
|
# UTC ISO-8601 date of an epoch, GNU then BSD date: the fin field of the exclusions.
|
|
32
32
|
iso() {
|
|
@@ -73,7 +73,7 @@ agent_workspace() {
|
|
|
73
73
|
echo "devzone agent: Kubernetes workspace (pod devzone-workspace-0, $in_pod); --local for the container"
|
|
74
74
|
agent_kc cp "$brief" "devzone-workspace-0:/tmp/devzone-agent-$name.md" -c workspace
|
|
75
75
|
# shellcheck disable=SC2016 # the pod shell expands MODEL_OPT, not this one
|
|
76
|
-
agent_kc exec devzone-workspace-0 -c workspace -- env
|
|
76
|
+
agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_ROOT="$pod_root" MODEL_OPT="$MODELE_LISTE" bash -lc 'devzone agent ${MODEL_OPT:+--modele "$MODEL_OPT"} "$1" "$2"' _ "$in_pod" "/tmp/devzone-agent-$name.md" || code=$?
|
|
77
77
|
journal="$(journal_of "$name")"
|
|
78
78
|
mkdir -p "$(dirname "$journal")"
|
|
79
79
|
if ! agent_kc exec devzone-workspace-0 -c workspace -- cat "$pod_root/workspace/.agents/$name.log" >>"$journal"; then
|
package/.devcontainer/agent.sh
CHANGED
|
@@ -15,31 +15,31 @@ while [ -L "$SOURCE" ]; do
|
|
|
15
15
|
esac
|
|
16
16
|
done
|
|
17
17
|
ICI="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
18
|
-
RACINE="${
|
|
19
|
-
# shellcheck source=agent-
|
|
20
|
-
. "$ICI/agent-
|
|
21
|
-
# shellcheck source=agent-
|
|
22
|
-
. "$ICI/agent-
|
|
18
|
+
RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
|
|
19
|
+
# shellcheck source=agent-errors.sh disable=SC1091
|
|
20
|
+
. "$ICI/agent-errors.sh"
|
|
21
|
+
# shellcheck source=agent-rights.sh disable=SC1091
|
|
22
|
+
. "$ICI/agent-rights.sh"
|
|
23
23
|
# shellcheck source=SCRIPTDIR/agent-session.sh disable=SC1091
|
|
24
24
|
. "$ICI/agent-session.sh"
|
|
25
25
|
# shellcheck source=agent-workspace.sh disable=SC1091
|
|
26
26
|
. "$ICI/agent-workspace.sh"
|
|
27
27
|
# shellcheck source=agent-local.sh disable=SC1091
|
|
28
28
|
. "$ICI/agent-local.sh"
|
|
29
|
-
# shellcheck source=SCRIPTDIR/agent-
|
|
30
|
-
. "$ICI/agent-
|
|
29
|
+
# shellcheck source=SCRIPTDIR/agent-model.sh disable=SC1091
|
|
30
|
+
. "$ICI/agent-model.sh"
|
|
31
31
|
FREE_MODELS=(big-pickle deepseek-v4.1-flash-free hy4-flash-free nemotron-3.5-super-vl-free
|
|
32
32
|
nemotron-3.5-lightning-free mimo-v2.6-flash-free beam-free flint-40b-free longcat-2.5-free)
|
|
33
33
|
# Session pod ephemere (#222)
|
|
34
34
|
# shellcheck source=agent-pod.sh disable=SC1091
|
|
35
35
|
. "$ICI/agent-pod.sh"
|
|
36
36
|
SILENCE="${DEVZONE_AGENT_SILENCE:-45}"
|
|
37
|
-
FROZEN="${
|
|
38
|
-
AGENT_ETAT="${
|
|
37
|
+
FROZEN="${DEVZONE_AGENT_FROZEN:-600}"
|
|
38
|
+
AGENT_ETAT="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
|
|
39
39
|
# Pause between read and write of the rank (tests only): active only when
|
|
40
|
-
#
|
|
40
|
+
# DEVZONE_AGENT_PAUSE_RANK is set under bats; never a pause by default.
|
|
41
41
|
PAUSE_RANK=0
|
|
42
|
-
if [ -n "${
|
|
42
|
+
if [ -n "${DEVZONE_AGENT_PAUSE_RANK:-}" ] && [ -n "${BATS_TEST_TMPDIR:-}" ]; then PAUSE_RANK="$DEVZONE_AGENT_PAUSE_RANK"; fi
|
|
43
43
|
# Retries of the same session for a network cause, per model, before the next model
|
|
44
44
|
NETWORK_RETRIES=3
|
|
45
45
|
refuse() { echo "devzone agent: $*" >&2; exit 2; }
|
|
@@ -104,7 +104,7 @@ agent_launch() {
|
|
|
104
104
|
if [ "$(error_cause "$(error_lines "$new")")" != "quota" ]; then started=1; break; fi
|
|
105
105
|
fi
|
|
106
106
|
if [ $(( $(date +%s) - start_t )) -ge "$SILENCE" ]; then break; fi
|
|
107
|
-
sleep "${
|
|
107
|
+
sleep "${DEVZONE_AGENT_STEP:-1}"
|
|
108
108
|
done
|
|
109
109
|
if [ "$discard" = 1 ]; then resume; i=$(( i + 1 )); continue; fi
|
|
110
110
|
if kill -0 "$pid" 2>/dev/null && [ "$started" = 0 ]; then
|
|
@@ -127,7 +127,7 @@ agent_launch() {
|
|
|
127
127
|
size="$(wc -c <"$journal")"
|
|
128
128
|
while kill -0 "$pid" 2>/dev/null; do
|
|
129
129
|
if session_fatal_error "$pid" "$journal" "$offset" "$m" "$folder"; then discard=1; break; fi
|
|
130
|
-
sleep "${
|
|
130
|
+
sleep "${DEVZONE_AGENT_STEP:-1}"
|
|
131
131
|
now="$(date +%s)"
|
|
132
132
|
if [ "$(wc -c <"$journal")" -gt "$size" ]; then
|
|
133
133
|
size="$(wc -c <"$journal")"
|
|
@@ -207,7 +207,7 @@ agent_launch() {
|
|
|
207
207
|
}
|
|
208
208
|
case "${1:-}" in
|
|
209
209
|
status) agent_pod_status ;;
|
|
210
|
-
etat) if [ "${2:-}" = "--json" ]; then exec bash "$ICI/agent-
|
|
210
|
+
etat) if [ "${2:-}" = "--json" ]; then exec bash "$ICI/agent-state-json.sh"; else agent_state; fi ;;
|
|
211
211
|
liberer)
|
|
212
212
|
[ -n "${2:-}" ] || { agent_aide >&2; exit 2; }
|
|
213
213
|
exclusion_clear "$2"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
set -u
|
|
10
10
|
|
|
11
11
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
-
MESSAGE_FILE="$SCRIPT_DIR/docker-
|
|
12
|
+
MESSAGE_FILE="$SCRIPT_DIR/docker-guard.message"
|
|
13
13
|
FALLBACK="devzone is Kubernetes-first: only pods are containers. Use kubectl, or a throwaway pod or namespace. Host action: set DEVZONE_ALLOW_DOCKER to 1."
|
|
14
14
|
MESSAGE="$FALLBACK"
|
|
15
15
|
if [ -r "$MESSAGE_FILE" ]; then
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# host-models.sh check update check of each model (delegates to host-check.sh)
|
|
10
10
|
# host-models.sh rapport report (delegates to host-check.sh)
|
|
11
11
|
# Default URL: http://host.docker.internal:11434, overridable with DEVZONE_OLLAMA_URL.
|
|
12
|
-
# Measurements:
|
|
12
|
+
# Measurements: DEVZONE_AI_MEASURES, else ~/.config/devzone/ia-mesures.json
|
|
13
13
|
# ({"<model>": {"reussite": 0..1, "tok_s": n, "date": "..."}}).
|
|
14
14
|
# Short timeout; exits 0 and writes nothing when Ollama does not answer.
|
|
15
15
|
# bash 3.2 (macOS). Code and comments in English.
|
|
@@ -18,7 +18,7 @@ set -euo pipefail
|
|
|
18
18
|
URL="${DEVZONE_OLLAMA_URL:-http://host.docker.internal:11434}"
|
|
19
19
|
URL="${URL%/}"
|
|
20
20
|
FILE="$HOME/.config/opencode/config.json"
|
|
21
|
-
MESURES="${
|
|
21
|
+
MESURES="${DEVZONE_AI_MEASURES:-$HOME/.config/devzone/ia-mesures.json}"
|
|
22
22
|
|
|
23
23
|
# True when a model is an embedding model (Ollama details.type, or a name
|
|
24
24
|
# containing "embed", case-insensitive).
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// Guard for opencode 2.x: blocks Docker commands in devzone (Kubernetes-first).
|
|
2
|
-
// Each shell tool call is checked by docker-
|
|
2
|
+
// Each shell tool call is checked by docker-guard.sh. Exit code 2: error shown
|
|
3
3
|
// to the agent with stderr message. Script absent or failing: nothing blocked.
|
|
4
4
|
// The installed copy (devzone enable ia) replaces the placeholder below with
|
|
5
|
-
// the script path;
|
|
6
|
-
// from the plugin location itself (.devcontainer/
|
|
5
|
+
// the script path; DEVZONE_DOCKER_GUARD overrides it. The script is resolved
|
|
6
|
+
// from the plugin location itself (.devcontainer/ai/plugins -> ../docker-guard.sh).
|
|
7
7
|
// opencode 1.x also loads default exports with an id; without ctx.tool.hook the
|
|
8
|
-
// 1.x guard in devzone-
|
|
8
|
+
// 1.x guard in devzone-guard.js remains active.
|
|
9
9
|
import { spawnSync } from "node:child_process"
|
|
10
10
|
import { existsSync } from "node:fs"
|
|
11
11
|
import { fileURLToPath } from "node:url"
|
|
12
12
|
import { dirname, join } from "node:path"
|
|
13
13
|
|
|
14
|
-
const INSTALLED = process.env.
|
|
14
|
+
const INSTALLED = process.env.DEVZONE_DOCKER_GUARD || "__DEVZONE_DOCKER_GUARD__"
|
|
15
15
|
|
|
16
16
|
function guardScript() {
|
|
17
|
-
if (INSTALLED && INSTALLED.indexOf("
|
|
17
|
+
if (INSTALLED && INSTALLED.indexOf("__DEVZONE_DOCKER_GUARD__") !== 0 && existsSync(INSTALLED)) {
|
|
18
18
|
return INSTALLED
|
|
19
19
|
}
|
|
20
|
-
const script = join(dirname(fileURLToPath(import.meta.url)), "..", "docker-
|
|
20
|
+
const script = join(dirname(fileURLToPath(import.meta.url)), "..", "docker-guard.sh")
|
|
21
21
|
if (existsSync(script)) {
|
|
22
22
|
return script
|
|
23
23
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// Guard for opencode 1.x: blocks Docker commands in devzone (Kubernetes-first).
|
|
2
|
-
// Each shell tool call is checked by docker-
|
|
2
|
+
// Each shell tool call is checked by docker-guard.sh. Exit code 2: error shown
|
|
3
3
|
// to the agent with stderr message. Script absent or failing: nothing blocked.
|
|
4
4
|
// The installed copy (devzone enable ia) replaces the placeholder below with
|
|
5
|
-
// the script path;
|
|
6
|
-
// from the plugin location itself (.devcontainer/
|
|
5
|
+
// the script path; DEVZONE_DOCKER_GUARD overrides it. The script is resolved
|
|
6
|
+
// from the plugin location itself (.devcontainer/ai/plugins -> ../docker-guard.sh).
|
|
7
7
|
import { spawnSync } from "node:child_process"
|
|
8
8
|
import { existsSync } from "node:fs"
|
|
9
9
|
import { fileURLToPath } from "node:url"
|
|
10
10
|
import { dirname, join } from "node:path"
|
|
11
11
|
|
|
12
|
-
const INSTALLED = process.env.
|
|
12
|
+
const INSTALLED = process.env.DEVZONE_DOCKER_GUARD || "__DEVZONE_DOCKER_GUARD__"
|
|
13
13
|
|
|
14
14
|
function guardScript() {
|
|
15
|
-
if (INSTALLED && INSTALLED.indexOf("
|
|
15
|
+
if (INSTALLED && INSTALLED.indexOf("__DEVZONE_DOCKER_GUARD__") !== 0 && existsSync(INSTALLED)) {
|
|
16
16
|
return INSTALLED
|
|
17
17
|
}
|
|
18
|
-
const script = join(dirname(fileURLToPath(import.meta.url)), "..", "docker-
|
|
18
|
+
const script = join(dirname(fileURLToPath(import.meta.url)), "..", "docker-guard.sh")
|
|
19
19
|
if (existsSync(script)) {
|
|
20
20
|
return script
|
|
21
21
|
}
|