@amsterdamdatalabs/adl-agent-control-linux-x64 0.1.10 → 0.1.12

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/bin/adl CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/adl
3
- size: 82925024 bytes
4
- sha256: bf72c4f43099dc33afd161d5e8205d2fbfc5607e4b3aafac4ac0644224b75337
3
+ size: 82949600 bytes
4
+ sha256: b0711f880f163524abb11d00eb61e134b582627c11fe70bb96ea2d91133b3fbb
package/bin/git CHANGED
@@ -435,7 +435,7 @@ case "$command_name" in
435
435
  # "whatever the schedule says" -- "Otherwise, the tasks are determined
436
436
  # by which maintenance.<task>.enabled config options are true. By
437
437
  # default, only maintenance.gc.enabled is true." A bare `run` (the
438
- # shape a human, a GUI, or the git-maintain LaunchAgent's own
438
+ # shape a human, a GUI, or a scheduled repository-maintenance job's own
439
439
  # background gc actually calls) therefore almost never touches the
440
440
  # network at all -- routing it unconditionally, as this used to,
441
441
  # refused every one of those local-only callers once git-ado went
package/bin/git-ado CHANGED
@@ -53,7 +53,7 @@
53
53
  # NEVER a fallback to another identity: an unrecognized agent name is
54
54
  # refused, by name, before anything reaches adl-agent-id.
55
55
  #
56
- # HOST AUTOMATION (sync-and-reconcile, scratch-reap, git-maintain) is not one
56
+ # HOST AUTOMATION (sync-and-reconcile, scratch-reap, `adl maintain`) is not one
57
57
  # of the three named agents and is not a human terminal either, but it goes
58
58
  # through THIS script's ordinary agent path as agent-tarun, the machine's own
59
59
  # default agent (2026-09-27 decision 5). THIS SCRIPT NEVER READS THE
@@ -64,7 +64,7 @@
64
64
  # (packages/fleet/src/default-agent-file.ts owns the WRITE side), and sets
65
65
  # ADL_AGENT_ID_AGENT in the child env before it ever reaches this script --
66
66
  # see e.g. packages/fleet/src/scratch-reap.ts and
67
- # packages/fleet/jobs/git-maintain/src/main.ts. The separate host-only
67
+ # packages/fleet/src/repo-maintain.ts. The separate host-only
68
68
  # credentialed path (git-ado-host) is retired: the old DevOps vault
69
69
  # credentials it used were deleted, so it was dead regardless.
70
70
  set -euo pipefail
@@ -21,7 +21,7 @@ bun_compile_build() {
21
21
  local bun_bin="$1"
22
22
  local entry_path="$2"
23
23
  local target="$3"
24
- [[ -f "$entry_path" ]] || { echo "bun-compile entry missing: $entry_path" >&2; exit 1; }
24
+ [[ -f "$entry_path" ]] || { echo "ERROR bun-compile entry missing: $entry_path" >&2; exit 1; }
25
25
  (
26
26
  build_dir="$(mktemp -d)"
27
27
  trap 'rm -rf "$build_dir"' EXIT
@@ -0,0 +1,59 @@
1
+ # Shared host lookup for `adl setup` (bin/setup) and `adl reconcile`
2
+ # (bin/reconcile-host): the ONE place that maps a fleet host name to its
3
+ # manifest device entry, so the two commands can never disagree on which
4
+ # account owns a host or which minute it is scheduled at.
5
+ #
6
+ # Sourced, never executed. Needs jq on PATH. Both callers read the manifest
7
+ # that ships inside their own package (packages/fleet/manifest.json); there is
8
+ # no checkout mode and no per-command owner flag -- the owner is the device's
9
+ # `administrator`.
10
+ #
11
+ # fleet_host_resolve COMMAND MANIFEST HOST
12
+ # On success sets fleet_host_platform (mac|linux), fleet_host_owner,
13
+ # fleet_host_minute and fleet_host_repo_location (empty when the device
14
+ # declares none). On failure prints one `ERROR COMMAND: ...` line to stderr
15
+ # and returns 2 (unknown host) or 1 (unreadable manifest, bad entry, or the
16
+ # host belongs to the other operating system).
17
+
18
+ fleet_host_resolve() {
19
+ local command="$1" manifest="$2" host="$3"
20
+ local row valid os_platform
21
+ fleet_host_platform=""
22
+ fleet_host_owner=""
23
+ fleet_host_minute=""
24
+ fleet_host_repo_location=""
25
+
26
+ [[ -f "$manifest" ]] || { echo "ERROR $command: fleet manifest missing: $manifest" >&2; return 1; }
27
+
28
+ row="$(jq -r --arg host "$host" '
29
+ [ ("mac", "linux") as $platform
30
+ | (.[$platform].devices // {}) | to_entries[] | select(.key == $host)
31
+ | [$platform, (.value.administrator // ""), ((.value.schedule_minute // "") | tostring), (.value.repo_location // "")]
32
+ | join("\u001f") ] | first // empty
33
+ ' "$manifest")" || { echo "ERROR $command: cannot read fleet manifest: $manifest" >&2; return 1; }
34
+
35
+ if [[ -z "$row" ]]; then
36
+ valid="$(jq -r '[(.mac.devices // {} | keys_unsorted[]), (.linux.devices // {} | keys_unsorted[])] | join(", ")' "$manifest")" || {
37
+ echo "ERROR $command: cannot read fleet manifest: $manifest" >&2
38
+ return 1
39
+ }
40
+ echo "ERROR $command: unknown host '$host'; valid hosts: $valid" >&2
41
+ return 2
42
+ fi
43
+
44
+ # A non-whitespace delimiter (unit separator): `read` collapses runs of a
45
+ # whitespace IFS such as tab, which would shift a later field into an empty one.
46
+ IFS=$'\x1f' read -r fleet_host_platform fleet_host_owner fleet_host_minute fleet_host_repo_location <<<"$row"
47
+ [[ -n "$fleet_host_owner" ]] || { echo "ERROR $command: host '$host' has no administrator in $manifest" >&2; return 1; }
48
+ [[ "$fleet_host_minute" =~ ^[0-9]+$ ]] || { echo "ERROR $command: host '$host' has no schedule_minute in $manifest" >&2; return 1; }
49
+
50
+ case "$(uname -s)" in
51
+ Darwin) os_platform=mac ;;
52
+ Linux) os_platform=linux ;;
53
+ *) echo "ERROR $command: unsupported operating system: $(uname -s)" >&2; return 1 ;;
54
+ esac
55
+ [[ "$fleet_host_platform" == "$os_platform" ]] || {
56
+ echo "ERROR $command: host '$host' is a $fleet_host_platform device but this machine is $os_platform" >&2
57
+ return 1
58
+ }
59
+ }
@@ -320,34 +320,34 @@ lean_ctx_observe_hook_write() {
320
320
  local resolved mode owner tmp
321
321
  resolved="$(lean_ctx_observe_hook_resolve_target "$path")"
322
322
  mode="$(lean_ctx_observe_hook_stat_mode "$resolved")" || {
323
- echo "FAILED: could not stat mode of $resolved" >&2
323
+ echo "ERROR FAILED: could not stat mode of $resolved" >&2
324
324
  return 1
325
325
  }
326
326
  owner="$(lean_ctx_observe_hook_stat_owner "$resolved")" || {
327
- echo "FAILED: could not stat owner of $resolved" >&2
327
+ echo "ERROR FAILED: could not stat owner of $resolved" >&2
328
328
  return 1
329
329
  }
330
330
  tmp="$(mktemp "$(dirname "$resolved")/.$(basename "$resolved").XXXXXX" 2>/dev/null)" || {
331
- echo "FAILED: mktemp for $resolved failed" >&2
331
+ echo "ERROR FAILED: mktemp for $resolved failed" >&2
332
332
  return 1
333
333
  }
334
334
  if ! cat "$content_src" >"$tmp" 2>/dev/null; then
335
- echo "FAILED: writing $tmp failed" >&2
335
+ echo "ERROR FAILED: writing $tmp failed" >&2
336
336
  rm -f "$tmp" 2>/dev/null
337
337
  return 1
338
338
  fi
339
339
  if ! chmod "$mode" "$tmp" 2>/dev/null; then
340
- echo "FAILED: chmod $mode $tmp failed" >&2
340
+ echo "ERROR FAILED: chmod $mode $tmp failed" >&2
341
341
  rm -f "$tmp" 2>/dev/null
342
342
  return 1
343
343
  fi
344
344
  if ! chown "$owner" "$tmp" 2>/dev/null; then
345
- echo "FAILED: chown $owner $tmp failed" >&2
345
+ echo "ERROR FAILED: chown $owner $tmp failed" >&2
346
346
  rm -f "$tmp" 2>/dev/null
347
347
  return 1
348
348
  fi
349
349
  if ! mv -f "$tmp" "$resolved" 2>/dev/null; then
350
- echo "FAILED: mv $tmp -> $resolved failed" >&2
350
+ echo "ERROR FAILED: mv $tmp -> $resolved failed" >&2
351
351
  rm -f "$tmp" 2>/dev/null
352
352
  return 1
353
353
  fi
@@ -624,11 +624,11 @@ lean_ctx_observe_strip_guard_euid() {
624
624
  local euid="$1" home="$2" owner
625
625
  [[ "$euid" == 0 ]] || return 0
626
626
  owner="$(lean_ctx_observe_hook_stat_owner "$home" 2>/dev/null)" || {
627
- echo "lean-ctx-observe-strip: refusing -- running as root (EUID=0) but could not determine the owner of --home $home" >&2
627
+ echo "ERROR lean-ctx-observe-strip: refusing -- running as root (EUID=0) but could not determine the owner of --home $home" >&2
628
628
  return 1
629
629
  }
630
630
  local owner_uid="${owner%%:*}"
631
631
  [[ "$owner_uid" == 0 ]] && return 0
632
- echo "lean-ctx-observe-strip: refusing -- running as root (EUID=0) against --home $home, owned by uid $owner_uid, not root. bin/reconcile's apply path always runs this script via 'sudo -u <administrator>' (or, on Linux, as root against root's own /root), so it should never execute as literal root against a non-root user's home. Re-run as that user, or via 'sudo -u <that user> lean-ctx-observe-strip --home $home --mode ...'." >&2
632
+ echo "ERROR lean-ctx-observe-strip: refusing -- running as root (EUID=0) against --home $home, owned by uid $owner_uid, not root. bin/reconcile's apply path always runs this script via 'sudo -u <administrator>' (or, on Linux, as root against root's own /root), so it should never execute as literal root against a non-root user's home. Re-run as that user, or via 'sudo -u <that user> lean-ctx-observe-strip --home $home --mode ...'." >&2
633
633
  return 1
634
634
  }