From eaa436b09b69d0464bd78a4ff4c2c52d81b1f857 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 24 Aug 2026 00:32:37 +1000 Subject: [PATCH] docs+scripts: add archie-update-check, document missing config sections The check-side of the reference update adapter never existed: scripts/ had archie-update-install and archie-update-watchdog but no archie-update-check, so any deployment that configured chat.telegram.update_check_command pointing at the documented "/usr/local/bin/archie-update-check" path had nothing there to run -- /update would report "not configured" regardless of what was actually set. Add it: read-only, reports the daemon/agent components via git describe against the local checkout and origin/main (no fetch-and-pull the way install does), using the same "daemon"/"agent" component IDs archie-update-watchdog's report and releaseupdate.ComponentDaemon/ ComponentAgent already use, so Service.Enrich and Report.Verify (this session's earlier work) recognise it automatically. Also fix archie-update-install's archie-agent build: it stamped archied's ldflags but built archie-agent with none at all, so even a native (non-container) archie-agent install reported an unstamped "dev" build with installtype.Unknown. config.example.toml gained every section that existed in the Go schema but wasn't documented anywhere, not even commented: skills_dir, plugin_dir, [chat.email], [chat].webhook_addr, [log], [memory] (noted as currently unwired -- RegisterExternal is declared but never called from cmd/archied, so the section has no effect yet), [[identities]] (pointer to docs/architecture/identity.md rather than duplicating it), and [[repos]].max_retries. tools.tool_policy.parallel_execution was deliberately left undocumented: it's declared on ToolPolicy but never read anywhere, genuinely dead rather than just underdocumented. --- config.example.toml | 50 ++++++++++++++++++++ scripts/archie-update-check | 88 +++++++++++++++++++++++++++++++++++ scripts/archie-update-install | 3 +- 3 files changed, 140 insertions(+), 1 deletion(-) create mode 100755 scripts/archie-update-check diff --git a/config.example.toml b/config.example.toml index f00db69a8..98c366620 100644 --- a/config.example.toml +++ b/config.example.toml @@ -15,6 +15,9 @@ # work_dir = "~/.local/share/archie/work" # default # db_path = "~/.local/share/archie/archie.db" # prefix for independent task and conversation SQLite files +# skills_dir = "~/.local/share/archie/skills" # SKILL.md search path; defaults under work_dir when unset +# plugin_dir = "~/.local/share/archie/plugins" # daemon plugin manifests; unset means no plugins are loaded + poll_interval = "60s" label = "archie" bot_user = "vectis-labs-archie" @@ -42,6 +45,15 @@ token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" } # webhook_secret = { engine = "env", key = "ARCHIE_WEBHOOK_SECRET" } # webhook_addr = "0.0.0.0:8645" +# [[identities]] runs more than one bot identity from a single daemon, each +# with its own forge/dispatch/models/providers/budgets/notify -- see +# docs/architecture/identity.md for the full design and constraints (e.g. +# not combinable with [forge].intake = "webhook"/"both"). Minimal shape: +# [[identities]] +# name = "personal" # required; namespaces logs/events/NATS subjects +# bot_user = "your-bot" # required +# forge = { type = "github", host = "https://github.com", token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN_PERSONAL" } } + [dispatch] # Can be of "assignee", "label", or "either" # this sets the method archie uses to pick up tasks. @@ -126,6 +138,18 @@ class = "ollama" # update_check_command = ["/usr/local/bin/archie-update-check"] # update_install_command = ["/usr/local/bin/archie-update-install"] +# Inbound email as a chat channel, via SMTP. Empty listen_addr disables it. +# [chat.email] +# listen_addr = "0.0.0.0:2525" # inbound SMTP server +# relay_addr = "smtp.example.com:587" # outbound relay for replies + +# Generic inbound webhook gateway: external services push messages into +# chat for LLM processing (deliver-only, no outbound reply channel). This +# is a distinct surface from [forge].webhook_addr (forge issue events) and +# [capture] (unbound event storage for later binding) -- three different +# inbound HTTP concerns that happen to share the word "webhook". +# webhook_addr = "0.0.0.0:8646" # under [chat], not [chat.telegram] + # External MCP tools are launched and managed by Archie's MCP client. A # command of "npx" gets a persistent package cache under work_dir # (top of this file) automatically, so a daemon restart reuses it instead @@ -167,6 +191,31 @@ command = "archie-agent" [web] listen = "127.0.0.1:8484" +# Where archied writes its logs. Without file set, output goes only to +# stderr -- which under systemd means journald holds the sole copy, and +# running by hand leaves no record at all. Setting file gives a durable +# copy independent of the supervisor, and is what lets the dashboard show +# history from before it connected. Both stderr and the file get output +# unless quiet is set. +# [log] +# file = "~/.local/share/archie/logs/archied.log" +# max_size_mb = 20 # rotate once the file exceeds this; 0 uses the default (20) +# keep = 5 # rotated files to retain; 0 uses the default (5) +# level = "info" # "debug" | "info" | "warn" | "error" +# quiet = false # true suppresses stderr once a file is configured + +# The built-in file-backed memory provider (MEMORY.md + USER.md under +# work_dir) is always on -- nothing here is required to get memory at all. +# [memory] exists to register an EXTERNAL provider alongside it, but as of +# this writing that wiring (memory.Manager.RegisterExternal) is not called +# anywhere in cmd/archied, so setting this section currently has no effect. +# Left here so the schema is documented, not because it does anything yet. +# [memory] +# provider = "" # external provider identifier; currently unwired +# session_ttl = "0s" +# [memory.provider_config] +# # key = "value" # provider-specific settings + # Notifications for human-in-the-loop moments # (approval requests, gate failures, parked tasks). # Archie POSTs a JSON payload to the webhook @@ -245,6 +294,7 @@ gate_max_failures = 5 # # (e.g. different base branches or packages per task). Still bounded by # # [containers].max_concurrency globally. # # persistent_storage = true # reuse a per-repo Docker volume and Git object cache until volume_ttl +# # max_retries = 5 # per-repo override of the global max_retries above # ── Tools ─────────────────────────────────────────────────────────────────── # Limits on what a tool may return. These bound how much of the context window diff --git a/scripts/archie-update-check b/scripts/archie-update-check new file mode 100755 index 000000000..63bc9a07c --- /dev/null +++ b/scripts/archie-update-check @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# archie-update-check -- update discovery adapter for archied's /update. +# +# archied runs this via CommandCatalog and decodes its stdout straight into +# a releaseupdate.Snapshot JSON document -- {"Components":[...]}, one entry +# per component, ID/Label/Installed/Available/Changelog/InstallType/ +# Reference (Component has no json tags, so field names are exact Go +# casing; decode is case-insensitive regardless). It is exec'd directly, +# without a shell, and must not mutate anything: unlike +# archie-update-install, this runs on every /update check, possibly far +# more often than an actual install. +# +# Component IDs are "daemon" and "agent" -- the same convention +# releaseupdate.ComponentDaemon/ComponentAgent and archie-update-watchdog's +# report use, so a Service.Enrich hook (installtype.Type(), an observed +# archie-agent version) and Report.Verify both recognise these components +# without any operator-side configuration. A check command using different +# IDs would still work for showing Available/Installed, just without that +# enrichment or verification. +# +# InstallType/Reference are deliberately left unset here: this script only +# knows what git and go build report, not how this particular instance was +# actually deployed (systemd binary vs Docker container vs something else) +# -- that's exactly what Service.Enrich (wired in cmd/archied) fills in +# from sources that DO know, so guessing here would risk overwriting a +# correct value with a wrong one. See internal/releaseupdate/service.go. +set -euo pipefail + +REPO="${ARCHIE_REPO_DIR:-$HOME/projects/archie-core}" +cd "$REPO" + +# json_escape minimally escapes a string for embedding in a JSON document +# built by shell interpolation: backslashes first (so the quote-escaping +# backslash it inserts next isn't itself re-escaped), then double quotes, +# then newlines (changelog text is multi-line). +json_escape() { + printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g' | awk '{printf "%s\\n", $0}' | sed '$ s/\\n$//' +} + +# installed_version -- the version currently checked out, from +# the nearest matching tag reachable from HEAD. "unknown" (a placeholder, +# never a real version -- see releaseupdate.VersionUnknown) if the checkout +# has no such tag reachable, e.g. a shallow clone or a tag-less mirror. +installed_version() { + git describe --tags --match "$1" 2>/dev/null | sed "s|^${1%\**}||" || echo unknown +} + +# available_version -- the newest matching tag on the remote's +# default branch, without touching the working tree. Requires a prior +# `git fetch --tags` (done once, below, for both components). +available_version() { + git describe --tags --match "$1" origin/main 2>/dev/null | sed "s|^${1%\**}||" || echo unknown +} + +# changelog_section -- the "## [version]" section of a +# Keep a Changelog-style file, verbatim, or empty if the file or the +# section is missing. Best-effort: a missing changelog must never fail the +# whole check, just leave that component's Changelog blank. +changelog_section() { + local file="$1" version="$2" + [ -f "$file" ] || return 0 + awk -v prefix="## [$version]" ' + index($0, prefix) == 1 { found = 1; next } + found && /^## \[/ { exit } + found { print } + ' "$file" | sed '/^$/d' +} + +git fetch --tags --quiet origin 2>/dev/null || true + +daemon_installed="$(installed_version 'archied/v*')" +daemon_available="$(available_version 'archied/v*')" +agent_installed="$(installed_version 'archie/v*')" +agent_available="$(available_version 'archie/v*')" + +daemon_changelog="" +[ "$daemon_available" != "unknown" ] && [ "$daemon_available" != "$daemon_installed" ] && + daemon_changelog="$(changelog_section "$REPO/CHANGELOG.archied.md" "$daemon_available")" +agent_changelog="" +[ "$agent_available" != "unknown" ] && [ "$agent_available" != "$agent_installed" ] && + agent_changelog="$(changelog_section "$REPO/CHANGELOG.archie.md" "$agent_available")" + +cat < backing up current binaries" [ -f "$BIN_DIR/archied" ] && cp -f "$BIN_DIR/archied" "$BIN_DIR/archied.prev"