Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a3bf5a71a
|
||
|
|
0218e4ec89
|
||
|
|
ce70d4f3ee
|
||
|
|
83613d902a
|
||
|
|
1026d5e3b6
|
||
|
|
ee4c3f9c16
|
||
|
|
21de660ae1
|
||
|
|
52b027955b
|
||
|
|
e2917420fb
|
||
|
|
c226c4f686
|
||
|
|
9e2cf252ac
|
||
|
|
9fe446a426
|
||
|
|
20d81258ac
|
||
|
|
053ed58c08
|
||
|
|
546e5cd6ef
|
||
|
|
2f802e04a4
|
||
|
|
124d2033fc
|
||
|
|
46372b51d5
|
||
|
|
db36d853ce
|
||
|
|
4b97ac5841
|
||
|
|
e909aee155
|
||
|
|
564339e1aa
|
||
|
|
e45fee9bc9
|
||
|
|
4cdb5996c5
|
||
|
|
4657ff2646
|
||
|
|
703d5376bb
|
||
|
|
dd80500e7a
|
||
|
|
1e21aa975d
|
||
|
|
66b63260e9
|
||
|
|
470015483e
|
||
|
|
42f0688f84
|
||
|
|
b6f7059212
|
||
|
|
88afd1ebc9
|
||
|
|
a4a4e97f07
|
||
|
|
4bc0d54341
|
||
|
|
dabe0b4f7c
|
||
|
|
28733c8522
|
||
|
|
4b1ae4babf
|
||
|
|
50b75f6987
|
||
|
|
0c8b673615
|
||
|
|
ef62dcc97a
|
||
|
|
82cfc1de5b
|
||
|
|
983f462740
|
||
|
|
46edda9961
|
||
|
|
3dcc8da0de
|
||
|
|
a2972ac5d6
|
||
|
|
85e6f8eb40
|
||
|
|
55077620bb
|
||
|
|
400699cfbb
|
||
|
|
a0385a56c7
|
||
|
|
22aee72679
|
||
|
|
ff58c8e39b
|
||
|
|
25007e8316
|
||
|
|
b9dd744f8c
|
||
|
|
a91df7ec1f
|
||
|
|
5712c9c4e6
|
||
|
|
1f5163092b
|
||
|
|
4e1f1b3c4d
|
||
|
|
1b8eb362d2
|
||
|
|
7903a0e225
|
||
|
|
3a700cddfa
|
||
|
|
0238f247e5
|
||
|
|
e594ec3780
|
||
|
|
200c6d0928
|
||
|
|
0dbf241106
|
||
|
|
af753290e7
|
||
|
|
a6644c20cd
|
||
|
|
4877362223
|
||
|
|
0335872701
|
||
|
|
eb9d470ba8
|
||
|
|
a3d32e92e5
|
||
|
|
deb3865d75
|
||
|
|
6d97f62929
|
||
|
|
18d1e07a21
|
||
|
|
cf249d7643
|
||
|
|
66220e1752
|
||
|
|
93c9eb51f3
|
||
|
|
e787a79af4
|
||
|
|
777b17acf7
|
||
|
|
02df83ccb7
|
||
|
|
68d81fbbd0
|
||
|
|
75c3d2b096
|
||
|
|
e898acedc8
|
||
|
|
b89d9e0f05
|
||
|
|
58858f0d92
|
||
|
|
8b64ab0afe
|
||
|
|
e8366683a9
|
||
|
|
99a3d675a8
|
||
|
|
a69a0ea942
|
||
|
|
9cd31e48ca
|
||
|
|
998c72f8d3
|
||
|
|
7a311a3c74
|
||
|
|
e78cb1e63e
|
||
|
|
14e2474a49
|
||
|
|
86192e8053
|
||
|
|
990cd9408c
|
||
|
|
c7ce32df3e
|
||
|
|
5d620461fe
|
||
|
|
411632548c
|
||
|
|
a262151cb9
|
||
|
|
a8d1de8b5e
|
||
|
|
9f830db510
|
||
|
|
80129b7dd6
|
||
|
|
48c28b36ba
|
||
|
|
c5382a8476
|
||
|
|
eed9101d5b
|
||
|
|
cdfdf3a756
|
||
|
|
1d329bad35
|
||
|
|
f5c566bcab
|
||
|
|
90090922e1
|
||
|
|
a8f1fc9ea3
|
||
|
|
a9621b91cd
|
||
|
|
c7fabbee25
|
||
|
|
b7b6078939
|
||
|
|
39bfde195c
|
||
|
|
67ae6afec1
|
||
|
|
b314968328
|
||
|
|
432e6280d6
|
||
|
|
236d0b678a
|
||
|
|
5f45cdebb5
|
||
|
|
bfe28f6750
|
||
|
|
44a7d59acf
|
||
|
|
7148579544
|
||
|
|
6eea6aaffa
|
||
|
|
dc4cd29c83
|
||
|
|
87ed8a2e15
|
||
|
|
855e8ceb3b
|
||
|
|
7a9f507e2d
|
||
|
|
104854da2a
|
||
|
|
3225396cf1
|
||
|
|
811cab57ac
|
||
|
|
3a965e2a4f
|
||
|
|
7d664d7efb
|
||
|
|
92fbcd7a28
|
||
|
|
5edf58fd68
|
||
|
|
da1795c597
|
||
|
|
a18a4f7500
|
||
|
|
7ab209fa7e
|
||
|
|
97fbc35ee4
|
||
|
|
7d6f22d227
|
||
|
|
0451545220
|
||
|
|
5c02207d48
|
||
|
|
e784adbd7a
|
||
|
|
d3678869d2
|
||
|
|
6c287b48e6
|
||
|
|
bbd3c39ef1
|
||
|
|
2096ae8267
|
||
|
|
a1ec538a87
|
||
|
|
45b9295cb7
|
||
|
|
e7d3ed72e4
|
||
|
|
82f5afaa6d
|
||
|
|
2f95dfb67d
|
||
|
|
fb732974f5
|
||
|
|
81c59d7fac
|
||
|
|
a2b82b4c25
|
||
|
|
21dfb56e50
|
||
|
|
41f44c43a1
|
||
|
|
ca4b039cb4
|
||
|
|
841c6aea16
|
||
|
|
fb330f350d
|
||
|
|
6516477b20
|
||
|
|
9d8e4f68ab
|
||
|
|
3653376221
|
||
|
|
925365b245
|
||
|
|
5b3ae6abde
|
||
|
|
ecf4e6b95a
|
||
|
|
6a17951a3a
|
||
|
|
0cfa701f5c
|
||
|
|
a5ba2c994f
|
||
|
|
5e9e551fbb
|
||
|
|
5810c49260
|
||
|
|
e2df9cbd0a
|
||
|
|
806c82bda3
|
||
|
|
39929b9e48
|
||
|
|
f4b7652ae7
|
||
|
|
1def83a43f
|
||
|
|
6d54952cbb
|
||
|
|
757c3016ae
|
||
|
|
a0ee8e3f2e
|
||
|
|
3eb976ef83
|
||
|
|
47a340bf79
|
||
|
|
cdd636d5aa
|
||
|
|
4c54d250f6
|
||
|
|
f9ac9229d5
|
||
|
|
0d9e2d1cd8
|
||
|
|
e389e1a21e
|
||
|
|
73e32f016a
|
||
|
|
6b7f6f2731
|
||
|
|
f5be0d60dd
|
||
|
|
851cb78b04
|
||
|
|
f183a397cb
|
||
|
|
f49ba6bd66
|
||
|
|
8dba4e6dec
|
||
|
|
c26eeda939
|
||
|
|
e6a2a16bba
|
||
|
|
6cc8107ebb
|
||
|
|
8c3464163d
|
||
|
|
8d89f47d6b
|
||
|
|
260732f400
|
||
|
|
55e477794e
|
||
|
|
3ff1649322
|
||
|
|
bdc457d11e
|
||
|
|
500d02be78
|
||
|
|
0cd9cefd76
|
||
|
|
0a770ed171
|
||
|
|
0d13b919da
|
||
|
|
63a1750936
|
||
|
|
d0118756d7
|
||
|
|
f4c304cfba
|
||
|
|
afaea346ee
|
||
|
|
68e8552f0d
|
||
|
|
b25676b612
|
||
|
|
60c0f19e63
|
||
|
|
65e6bafb23
|
||
|
|
1c191b4ee0
|
||
|
|
892ed291b9
|
||
|
|
c5f24ec914
|
||
|
|
aefb4e486b
|
||
|
|
7c7129eefb
|
||
|
|
db346b159d
|
||
|
|
a3d4b751b9
|
||
|
|
f3a379add1
|
||
|
|
d7741d6088
|
||
|
|
27df64f8b0
|
||
|
|
8890c9ac3e
|
||
|
|
fb281c192a
|
||
|
|
fc6f614408
|
||
|
|
40526b077f
|
||
|
|
061227708d
|
||
|
|
a04fd3834d | ||
|
|
a4fbaaf84c | ||
|
|
606da1aee5
|
||
|
|
228f17d98a | ||
|
|
3c1ecc8087
|
||
|
|
29e263ab23
|
||
|
|
fbc9ed21e7 | ||
|
|
76be7b87b2 | ||
|
|
804d306f75
|
||
|
|
782daf8bbb | ||
|
|
5baef8805d | ||
|
|
82ca9613c7
|
||
|
|
4e9745d5c6
|
||
|
|
ea64d84696 | ||
|
|
2bec268b29 | ||
|
|
5b282c9efe | ||
|
|
7b295df8ff
|
||
|
|
607bfddd0e | ||
|
|
779b036d95 | ||
|
|
27e997e0d9 | ||
|
|
433ea390a6
|
||
|
|
ff8615b090
|
||
|
|
14da38b9b7
|
||
|
|
017a1d56e2 | ||
|
|
af02cbe832 | ||
|
|
38d9cca84a | ||
|
|
cdae23d7e9 | ||
|
|
1ae6d39680 | ||
|
|
07e4e8f727 | ||
|
|
98941c20a0
|
||
|
|
fe8afb18d0
|
||
|
|
3f092c0704
|
||
|
|
f156150a8b
|
||
|
|
9dd55646bb
|
||
|
|
6a7f8b4847 | ||
|
|
1c5915f521
|
||
|
|
864240fd61 | ||
|
|
1730938e03 | ||
|
|
2a73a37d27 | ||
|
|
4694406434 | ||
|
|
b8c394767c | ||
|
|
604d615d7a | ||
|
|
77db59141c
|
||
|
|
eabd7c8884
|
||
|
|
7ffbf0435c
|
||
|
|
8082e200f2
|
||
|
|
b234a85090
|
||
|
|
37ea698a28 | ||
|
|
bc429cd351 | ||
|
|
75044ee4c0 | ||
|
|
914a5f9b03 | ||
|
|
a7a411bd4b | ||
|
|
9ac8a60999 | ||
|
|
04975db9a1
|
||
|
|
b97eb45275
|
||
|
|
658a4cb50e
|
||
|
|
5a98c313e0
|
||
|
|
f92c5b4536
|
||
|
|
c54d328f0d
|
||
|
|
161e8f95bf
|
||
|
|
c155bb24ba
|
||
|
|
0033933a58
|
||
|
|
a9aacab79d
|
||
|
|
dcc12582ce
|
||
|
|
4728c8c253
|
||
|
|
255e0c7ee0
|
||
|
|
bc16b74c93
|
||
|
|
44237b448b
|
||
|
|
e5e968780f
|
||
|
|
31578e8857
|
||
|
|
f3f90f3224
|
||
|
|
8aa3540fa7
|
||
|
|
52549c1bab
|
||
|
|
f7c3e1788c
|
||
|
|
5ea115746c
|
||
|
|
12a25faf31 | ||
|
|
c9a8e21759 | ||
|
|
28a6ac8b98
|
||
|
|
73860b26d2 | ||
|
|
9ca3432f8e | ||
|
|
1b53c5787e | ||
|
|
b509397e8d | ||
|
|
721e6332ed
|
||
|
|
cc49fecc77
|
No files matched your search
@@ -1,49 +0,0 @@
|
||||
name: canary
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "*/15 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: canary
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
judge:
|
||||
if: vars.CANARY_URL != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- name: Build archied
|
||||
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Judge the canary
|
||||
env:
|
||||
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
|
||||
CANARY_WINDOW: ${{ vars.CANARY_WINDOW }}
|
||||
run: |
|
||||
window_args=()
|
||||
if [ -n "$CANARY_WINDOW" ]; then
|
||||
window_args=(-window "$CANARY_WINDOW")
|
||||
fi
|
||||
"$RUNNER_TEMP/archied" release canary check -dashboard "${{ vars.CANARY_URL }}" \
|
||||
"${window_args[@]}" \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
+71
-171
@@ -2,11 +2,10 @@ name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
|
||||
concurrency:
|
||||
group: ${{ startsWith(github.ref, 'refs/tags/') && format('deploy-release-{0}', github.sha) || format('deploy-{0}', github.ref) }}
|
||||
group: deploy-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
@@ -18,59 +17,40 @@ jobs:
|
||||
runs-on: self-hosted
|
||||
outputs:
|
||||
archied_version: ${{ steps.release_tag.outputs.archied_version }}
|
||||
run: ${{ steps.release_tag.outputs.run }}
|
||||
sha: ${{ steps.release_tag.outputs.sha }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
|
||||
- name: Resolve archied tag at HEAD
|
||||
- name: Resolve the release
|
||||
id: release_tag
|
||||
run: |
|
||||
version="$(git tag --points-at HEAD --list 'v*' | sed -e 's|^v||' | sort -V | tail -1)"
|
||||
echo "archied_version=$version" >> "$GITHUB_OUTPUT"
|
||||
if [ -n "$version" ]; then
|
||||
echo "archied release at HEAD: $version"
|
||||
else
|
||||
echo "no release tag at HEAD; distribution zip will be skipped"
|
||||
fi
|
||||
run=true
|
||||
case "$GITHUB_REF" in
|
||||
refs/tags/*) ;;
|
||||
*)
|
||||
if [ -n "$version" ]; then
|
||||
run=false
|
||||
echo "the v$version tag push runs this commit; skipping the branch run"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
echo "run=$run" >> "$GITHUB_OUTPUT"
|
||||
echo "archied_version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
echo "sha=$(git rev-parse "${GITHUB_REF}^{commit}")" >> "$GITHUB_OUTPUT"
|
||||
|
||||
gate:
|
||||
needs: plan
|
||||
if: needs.plan.outputs.run == 'true'
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: "22"
|
||||
node-version: "24"
|
||||
|
||||
- name: Install quality tools
|
||||
run: |
|
||||
@@ -94,191 +74,121 @@ jobs:
|
||||
run: docker pull alpine:3
|
||||
|
||||
- name: Quality gate
|
||||
env:
|
||||
RELEASE_VERSION: ${{ needs.plan.outputs.archied_version }}
|
||||
run: |
|
||||
task check TEST_FLAGS=-count=1
|
||||
task check dist TEST_FLAGS=-count=1 VERSION="$RELEASE_VERSION"
|
||||
git diff --exit-code
|
||||
|
||||
- name: Vulnerability scan
|
||||
run: |
|
||||
go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
go install golang.org/x/vuln/cmd/govulncheck@v1.9.0
|
||||
govulncheck ./...
|
||||
|
||||
- name: Release tags must match changelogs
|
||||
run: |
|
||||
set -e
|
||||
fail=0
|
||||
for tag in $(git tag --points-at HEAD); do
|
||||
case "$tag" in
|
||||
v*)
|
||||
ver="${tag#v}"
|
||||
echo " release tag $tag -> looking for [$ver] in CHANGELOG.md"
|
||||
grep -q "^## \\[$ver\\]" CHANGELOG.md || {
|
||||
echo " FAIL: CHANGELOG.md has no [$ver] section"
|
||||
fail=1
|
||||
}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ $fail -ne 0 ]; then
|
||||
echo
|
||||
echo "A release tag points at this commit but its changelog does not"
|
||||
echo "describe that version. Cut releases with the release workflow."
|
||||
exit 1
|
||||
fi
|
||||
if ! git tag --points-at HEAD | grep -qE '^v[0-9]' ; then
|
||||
echo "This commit isn't a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest promoted release."
|
||||
fi
|
||||
- name: Package the release binaries
|
||||
# tar keeps the executable bit, which an uploaded artifact drops.
|
||||
run: tar -cf release-binaries.tar dist
|
||||
|
||||
- name: Upload the release binaries
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
with:
|
||||
name: release-binaries
|
||||
path: release-binaries.tar
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
archied-image:
|
||||
needs: gate
|
||||
needs: [plan, gate]
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Resolve the commit this ref points at
|
||||
id: commit
|
||||
run: |
|
||||
sha="$(git rev-parse "${GITHUB_REF}^{commit}")"
|
||||
echo "sha=$sha" >> "$GITHUB_OUTPUT"
|
||||
echo "short=${sha:0:12}" >> "$GITHUB_OUTPUT"
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
|
||||
with:
|
||||
# One named builder that is never removed, so the Dockerfiles' cache
|
||||
# mounts are still there on the next run. Removing it at the end of
|
||||
# a job would take it from under another run that is building.
|
||||
name: archie-ci
|
||||
cleanup: false
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Resolve component versions
|
||||
id: versions
|
||||
run: |
|
||||
RELEASE_TAG="$(git tag --points-at HEAD --list 'v*' | sort -V | tail -1)"
|
||||
GATEWAY_VERSION="${RELEASE_TAG#v}"
|
||||
RUNTIME_VERSION="${RELEASE_TAG#v}"
|
||||
[ -n "$GATEWAY_VERSION" ] || GATEWAY_VERSION="dev+${GITHUB_SHA:0:12}"
|
||||
[ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION="dev+${GITHUB_SHA:0:12}"
|
||||
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "gateway=$GATEWAY_VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT"
|
||||
{
|
||||
echo "archied_tags<<EOF"
|
||||
if [ -n "$RELEASE_TAG" ]; then
|
||||
echo "git.catlow.cloud/sam/archied:$RELEASE_TAG"
|
||||
fi
|
||||
echo "git.catlow.cloud/sam/archied:edge"
|
||||
echo "git.catlow.cloud/sam/archied:sha-${{ steps.commit.outputs.sha }}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push archied
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.archied
|
||||
push: true
|
||||
tags: ${{ steps.versions.outputs.archied_tags }}
|
||||
tags: |
|
||||
git.catlow.cloud/sam/archied:v${{ needs.plan.outputs.archied_version }}
|
||||
git.catlow.cloud/sam/archied:sha-${{ needs.plan.outputs.sha }}
|
||||
build-args: |
|
||||
GATEWAY_VERSION=${{ steps.versions.outputs.gateway }}
|
||||
RUNTIME_VERSION=${{ steps.versions.outputs.runtime }}
|
||||
GATEWAY_VERSION=${{ needs.plan.outputs.archied_version }}
|
||||
RUNTIME_VERSION=${{ needs.plan.outputs.archied_version }}
|
||||
cache-from: type=gha,scope=archied
|
||||
cache-to: type=gha,mode=max,scope=archied
|
||||
|
||||
agent-image:
|
||||
needs: [plan, gate]
|
||||
outputs:
|
||||
agent_digest: ${{ steps.agent.outputs.digest }}
|
||||
needs: gate
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Resolve the commit this ref points at
|
||||
id: commit
|
||||
run: |
|
||||
sha="$(git rev-parse "${GITHUB_REF}^{commit}")"
|
||||
echo "sha=$sha" >> "$GITHUB_OUTPUT"
|
||||
echo "short=${sha:0:12}" >> "$GITHUB_OUTPUT"
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
|
||||
with:
|
||||
# One named builder that is never removed, so the Dockerfiles' cache
|
||||
# mounts are still there on the next run. Removing it at the end of
|
||||
# a job would take it from under another run that is building.
|
||||
name: archie-ci
|
||||
cleanup: false
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Resolve runtime version
|
||||
id: versions
|
||||
run: |
|
||||
RELEASE_TAG="$(git tag --points-at HEAD --list 'v*' | sort -V | tail -1)"
|
||||
RUNTIME_VERSION="${RELEASE_TAG#v}"
|
||||
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push archie-agent
|
||||
id: agent
|
||||
if: steps.versions.outputs.release_tag != ''
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
git.catlow.cloud/sam/archie-agent:${{ steps.versions.outputs.release_tag }}
|
||||
git.catlow.cloud/sam/archie-agent:sha-${{ steps.commit.outputs.sha }}
|
||||
git.catlow.cloud/sam/archie-agent:v${{ needs.plan.outputs.archied_version }}
|
||||
git.catlow.cloud/sam/archie-agent:sha-${{ needs.plan.outputs.sha }}
|
||||
build-args: |
|
||||
RUNTIME_VERSION=${{ steps.versions.outputs.runtime }}
|
||||
RUNTIME_VERSION=${{ needs.plan.outputs.archied_version }}
|
||||
cache-from: type=gha,scope=archie-agent
|
||||
cache-to: type=gha,mode=max,scope=archie-agent
|
||||
|
||||
dist-zip:
|
||||
needs: [plan, gate, agent-image]
|
||||
if: needs.plan.outputs.archied_version != ''
|
||||
needs: [plan, gate, archied-image, agent-image]
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
# The gate built these from the tree it checked; nothing is compiled here.
|
||||
- name: Download the release binaries
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
name: release-binaries
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Build the dashboard
|
||||
working-directory: ui
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
- name: Unpack the release binaries
|
||||
run: tar -xf release-binaries.tar
|
||||
|
||||
- name: Resolve archied version
|
||||
id: version
|
||||
run: echo "version=${{ needs.plan.outputs.archied_version }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build linux/amd64 binaries
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
set -e
|
||||
ldflags="-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/app/agentworker.version=${{ steps.version.outputs.version }}"
|
||||
mkdir -p dist
|
||||
for cmd in $(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json); do
|
||||
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
|
||||
done
|
||||
|
||||
- name: Assemble distribution zip
|
||||
id: zip
|
||||
run: |
|
||||
@@ -288,7 +198,7 @@ jobs:
|
||||
for cmd in $(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json); do
|
||||
cp "dist/$cmd" "$name/"
|
||||
done
|
||||
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$name/"
|
||||
cp deployments/INSTRUCTIONS.md "$name/"
|
||||
digest='${{ needs.agent-image.outputs.agent_digest }}'
|
||||
test -n "$digest"
|
||||
jq --arg image "git.catlow.cloud/sam/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
|
||||
@@ -297,7 +207,7 @@ jobs:
|
||||
echo "name=$name" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload distribution zip
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
with:
|
||||
name: ${{ steps.zip.outputs.name }}
|
||||
path: ${{ steps.zip.outputs.name }}.zip
|
||||
@@ -327,32 +237,22 @@ jobs:
|
||||
set -e
|
||||
tag="v${{ steps.version.outputs.version }}"
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
prerelease=false
|
||||
case "$version" in *-*) prerelease=true ;; esac
|
||||
notes="$(mktemp)"
|
||||
awk -v hdr="## [$version]" '
|
||||
index($0, hdr) == 1 { printing = 1 }
|
||||
printing && /^## \[/ && index($0, hdr) != 1 { exit }
|
||||
printing { print }
|
||||
' CHANGELOG.md > "$notes"
|
||||
if ! [ -s "$notes" ]; then
|
||||
echo "no [$version] section extracted from CHANGELOG.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
previous="$(git describe --tags --abbrev=0 --match 'v*' "$tag^" 2>/dev/null || true)"
|
||||
git log --no-merges --format='- %s' ${previous:+"$previous.."}"$tag" > "$notes"
|
||||
api="https://git.catlow.cloud/api/v1"
|
||||
repo="sam/archie"
|
||||
auth="Authorization: token $DEPLOY_TOKEN"
|
||||
curl -sf -X DELETE -H "$auth" "$api/repos/$repo/releases/tags/$tag" >/dev/null || true
|
||||
curl -sf -X POST -H "$auth" -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg tag "$tag" --arg name "Archie v$version" --arg body "$(cat "$notes")" \
|
||||
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \
|
||||
--argjson prerelease "$prerelease" \
|
||||
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: $prerelease}')" \
|
||||
"$api/repos/$repo/releases" >/dev/null
|
||||
echo "published release notes for $tag"
|
||||
|
||||
- name: Install the release on the canary
|
||||
if: vars.CANARY_URL != ''
|
||||
env:
|
||||
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
|
||||
run: ./dist/archied release canary start -dashboard "${{ vars.CANARY_URL }}" -version "${{ steps.version.outputs.version }}"
|
||||
|
||||
- name: Link the packages to this repository
|
||||
env:
|
||||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "release the canary is expected to run; must match what it runs"
|
||||
description: "published release to move stable to, such as 1.63.0"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
@@ -18,30 +18,26 @@ permissions:
|
||||
|
||||
jobs:
|
||||
promote:
|
||||
if: vars.CANARY_URL != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- name: Build archied
|
||||
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Promote the canary's release
|
||||
- name: Fetch the release's archied
|
||||
env:
|
||||
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
"$RUNNER_TEMP/archied" release canary promote -dashboard "${{ vars.CANARY_URL }}" \
|
||||
-version "${{ inputs.version }}" \
|
||||
set -e
|
||||
image="git.catlow.cloud/sam/archied:v$VERSION"
|
||||
docker pull -q "$image"
|
||||
container="$(docker create "$image")"
|
||||
docker cp "$container:/usr/local/bin/archied" "$RUNNER_TEMP/archied"
|
||||
docker rm "$container" >/dev/null
|
||||
|
||||
- name: Promote to stable
|
||||
env:
|
||||
VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
"$RUNNER_TEMP/archied" release promote \
|
||||
-version "$VERSION" \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
@@ -14,22 +14,22 @@ jobs:
|
||||
check:
|
||||
runs-on: archie-quality
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Verify unprivileged user namespaces
|
||||
run: unshare --user --map-root-user --net true
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
go install mvdan.cc/gofumpt@v0.11.0
|
||||
bash tools/proto.sh install
|
||||
|
||||
- uses: actions/cache@v4
|
||||
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
|
||||
with:
|
||||
path: ~/.cache/golangci-lint
|
||||
key: golangci-lint-${{ hashFiles('.golangci-version', '.golangci.yml', 'go.sum') }}-${{ github.sha }}
|
||||
|
||||
@@ -23,19 +23,19 @@ jobs:
|
||||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$DEPLOY_TOKEN" ]; then
|
||||
echo "::error::DEPLOY_TOKEN is not set for this repository, so the release cannot push its commit and tag. Set the secret here, or dispatch the release from the Gitea primary."
|
||||
echo "::error::DEPLOY_TOKEN is not set for this repository, so the release cannot push its tag. Set the secret here, or dispatch the release from the Gitea primary."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.DEPLOY_TOKEN }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
@@ -52,4 +52,4 @@ jobs:
|
||||
task release RELEASE="$RELEASE"
|
||||
|
||||
- name: Push the release
|
||||
run: git push --atomic origin main "$(git describe --exact-match --match 'v*' HEAD)"
|
||||
run: git push origin "$(git describe --exact-match --match 'v*' HEAD)"
|
||||
@@ -1,6 +1,7 @@
|
||||
/archied
|
||||
/archie-agent
|
||||
/bin/
|
||||
/dist/
|
||||
.task/
|
||||
*.db
|
||||
.references/
|
||||
@@ -49,3 +50,4 @@ __pycache__/
|
||||
/archipelago
|
||||
.agents-run/
|
||||
/.pnpm-store/
|
||||
deployments/archie/.build/
|
||||
+33
-1
@@ -42,6 +42,7 @@ linters:
|
||||
- errorlint
|
||||
- fatcontext
|
||||
- forcetypeassert
|
||||
- gosec
|
||||
- makezero
|
||||
- nilerr
|
||||
- nilnesserr
|
||||
@@ -96,6 +97,32 @@ linters:
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore", desc: "reach the State Store through its contract"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/domain/workflow", desc: "the workflow engine is the daemon's"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/agentexec", desc: "agent execution is the daemon's"}
|
||||
# The single binary replaces the services slice by slice. It never
|
||||
# imports their packages, so each old path can be deleted outright.
|
||||
single-binary:
|
||||
files: ["**/cmd/archie/**", "**/internal/app/archie/**", "**/internal/platform/**", "**/modules/**"]
|
||||
deny:
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "an old service; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/statestore", desc: "an old service; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archiegateway", desc: "an old service; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archiemessaging", desc: "an old service; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archieui", desc: "an old service; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/servicekit", desc: "old service plumbing"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/daemon", desc: "old service code; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/gateway", desc: "old service code; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/webui", desc: "old service code; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/domain", desc: "old domain code; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/infrastructure", desc: "old infrastructure; move what you need into a module"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/state", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/gateway", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/daemon", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/controlplane", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/messaging", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/logging", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/forge", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/contracts/channel", desc: "an internal service contract being deleted"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/config", desc: "the single binary has its own bootstrap config"}
|
||||
- {pkg: "github.com/nats-io", desc: "the single binary has no message bus"}
|
||||
shared:
|
||||
files: ["**/internal/app/servicekit/**"]
|
||||
deny:
|
||||
@@ -128,6 +155,12 @@ linters:
|
||||
- HACK
|
||||
- BUG
|
||||
|
||||
gosec:
|
||||
excludes:
|
||||
- G104 # errcheck covers unchecked errors
|
||||
- G115 # integer conversions are bounded where they occur
|
||||
- G204 # running commands is what the tools and workflow steps do
|
||||
- G304 # file paths come from configuration and confined worktrees
|
||||
interfacebloat:
|
||||
max: 8
|
||||
|
||||
@@ -147,7 +180,6 @@ linters:
|
||||
- ui/node_modules
|
||||
presets:
|
||||
- comments
|
||||
- std-error-handling
|
||||
- common-false-positives
|
||||
- legacy
|
||||
rules:
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
# Canary judge: check the release the canary is running, then promote it, pick
|
||||
# up a newer `next`, or roll it back. Every fifteen minutes, and on demand.
|
||||
#
|
||||
# Requires repo secrets canary_url, canary_token and deploy_token (the registry
|
||||
# credentials the `-latest` re-tagging needs). canary_window is optional.
|
||||
# Shell-side references are written $$name (see the note in deploy.yaml).
|
||||
#
|
||||
# Written to fail loudly when canary_url is missing: the schedule only exists
|
||||
# because the maintainer asked for one, so a canary nobody configured is a
|
||||
# misconfiguration, not a quiet skip.
|
||||
|
||||
when:
|
||||
- event: [cron]
|
||||
- event: [manual]
|
||||
|
||||
# A judging run takes longer than the interval when the canary is unhealthy;
|
||||
# overlapping runs would judge the same release twice.
|
||||
concurrency: 1
|
||||
|
||||
steps:
|
||||
- name: judge
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
CANARY_URL:
|
||||
from_secret: canary_url
|
||||
CANARY_WINDOW:
|
||||
from_secret: canary_window
|
||||
ARCHIE_CANARY_TOKEN:
|
||||
from_secret: canary_token
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to judge"; exit 1; }'
|
||||
- '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }'
|
||||
- go build -tags no_ui -o /tmp/archied ./cmd/archied
|
||||
# archied reads the registry credentials a docker login would have
|
||||
# written; this step has no docker CLI, so the file is written directly.
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p "$$HOME/.docker"
|
||||
auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0)
|
||||
printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json"
|
||||
- |
|
||||
set -eu
|
||||
set --
|
||||
if [ -n "$$CANARY_WINDOW" ]; then
|
||||
set -- -window "$$CANARY_WINDOW"
|
||||
fi
|
||||
/tmp/archied release canary check -dashboard "$$CANARY_URL" "$$@" \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
@@ -1,333 +0,0 @@
|
||||
# Publish pipeline: a push to main builds the edge images, a v* tag also cuts a
|
||||
# signed release. The release workflow pushes main and the tag in one command,
|
||||
# so both events are delivered for the same commit; `plan` decides which
|
||||
# pipeline does the work and the other one skips.
|
||||
#
|
||||
# Requires repo secrets: deploy_token (pushes images, publishes the Gitea
|
||||
# release, links the packages) and release_signing_key (the ed25519 seed the
|
||||
# release statement is signed with). canary_url and canary_token are optional;
|
||||
# without them the canary install is skipped.
|
||||
#
|
||||
# Every shell-side reference is written $$name, which arrives at the shell as
|
||||
# $name. Woodpecker rewrites only the braced form: ${name} is substituted before
|
||||
# the shell runs, and an operator inside it is dropped, so ${version:-none}
|
||||
# becomes empty instead of defaulting. The escaped form is used everywhere so the
|
||||
# rule is mechanical rather than a judgement per line.
|
||||
|
||||
when:
|
||||
- event: push
|
||||
branch: [main]
|
||||
- event: tag
|
||||
ref: refs/tags/v*
|
||||
|
||||
# Two deployments at once would race on the released tags and on `latest`.
|
||||
concurrency: 1
|
||||
|
||||
variables:
|
||||
# The gate and the distribution step both build the dashboard. Anchored here
|
||||
# rather than written twice, so the digest and the pnpm version can only
|
||||
# change in one place.
|
||||
- &node-setup |
|
||||
set -eu
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends xz-utils
|
||||
curl -fsSL -o /tmp/node.tar.xz https://nodejs.org/dist/v24.22.2/node-v24.22.2-linux-x64.tar.xz
|
||||
echo "48cc0e21e048790e54c0cf5749c2725005313d652651c40b7a21feb9697aaf75 /tmp/node.tar.xz" | sha256sum -c -
|
||||
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
||||
# pnpm's version belongs to the lockfile; installing any other one makes
|
||||
# `pnpm install --frozen-lockfile` reject the tree.
|
||||
npm install -g "pnpm@$(node -p 'require("./ui/package.json").packageManager.split("@")[1]')"
|
||||
|
||||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git:2.8.0
|
||||
settings:
|
||||
# A tag pipeline must see the tag it is building, and a branch pipeline
|
||||
# must see a tag pointing at HEAD to know the tag pipeline owns it.
|
||||
tags: true
|
||||
fetch_target_branch: true
|
||||
|
||||
steps:
|
||||
- name: plan
|
||||
image: alpine:3
|
||||
commands:
|
||||
- apk add --no-cache git
|
||||
- |
|
||||
set -eu
|
||||
# An annotated tag makes CI_COMMIT_SHA the tag object, so the commit is
|
||||
# resolved from the ref: image tags and the release statement pin it.
|
||||
sha=$(git rev-parse "$$CI_COMMIT_REF^{commit}")
|
||||
version=$(git tag --points-at HEAD --list 'v*' | sed -e 's|^v||' | sort -V | tail -1)
|
||||
run=true
|
||||
case "$$CI_PIPELINE_EVENT" in
|
||||
tag) ;;
|
||||
*) [ -z "$$version" ] || run=false ;;
|
||||
esac
|
||||
{
|
||||
echo "COMMIT_SHA=$$sha"
|
||||
echo "RELEASE_VERSION=$$version"
|
||||
echo "RUN=$$run"
|
||||
} > "$$CI_WORKSPACE/.git/ci-plan.env"
|
||||
echo "commit $$sha, release $${version:-none}, run $$run"
|
||||
|
||||
- name: gate
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [plan]
|
||||
# The full test suite starts containers. It drives the host daemon through
|
||||
# the Go client, so the socket is enough - this step needs no docker CLI.
|
||||
# The one test that needs the daemon binds a temporary directory into the
|
||||
# container it starts, so that directory has to exist at the same path on
|
||||
# the host; TMPDIR points the test at it.
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /var/tmp/woodpecker-archie-gate:/var/tmp/woodpecker-archie-gate
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
TMPDIR: /var/tmp/woodpecker-archie-gate
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "a release tag owns this commit; the tag pipeline publishes it"; exit 0; }'
|
||||
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version)
|
||||
- go install mvdan.cc/gofumpt@v0.11.0
|
||||
- bash tools/proto.sh install
|
||||
- *node-setup
|
||||
- |
|
||||
set -eu
|
||||
if ! git show-ref --verify --quiet refs/heads/main; then
|
||||
if git rev-parse --verify --quiet origin/main >/dev/null; then
|
||||
git branch main origin/main
|
||||
else
|
||||
# A tag pipeline clones the tag alone. HEAD is the released commit,
|
||||
# which was on main, so the contract baseline is that same tree.
|
||||
echo "no origin/main in this clone; using the released commit as the contract baseline"
|
||||
git branch main HEAD
|
||||
fi
|
||||
fi
|
||||
- task check TEST_FLAGS=-count=1
|
||||
- git diff --exit-code
|
||||
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
- govulncheck ./...
|
||||
- |
|
||||
set -eu
|
||||
fail=0
|
||||
for tag in $(git tag --points-at HEAD); do
|
||||
case "$$tag" in
|
||||
v*)
|
||||
ver=$(echo "$$tag" | sed -e 's|^v||')
|
||||
echo " release tag $$tag -> looking for [$$ver] in CHANGELOG.md"
|
||||
grep -q "^## \[$$ver\]" CHANGELOG.md || {
|
||||
echo " FAIL: CHANGELOG.md has no [$$ver] section"
|
||||
fail=1
|
||||
}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ $$fail -ne 0 ]; then
|
||||
echo
|
||||
echo "A release tag points at this commit but its changelog does not"
|
||||
echo "describe that version. Cut releases with the release workflow."
|
||||
exit 1
|
||||
fi
|
||||
if ! git tag --points-at HEAD | grep -qE '^v[0-9]'; then
|
||||
echo "This commit isn't a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest promoted release."
|
||||
fi
|
||||
|
||||
- name: archied-image
|
||||
image: docker:29-cli
|
||||
depends_on: [gate]
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }'
|
||||
- printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin
|
||||
- |
|
||||
set -eu
|
||||
# A release reports its version; anything else is a build of main and
|
||||
# says so, so a running binary can always name its commit.
|
||||
if [ -n "$$RELEASE_VERSION" ]; then
|
||||
component=$$RELEASE_VERSION
|
||||
else
|
||||
component="dev+$(echo "$$COMMIT_SHA" | cut -c1-12)"
|
||||
fi
|
||||
set -- \
|
||||
--tag "git.catlow.cloud/sam/archied:edge" \
|
||||
--tag "git.catlow.cloud/sam/archied:sha-$$COMMIT_SHA"
|
||||
if [ -n "$$RELEASE_VERSION" ]; then
|
||||
set -- "$$@" --tag "git.catlow.cloud/sam/archied:v$$RELEASE_VERSION"
|
||||
fi
|
||||
# No cache flags: the agent's daemon keeps its layer cache between
|
||||
# pipelines, which is what type=gha bought on ephemeral runners.
|
||||
docker buildx build --push --file Dockerfile.archied \
|
||||
--build-arg GATEWAY_VERSION="$$component" \
|
||||
--build-arg RUNTIME_VERSION="$$component" \
|
||||
--provenance=false \
|
||||
"$$@" .
|
||||
|
||||
- name: agent-image
|
||||
image: docker:29-cli
|
||||
depends_on: [gate]
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; the agent image is only published with a release"; exit 0; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }'
|
||||
- printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin
|
||||
- |
|
||||
set -eu
|
||||
apk add --no-cache jq
|
||||
docker buildx build --push --file Dockerfile \
|
||||
--build-arg RUNTIME_VERSION="$$RELEASE_VERSION" \
|
||||
--tag "git.catlow.cloud/sam/archie-agent:v$$RELEASE_VERSION" \
|
||||
--tag "git.catlow.cloud/sam/archie-agent:sha-$$COMMIT_SHA" \
|
||||
--provenance=false \
|
||||
--metadata-file "$$CI_WORKSPACE/.git/agent-image.json" \
|
||||
.
|
||||
# The release statement pins the agent image by digest, so the digest is
|
||||
# what the distribution records, not the tag.
|
||||
jq -er '."containerimage.digest"' "$$CI_WORKSPACE/.git/agent-image.json" \
|
||||
> "$$CI_WORKSPACE/.git/agent-image.digest"
|
||||
echo "agent image $(cat "$$CI_WORKSPACE/.git/agent-image.digest")"
|
||||
|
||||
- name: dist
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [archied-image, agent-image]
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; no distribution to build"; exit 0; }'
|
||||
- apt-get update -qq
|
||||
- apt-get install -y -qq --no-install-recommends jq zip
|
||||
- *node-setup
|
||||
# A subshell: a bare `cd ui` here would leave every later command in this
|
||||
# step building from the dashboard directory.
|
||||
- |
|
||||
set -eu
|
||||
(
|
||||
cd ui
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
)
|
||||
- |
|
||||
set -eu
|
||||
base=github.com/samcharles93/archie-core
|
||||
ldflags="-X $${base}/internal/installtype.buildType=binary -X $${base}/internal/buildinfo.Version=$$RELEASE_VERSION -X $${base}/internal/buildinfo.Runtime=$$RELEASE_VERSION -X $${base}/internal/app/agentworker.version=$$RELEASE_VERSION"
|
||||
cmds=$(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json)
|
||||
mkdir -p dist
|
||||
for cmd in $$cmds; do
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "$$ldflags" -o "dist/$$cmd" "./cmd/$$cmd"
|
||||
done
|
||||
name="archie-core-archied-v$$RELEASE_VERSION-linux-amd64"
|
||||
mkdir -p "$$name"
|
||||
for cmd in $$cmds; do
|
||||
cp "dist/$$cmd" "$$name/"
|
||||
done
|
||||
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$$name/"
|
||||
if [ -f README.md ]; then cp README.md "$$name/"; fi
|
||||
digest=$(cat "$$CI_WORKSPACE/.git/agent-image.digest")
|
||||
test -n "$$digest"
|
||||
jq --arg image "git.catlow.cloud/sam/archie-agent@$$digest" '. + {agent_image: $$image}' \
|
||||
release.json > "$$name/release.json"
|
||||
zip -qr "$$name.zip" "$$name"
|
||||
echo "RELEASE_ZIP=$$name.zip" >> "$$CI_WORKSPACE/.git/ci-plan.env"
|
||||
echo "built $$name.zip"
|
||||
|
||||
- name: publish
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [dist]
|
||||
environment:
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
ARCHIE_RELEASE_SEED:
|
||||
from_secret: release_signing_key
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; nothing to publish"; exit 0; }'
|
||||
- '[ -n "$$ARCHIE_RELEASE_SEED" ] || { echo "repo secret release_signing_key is not set"; exit 1; }'
|
||||
# archied pushes the release artifact with oras, which reads the registry
|
||||
# credentials a docker login would have written.
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p "$$HOME/.docker"
|
||||
auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0)
|
||||
printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json"
|
||||
- |
|
||||
set -eu
|
||||
prerelease=false
|
||||
case "$$RELEASE_VERSION" in *-*) prerelease=true ;; esac
|
||||
digest=$(cat "$$CI_WORKSPACE/.git/agent-image.digest")
|
||||
./dist/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
-version "$$RELEASE_VERSION" -prerelease="$$prerelease" \
|
||||
-zip "$$RELEASE_ZIP" \
|
||||
-agent-image "git.catlow.cloud/sam/archie-agent@$$digest" \
|
||||
-changelog "https://git.catlow.cloud/sam/archie/releases/tag/v$$RELEASE_VERSION"
|
||||
|
||||
- name: notes
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [dist]
|
||||
environment:
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; no notes to publish"; exit 0; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }'
|
||||
- apt-get update -qq
|
||||
- apt-get install -y -qq --no-install-recommends jq
|
||||
- |
|
||||
set -eu
|
||||
tag="v$$RELEASE_VERSION"
|
||||
notes=$(mktemp)
|
||||
awk -v hdr="## [$$RELEASE_VERSION]" '
|
||||
index($$0, hdr) == 1 { printing = 1 }
|
||||
printing && /^## \[/ && index($$0, hdr) != 1 { exit }
|
||||
printing { print }
|
||||
' CHANGELOG.md > "$$notes"
|
||||
if ! [ -s "$$notes" ]; then
|
||||
echo "no [$$RELEASE_VERSION] section extracted from CHANGELOG.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
api=https://git.catlow.cloud/api/v1
|
||||
repo=sam/archie
|
||||
auth="Authorization: token $$DEPLOY_TOKEN"
|
||||
curl -sf -X DELETE -H "$$auth" "$$api/repos/$$repo/releases/tags/$$tag" >/dev/null || true
|
||||
curl -sf -X POST -H "$$auth" -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg tag "$$tag" --arg name "Archie v$$RELEASE_VERSION" --arg body "$(cat "$$notes")" \
|
||||
'{tag_name: $$tag, name: $$name, body: $$body, draft: false, prerelease: false}')" \
|
||||
"$$api/repos/$$repo/releases" >/dev/null
|
||||
echo "published release notes for $$tag"
|
||||
# The packages exist under this repository's namespace but are not
|
||||
# linked to it, so the package pages stay empty until this runs.
|
||||
for name in archied archie-agent archie; do
|
||||
curl -sS -o /dev/null -X POST -H "$$auth" \
|
||||
"$$api/packages/sam/container/$$name/-/link/archie" || true
|
||||
done
|
||||
|
||||
- name: canary
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [publish]
|
||||
environment:
|
||||
CANARY_URL:
|
||||
from_secret: canary_url
|
||||
ARCHIE_CANARY_TOKEN:
|
||||
from_secret: canary_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; nothing to install on the canary"; exit 0; }'
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "canary_url is not set; skipping the canary install"; exit 0; }'
|
||||
- ./dist/archied release canary start -dashboard "$$CANARY_URL" -version "$$RELEASE_VERSION"
|
||||
@@ -1,41 +0,0 @@
|
||||
# Manual promotion: move stable to the release the canary is running, without
|
||||
# waiting for its verdict. Same rules as the canary's own promotion, minus the
|
||||
# window.
|
||||
#
|
||||
# Start it with the pipeline variable VERSION set to the release the canary
|
||||
# runs (woodpecker-cli pipeline create --branch main --var VERSION=1.57.0).
|
||||
#
|
||||
# Requires repo secrets canary_url, canary_token and deploy_token.
|
||||
|
||||
when:
|
||||
- event: [manual]
|
||||
|
||||
concurrency: 1
|
||||
|
||||
steps:
|
||||
- name: promote
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
CANARY_URL:
|
||||
from_secret: canary_url
|
||||
ARCHIE_CANARY_TOKEN:
|
||||
from_secret: canary_token
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$VERSION" ] || { echo "VERSION is empty: start this workflow with the pipeline variable VERSION=<release the canary runs>"; exit 1; }'
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to read"; exit 1; }'
|
||||
- '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }'
|
||||
- go build -tags no_ui -o /tmp/archied ./cmd/archied
|
||||
# archied reads the registry credentials a docker login would have
|
||||
# written; this step has no docker CLI, so the file is written directly.
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p "$$HOME/.docker"
|
||||
auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0)
|
||||
printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json"
|
||||
- >-
|
||||
/tmp/archied release canary promote -dashboard "$$CANARY_URL"
|
||||
-version "$$VERSION"
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
@@ -1,60 +0,0 @@
|
||||
# Pull-request gate: the same `task check` the maintainer runs locally.
|
||||
#
|
||||
# One step, not one step per check: `task check` installs task, golangci-lint,
|
||||
# gofumpt, buf and sqlc into the container it runs in, and a second step starts
|
||||
# from an empty container and pays for that again.
|
||||
|
||||
when:
|
||||
- event: [pull_request]
|
||||
|
||||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git:2.8.0
|
||||
settings:
|
||||
# The gate compares the contracts against main and reads the release tags
|
||||
# for the version a build reports, so a partial clone will not do.
|
||||
tags: true
|
||||
# A pull-request pipeline otherwise clones only the pull request's own
|
||||
# ref, leaving no main for the contract baseline to compare against.
|
||||
fetch_target_branch: true
|
||||
|
||||
steps:
|
||||
- name: check
|
||||
image: golang:1.27.3-bookworm
|
||||
commands:
|
||||
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version)
|
||||
- go install mvdan.cc/gofumpt@v0.11.0
|
||||
- bash tools/proto.sh install
|
||||
# The gate builds and tests the dashboard, so Node and pnpm sit next to
|
||||
# Go. Pinned tarball verified by digest, not a third-party setup script:
|
||||
# the gate must not change under the repository.
|
||||
- |
|
||||
set -eu
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends xz-utils
|
||||
curl -fsSL -o /tmp/node.tar.xz https://nodejs.org/dist/v24.22.2/node-v24.22.2-linux-x64.tar.xz
|
||||
echo "48cc0e21e048790e54c0cf5749c2725005313d652651c40b7a21feb9697aaf75 /tmp/node.tar.xz" | sha256sum -c -
|
||||
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
||||
# pnpm's version belongs to the lockfile; installing any other one makes
|
||||
# `pnpm install --frozen-lockfile` reject the tree.
|
||||
npm install -g "pnpm@$(node -p 'require("./ui/package.json").packageManager.split("@")[1]')"
|
||||
node --version
|
||||
pnpm --version
|
||||
- |
|
||||
set -eu
|
||||
# The contract baseline is a local main. plugin-git fetches with an explicit
|
||||
# refspec, so it creates no remote-tracking branch itself; only the target
|
||||
# branch fetch above does, which is why this fails rather than comparing
|
||||
# the pull request against its own tree.
|
||||
if ! git show-ref --verify --quiet refs/heads/main; then
|
||||
if ! git rev-parse --verify --quiet origin/main >/dev/null; then
|
||||
echo "no main in this clone, so the contracts cannot be compared against a baseline" >&2
|
||||
exit 1
|
||||
fi
|
||||
git branch main origin/main
|
||||
fi
|
||||
- task --concurrency 1 check
|
||||
# The gate rewrites the tree (fmt, generated contracts and queries); a
|
||||
# rewrite the author did not commit is a failure, not a side effect.
|
||||
- git diff --exit-code
|
||||
@@ -1,50 +0,0 @@
|
||||
# Manual release: turn [Unreleased] in CHANGELOG.md into a release commit, tag
|
||||
# it, and push main and the tag in one command. The deploy pipeline publishes
|
||||
# what this pushes, so this workflow commits and tags but never builds.
|
||||
#
|
||||
# Start it with the pipeline variable RELEASE=minor (or major, patch, or an
|
||||
# exact 1.2.3): woodpecker-cli pipeline create --branch main --var RELEASE=minor
|
||||
# sam/archie, or the same variable in the web UI's pipeline dialog.
|
||||
#
|
||||
# Shell-side references are written $$name (see the note in deploy.yaml).
|
||||
#
|
||||
# Requires repo secret deploy_token, a token that may push to main and to tags.
|
||||
|
||||
when:
|
||||
- event: [manual]
|
||||
|
||||
# Two releases at once would read the same last tag and try to write it twice.
|
||||
concurrency: 1
|
||||
|
||||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git:2.8.0
|
||||
settings:
|
||||
# `task release` derives the next version from the release tags.
|
||||
tags: true
|
||||
fetch_target_branch: true
|
||||
|
||||
steps:
|
||||
- name: cut
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$RELEASE" ] || { echo "RELEASE is empty: start this workflow with the pipeline variable RELEASE=major|minor|patch|x.y.z"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the release cannot push its commit and tag"; exit 1; }'
|
||||
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
- git config user.name "Sam Catlow"
|
||||
- git config user.email "sam@catlow.tech"
|
||||
- task release RELEASE="$$RELEASE"
|
||||
- |
|
||||
set -eu
|
||||
tag=$(git describe --exact-match --match 'v*' HEAD)
|
||||
# HEAD, not a local main: the clone checks out the fetched ref detached,
|
||||
# so there is no branch to name. The release commit is a child of main,
|
||||
# so this is the fast-forward an atomic push needs.
|
||||
#
|
||||
# Gitea authenticates a token in the password position and ignores the
|
||||
# user name, so the token never has to be a real login.
|
||||
git push --atomic "https://x-access-token:$$DEPLOY_TOKEN@git.catlow.cloud/sam/archie.git" HEAD:refs/heads/main "$$tag"
|
||||
echo "released $$tag"
|
||||
-2895
File diff suppressed because it is too large.
Load diff
@@ -5,21 +5,39 @@ here changes a decision. If a rule stops changing decisions, delete it.
|
||||
|
||||
## What this is
|
||||
|
||||
**archie-core** is event-driven agentic automation. An event (an issue, PR,
|
||||
webhook, schedule, chat message) is matched to a workflow, the workflow runs an
|
||||
agent or tool in an isolated container, and the result lands somewhere for
|
||||
review or action. A repository is an optional input to a workflow, not the point
|
||||
of the product. A forge is one of many inputs or outputs; core code never
|
||||
assumes one.
|
||||
**archie-core** is event-driven agentic automation. An event (an alert, a
|
||||
webhook, a schedule, a chat message, an issue) is matched to a workflow, the
|
||||
workflow runs an agent whose every action is judged before it runs, and the
|
||||
result lands somewhere for review or action. A repository is an optional input
|
||||
to a workflow, not the point of the product. A forge is one of many inputs or
|
||||
outputs; core code never assumes one.
|
||||
|
||||
<temporary - remove on 2026-12-01> The goal until 1 December is a
|
||||
production-ready archie-core, including the features the maintainer is still
|
||||
adding. Speak up when a request competes with something more urgent: a bug that
|
||||
loses work, a failure that shows nothing, a security gap, a broken setup path.
|
||||
Give the trade-off in a sentence or two and suggest whether the request belongs
|
||||
in the backlog. Don't hold work back on your own judgement. </temporary>
|
||||
## Layout
|
||||
|
||||
## Services and layout
|
||||
Main is becoming one binary, `archie`. The design is ARCHITECTURE.md in the
|
||||
private sam/archie-product repo, and the work is epic #1977. New work goes
|
||||
there:
|
||||
|
||||
- `cmd/archie` parses flags and calls `internal/app/archie`, the composition
|
||||
root.
|
||||
- Each module is `modules/<name>/`: an API package and an `internal/` directory
|
||||
nothing outside the module can import. Modules reach each other only through
|
||||
API packages, own their schema and tables, and keep no state only in memory.
|
||||
- `internal/platform/` holds the few leaf packages every module may use.
|
||||
- The new code never imports the old services' packages (depguard enforces it).
|
||||
Old code moves: `git mv` it into the module that owns it, then adapt it.
|
||||
While an old service still imports it, copy it instead, name the source
|
||||
path in the commit, and delete the old copy with its service.
|
||||
MIGRATION.md in sam/archie-product gives every old package a destination and
|
||||
a verdict. Writing a replacement from scratch, or deleting an old package,
|
||||
needs the maintainer's verdict on its row. Before building anything an old
|
||||
package already does, read that package and carry its behaviour.
|
||||
|
||||
### The services being replaced
|
||||
|
||||
The six services below are deleted slice by slice as the binary replaces them,
|
||||
each only once MIGRATION.md has a verdict for every package it holds. Don't
|
||||
add features to them; fix them only when a bug blocks work.
|
||||
|
||||
Each service is a gRPC contract in `proto/<service>/v1`, generated into
|
||||
`internal/contracts/<service>/v1`, and one binary in `cmd/` that parses flags
|
||||
@@ -27,16 +45,22 @@ and calls its composition root in `internal/app/<service>`.
|
||||
|
||||
| Binary | Serves | Dials |
|
||||
| --- | --- | --- |
|
||||
| `archie-state-store` | State Store and Control Plane contracts; owns the task and control-plane PostgreSQL tables | PostgreSQL |
|
||||
| `archie-gateway` | Chat, conversation state, task tools | State Store |
|
||||
| `archied` | Scheduling, workflow runs, harness, Daemon contract | State Store, Gateway, Messaging |
|
||||
| `archie-messaging` | External channel frontends | Gateway |
|
||||
| `archie-ui` | Dashboard HTTP API (`internal/webui`) and the embedded SPA | State Store, Gateway, daemon, harness |
|
||||
| `archie-state-store` | State Store and Control Plane contracts; owns the task and control-plane tables | PostgreSQL |
|
||||
| `archie-gateway` | Chat contract; owns the conversation tables | State Store, PostgreSQL |
|
||||
| `archied` | Daemon contract; scheduling, workflow runs, task containers | State Store, Gateway, Messaging, NATS |
|
||||
| `archie-messaging` | Messaging contract; external channel frontends | State Store, Gateway |
|
||||
| `archie-ui` | Dashboard HTTP API (`internal/webui`) and the embedded SPA | State Store, Gateway, Daemon, Messaging |
|
||||
| `archie-agent` | The worker inside each task container | NATS |
|
||||
|
||||
Forge, channel and secret-engine contracts are extension boundaries, not
|
||||
services: a core binary starts the extension as a plugin process and dials it.
|
||||
`archied` also runs the State Store's backup and restore during a host update.
|
||||
|
||||
`internal/domain` holds behaviour and interfaces; `internal/infrastructure`
|
||||
implements them. Dashboard work follows `ui/CLAUDE.md`. Workflow YAML and its
|
||||
step vocabulary are in `WORKFLOWS.md`; the server catalogue is authoritative.
|
||||
implements them. Every instruction sent to a model is a file in
|
||||
`internal/prompts`, read through that package; never inline a prompt in code.
|
||||
Dashboard work follows `ui/CLAUDE.md`. Workflow YAML and its step vocabulary
|
||||
are in `WORKFLOWS.md`; the server catalogue is authoritative.
|
||||
|
||||
## Authority
|
||||
|
||||
@@ -54,6 +78,11 @@ When sources disagree, the higher one wins:
|
||||
- **A clear direction is the go-ahead.** Do it in the same turn. Do not restate
|
||||
the plan, offer options, or ask "shall I proceed?". Stop only for destructive
|
||||
or outward-facing actions (deleting data, pushing, touching a live host).
|
||||
- **Push back when it matters.** If a request competes with something clearly
|
||||
more urgent (a bug that loses work, a failure that shows nothing, a security
|
||||
gap, a broken setup path), or looks like the wrong call, say so once in a
|
||||
sentence or two and suggest whether it belongs in the backlog. Then do what
|
||||
was asked: don't repeat the point or hold work back on your own judgement.
|
||||
- **Post outside the repo only when told.** Chat, tickets and any external
|
||||
service get a message only on the maintainer's instruction.
|
||||
- **Report, don't narrate.** Final replies say what changed, what was verified,
|
||||
@@ -65,23 +94,22 @@ When sources disagree, the higher one wins:
|
||||
|
||||
## How to decide
|
||||
|
||||
- **Broken beats new.** A bug that blocks work gets fixed now, with the smallest
|
||||
change that unblocks it. No design docs and no new mechanism.
|
||||
- **Cheapest option first.** Before building, name the smallest change that
|
||||
solves the problem, including changing configuration or deleting something. If
|
||||
your plan adds a new mechanism (RPC, process, binary, abstraction, config
|
||||
field, tool) or grows past about 100 lines, stop and assess whether you're
|
||||
taking the path of least resistance.
|
||||
- **Broken comes first.** A bug that blocks or loses work goes ahead of new
|
||||
features. Fix the cause. When that's a bigger job, unblock with a small change
|
||||
first and file the proper fix rather than stopping there.
|
||||
- **Cheapest option first.** Before building, consider the smallest change that
|
||||
solves the problem, including changing configuration or deleting something.
|
||||
A new mechanism (RPC, process, binary, abstraction, config field, tool) is
|
||||
fine when it's the right design; say why the smaller option wasn't enough.
|
||||
- **Delete before adding.** Unused code, dead paths, fallbacks nobody takes and
|
||||
features nobody runs get removed, not maintained. Solo project, single user:
|
||||
breaking changes need no compatibility shims.
|
||||
- **Finish before starting.** Prefer completing a half-built feature end to end
|
||||
over starting a new one.
|
||||
- **Services own contracts.** A service is a gRPC contract in
|
||||
`proto/<service>/v1` and one binary that serves it. Services reach each other
|
||||
only through those contracts, never through another service's tables or
|
||||
packages. A new command is a subcommand of an existing binary. A new binary
|
||||
exists only for a new service or a real process boundary.
|
||||
- **Modules own their API and tables.** A module reaches another only through
|
||||
its API package, never its tables or `internal/`. The only real process
|
||||
boundaries are extensions and the runner. A new command is a subcommand of
|
||||
`archie`.
|
||||
- **No compensating tools.** Do not write a linter, checker or generator to
|
||||
enforce something a simpler design would make unnecessary. Fix the design.
|
||||
- **A setting must work end to end.** A config field that parses but has no
|
||||
@@ -121,19 +149,37 @@ The default for a change is no new test. Write one only when:
|
||||
|
||||
A test that exists must catch a real regression, survive refactoring, run fast,
|
||||
and be cheap to keep. Never test wiring, constants, defaults, struct shapes,
|
||||
fakes, or call order. No test opens a real database or needs Docker; test
|
||||
SQL semantics at the interceptor or domain level with fakes. One table-driven test per behaviour; extend the table
|
||||
instead of adding a second test. Prefer making an invalid state unrepresentable
|
||||
to testing that it is rejected. Test helpers live in `_test.go` files only.
|
||||
fakes, or call order. Prefer making an invalid state unrepresentable to testing
|
||||
that it is rejected.
|
||||
|
||||
How to write one:
|
||||
|
||||
- **Prove it.** Run the new test against the code before the fix and see it
|
||||
fail. A test that passes either way proves nothing: delete it. When a bug
|
||||
can't be reproduced deterministically (a race, say), fix it with an API that
|
||||
rules it out and don't add a test.
|
||||
- **One table per behaviour.** Extend the table instead of adding a second test.
|
||||
Name the test after the behaviour, and say in its comment what regression it
|
||||
guards.
|
||||
- **Same gate as production.** Tests pass golangci-lint, gosec included, with no
|
||||
exclusions for test files. Fix what the linter finds. A fixture that has to
|
||||
look like a secret (a key the redaction must catch, a URL with a password the
|
||||
parser must reject) uses a plainly fake value and a `//nolint:gosec` saying
|
||||
what it tests.
|
||||
- **Isolated.** Use `t.TempDir()` and `t.Setenv`, never host state. A test that
|
||||
commits with git sets `GIT_CONFIG_GLOBAL` to `os.DevNull`. No test opens a
|
||||
real database or needs Docker: test SQL semantics at the interceptor or domain
|
||||
level with fakes. Files are written `0o600`, or `0o700` for a script.
|
||||
- **Shared setup in helpers.** When several tests repeat the same setup, put it
|
||||
in a helper in a `_test.go` file, never in production code.
|
||||
|
||||
## Invariants
|
||||
|
||||
These protect users. Do not weaken them without the maintainer's say-so.
|
||||
|
||||
- Failure stays local. Any service may crash, restart or be absent without
|
||||
losing accepted work or taking another service down. Callers retry, degrade
|
||||
and report the dependency as unhealthy; they never exit because a peer is
|
||||
missing, and work is acknowledged only once it is durable.
|
||||
- A crash loses no accepted work, and a restart resumes every run. Work is
|
||||
acknowledged only once it is durable. A missing dependency is reported
|
||||
unhealthy and retried, never a reason to exit.
|
||||
- The model never runs git. Commits and pushes go through the daemon.
|
||||
- The daemon's own credentials never enter an agent container. Containers get
|
||||
task-scoped grants that are revoked when the task ends.
|
||||
@@ -157,10 +203,10 @@ task dev # every service + Vite at http://localhost:5173, from deployments/d
|
||||
task e2e:up # seeded local stack; task e2e:check -- all runs the browser checks
|
||||
```
|
||||
|
||||
`task proto:generate` and `task db:generate` write the committed generated
|
||||
output for `proto/` and `internal/infrastructure/postgres/`; `task check` runs
|
||||
their check variants and rejects stale output. The e2e stack is not part of the
|
||||
gate.
|
||||
`task proto:generate`, `task db:generate` and `task openapi:generate` write
|
||||
the committed generated output for `proto/`, `internal/infrastructure/postgres/`
|
||||
and `api/openapi.yaml`; `task check` runs their check variants and rejects stale
|
||||
output. The e2e stack is not part of the gate.
|
||||
|
||||
Requires Go 1.27, Task, golangci-lint, Node, pnpm and Docker. Adopt `task fmt` and
|
||||
`go fix` output as-is.
|
||||
@@ -170,7 +216,7 @@ Requires Go 1.27, Task, golangci-lint, Node, pnpm and Docker. Adopt `task fmt` a
|
||||
run, say what you did verify.
|
||||
- Commit finished work without asking. Stage only your own paths and commit in
|
||||
the same command. Conventional Commits scoped by package, short messages. Push
|
||||
only when told.
|
||||
every commit as soon as it is made; a local-only commit is not acceptable.
|
||||
- Never commit binaries, build output, scratch files or `.references/`. Scratch
|
||||
goes in `/tmp`.
|
||||
- Runtime config lives at `${XDG_CONFIG_HOME:-~/.config}/archie/config.toml`.
|
||||
@@ -183,19 +229,25 @@ Work is tracked as issues on the primary remote, never in Markdown TODO files.
|
||||
GitHub is a read-only mirror; do not open, close or comment there.
|
||||
|
||||
```bash
|
||||
tea issues list -r sam/archie --state open --labels priority::critical
|
||||
tea issues list -r sam/archie --labels epic/<slug> --state open
|
||||
tea issues list -r sam/archie --state open --labels critical
|
||||
tea issues view 497
|
||||
tea issues edit 497 --add-labels status::in_progress --add-assignees sam
|
||||
tea issues edit 497 --add-labels in-progress --add-assignees sam
|
||||
tea comment 497 "what changed, and what was run"
|
||||
tea issues close 497
|
||||
```
|
||||
|
||||
- An issue is the plan: what is wrong or wanted, and how you know it is done.
|
||||
Keep it to that.
|
||||
- Labels carry state: `type::`, `priority::`, `status::in_progress` and
|
||||
`status::deferred`. Open/closed is the issue state, not a label.
|
||||
`epic/<slug>` says which epic an issue belongs to.
|
||||
- Labels carry state: a type (`bug`, `feature`, `task`, `chore`, `epic`,
|
||||
`decision`, `discovery`), a priority (`critical`, `high`, `medium`, `low`), `in-progress`
|
||||
and `deferred`. Open/closed is the issue state, not a label.
|
||||
- An epic's children are its dependencies: link each one as it is filed (Gitea
|
||||
MCP `issue_write` `add_dependency`, the epic `blocked_by` the child), plus any
|
||||
real blocker between children. No `epic/<slug>` label; the dependencies are
|
||||
the link, and the only place the web UI shows an epic's children.
|
||||
- `tea` drops labels on `issues create` and `edit --add-labels`. Label through
|
||||
the Gitea MCP connector, by label ID: it resolves names from the first 50
|
||||
labels only.
|
||||
- Cite the issue number in commits and comments.
|
||||
- `tea issues list --labels` silently ignores an unknown name and returns every
|
||||
issue. Check the count is plausible before trusting a filtered list.
|
||||
|
||||
+7
-3
@@ -10,9 +10,13 @@ FROM golang:1.27-trixie AS builder
|
||||
ARG RUNTIME_VERSION=dev
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
# Cache mounts keep modules and compiled packages on the build daemon; without
|
||||
# them COPY . . makes every commit a cold compile.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
CGO_ENABLED=0 go build \
|
||||
-ldflags "-X github.com/samcharles93/archie-core/internal/app/agentworker.version=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=container" \
|
||||
-o /usr/local/bin/archie-agent ./cmd/archie-agent/
|
||||
|
||||
@@ -99,5 +103,5 @@ ENV GOMODCACHE=/data/cache/go/mod \
|
||||
|
||||
COPY --from=builder /usr/local/bin/archie-agent /usr/local/bin/archie-agent
|
||||
|
||||
# The daemon injects NATS_URL and, when configured, NATS_TOKEN.
|
||||
# The daemon injects NATS_URL.
|
||||
ENTRYPOINT ["archie-agent"]
|
||||
+6
-3
@@ -12,12 +12,16 @@ RUN pnpm run build
|
||||
FROM golang:1.27-trixie AS builder
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
# Cache mounts keep modules and compiled packages on the build daemon; without
|
||||
# them COPY . . makes every commit a cold compile.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
||||
COPY . .
|
||||
COPY --from=dashboard /src/ui/dist ./ui/dist
|
||||
ARG GATEWAY_VERSION=dev
|
||||
ARG RUNTIME_VERSION=dev
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
CGO_ENABLED=0 go build \
|
||||
-ldflags "-X github.com/samcharles93/archie-core/internal/buildinfo.Version=${GATEWAY_VERSION} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=container" \
|
||||
-o /usr/local/bin/archied ./cmd/archied/
|
||||
|
||||
@@ -31,6 +35,5 @@ ARG RUNTIME_VERSION=dev
|
||||
LABEL org.opencontainers.image.version="${GATEWAY_VERSION}"
|
||||
LABEL cloud.catlow.archie.runtime-version="${RUNTIME_VERSION}"
|
||||
|
||||
COPY CHANGELOG.md /usr/share/archie/CHANGELOG.md
|
||||
|
||||
ENTRYPOINT ["archied"]
|
||||
+33
-235
@@ -1,258 +1,56 @@
|
||||
# Releasing
|
||||
|
||||
One release stream. `CHANGELOG.md` carries every release section, one generated
|
||||
page per version describes it, and one `v*` tag names the release. One version
|
||||
covers every process in the host bundle (`archied`, `archie-gateway`,
|
||||
`archie-state-store`, `archie-ui`, `archie-messaging`) and the `archie-agent`
|
||||
image; per-component detail is a labelled section inside the version
|
||||
(`### archied`, `### archie-agent`).
|
||||
|
||||
A release is cut by CI, published to `next`, run on the canary for a day, and
|
||||
promoted to `stable` only if the canary's signals pass. Nothing is run locally.
|
||||
|
||||
## Notes are written with the change
|
||||
|
||||
A commit that changes what a reader experiences adds its bullet under
|
||||
`## [Unreleased]` in `CHANGELOG.md`, in the same commit. The release takes that
|
||||
section as it stands, so write the bullet as the release note, not as a commit
|
||||
subject.
|
||||
|
||||
**Release notes describe the reader's experience of what shipped.** The test is
|
||||
the reader, not whether a sentence is negative:
|
||||
|
||||
- A capability that **never existed** leaves no expectation to correct, so a
|
||||
note about it reads as a feature to someone who never had the thing: out.
|
||||
- **The implementation's journey** (what was rebuilt, what a guard finally
|
||||
covers, what a browser API refuses to surface) isn't the reader's experience
|
||||
either: out.
|
||||
- A capability that **shipped but isn't yet wired** _is_ the reader's
|
||||
experience, so it belongs, worded as a caveat on the capability and paired
|
||||
with the behaviour that compensates for it.
|
||||
|
||||
Design constraints and withheld capabilities are not release news. Deleting a
|
||||
caveat a reader needs misleads them, which is the failure this rule exists to
|
||||
prevent.
|
||||
One `v*` tag names a release. One version covers every process in the host
|
||||
bundle (`archied`, `archie-gateway`, `archie-state-store`, `archie-ui`,
|
||||
`archie-messaging`) and the `archie-agent` image. Nothing is released from a
|
||||
laptop.
|
||||
|
||||
## Cutting a release
|
||||
|
||||
Dispatch the **release** workflow (`.github/workflows/release.yml`) with
|
||||
`major`, `minor`, `patch` or an exact version. It runs `task release` on `main`:
|
||||
|
||||
1. refuses a dirty tree, an existing tag, or an `[Unreleased]` with no entries;
|
||||
2. turns `[Unreleased]` into `## [x.y.z] - date` under a new empty
|
||||
`[Unreleased]`, and runs `task news`;
|
||||
3. commits `chore(release): vx.y.z` and tags `vx.y.z`;
|
||||
|
||||
then pushes `main` and the tag atomically with `DEPLOY_TOKEN`. A push made with
|
||||
the job token wouldn't start other workflows, so the user token is what lets
|
||||
the tag start the deploy.
|
||||
|
||||
Every workflow that reaches the registry or the canary reads its credentials
|
||||
from Actions secrets, so a mirror of this repository carries its own set:
|
||||
|
||||
| Name | Kind | Used by |
|
||||
|---|---|---|
|
||||
| `DEPLOY_TOKEN` | secret | release, deploy, canary, promote — the registry push, the tag push, and the package links |
|
||||
| `RELEASE_SIGNING_KEY` | secret | deploy — signs the release statement |
|
||||
| `CANARY_TOKEN` | secret | deploy, canary, promote — the canary's dashboard API |
|
||||
| `CANARY_URL` | variable | deploy, canary, promote — where that dashboard is |
|
||||
| `CANARY_WINDOW` | variable | canary — the judged window; empty means the default |
|
||||
|
||||
A mirror missing them fails at its first login or push; `release.yml` names the
|
||||
missing `DEPLOY_TOKEN` before it checks out, so the run doesn't read as a broken
|
||||
release.
|
||||
|
||||
After a release, pull `main` before committing on it again: CI has added the
|
||||
release commit.
|
||||
`major`, `minor`, `patch` or an exact version. It runs `task release` on
|
||||
`main`, which refuses a dirty tree or an existing tag and then tags `vx.y.z`,
|
||||
and pushes the tag with `DEPLOY_TOKEN`. A push made with the job token
|
||||
wouldn't start other workflows, so the user token is what lets the tag start
|
||||
the deploy.
|
||||
|
||||
## What a release publishes
|
||||
|
||||
The tag push runs `deploy.yml`:
|
||||
|
||||
- **Gate.** `task check TEST_FLAGS=-count=1` (uncached, including the
|
||||
Docker-backed tests `-short` skips) and `govulncheck`, then a check that the
|
||||
tag has a `[version]` section in `CHANGELOG.md`.
|
||||
- **Images.** `archied:v<version>` and `archie-agent:v<version>` on a release
|
||||
tag; `archied:edge` and `archied:sha-<commit>` on any other push to `main`.
|
||||
`:latest` moves only on promotion, so it names the newest promoted release.
|
||||
- **Gate.** `task check dist TEST_FLAGS=-count=1` and `govulncheck`. The
|
||||
binaries the zip ships are built in the same run, so nothing is compiled
|
||||
again after the gate.
|
||||
- **Images.** `archied:v<version>` and `archie-agent:v<version>`, plus
|
||||
`sha-<commit>` tags. `:latest` moves only on promotion.
|
||||
- **The signed release.** `archied release publish` signs a statement
|
||||
(version, issued_at, zip digest, agent image by digest) with
|
||||
`RELEASE_SIGNING_KEY` and pushes it with the distribution zip to
|
||||
`git.catlow.cloud/sam/archie` as `v<version>` and `next`. It never moves
|
||||
`stable`.
|
||||
- **The release-notes page** on Gitea, from that version's `CHANGELOG.md`
|
||||
section, which the statement links to.
|
||||
- **The canary install**: `archied release canary start` points the canary at
|
||||
`next` and installs the release through its dashboard.
|
||||
- **The release page** on Gitea, listing the commit subjects since the
|
||||
previous tag. The statement links to it.
|
||||
|
||||
GitHub-style Actions run the workflow from the tagged commit, so a fix to
|
||||
`deploy.yml` reaches a release only if it is an ancestor of the tag. Re-cut the
|
||||
release rather than committing the fix on top of a tagged one.
|
||||
Actions run the workflow from the tagged commit, so a fix to `deploy.yml`
|
||||
reaches a release only if it is an ancestor of the tag. Cut a new release
|
||||
rather than committing the fix on top of a tagged one.
|
||||
|
||||
## The canary
|
||||
## Promote
|
||||
|
||||
The canary is the production host, following `next`. Every quarter hour
|
||||
`canary.yml` runs `archied release canary check`, which reads the canary
|
||||
through its dashboard API and judges **the release the canary actually runs**,
|
||||
not the moving `next` tag:
|
||||
|
||||
| Signal | Source | Fails when |
|
||||
| --- | --- | --- |
|
||||
| Install outcome | `GET /api/chat/update` | the canary doesn't run the judged release (the watchdog rolled it back) |
|
||||
| Readiness | `GET /health/detailed` | the rollup isn't `ok` |
|
||||
| Alerts | `GET /api/alerts` | an open `action` alert was first raised after the release was installed |
|
||||
| Error log | `GET /api/logs?level=error` | error lines per window exceed `2 × baseline + 10` |
|
||||
| Task outcomes | `GET /api/tasks` | the share of finished tasks that parked or died rose more than 10 points |
|
||||
|
||||
- **Control.** The canary's own window before the release was installed. With
|
||||
one production host there's no simultaneous control.
|
||||
- **Window.** 24 hours counted from the **install** on the canary, not from
|
||||
the release's issue time: the host records it in `installed.json`
|
||||
(`committed_at`) and reports it as `installed_at` in `GET /api/chat/update`.
|
||||
One cycle of schedules and traffic. The first 30 minutes are for the install
|
||||
and restart. `canary.yml` passes `-window` when the `CANARY_WINDOW` Actions
|
||||
variable is set; the flag defaults to 24h. A host that doesn't report an
|
||||
install time degrades to the release statement's issue time.
|
||||
- **Hard signals** (install, readiness, alerts) roll back at any check after
|
||||
that. **Relative signals** (errors, tasks) are judged against the baseline
|
||||
whenever both windows carry enough data, so a breach rolls the release back
|
||||
even mid-window; a full window with no failure promotes it.
|
||||
- **Too little data skips a signal** rather than failing it: fewer than 5
|
||||
finished tasks in the window, or an error log that reaches back less than an
|
||||
hour into the baseline. A log read that stops short of a window is scaled to
|
||||
a full window from what it covers.
|
||||
|
||||
### Queueing
|
||||
|
||||
`deploy.yml` installs each new release on the canary with
|
||||
`archied release canary start -version V`, which first points the canary back
|
||||
at `next` (clearing any rollback pin) and then installs `V` — unless the
|
||||
canary is already judging a release newer than stable that isn't `V`, in which
|
||||
case `V` is **queued** behind it and the canary keeps running what it judges.
|
||||
`-force` installs regardless. A `check` that promotes (or finds nothing to
|
||||
judge) installs the newer `next` in the same run, so a queue drains one
|
||||
release per promotion.
|
||||
|
||||
### Subcommands
|
||||
|
||||
```
|
||||
archied release canary status read-only: channel/pin, installed release and
|
||||
installed_at, stable/next, window progress, and
|
||||
the verdict the current signals would give
|
||||
archied release canary start point the canary at next and install -version,
|
||||
queued behind a release being judged (-force to
|
||||
override)
|
||||
archied release canary check judge the installed release over -window
|
||||
(default 24h): promote, pick up a newer next,
|
||||
or roll back; a held canary is reported, and a
|
||||
held pin that is no longer installable fails
|
||||
the run red
|
||||
archied release canary promote promote the installed release now if its
|
||||
signals pass; refuses with exit 1 otherwise
|
||||
archied release canary unpin return the canary to next from any pin
|
||||
```
|
||||
|
||||
### Promote
|
||||
|
||||
A release that passes the window is promoted: `stable` is retagged to the
|
||||
`v<version>` manifest. The signature covers the statement, not the tag, so the
|
||||
retag needs no signing key. The `archied` and `archie-agent` images' `:latest`
|
||||
move to their `:v<version>` first, and the agent image must be the digest the
|
||||
statement pins. Promotion refuses a prerelease and a release issued before the
|
||||
one `stable` names, the same replay rule hosts enforce. The decision and its
|
||||
reasons are in the `canary` run log.
|
||||
|
||||
Early promotion is a dispatch away: the **promote** workflow
|
||||
(`.github/workflows/promote.yml`) takes a `version` input and runs
|
||||
`archied release canary promote -version V` on the canary. It judges the
|
||||
release the canary runs — the window doesn't matter for the decision — and
|
||||
refuses (red run) on any hard failure or relative breach with enough data.
|
||||
|
||||
### Roll back
|
||||
|
||||
`stable` stays put, and the run turns red. Before the canary is pinned to
|
||||
`stable`, `check` verifies `stable` is actually installable — its statement's
|
||||
zip blob must still be in the release repository and its pinned agent image
|
||||
must still resolve (`releaseupdate.Installable`). If it isn't, the run fails
|
||||
loudly and the canary stays on `next` rather than being stranded on a pin.
|
||||
Otherwise the canary is pinned to the `stable` version through its update
|
||||
settings and reinstalled through its dashboard.
|
||||
|
||||
A release whose migrations differ from `stable`'s can't go back without
|
||||
restoring the pre-update database snapshot, which loses every write since. The
|
||||
canary is held on the failed release instead (pinned to it) and the fix goes
|
||||
forward in the next release. The next release's deploy points the canary back
|
||||
at `next`.
|
||||
|
||||
A pinned canary isn't judged, so a rollback is decided once — but `check`
|
||||
verifies the pin is still installable every run, so a stranded pin shows red
|
||||
instead of green. `archied release canary unpin` returns the canary to `next`
|
||||
by hand.
|
||||
|
||||
### Configuration
|
||||
|
||||
| Name | Kind | Holds |
|
||||
| --- | --- | --- |
|
||||
| `CANARY_URL` | Actions variable | the canary's dashboard URL; unset disables the canary steps |
|
||||
| `CANARY_TOKEN` | Actions secret | an API token bound to a dedicated `service_account` identity on the canary, carrying only the canary grant policy (see below) — never instance admin |
|
||||
| `CANARY_WINDOW` | Actions variable | optional `-window` override for `canary check`; unset is 24h |
|
||||
| `DEPLOY_TOKEN` | Actions secret | registry and repository write, for publishing, promoting and the release push; stays CI-only, promotion runs in CI and never on the host |
|
||||
| `RELEASE_SIGNING_KEY` | Actions secret | the release signing seed |
|
||||
|
||||
#### Setting up `CANARY_TOKEN` once
|
||||
|
||||
`CANARY_TOKEN` is a bearer token for a dedicated service-account identity in
|
||||
the system org whose only grant is the canary policy
|
||||
(`access.CanaryGrantPolicy`): read the signal endpoints (`GET /api/chat/update`,
|
||||
`GET /api/alerts`, `GET /api/logs`, `GET /api/tasks`), read and write the
|
||||
`update-settings` resource, and trigger an update install
|
||||
(`POST /api/chat/update/install`). It carries no other rights, and instance
|
||||
admin is never needed. With an instance-admin token (for example the operator
|
||||
session), run against the canary host:
|
||||
Dispatch the **promote** workflow (`.github/workflows/promote.yml`) with a
|
||||
`version`. It retags `stable` to that release and moves the `archied` and
|
||||
`archie-agent` images' `:latest` to it. Promotion refuses a prerelease and a
|
||||
release issued before the one `stable` names, the same replay rule hosts
|
||||
enforce. The same thing by hand:
|
||||
|
||||
```bash
|
||||
# 1. Create the service-account identity in the system org.
|
||||
curl -X POST "$CANARY_URL/api/identities" -H "Authorization: Bearer $ADMIN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"kind":"service_account","display_name":"ci-canary"}'
|
||||
# -> {"id":"<canary-identity-id>", ...}
|
||||
|
||||
# 2. Issue its token (shown exactly once).
|
||||
curl -X POST "$CANARY_URL/api/identities/<canary-identity-id>/tokens" \
|
||||
-H "Authorization: Bearer $ADMIN" -H 'Content-Type: application/json' \
|
||||
-d '{"name":"ci-canary","days":90}'
|
||||
# -> {"id":"<token-hash>","token":"archie_pat_..."} -- store the token value as the CANARY_TOKEN secret
|
||||
|
||||
# 3. Install the grant pair, scoped to that identity. The policies' org is
|
||||
# pinned to the caller's org (org-sys for the instance admin), so the
|
||||
# bodies need no org field. The permit alone is not enough: service
|
||||
# accounts created through the API are assigned the developer role, so a
|
||||
# matching forbid (installed second) negates everything outside the
|
||||
# permit's surface for that identity.
|
||||
curl -X PUT "$CANARY_URL/api/access/policies" -H "Authorization: Bearer $ADMIN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"id":"org-canary-grant","level":"org","text":"permit(principal, action, resource) when {\n resource.org == principal.org &&\n principal == Archie::Identity::\"<canary-identity-id>\" &&\n (\n (action == Archie::Action::\"read\" && [\"dashboard\", \"task\"].contains(resource.kind)) ||\n (action == Archie::Action::\"read\" && resource == Archie::Object::\"update-settings\") ||\n (action == Archie::Action::\"update\" && resource == Archie::Object::\"update\") ||\n (action == Archie::Action::\"manage_identities\" && resource == Archie::Object::\"update-settings\")\n )\n};"}'
|
||||
```
|
||||
|
||||
The second policy forbids the canary identity from everything the permit does
|
||||
not name, so its developer role cannot widen the grant:
|
||||
|
||||
```bash
|
||||
curl -X PUT "$CANARY_URL/api/access/policies" -H "Authorization: Bearer $ADMIN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"id":"org-canary-grant-forbid","level":"org","text":"forbid(principal, action, resource) when {\\n resource.org == principal.org &&\\n principal == Archie::Identity::\\\"<canary-identity-id>\\\" &&\\n !(\\n (action == Archie::Action::\\\"read\\\" && [\\\"dashboard\\\", \\\"task\\\"].contains(resource.kind)) ||\\n (action == Archie::Action::\\\"read\\\" && resource == Archie::Object::\\\"update-settings\\\") ||\\n (action == Archie::Action::\\\"update\\\" && resource == Archie::Object::\\\"update\\\") ||\\n (action == Archie::Action::\\\"manage_identities\\\" && resource == Archie::Object::\\\"update-settings\\\")\\n )\\n};"}'
|
||||
```
|
||||
|
||||
The policy texts are exactly `access.CanaryGrantPolicy` and
|
||||
`access.CanaryGrantForbidPolicy` from `internal/domain/access/canary.go` with
|
||||
the identity id filled in. The canary needs no other rights: `GET
|
||||
/health/detailed` is unauthenticated, and every other call it makes is covered
|
||||
by the grant pair.
|
||||
|
||||
The runner must reach `CANARY_URL`. Without a canary a release stays on `next`
|
||||
until promoted by hand, under the same refusals:
|
||||
|
||||
```bash
|
||||
archied release promote -version 1.57.0 \
|
||||
archied release promote -version 1.63.0 \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
```
|
||||
|
||||
## Secrets
|
||||
|
||||
| Name | Used by |
|
||||
|---|---|
|
||||
| `DEPLOY_TOKEN` | release, deploy, promote: the registry push, the tag push and the package links |
|
||||
| `RELEASE_SIGNING_KEY` | deploy: signs the release statement |
|
||||
+57
-29
@@ -64,21 +64,23 @@ tasks:
|
||||
- task: db:generate
|
||||
- git diff --exit-code -- internal/infrastructure/postgres/postgresdb
|
||||
|
||||
openapi:generate:
|
||||
desc: Write the API's OpenAPI document to api/openapi.yaml
|
||||
cmds:
|
||||
- mkdir -p api
|
||||
- go run ./cmd/archie openapi > api/openapi.yaml
|
||||
|
||||
openapi:check:
|
||||
desc: Regenerate the OpenAPI document and reject uncommitted differences
|
||||
cmds:
|
||||
- task: openapi:generate
|
||||
- git diff --exit-code -- api/openapi.yaml
|
||||
|
||||
proto:check:
|
||||
desc: Regenerate contracts and reject uncommitted generated differences
|
||||
cmds:
|
||||
- bash tools/proto.sh check
|
||||
|
||||
news:
|
||||
desc: Regenerate the release data artifacts from the changelog
|
||||
cmds:
|
||||
- go -C tools run -mod=readonly ./newsgen --repo-root ..
|
||||
|
||||
news:check:
|
||||
desc: Verify the committed release notes match the changelog
|
||||
cmds:
|
||||
- go -C tools run -mod=readonly ./newsgen check --repo-root ..
|
||||
|
||||
vet:
|
||||
desc: Run go vet
|
||||
cmds:
|
||||
@@ -88,7 +90,6 @@ tasks:
|
||||
desc: Run golangci-lint
|
||||
cmds:
|
||||
- golangci-lint run ./...
|
||||
- cd tools && golangci-lint run ./...
|
||||
|
||||
ui:deps:
|
||||
desc: Install dashboard dependencies
|
||||
@@ -101,6 +102,9 @@ tasks:
|
||||
|
||||
ui:
|
||||
desc: Build the dashboard into ui/dist, which the Go build embeds
|
||||
# check builds the dashboard and then build depends on it again; a second
|
||||
# build empties ui/dist under the Go steps that embed it.
|
||||
run: once
|
||||
dir: ui
|
||||
deps: [ui:deps]
|
||||
cmds:
|
||||
@@ -143,7 +147,7 @@ tasks:
|
||||
done
|
||||
|
||||
dev:postgres:
|
||||
desc: Start PostgreSQL and wait for readiness
|
||||
desc: Start PostgreSQL, wait for readiness, provision the database roles
|
||||
cmds:
|
||||
- docker compose up -d postgres
|
||||
- |
|
||||
@@ -157,6 +161,15 @@ tasks:
|
||||
done
|
||||
echo "postgres did not become healthy within 60s" >&2
|
||||
exit 1
|
||||
- |
|
||||
# docker-compose.yml creates the dev database with a superuser named
|
||||
# archie; provision the least-privilege roles deployments/dev.toml
|
||||
# points at. Idempotent, so this also upgrades a volume created before
|
||||
# the role split.
|
||||
go run ./cmd/archie-state-store provision \
|
||||
-admin-url "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable" \
|
||||
-runtime-url "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable" \
|
||||
-migration-url "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
|
||||
dev:wait-state:
|
||||
internal: true
|
||||
@@ -221,16 +234,13 @@ tasks:
|
||||
cmds:
|
||||
- node e2e/run.cjs {{.CLI_ARGS}}
|
||||
|
||||
canary:rehearse:
|
||||
# Local rehearsal only: spins up its own registry, database and host, and
|
||||
# is deliberately absent from check and CI.
|
||||
desc: Rehearse the release-canary loop on a throwaway local host (needs docker; never part of the gate)
|
||||
cmds:
|
||||
- sh tools/canary-rehearse.sh
|
||||
|
||||
build:
|
||||
desc: Build archie services and agent binaries
|
||||
deps: [ui]
|
||||
# Static, like the binaries a release ships, so `dist` reuses these
|
||||
# compiled packages and only links again.
|
||||
env:
|
||||
CGO_ENABLED: "0"
|
||||
vars:
|
||||
GATEWAY_VERSION: '{{.GATEWAY_VERSION | default .VERSION}}'
|
||||
RUNTIME_VERSION: '{{.RUNTIME_VERSION | default .VERSION}}'
|
||||
@@ -257,13 +267,38 @@ tasks:
|
||||
- "{{.BIN_DIR}}/archie-ui"
|
||||
- "{{.BIN_DIR}}/archie-messaging"
|
||||
- "{{.BIN_DIR}}/archie-agent"
|
||||
- "{{.BIN_DIR}}/archie"
|
||||
cmds:
|
||||
# One flag set for every service, matching the release workflow, so each
|
||||
# binary reports the same version.
|
||||
- for: [archied, archie-gateway, archie-state-store, archie-ui, archie-messaging]
|
||||
- for: [archie, archied, archie-gateway, archie-state-store, archie-ui, archie-messaging]
|
||||
cmd: go build -trimpath -ldflags "{{.SERVICE_LDFLAGS}}" -o {{.BIN_DIR}}/{{.ITEM}} ./cmd/{{.ITEM}}
|
||||
- go build -trimpath -ldflags "-X github.com/samcharles93/archie-core/internal/app/agentworker.version={{.RUNTIME_VERSION}} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-agent ./cmd/archie-agent
|
||||
|
||||
dist:
|
||||
desc: Build the linux/amd64 binaries a release ships into dist/ (VERSION=1.2.3; needs jq)
|
||||
deps: [ui]
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: "0"
|
||||
vars:
|
||||
DIST_LDFLAGS: >-
|
||||
-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary
|
||||
-X github.com/samcharles93/archie-core/internal/buildinfo.Version={{.VERSION}}
|
||||
-X github.com/samcharles93/archie-core/internal/buildinfo.Runtime={{.VERSION}}
|
||||
-X github.com/samcharles93/archie-core/internal/app/agentworker.version={{.VERSION}}
|
||||
cmds:
|
||||
# release.json names what a release ships, so the zip and this build
|
||||
# cannot disagree. The compiler flags match `build`, so after the gate
|
||||
# has built bin/ this only links.
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p dist
|
||||
for cmd in $(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json); do
|
||||
go build -trimpath -ldflags "{{.DIST_LDFLAGS}}" -o "dist/$cmd" "./cmd/$cmd"
|
||||
done
|
||||
|
||||
test:
|
||||
desc: Run Go tests; the release gate passes TEST_FLAGS=-count=1
|
||||
cmds:
|
||||
@@ -288,13 +323,13 @@ tasks:
|
||||
- task: fmt
|
||||
- task: proto:check
|
||||
- task: db:check
|
||||
- task: openapi:check
|
||||
- task: check:readonly
|
||||
|
||||
check:readonly:
|
||||
internal: true
|
||||
deps:
|
||||
- task: proto:lint
|
||||
- task: news:check
|
||||
- task: vet
|
||||
- task: lint
|
||||
- task: build
|
||||
@@ -302,7 +337,7 @@ tasks:
|
||||
- task: test:ui
|
||||
|
||||
release:
|
||||
desc: "Turn [Unreleased] into a release, then commit and tag it (RELEASE=major|minor|patch|1.2.3)"
|
||||
desc: "Tag main as a release (RELEASE=major|minor|patch|1.2.3)"
|
||||
requires:
|
||||
vars: [RELEASE]
|
||||
cmds:
|
||||
@@ -321,12 +356,5 @@ tasks:
|
||||
esac
|
||||
echo "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$' || die "$version is not a version"
|
||||
! git rev-parse -q --verify "refs/tags/v$version" >/dev/null || die "v$version already exists"
|
||||
awk '/^## \[Unreleased\]/ { u = 1; next } u && /^## \[/ { exit } u && /^- / { found = 1 } END { exit !found }' CHANGELOG.md ||
|
||||
die "[Unreleased] in CHANGELOG.md has no entries"
|
||||
awk -v hdr="## [$version] - $(date -u +%F)" '{ print } /^## \[Unreleased\]/ { print ""; print hdr }' CHANGELOG.md >CHANGELOG.md.tmp
|
||||
mv CHANGELOG.md.tmp CHANGELOG.md
|
||||
go -C tools run -mod=readonly ./newsgen --repo-root ..
|
||||
git add CHANGELOG.md docs/news
|
||||
git commit -q -m "chore(release): v$version"
|
||||
git tag -a "v$version" -m "v$version"
|
||||
echo "tagged v$version"
|
||||
+5
-4
@@ -46,7 +46,6 @@ steps:
|
||||
| `outputs` | mapping | Named, typed results the run writes once each (same shape as inputs). A required output the run never writes parks it. A calling workflow reads them. |
|
||||
| `profile` | text | The container profile (`[containers.profiles]`) the run's agents use. Resolved when the task is dispatched. |
|
||||
| `identity` | text | The identity every run acts as, whatever started it. Empty runs as the starter. |
|
||||
| `needs` | mapping | Harness capabilities the run requires: `captures` (bool), `gate_retries` (number). Declared outputs imply `captures`. |
|
||||
|
||||
## A step
|
||||
|
||||
@@ -315,8 +314,10 @@ expressions that limit which files the rule applies to.
|
||||
|
||||
## What starts a workflow
|
||||
|
||||
- **Issues**, by label: `bug` runs `tdd`, `feature` runs `feasibility`, anything
|
||||
else runs `triage`, which classifies it and hands off.
|
||||
- **Issues**, by label: the Issue routing setting lists label to workflow rules
|
||||
(first match wins) and a default for the rest. It starts as `bug` runs
|
||||
`tdd`, `feature` runs `feasibility`, anything else runs `triage`, which
|
||||
classifies it and hands off.
|
||||
- **Event bindings**: a webhook source mapped onto a workflow and its inputs
|
||||
(Events page).
|
||||
- **Schedules**: each firing is captured on the reserved `schedule` source as
|
||||
@@ -324,7 +325,7 @@ expressions that limit which files the rule applies to.
|
||||
`fired_at`). A schedule trigger is a binding on that source using the
|
||||
`schedule-fired` mapping, filtered to one `schedule_id`. A firing starts at
|
||||
most one task per binding.
|
||||
- **Playbooks**: a trigger (issue kind and labels) and actions that dispatch
|
||||
- **Playbooks**: a trigger (issue labels) and actions that dispatch
|
||||
workflows.
|
||||
- **Other workflows**: `workflow.call` (a child run), `workflow.handoff` (the
|
||||
same task, requeued), `workflow.approve` (once approved).
|
||||
|
||||
+3451
File diff suppressed because it is too large.
Load diff
+16
-61
@@ -3,6 +3,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
@@ -21,17 +22,6 @@ import (
|
||||
|
||||
type workerRunner func(context.Context, agentworker.Settings, *slog.Logger) error
|
||||
|
||||
// runHold blocks until signalled and exits 0. It is the keepalive for a Kit
|
||||
// container that runs no worker: the agent binary is archie's own and is
|
||||
// mounted into every Kit, so the container needs no binary the image may not
|
||||
// ship, and holds no environment of its own.
|
||||
func runHold() int {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
<-ctx.Done()
|
||||
return 0
|
||||
}
|
||||
|
||||
func main() {
|
||||
os.Exit(run())
|
||||
}
|
||||
@@ -41,15 +31,9 @@ func run() int {
|
||||
}
|
||||
|
||||
func runCommand(args []string, getenv func(string) string, stderr io.Writer, runWorker workerRunner) int {
|
||||
if len(args) > 0 && args[0] == "hold" {
|
||||
return runHold()
|
||||
}
|
||||
if len(args) > 0 && args[0] == "relay" {
|
||||
return runRelay(args[1:], stderr, agentworker.RunRelay)
|
||||
}
|
||||
if len(args) > 0 && args[0] == "mcp" {
|
||||
return runMCP(args[1:], stderr, agentworker.RunCaptureMCP)
|
||||
}
|
||||
flags := flag.NewFlagSet("archie-agent", flag.ContinueOnError)
|
||||
flags.SetOutput(stderr)
|
||||
natsURLFlag := flags.String("nats-url", "", "NATS server URL (defaults to NATS_URL)")
|
||||
@@ -69,9 +53,12 @@ func runCommand(args []string, getenv func(string) string, stderr io.Writer, run
|
||||
return 0
|
||||
}
|
||||
|
||||
natsURL, natsToken := natsConnectionSettings(*natsURLFlag, getenv)
|
||||
natsURL := *natsURLFlag
|
||||
if natsURL == "" {
|
||||
fmt.Fprintln(stderr, "error: -nats-url or NATS_URL is required")
|
||||
natsURL = getenv("NATS_URL")
|
||||
}
|
||||
if natsURL == "" {
|
||||
_, _ = fmt.Fprintln(stderr, "error: -nats-url or NATS_URL is required")
|
||||
flags.Usage()
|
||||
return 1
|
||||
}
|
||||
@@ -85,7 +72,7 @@ func runCommand(args []string, getenv func(string) string, stderr io.Writer, run
|
||||
stateStoreURL = getenv("STATE_STORE_URL")
|
||||
}
|
||||
if stateStoreURL == "" {
|
||||
fmt.Fprintln(stderr, "error: -state-store-url or STATE_STORE_URL is required (the legacy NATS storerpc path is deleted)")
|
||||
_, _ = fmt.Fprintln(stderr, "error: -state-store-url or STATE_STORE_URL is required (the legacy NATS storerpc path is deleted)")
|
||||
flags.Usage()
|
||||
return 1
|
||||
}
|
||||
@@ -94,12 +81,17 @@ func runCommand(args []string, getenv func(string) string, stderr io.Writer, run
|
||||
stateStoreToken = getenv("STATE_STORE_TOKEN")
|
||||
}
|
||||
|
||||
stateStoreCA, err := base64.StdEncoding.DecodeString(getenv("STATE_STORE_CA_BASE64"))
|
||||
if err != nil {
|
||||
_, _ = fmt.Fprintf(stderr, "error: STATE_STORE_CA_BASE64: %v\n", err)
|
||||
return 1
|
||||
}
|
||||
|
||||
if err := runWorker(ctx, agentworker.Settings{
|
||||
NATSURL: natsURL,
|
||||
NATSToken: natsToken,
|
||||
StateStoreTarget: stateStoreURL,
|
||||
StateStoreToken: stateStoreToken,
|
||||
StateStoreCA: []byte(getenv("STATE_STORE_CA")),
|
||||
StateStoreCA: stateStoreCA,
|
||||
ModelProxy: getenv(egress.ModelProxyEnv),
|
||||
ModelProxyHosts: egress.ParseHosts(getenv(egress.ModelProxyHostsEnv)),
|
||||
ModelProxyCA: getenv(egress.ModelProxyCAEnv),
|
||||
@@ -109,14 +101,6 @@ func runCommand(args []string, getenv func(string) string, stderr io.Writer, run
|
||||
return 0
|
||||
}
|
||||
|
||||
func natsConnectionSettings(flagURL string, getenv func(string) string) (url, token string) {
|
||||
url = flagURL
|
||||
if url == "" {
|
||||
url = getenv("NATS_URL")
|
||||
}
|
||||
return url, getenv("NATS_TOKEN")
|
||||
}
|
||||
|
||||
type relayServer func(ctx context.Context, forwards map[string]string) error
|
||||
|
||||
// runRelay is the sandbox egress relay: the container on both a sandbox's
|
||||
@@ -150,43 +134,14 @@ func runRelay(args []string, stderr io.Writer, serve relayServer) int {
|
||||
return 2
|
||||
}
|
||||
if len(forwards) == 0 {
|
||||
fmt.Fprintln(stderr, "error: at least one -forward is required")
|
||||
_, _ = fmt.Fprintln(stderr, "error: at least one -forward is required")
|
||||
flags.Usage()
|
||||
return 1
|
||||
}
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
if err := serve(ctx, forwards); err != nil {
|
||||
fmt.Fprintln(stderr, "error:", err)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type mcpServer func(ctx context.Context, specPath, capturesPath string) error
|
||||
|
||||
// runMCP serves a stage's capture tools to a harness over stdio. The
|
||||
// harness starts it, so it runs as the harness user and holds no secrets.
|
||||
func runMCP(args []string, stderr io.Writer, serve mcpServer) int {
|
||||
flags := flag.NewFlagSet("archie-agent mcp", flag.ContinueOnError)
|
||||
flags.SetOutput(stderr)
|
||||
spec := flags.String("spec", "", "JSON file listing the stage's capture tools")
|
||||
captures := flags.String("captures", "", "file accepted capture calls are appended to")
|
||||
if err := flags.Parse(args); err != nil {
|
||||
if errors.Is(err, flag.ErrHelp) {
|
||||
return 0
|
||||
}
|
||||
return 2
|
||||
}
|
||||
if *spec == "" || *captures == "" {
|
||||
fmt.Fprintln(stderr, "error: -spec and -captures are required")
|
||||
flags.Usage()
|
||||
return 1
|
||||
}
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
if err := serve(ctx, *spec, *captures); err != nil {
|
||||
fmt.Fprintln(stderr, "error:", err)
|
||||
_, _ = fmt.Fprintln(stderr, "error:", err)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
|
||||
@@ -19,10 +19,13 @@ import (
|
||||
func main() { os.Exit(run()) }
|
||||
|
||||
func run() int {
|
||||
// A leading non-flag argument selects a recovery subcommand; anything else,
|
||||
// A leading non-flag argument selects a subcommand; anything else,
|
||||
// including no arguments at all, serves the State Store contract. An
|
||||
// unrecognised word is refused rather than ignored, so a mistyped recovery
|
||||
// command never leaves an operator watching a server start instead.
|
||||
// unrecognised word is refused rather than ignored, so a mistyped command
|
||||
// never leaves an operator watching a server start instead.
|
||||
if args := os.Args[1:]; statestore.IsProvisionArgs(args) {
|
||||
return statestore.RunProvision(context.Background(), args[1:], os.Stdout, os.Stderr)
|
||||
}
|
||||
if args := os.Args[1:]; statestore.IsAccessResetArgs(args) {
|
||||
return statestore.RunAccessReset(context.Background(), args[2:], os.Stderr)
|
||||
}
|
||||
@@ -36,7 +39,7 @@ func run() int {
|
||||
flag.StringVar(&options.Listen, "listen", "", "state store gRPC listen address (defaults to [services.state].listen, else 127.0.0.1:9090)")
|
||||
flag.StringVar(&options.ReadyAddr, "ready-addr", "", "optional readiness HTTP listen address (e.g. 127.0.0.1:9091)")
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(flag.CommandLine.Output(), "usage: archie-state-store [flags] # serve the State Store gRPC contract\n\noffline recovery: archie-state-store <backup|restore|validate|rollback> -h | access reset -h\n\n")
|
||||
_, _ = fmt.Fprintf(flag.CommandLine.Output(), "usage: archie-state-store [flags] # serve the State Store gRPC contract\n\ndatabase roles: archie-state-store provision -h\noffline recovery: archie-state-store <backup|restore|validate|rollback> -h | access reset -h\n\n")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
flag.Parse()
|
||||
|
||||
@@ -47,7 +47,7 @@ the daemon boots with, which names the database.
|
||||
// 1 the operation failed, 2 the command line was wrong.
|
||||
func runRecovery(args []string, stdout, stderr io.Writer) int {
|
||||
if len(args) == 0 {
|
||||
fmt.Fprint(stderr, recoveryUsage)
|
||||
_, _ = fmt.Fprint(stderr, recoveryUsage)
|
||||
return 2
|
||||
}
|
||||
command := args[0]
|
||||
@@ -55,14 +55,14 @@ func runRecovery(args []string, stdout, stderr io.Writer) int {
|
||||
switch command {
|
||||
case statestore.RecoveryBackup, statestore.RecoveryRestore, statestore.RecoveryValidate, statestore.RecoveryRollback:
|
||||
default:
|
||||
fmt.Fprintf(stderr, "archie-state-store: unknown command %q\n\n", command)
|
||||
fmt.Fprint(stderr, recoveryUsage)
|
||||
_, _ = fmt.Fprintf(stderr, "archie-state-store: unknown command %q\n\n", command)
|
||||
_, _ = fmt.Fprint(stderr, recoveryUsage)
|
||||
return 2
|
||||
}
|
||||
|
||||
flags := flag.NewFlagSet("archie-state-store "+command, flag.ContinueOnError)
|
||||
flags.SetOutput(stderr)
|
||||
flags.Usage = func() { fmt.Fprint(stderr, recoveryUsage) }
|
||||
flags.Usage = func() { _, _ = fmt.Fprint(stderr, recoveryUsage) }
|
||||
flags.StringVar(&options.Out, "out", "", "snapshot file backup writes")
|
||||
flags.StringVar(&options.From, "from", "", "snapshot file restore reads")
|
||||
flags.StringVar(&options.Kind, "kind", "", "control-plane resource kind rollback replays")
|
||||
@@ -80,15 +80,15 @@ func runRecovery(args []string, stdout, stderr io.Writer) int {
|
||||
return 2
|
||||
}
|
||||
if flags.NArg() > 0 {
|
||||
fmt.Fprintf(stderr, "archie-state-store %s: unexpected argument %q\n", command, flags.Arg(0))
|
||||
_, _ = fmt.Fprintf(stderr, "archie-state-store %s: unexpected argument %q\n", command, flags.Arg(0))
|
||||
return 2
|
||||
}
|
||||
|
||||
summary, err := statestore.RunRecovery(context.Background(), options)
|
||||
if err != nil {
|
||||
fmt.Fprintf(stderr, "archie-state-store %s: %v\n", command, err)
|
||||
_, _ = fmt.Fprintf(stderr, "archie-state-store %s: %v\n", command, err)
|
||||
return 1
|
||||
}
|
||||
fmt.Fprintln(stdout, summary)
|
||||
_, _ = fmt.Fprintln(stdout, summary)
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Command archie is the single Archie binary. It parses flags and hands over to
|
||||
// the composition root.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/archie"
|
||||
"github.com/samcharles93/archie-core/internal/buildinfo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := run(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "archie:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run() error {
|
||||
configPath := flag.String("config", archie.DefaultConfigPath(), "path to the bootstrap config file")
|
||||
newIdentity := flag.Bool("new-age-identity", false, "print a new age identity for age_identity and exit")
|
||||
showVersion := buildinfo.RegisterVersionFlag("archie")
|
||||
flag.Usage = func() {
|
||||
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "usage: archie [flags]\n archie openapi print the API's OpenAPI document")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
flag.Parse()
|
||||
showVersion()
|
||||
if *newIdentity {
|
||||
return archie.NewAgeIdentity(os.Stdout)
|
||||
}
|
||||
switch flag.Arg(0) {
|
||||
case "":
|
||||
case "openapi":
|
||||
doc, err := archie.Document()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = os.Stdout.Write(doc)
|
||||
return err
|
||||
default:
|
||||
return fmt.Errorf("unknown command %q", flag.Arg(0))
|
||||
}
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
return archie.Run(ctx, *configPath)
|
||||
}
|
||||
+8
-2
@@ -7,7 +7,12 @@
|
||||
# Secrets are never written here: each is a {engine, key} reference. The
|
||||
# built-in "env" engine reads key as an environment variable.
|
||||
|
||||
# database_url = "postgres://archie:archie@localhost:5432/archie?sslmode=disable"
|
||||
# The URL the services connect as: a least-privilege role, created by
|
||||
# `archie-state-store provision`. migration_database_url is the role that owns
|
||||
# the schema and runs migrations; when it is absent, database_url does both,
|
||||
# which is what a single-role install does.
|
||||
# database_url = "postgres://archie_runtime:secret@localhost:5432/archie?sslmode=disable"
|
||||
# migration_database_url = "postgres://archie_migrator:secret@localhost:5432/archie?sslmode=disable"
|
||||
# work_dir = "~/.local/share/archie/work"
|
||||
# state_dir = "~/.local/share/archie"
|
||||
|
||||
@@ -69,7 +74,8 @@ target = "127.0.0.1:9090"
|
||||
# [nats]
|
||||
# mode = "embedded" # or "external" with url
|
||||
# url = "nats://localhost:4222"
|
||||
# token_env = "NATS_TOKEN"
|
||||
# token_env = "NATS_TOKEN" # external: the archie-callout user's password
|
||||
# callout_issuer_seed_env = "NATS_CALLOUT_SEED" # external: account nkey seed; the broker's auth_callout issuer is its public key
|
||||
|
||||
# [log]
|
||||
# file = "~/.local/share/archie/logs/archied.log"
|
||||
|
||||
@@ -14,8 +14,7 @@ contracts (or NATS, for task actions):
|
||||
Without `archie-messaging` the channels are simply absent, so it needs a unit
|
||||
of its own (`deployments/systemd-user-service.md`).
|
||||
|
||||
`archie-agent` (the per-task sandboxed runtime) has no unit of its own: it
|
||||
ships beside `archied` because a Kit run mounts it from that directory. The
|
||||
`archie-agent` (the per-task sandboxed runtime) has no unit of its own. The
|
||||
agent image is a separate thing, pulled for the containers `archied` spawns
|
||||
per task: `[containers].image` defaults to
|
||||
`git.catlow.cloud/sam/archie-agent:latest`, while this archive's `release.json`
|
||||
@@ -30,7 +29,10 @@ that reference is on a registry that needs a login -- see
|
||||
(<https://offloaded.dev>) —
|
||||
`standalone.toml` (no forge, the simplest start),
|
||||
`single-forge-github.toml` and `docker-nats-stack.toml` cover the common cases. Every one needs
|
||||
PostgreSQL 18 at `database_url`. Copy whichever fits to:
|
||||
PostgreSQL 18 with the `archie_migrator` and `archie_runtime` roles created
|
||||
once by `archie-state-store provision` (see `deployments/README.md`);
|
||||
`docker compose up -d postgres` plus that command gives the local default.
|
||||
Copy whichever fits to:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/archie
|
||||
|
||||
+32
-1
@@ -42,7 +42,9 @@ systemctl --user start archied
|
||||
|
||||
Start order does not matter: a service waits for its peers and reports them as
|
||||
degraded meanwhile. Every template needs PostgreSQL 18 at `database_url`;
|
||||
`docker compose up -d postgres` provides the default one.
|
||||
`docker compose up -d postgres` provides the default server. Its two login
|
||||
roles are created once per database by `archie-state-store provision` -- see
|
||||
[Database roles](#database-roles).
|
||||
|
||||
The State Store service (`archie-state-store`) owns the task data in the
|
||||
PostgreSQL database `database_url` names and serves the `StateStore` gRPC
|
||||
@@ -54,6 +56,35 @@ gateway address, because a container cannot reach the host's loopback. A
|
||||
non-loopback address needs `[tls]` certificates from your own CA; see
|
||||
`config.example.toml`.
|
||||
|
||||
## Database roles
|
||||
|
||||
The services do not connect as the database owner. `archie-state-store
|
||||
provision` creates, or reconciles, two login roles in an existing PostgreSQL
|
||||
database and hands the schema to one of them:
|
||||
|
||||
- `archie_migrator` owns the schema and its objects and runs the goose
|
||||
migrations;
|
||||
- `archie_runtime` may read and write rows (SELECT, INSERT, UPDATE, DELETE,
|
||||
sequence USAGE, function EXECUTE) and has no CREATE privilege, so it cannot
|
||||
change the schema.
|
||||
|
||||
Run it once per database with a role allowed to create roles and take ownership
|
||||
of the schema (the database owner or a superuser), then point the templates at
|
||||
the two roles: `database_url` is the runtime URL and `migration_database_url`
|
||||
the migration one. The command is idempotent, so re-running it after an upgrade
|
||||
reconciles objects a migration added.
|
||||
|
||||
```bash
|
||||
archie-state-store provision \
|
||||
-admin-url "postgres://owner:secret@db:5432/archie" \
|
||||
-runtime-url "postgres://archie_runtime:secret@db:5432/archie" \
|
||||
-migration-url "postgres://archie_migrator:secret@db:5432/archie"
|
||||
```
|
||||
|
||||
The bundled installer and `task dev` run this for you. A configuration with only
|
||||
`database_url` keeps working exactly as before: that one role applies the
|
||||
schema and serves, which is what an install that has not split the roles does.
|
||||
|
||||
## Running the dashboard
|
||||
|
||||
The dashboard is served by the standalone UI Service (`archie-ui`), not by
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
name: archie
|
||||
|
||||
services:
|
||||
archie-db:
|
||||
image: postgres:18-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: archie
|
||||
POSTGRES_USER: archie_owner
|
||||
POSTGRES_PASSWORD: ${ARCHIE_OWNER_PASSWORD:?}
|
||||
ARCHIE_APP_PASSWORD: ${ARCHIE_APP_PASSWORD:?}
|
||||
volumes:
|
||||
- ./postgres:/var/lib/postgresql
|
||||
- ./initdb:/docker-entrypoint-initdb.d:ro
|
||||
networks: [internal]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U archie_owner -d archie"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
archie:
|
||||
image: gcr.io/distroless/static-debian12:nonroot
|
||||
restart: unless-stopped
|
||||
command: ["/archie/archie", "-config", "/archie/config.toml"]
|
||||
# Docker's default seccomp profile plus the one clone the extension host
|
||||
# needs to confine an extension in its own user and network namespace.
|
||||
security_opt:
|
||||
- seccomp=./seccomp.json
|
||||
volumes:
|
||||
- ./bin/archie:/archie/archie:ro
|
||||
- ./config.toml:/archie/config.toml:ro
|
||||
- ./extensions:/archie/extensions:ro
|
||||
ports:
|
||||
- "${ARCHIE_BIND:?}:8080"
|
||||
networks: [internal]
|
||||
depends_on:
|
||||
archie-db:
|
||||
condition: service_healthy
|
||||
|
||||
networks:
|
||||
internal: {}
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deploys the single binary's stack to a host over ssh: deploy.sh root@staging-host.
|
||||
# The first run creates the secrets on the host; they never leave it.
|
||||
set -euo pipefail
|
||||
|
||||
target=${1:?usage: deploy.sh user@host [bind-address:port]}
|
||||
bind=${2:-}
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
repo=$(cd "$here/../.." && pwd)
|
||||
dir=/root/archie
|
||||
|
||||
version=$(git -C "$repo" describe --tags --always --dirty)
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -C "$repo" -trimpath \
|
||||
-ldflags "-X github.com/samcharles93/archie-core/internal/buildinfo.Version=$version" \
|
||||
-o "$here/.build/archie" ./cmd/archie
|
||||
|
||||
ssh "$target" "mkdir -p $dir/bin $dir/initdb $dir/extensions"
|
||||
scp -q "$here/compose.yml" "$target:$dir/compose.yml"
|
||||
scp -q "$here/seccomp.json" "$target:$dir/seccomp.json"
|
||||
scp -q "$here/initdb/01-roles.sh" "$target:$dir/initdb/01-roles.sh"
|
||||
scp -q "$here/.build/archie" "$target:$dir/bin/archie.new"
|
||||
|
||||
ssh "$target" BIND="$bind" DIR="$dir" bash -s <<'REMOTE'
|
||||
set -euo pipefail
|
||||
cd "$DIR"
|
||||
chmod 755 initdb/01-roles.sh
|
||||
mv bin/archie.new bin/archie && chmod 755 bin/archie
|
||||
if [ ! -f .env ]; then
|
||||
[ -n "$BIND" ] || { echo "first deploy needs a bind address, e.g. 10.0.0.1:8099" >&2; exit 1; }
|
||||
umask 077
|
||||
printf 'ARCHIE_OWNER_PASSWORD=%s\nARCHIE_APP_PASSWORD=%s\nARCHIE_BIND=%s\n' \
|
||||
"$(openssl rand -hex 24)" "$(openssl rand -hex 24)" "$BIND" > .env
|
||||
fi
|
||||
if [ ! -f config.toml ]; then
|
||||
set -a; . ./.env; set +a
|
||||
umask 077
|
||||
cat > config.toml <<CONFIG
|
||||
listen = "0.0.0.0:8080"
|
||||
[database]
|
||||
url = "postgres://archie_app:${ARCHIE_APP_PASSWORD}@archie-db:5432/archie?sslmode=disable"
|
||||
owner_url = "postgres://archie_owner:${ARCHIE_OWNER_PASSWORD}@archie-db:5432/archie?sslmode=disable"
|
||||
CONFIG
|
||||
chown 65532:65532 config.toml
|
||||
fi
|
||||
# The admin token guards /api/. Only its hash goes in the config, as a
|
||||
# top-level key, so it must come before the [database] table.
|
||||
if ! grep -q '^admin_token_sha256' config.toml; then
|
||||
umask 077
|
||||
openssl rand -hex 32 | tr -d '\n' > admin-token
|
||||
hash=$(sha256sum admin-token | cut -d' ' -f1)
|
||||
sed -i "1i admin_token_sha256 = \"$hash\"" config.toml
|
||||
chown 65532:65532 config.toml
|
||||
fi
|
||||
# The age identity seals the credentials Archie keeps. It is made here and
|
||||
# never leaves the host; back it up, or credentials die with it.
|
||||
if ! grep -q '^age_identity' config.toml; then
|
||||
umask 077
|
||||
identity=$(bin/archie -new-age-identity)
|
||||
sed -i "1i age_identity = \"$identity\"" config.toml
|
||||
unset identity
|
||||
chown 65532:65532 config.toml
|
||||
fi
|
||||
docker compose up -d --remove-orphans
|
||||
docker compose up -d --force-recreate archie
|
||||
REMOTE
|
||||
echo "deployed $version to $target"
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Runs once, on an empty data directory. The owner (POSTGRES_USER) runs
|
||||
# migrations; archie_app is the runtime role and holds no DDL rights.
|
||||
set -eu
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" \
|
||||
-v app_password="$ARCHIE_APP_PASSWORD" <<'SQL'
|
||||
CREATE ROLE archie_app LOGIN PASSWORD :'app_password';
|
||||
GRANT CONNECT ON DATABASE archie TO archie_app;
|
||||
SQL
|
||||
File diff suppressed because it is too large.
Load diff
+15
-3
@@ -9,16 +9,28 @@
|
||||
# [web] entirely.
|
||||
|
||||
# `task dev` runs archie-state-store against this overlay, and the State Store
|
||||
# fails closed without a PostgreSQL URL. This must reach the `postgres`
|
||||
# fails closed without a PostgreSQL URL. These must reach the `postgres`
|
||||
# service in docker-compose.yml, which `task dev` brings up first via
|
||||
# dev:postgres -- keep the URL and that service in agreement.
|
||||
# dev:postgres -- keep them and that service in agreement. dev:postgres also
|
||||
# provisions the two roles: the services serve as archie_runtime and migrate
|
||||
# as archie_migrator, while the Compose-created archie role is only the
|
||||
# admin that created them.
|
||||
bot_user = "archie-dev"
|
||||
|
||||
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
database_url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
migration_database_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
|
||||
[web]
|
||||
listen = "127.0.0.1:8484"
|
||||
|
||||
# The installed config may point [nats] at the optional external broker, which
|
||||
# `task dev` never starts. An explicit empty url overrides it, so the daemon
|
||||
# runs the embedded broker as in the e2e stack; the broker binds the host
|
||||
# gateway, which task containers reach.
|
||||
[nats]
|
||||
mode = "embedded"
|
||||
url = ""
|
||||
|
||||
# `task dev` runs archie-state-store via dev:state-store, which passes no
|
||||
# -listen, so the listen below is the port the store binds. It must agree with
|
||||
# the target: these two lines are the only place that pair is stated. Move them
|
||||
|
||||
@@ -16,9 +16,12 @@ bot_user = "archie"
|
||||
work_dir = "~/.local/share/archie/work"
|
||||
state_dir = "~/.local/share/archie" # NATS store, task logs
|
||||
# The State Store's PostgreSQL connection (PostgreSQL 18, required).
|
||||
# `docker compose up -d postgres` provides this local default; point it at
|
||||
# your own Postgres 18 server otherwise.
|
||||
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
# `docker compose up -d postgres` provides the local default; point it at
|
||||
# your own Postgres 18 server otherwise. The services serve as archie_runtime
|
||||
# and migrations run as archie_migrator; create both once with
|
||||
# `archie-state-store provision -h` (deployments/README.md).
|
||||
database_url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
migration_database_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
|
||||
[services.gateway]
|
||||
target = "127.0.0.1:8585"
|
||||
@@ -56,6 +59,8 @@ mode = "external"
|
||||
# The pinned Compose-network gateway is reachable from both the host daemon
|
||||
# and the task containers it launches on archie-core_default.
|
||||
url = "nats://172.19.0.1:4222"
|
||||
token_env = "NATS_TOKEN"
|
||||
callout_issuer_seed_env = "NATS_CALLOUT_SEED"
|
||||
|
||||
[containers]
|
||||
network = "archie-core_default"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
jetstream { store_dir: /data }
|
||||
http_port: 8222
|
||||
|
||||
authorization {
|
||||
users: [{ user: "archie-callout", password: $NATS_TOKEN }]
|
||||
auth_callout {
|
||||
issuer: $NATS_CALLOUT_ISSUER
|
||||
auth_users: ["archie-callout"]
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,12 @@
|
||||
work_dir = "~/.local/share/archie/work"
|
||||
state_dir = "~/.local/share/archie" # NATS store, task logs
|
||||
# The State Store's PostgreSQL connection (PostgreSQL 18, required).
|
||||
# `docker compose up -d postgres` provides this local default; point it at
|
||||
# your own Postgres 18 server otherwise.
|
||||
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
# `docker compose up -d postgres` provides the local default; point it at
|
||||
# your own Postgres 18 server otherwise. The services serve as archie_runtime
|
||||
# and migrations run as archie_migrator; create both once with
|
||||
# `archie-state-store provision -h` (deployments/README.md).
|
||||
database_url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
migration_database_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
poll_interval = "60s"
|
||||
label = "archie"
|
||||
bot_user = "archie-bot"
|
||||
|
||||
@@ -15,9 +15,12 @@ bot_user = "archie"
|
||||
work_dir = "~/.local/share/archie/work"
|
||||
state_dir = "~/.local/share/archie" # NATS store, task logs
|
||||
# PostgreSQL 18 connection (required).
|
||||
# `docker compose up -d postgres` provides this local default; point it at
|
||||
# your own Postgres 18 server otherwise.
|
||||
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
# `docker compose up -d postgres` provides the local default; point it at
|
||||
# your own Postgres 18 server otherwise. The services serve as archie_runtime
|
||||
# and migrations run as archie_migrator; create both once with
|
||||
# `archie-state-store provision -h` (deployments/README.md).
|
||||
database_url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
migration_database_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
|
||||
[services.gateway]
|
||||
target = "127.0.0.1:8585"
|
||||
|
||||
@@ -54,7 +54,7 @@ Open the dashboard to configure the organisation, workspace and first administra
|
||||
Complete setup before exposing it publicly; remote access requires an HTTPS reverse proxy.
|
||||
|
||||
**Auth note:** `archie-ui` authenticates to the Gateway, State Store and
|
||||
harness with its `[tls]` certificate (`archie-ui.pem`) from `config.toml`.
|
||||
daemon with its `[tls]` certificate (`archie-ui.pem`) from `config.toml`.
|
||||
|
||||
For supervision, `GET /healthz` on `[web].listen` is the process's liveness
|
||||
probe (token-free by design); the authenticated readiness surface lives at
|
||||
@@ -225,11 +225,19 @@ docker compose up -d nats
|
||||
[nats]
|
||||
mode = "external"
|
||||
url = "nats://172.19.0.1:4222"
|
||||
token_env = "NATS_TOKEN"
|
||||
callout_issuer_seed_env = "NATS_CALLOUT_SEED"
|
||||
|
||||
[containers]
|
||||
network = "archie-core_default"
|
||||
```
|
||||
|
||||
The broker defers every login to archied (NATS auth callout), so a worker logs
|
||||
in with its run credential and reaches only its own task's subjects. Generate
|
||||
an account nkey (`nk -gen account -pubout`), export its seed as
|
||||
`NATS_CALLOUT_SEED` for archied and its public key as `NATS_CALLOUT_ISSUER` for
|
||||
Compose, and set `NATS_TOKEN` to the same value in both.
|
||||
|
||||
The daemon hands workers the URL its own client connected to. The Compose
|
||||
service name is not resolvable from the native host, and localhost inside a
|
||||
worker is the worker itself; the pinned network gateway is reachable from both.
|
||||
|
||||
+10
-9
@@ -19,8 +19,9 @@ services:
|
||||
# The standalone archie-state-store process's database. PostgreSQL 18 is
|
||||
# the required minimum and target; `postgres.Open` refuses anything older.
|
||||
# `task dev` brings this up before the State Store via dev:postgres. The
|
||||
# credentials and database name below are the dev default mirrored by
|
||||
# deployments/dev.toml's database_url -- change both together.
|
||||
# This superuser is the dev database's admin: `task dev` runs archie-state-store
|
||||
# provision after first start to create the least-privilege roles the
|
||||
# mirroring deployments/dev.toml URLs name -- change them together.
|
||||
postgres:
|
||||
image: postgres:18
|
||||
environment:
|
||||
@@ -45,19 +46,19 @@ services:
|
||||
nats:
|
||||
image: nats:2.14-alpine3.22
|
||||
# The client port is published on every interface (agent containers reach
|
||||
# it over the bridge), so it refuses to start without a token. Set
|
||||
# NATS_TOKEN here and name the same value in [nats] token_env.
|
||||
entrypoint:
|
||||
- sh
|
||||
- -c
|
||||
- '[ -n "$$NATS_TOKEN" ] || { echo "NATS_TOKEN is required" >&2; exit 1; }; exec nats-server -js -m 8222 --auth "$$NATS_TOKEN"'
|
||||
# it over the bridge), so it defers every login to archied. Set NATS_TOKEN
|
||||
# (name it in [nats] token_env) and NATS_CALLOUT_ISSUER, the public key of
|
||||
# the account nkey seed named in [nats] callout_issuer_seed_env.
|
||||
command: ["-c", "/etc/nats/nats.conf"]
|
||||
environment:
|
||||
NATS_TOKEN: ${NATS_TOKEN:-}
|
||||
NATS_TOKEN: ${NATS_TOKEN:?NATS_TOKEN is required}
|
||||
NATS_CALLOUT_ISSUER: ${NATS_CALLOUT_ISSUER:?NATS_CALLOUT_ISSUER is required}
|
||||
ports:
|
||||
- "4222:4222" # client
|
||||
- "127.0.0.1:8222:8222" # monitoring (http://localhost:8222)
|
||||
volumes:
|
||||
- nats_data:/data
|
||||
- ./deployments/nats-callout.conf:/etc/nats/nats.conf:ro
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:8222/healthz"]
|
||||
|
||||
@@ -55,10 +55,10 @@ Save. The binding starts in **draft** -- nothing fires yet.
|
||||
|
||||
## 5. Approve it
|
||||
|
||||
A **draft** or freshly-**edited** binding needs explicit approval
|
||||
before it can ever match a live event -- this is deliberate, not a missing step:
|
||||
an operator authoring a binding is a considered act, an event arriving is not,
|
||||
and nothing should self-arm. Click **Approve**. Status becomes **armed**.
|
||||
A **draft** or freshly-**edited** binding needs explicit approval before it can
|
||||
ever match a live event -- this is deliberate, not a missing step: an operator
|
||||
authoring a binding is a considered act, an event arriving is not, and nothing
|
||||
should self-arm. Click **Approve**. Status becomes **armed**.
|
||||
|
||||
## 6. Fire it for real
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# PR review benchmark
|
||||
|
||||
```
|
||||
task bench:prreview
|
||||
```
|
||||
|
||||
Reviews the 38 runnable Martian pull requests once each at `deep` depth with the
|
||||
production pipeline, judges the posted comments against the golden comments in
|
||||
`internal/app/prbench/martian.json`, and writes
|
||||
`docs/benchmarks/pr-review-<timestamp>.md` (recall per PR, overall recall,
|
||||
precision, models, archie version). Commit that file with the run.
|
||||
|
||||
- Models come from the config at `~/.config/archie/config.toml`: the reviewer
|
||||
and judge both default to its `default` alias. Override with
|
||||
`task bench:prreview -- -model ALIAS_OR_PROVIDER/MODEL -judge-model ALIAS_OR_PROVIDER/MODEL`.
|
||||
Pick a judge other than the reviewer's model for an independent judgement.
|
||||
Aliases set only in the dashboard are not in the file; pass a `provider/model`
|
||||
ref instead.
|
||||
- Pull requests are public, so no credential is needed. `GH_TOKEN` or
|
||||
`GITHUB_TOKEN`, if set, only raises the GitHub API rate limit.
|
||||
- `-problems ID,ID` runs a partial smoke run; its report says it is not the
|
||||
acceptance run. A full run reports PASS when nothing failed and golden
|
||||
micro-recall is at least 0.70.
|
||||
- It is not part of `task test` and posts nothing to any pull request.
|
||||
@@ -1,224 +0,0 @@
|
||||
{
|
||||
"/news/archie/1.0.0/": "/news/1.0.0/",
|
||||
"/news/archie/1.1.0/": "/news/1.1.0/",
|
||||
"/news/archie/1.10.0/": "/news/1.10.0/",
|
||||
"/news/archie/1.11.0/": "/news/1.11.0/",
|
||||
"/news/archie/1.11.1/": "/news/1.11.1/",
|
||||
"/news/archie/1.12.0/": "/news/1.12.0/",
|
||||
"/news/archie/1.13.0/": "/news/1.13.0/",
|
||||
"/news/archie/1.14.0/": "/news/1.14.0/",
|
||||
"/news/archie/1.15.0/": "/news/1.15.0/",
|
||||
"/news/archie/1.16.0/": "/news/1.16.0/",
|
||||
"/news/archie/1.16.1/": "/news/1.16.1/",
|
||||
"/news/archie/1.17.0/": "/news/1.17.0/",
|
||||
"/news/archie/1.17.1/": "/news/1.17.1/",
|
||||
"/news/archie/1.18.0/": "/news/1.18.0/",
|
||||
"/news/archie/1.19.0/": "/news/1.19.0/",
|
||||
"/news/archie/1.19.1/": "/news/1.19.1/",
|
||||
"/news/archie/1.19.10/": "/news/1.19.10/",
|
||||
"/news/archie/1.19.2/": "/news/1.19.2/",
|
||||
"/news/archie/1.19.3/": "/news/1.19.3/",
|
||||
"/news/archie/1.19.4/": "/news/1.19.4/",
|
||||
"/news/archie/1.19.5/": "/news/1.19.5/",
|
||||
"/news/archie/1.19.6/": "/news/1.19.6/",
|
||||
"/news/archie/1.19.7/": "/news/1.19.7/",
|
||||
"/news/archie/1.19.8/": "/news/1.19.8/",
|
||||
"/news/archie/1.19.9/": "/news/1.19.9/",
|
||||
"/news/archie/1.2.0/": "/news/1.2.0/",
|
||||
"/news/archie/1.20.0/": "/news/1.20.0/",
|
||||
"/news/archie/1.21.0/": "/news/1.21.0/",
|
||||
"/news/archie/1.22.0/": "/news/1.22.0/",
|
||||
"/news/archie/1.23.0/": "/news/1.23.0/",
|
||||
"/news/archie/1.24.0/": "/news/1.24.0/",
|
||||
"/news/archie/1.25.0/": "/news/1.25.0/",
|
||||
"/news/archie/1.26.0/": "/news/1.26.0/",
|
||||
"/news/archie/1.27.0/": "/news/1.27.0/",
|
||||
"/news/archie/1.28.0/": "/news/1.28.0/",
|
||||
"/news/archie/1.29.0/": "/news/1.29.0/",
|
||||
"/news/archie/1.3.0/": "/news/1.3.0/",
|
||||
"/news/archie/1.3.1/": "/news/1.3.1/",
|
||||
"/news/archie/1.30.0/": "/news/1.30.0/",
|
||||
"/news/archie/1.31.0/": "/news/1.31.0/",
|
||||
"/news/archie/1.32.0/": "/news/1.32.0/",
|
||||
"/news/archie/1.32.1/": "/news/1.32.1/",
|
||||
"/news/archie/1.33.0/": "/news/1.33.0/",
|
||||
"/news/archie/1.34.0/": "/news/1.34.0/",
|
||||
"/news/archie/1.35.0/": "/news/1.35.0/",
|
||||
"/news/archie/1.36.0/": "/news/1.36.0/",
|
||||
"/news/archie/1.37.0/": "/news/1.37.0/",
|
||||
"/news/archie/1.37.1/": "/news/1.37.1/",
|
||||
"/news/archie/1.38.0/": "/news/1.38.0/",
|
||||
"/news/archie/1.39.0/": "/news/1.39.0/",
|
||||
"/news/archie/1.4.0/": "/news/1.4.0/",
|
||||
"/news/archie/1.4.1/": "/news/1.4.1/",
|
||||
"/news/archie/1.40.0/": "/news/1.40.0/",
|
||||
"/news/archie/1.41.0/": "/news/1.41.0/",
|
||||
"/news/archie/1.41.1/": "/news/1.41.1/",
|
||||
"/news/archie/1.41.2/": "/news/1.41.2/",
|
||||
"/news/archie/1.42.0/": "/news/1.42.0/",
|
||||
"/news/archie/1.43.0/": "/news/1.43.0/",
|
||||
"/news/archie/1.44.0/": "/news/1.44.0/",
|
||||
"/news/archie/1.44.1/": "/news/1.44.1/",
|
||||
"/news/archie/1.45.0/": "/news/1.45.0/",
|
||||
"/news/archie/1.46.0/": "/news/1.46.0/",
|
||||
"/news/archie/1.47.0/": "/news/1.47.0/",
|
||||
"/news/archie/1.47.1/": "/news/1.47.1/",
|
||||
"/news/archie/1.47.2/": "/news/1.47.2/",
|
||||
"/news/archie/1.47.3/": "/news/1.47.3/",
|
||||
"/news/archie/1.48.0/": "/news/1.48.0/",
|
||||
"/news/archie/1.48.1/": "/news/1.48.1/",
|
||||
"/news/archie/1.49.0/": "/news/1.49.0/",
|
||||
"/news/archie/1.49.1/": "/news/1.49.1/",
|
||||
"/news/archie/1.49.2/": "/news/1.49.2/",
|
||||
"/news/archie/1.49.3/": "/news/1.49.3/",
|
||||
"/news/archie/1.49.4/": "/news/1.49.4/",
|
||||
"/news/archie/1.5.0/": "/news/1.5.0/",
|
||||
"/news/archie/1.50.0/": "/news/1.50.0/",
|
||||
"/news/archie/1.50.1/": "/news/1.50.1/",
|
||||
"/news/archie/1.51.0/": "/news/1.51.0/",
|
||||
"/news/archie/1.51.1/": "/news/1.51.1/",
|
||||
"/news/archie/1.52.0/": "/news/1.52.0/",
|
||||
"/news/archie/1.53.0/": "/news/1.53.0/",
|
||||
"/news/archie/1.54.0/": "/news/1.54.0/",
|
||||
"/news/archie/1.54.1/": "/news/1.54.1/",
|
||||
"/news/archie/1.54.2/": "/news/1.54.2/",
|
||||
"/news/archie/1.54.3/": "/news/1.54.3/",
|
||||
"/news/archie/1.55.0/": "/news/1.55.0/",
|
||||
"/news/archie/1.56.0/": "/news/1.56.0/",
|
||||
"/news/archie/1.57.0/": "/news/1.57.0/",
|
||||
"/news/archie/1.58.0/": "/news/1.58.0/",
|
||||
"/news/archie/1.58.1/": "/news/1.58.1/",
|
||||
"/news/archie/1.59.0/": "/news/1.59.0/",
|
||||
"/news/archie/1.6.0/": "/news/1.6.0/",
|
||||
"/news/archie/1.60.0/": "/news/1.60.0/",
|
||||
"/news/archie/1.61.0/": "/news/1.61.0/",
|
||||
"/news/archie/1.61.1/": "/news/1.61.1/",
|
||||
"/news/archie/1.61.2/": "/news/1.61.2/",
|
||||
"/news/archie/1.61.3/": "/news/1.61.3/",
|
||||
"/news/archie/1.62.0/": "/news/1.62.0/",
|
||||
"/news/archie/1.7.0/": "/news/1.7.0/",
|
||||
"/news/archie/1.8.0/": "/news/1.8.0/",
|
||||
"/news/archie/1.9.0/": "/news/1.9.0/",
|
||||
"/news/archie/1.9.1/": "/news/1.9.1/",
|
||||
"/news/archie/1.9.10/": "/news/1.9.10/",
|
||||
"/news/archie/1.9.11/": "/news/1.9.11/",
|
||||
"/news/archie/1.9.2/": "/news/1.9.2/",
|
||||
"/news/archie/1.9.3/": "/news/1.9.3/",
|
||||
"/news/archie/1.9.4/": "/news/1.9.4/",
|
||||
"/news/archie/1.9.5/": "/news/1.9.5/",
|
||||
"/news/archie/1.9.6/": "/news/1.9.6/",
|
||||
"/news/archie/1.9.7/": "/news/1.9.7/",
|
||||
"/news/archie/1.9.8/": "/news/1.9.8/",
|
||||
"/news/archie/1.9.9/": "/news/1.9.9/",
|
||||
"/news/archied/1.0.0/": "/news/1.0.0/",
|
||||
"/news/archied/1.1.0/": "/news/1.1.0/",
|
||||
"/news/archied/1.10.0/": "/news/1.10.0/",
|
||||
"/news/archied/1.11.0/": "/news/1.11.0/",
|
||||
"/news/archied/1.11.1/": "/news/1.11.1/",
|
||||
"/news/archied/1.12.0/": "/news/1.12.0/",
|
||||
"/news/archied/1.13.0/": "/news/1.13.0/",
|
||||
"/news/archied/1.14.0/": "/news/1.14.0/",
|
||||
"/news/archied/1.15.0/": "/news/1.15.0/",
|
||||
"/news/archied/1.16.0/": "/news/1.16.0/",
|
||||
"/news/archied/1.16.1/": "/news/1.16.1/",
|
||||
"/news/archied/1.17.0/": "/news/1.17.0/",
|
||||
"/news/archied/1.17.1/": "/news/1.17.1/",
|
||||
"/news/archied/1.18.0/": "/news/1.18.0/",
|
||||
"/news/archied/1.19.0/": "/news/1.19.0/",
|
||||
"/news/archied/1.19.1/": "/news/1.19.1/",
|
||||
"/news/archied/1.19.10/": "/news/1.19.10/",
|
||||
"/news/archied/1.19.2/": "/news/1.19.2/",
|
||||
"/news/archied/1.19.3/": "/news/1.19.3/",
|
||||
"/news/archied/1.19.4/": "/news/1.19.4/",
|
||||
"/news/archied/1.19.5/": "/news/1.19.5/",
|
||||
"/news/archied/1.19.6/": "/news/1.19.6/",
|
||||
"/news/archied/1.19.7/": "/news/1.19.7/",
|
||||
"/news/archied/1.19.8/": "/news/1.19.8/",
|
||||
"/news/archied/1.19.9/": "/news/1.19.9/",
|
||||
"/news/archied/1.2.0/": "/news/1.2.0/",
|
||||
"/news/archied/1.20.0/": "/news/1.20.0/",
|
||||
"/news/archied/1.21.0/": "/news/1.21.0/",
|
||||
"/news/archied/1.22.0/": "/news/1.22.0/",
|
||||
"/news/archied/1.23.0/": "/news/1.23.0/",
|
||||
"/news/archied/1.24.0/": "/news/1.24.0/",
|
||||
"/news/archied/1.25.0/": "/news/1.25.0/",
|
||||
"/news/archied/1.26.0/": "/news/1.26.0/",
|
||||
"/news/archied/1.27.0/": "/news/1.27.0/",
|
||||
"/news/archied/1.28.0/": "/news/1.28.0/",
|
||||
"/news/archied/1.29.0/": "/news/1.29.0/",
|
||||
"/news/archied/1.3.0/": "/news/1.3.0/",
|
||||
"/news/archied/1.3.1/": "/news/1.3.1/",
|
||||
"/news/archied/1.30.0/": "/news/1.30.0/",
|
||||
"/news/archied/1.31.0/": "/news/1.31.0/",
|
||||
"/news/archied/1.32.0/": "/news/1.32.0/",
|
||||
"/news/archied/1.32.1/": "/news/1.32.1/",
|
||||
"/news/archied/1.33.0/": "/news/1.33.0/",
|
||||
"/news/archied/1.34.0/": "/news/1.34.0/",
|
||||
"/news/archied/1.35.0/": "/news/1.35.0/",
|
||||
"/news/archied/1.36.0/": "/news/1.36.0/",
|
||||
"/news/archied/1.37.0/": "/news/1.37.0/",
|
||||
"/news/archied/1.37.1/": "/news/1.37.1/",
|
||||
"/news/archied/1.38.0/": "/news/1.38.0/",
|
||||
"/news/archied/1.39.0/": "/news/1.39.0/",
|
||||
"/news/archied/1.4.0/": "/news/1.4.0/",
|
||||
"/news/archied/1.4.1/": "/news/1.4.1/",
|
||||
"/news/archied/1.40.0/": "/news/1.40.0/",
|
||||
"/news/archied/1.41.0/": "/news/1.41.0/",
|
||||
"/news/archied/1.41.1/": "/news/1.41.1/",
|
||||
"/news/archied/1.41.2/": "/news/1.41.2/",
|
||||
"/news/archied/1.42.0/": "/news/1.42.0/",
|
||||
"/news/archied/1.43.0/": "/news/1.43.0/",
|
||||
"/news/archied/1.44.0/": "/news/1.44.0/",
|
||||
"/news/archied/1.44.1/": "/news/1.44.1/",
|
||||
"/news/archied/1.45.0/": "/news/1.45.0/",
|
||||
"/news/archied/1.46.0/": "/news/1.46.0/",
|
||||
"/news/archied/1.47.0/": "/news/1.47.0/",
|
||||
"/news/archied/1.47.1/": "/news/1.47.1/",
|
||||
"/news/archied/1.47.2/": "/news/1.47.2/",
|
||||
"/news/archied/1.47.3/": "/news/1.47.3/",
|
||||
"/news/archied/1.48.0/": "/news/1.48.0/",
|
||||
"/news/archied/1.48.1/": "/news/1.48.1/",
|
||||
"/news/archied/1.49.0/": "/news/1.49.0/",
|
||||
"/news/archied/1.49.1/": "/news/1.49.1/",
|
||||
"/news/archied/1.49.2/": "/news/1.49.2/",
|
||||
"/news/archied/1.49.3/": "/news/1.49.3/",
|
||||
"/news/archied/1.49.4/": "/news/1.49.4/",
|
||||
"/news/archied/1.5.0/": "/news/1.5.0/",
|
||||
"/news/archied/1.50.0/": "/news/1.50.0/",
|
||||
"/news/archied/1.50.1/": "/news/1.50.1/",
|
||||
"/news/archied/1.51.0/": "/news/1.51.0/",
|
||||
"/news/archied/1.51.1/": "/news/1.51.1/",
|
||||
"/news/archied/1.52.0/": "/news/1.52.0/",
|
||||
"/news/archied/1.53.0/": "/news/1.53.0/",
|
||||
"/news/archied/1.54.0/": "/news/1.54.0/",
|
||||
"/news/archied/1.54.1/": "/news/1.54.1/",
|
||||
"/news/archied/1.54.2/": "/news/1.54.2/",
|
||||
"/news/archied/1.54.3/": "/news/1.54.3/",
|
||||
"/news/archied/1.55.0/": "/news/1.55.0/",
|
||||
"/news/archied/1.56.0/": "/news/1.56.0/",
|
||||
"/news/archied/1.57.0/": "/news/1.57.0/",
|
||||
"/news/archied/1.58.0/": "/news/1.58.0/",
|
||||
"/news/archied/1.58.1/": "/news/1.58.1/",
|
||||
"/news/archied/1.59.0/": "/news/1.59.0/",
|
||||
"/news/archied/1.6.0/": "/news/1.6.0/",
|
||||
"/news/archied/1.60.0/": "/news/1.60.0/",
|
||||
"/news/archied/1.61.0/": "/news/1.61.0/",
|
||||
"/news/archied/1.61.1/": "/news/1.61.1/",
|
||||
"/news/archied/1.61.2/": "/news/1.61.2/",
|
||||
"/news/archied/1.61.3/": "/news/1.61.3/",
|
||||
"/news/archied/1.62.0/": "/news/1.62.0/",
|
||||
"/news/archied/1.7.0/": "/news/1.7.0/",
|
||||
"/news/archied/1.8.0/": "/news/1.8.0/",
|
||||
"/news/archied/1.9.0/": "/news/1.9.0/",
|
||||
"/news/archied/1.9.1/": "/news/1.9.1/",
|
||||
"/news/archied/1.9.10/": "/news/1.9.10/",
|
||||
"/news/archied/1.9.11/": "/news/1.9.11/",
|
||||
"/news/archied/1.9.2/": "/news/1.9.2/",
|
||||
"/news/archied/1.9.3/": "/news/1.9.3/",
|
||||
"/news/archied/1.9.4/": "/news/1.9.4/",
|
||||
"/news/archied/1.9.5/": "/news/1.9.5/",
|
||||
"/news/archied/1.9.6/": "/news/1.9.6/",
|
||||
"/news/archied/1.9.7/": "/news/1.9.7/",
|
||||
"/news/archied/1.9.8/": "/news/1.9.8/",
|
||||
"/news/archied/1.9.9/": "/news/1.9.9/"
|
||||
}
|
||||
@@ -1,557 +0,0 @@
|
||||
[
|
||||
{
|
||||
"version": "1.62.0",
|
||||
"date": "2026-11-10",
|
||||
"body": "### archied\n\n- When an agent step reaches its step budget, the task asks to continue instead of parking. Approving resumes the stopped step with its conversation, including inside a parallel branch.\n- A parked task is flagged when the credential, connection or setting its blocker names changes, so you can see which parks are worth retrying.\n- Merging, closing and issue tools use the repository's own forge connection. A repository on Gitea no longer gets a GitHub 404 when its pull request is merged from archie.\n- A restart re-queues a running task at the step it was interrupted in, and parks it after three restarts instead of looping.\n- Issues and pull request review activity from authors without write access are ignored.\n- A baseline repair made by the repository gate is opened as its own pull request before the task continues.\n- Closing an issue that still has open dependencies is recorded as refused, rather than parking the task.\n- When the work volume fills, stale task clones are reclaimed; clones with uncommitted or unpushed work are kept. Clones need 1 GiB free, not 5.\n- A corrupt repository mirror is rebuilt, and a push that hits a missing object rebuilds the mirror and retries once.\n- Readiness reports degraded when the run loop stalls.\n- Execution budgets set in the dashboard are no longer reverted when the model catalogue loads.\n- A full volume is reported as an environment failure, and an unreachable secret engine as unavailable, rather than as a bad or missing credential.\n- A park from the workflow identity check now appears in the task log.\n- Every task records the identity that created it, and its queued event names the task, actor and principal. System is the one instance identity: it polls forge connections and owns the root grants and connection permits the bot-named identity used to hold, which existing tasks, grants and permits move to on upgrade.\n\n### archie-ui\n\n- A chat reply is no longer lost when you switch conversation or reload mid-answer: the turn finishes and its reply is in the conversation when you come back. Stop is the only way to cancel it.\n- The task page offers every action the task list does.\n- Workflows have row actions, enabling or disabling one confirms with a toast, and the editor toolbar wraps on narrow screens.\n- The dashboard lists five tasks needing attention, not every one.\n- Dismiss all no longer covers the unread badge.\n\n### archie-agent\n\n- The agent image includes Task, so the repository gate no longer downloads it on every run."
|
||||
},
|
||||
{
|
||||
"version": "1.61.3",
|
||||
"date": "2026-11-08",
|
||||
"body": "### archie-ui\n\n- Issue, pull request and repository links on tasks open on the forge the repository's connection points at, instead of GitHub.\n\n- Settings: the Harness page is now part of Agent profiles. The setup terminal and the credential sign-in status sit on the same page as the Kit profiles they target, so a profile with a Kit can be signed in from the page that defines it."
|
||||
},
|
||||
{
|
||||
"version": "1.61.2",
|
||||
"date": "2026-11-07",
|
||||
"body": "### archied\n\n- archied no longer gets killed by the systemd watchdog when a restart or update leaves many tasks to resume. Each resumed task used to cost a full queue poll before the next was picked up, so a dozen of them outlasted the 30-second watchdog; an update that hit this was rolled back."
|
||||
},
|
||||
{
|
||||
"version": "1.61.1",
|
||||
"date": "2026-11-07",
|
||||
"body": "### archie-gateway\n\n- An image or voice attachment that arrives as a link is now checked against what the link serves, the same as an uploaded one. A link whose content is not the declared type, or that cannot be read, is refused.\n\n### archie-ui\n\n- A workflow created on the canvas now saves the agent it runs as, so it runs instead of parking with \"declares no identity to run as\".\n\n### archie-state-store\n\n- A workflow that no longer validates after an upgrade (for example it names a step type that was removed) is repaired at startup instead of breaking every workflow. A shipped workflow is restored from this release's copy; a workflow you created is removed and logged, and its earlier revision stays in the resource history. Valid workflows you created or edited are kept."
|
||||
},
|
||||
{
|
||||
"version": "1.61.0",
|
||||
"date": "2026-11-07",
|
||||
"body": "### archied\n\n- A `workflow.handoff` now finishes its run and starts a separate, linked run of the next workflow on the same issue, instead of continuing as another attempt. The task page links each run to the one before and after it; attempts count only retries of one run.\n\n- A task no longer fails to prepare its worktree with \"some refs were not updated\" after a tag or branch moves on the forge.\n\n### archie-ui\n\n- The task page no longer flashes its loading state on every live update while a task runs.\n\n### archie-state-store\n\n- The extension catalogue lists and installs again. Its default signing key has changed; an instance that set its own catalogue signing key in Extension settings keeps using that key."
|
||||
},
|
||||
{
|
||||
"version": "1.60.0",
|
||||
"date": "2026-11-02",
|
||||
"body": "### archied\n\n- Curators can list a repository's open issues and file new ones with the `issue_list` and `issue_create` tools, which reach the forge through the daemon. A curator files only when its definition declares `issue_create`; the shipped self-intake example runs in dry run with `issue_list` for deduplication. Listing every open issue needs the forge extensions from the archipelago release after 1.2.0."
|
||||
},
|
||||
{
|
||||
"version": "1.59.0",
|
||||
"date": "2026-11-02",
|
||||
"body": "### archied\n\n- Forge extensions can open issues: the forge surface gains `CreateIssue` alongside list, comment and close, and the bundled Gitea and GitHub extensions implement it."
|
||||
},
|
||||
{
|
||||
"version": "1.58.1",
|
||||
"date": "2026-11-01",
|
||||
"body": "### archied\n\n- The systemd watchdog now also watches the task intake loop, and its warning names the loop that stalled.\n- archied no longer restarts about a minute after it starts. Under systemd, the watchdog never saw a poll pass and killed it on every start since 1.56.0."
|
||||
},
|
||||
{
|
||||
"version": "1.58.0",
|
||||
"date": "2026-11-01",
|
||||
"body": "### archied\n\n- Running `install.sh` over an install whose services are already running now restarts them, so they run the new binaries."
|
||||
},
|
||||
{
|
||||
"version": "1.57.0",
|
||||
"date": "2026-10-31",
|
||||
"body": "### archied\n\n- A release reaches `stable` only after it has run on a canary for a day and passed: `archied release publish` now publishes to `next` alone, `archied release canary start|check` installs a release on a canary and judges it from the canary's dashboard, promoting it or rolling the canary back, and `archied release promote` moves `stable` by hand. Promotion refuses a prerelease and a release older than the one `stable` names. The `archied` and `archie-agent` images are published as `:v<version>`, and `:latest` moves only when a release is promoted."
|
||||
},
|
||||
{
|
||||
"version": "1.56.0",
|
||||
"date": "2026-10-31",
|
||||
"body": "### archied\n\n- **Install once by hand.** Releases are now signed and published to `git.catlow.cloud/sam/archie`. A host on 1.55.0 or earlier still looks for releases on GitHub, so it finds this one only by running the new installer once: `curl -fsSL https://offloaded.dev/install.sh | bash`. Updates after that come from Settings → Status as before.\n- Releases are signed. Updates and `install.sh` refuse a release the release key did not sign, a zip that is not the one signed, and a channel moved back to an older release. Where releases and the extension catalogue come from is a setting (update settings and extension settings, or `[distribution]` in `config.toml` for a new instance), and `archied release keygen` and `archied release publish` publish signed releases to your own registry.\n- Organisations: forge connections, schedules, alerts, chat channels and audit are per organisation. A member acts in the organisation they select, the setup checklist follows it, and the instance's own forge is its root connection.\n- Workflows are edited as a draft and reach the running workflow only when published. Build a workflow with Archie from the canvas: chat writes the draft into the editor for review, and the editor locks while it does.\n- Schedules run from the State Store with run history, fire into their own organisation, and can trigger workflows. Daemon maintenance runs as built-in schedules.\n- A parked task links to the page that fixes its blocker (repository, credential, model or forge extension), and a parked task can be retried on the current workflow definition.\n- Shipped workflows run as a seeded agent identity with narrow grants instead of the root identity. Credential services are granted to dashboard identities from pickers, and personal API tokens have a name, a lifetime and a last-used time.\n- An org-scoped audit page with filters, a live tail, export and a retention setting; recorded access denials are kept for a set time and listed on their own page.\n- Instructions replace SOUL: instance, organisation, workflow and repository instructions are layered into every agent stage.\n- Chat docks at the bottom of every page and stays open across navigation. Tool calls show where they happened in a reply, with arguments (secrets masked) and durations, and `ask_questions` asks several questions at once.\n- Run more than one instance side by side: `ARCHIE_INSTANCE` names an instance, and the installer installs and updates a named one.\n- Pull request reviews submit REQUEST_CHANGES on blocking findings, list findings outside the diff in the review body, and repost without inline comments when the forge refuses their placement.\n- A workflow installs a repository's declared tooling before its gate, and tasks clone from a shared per-repository mirror.\n- Traces: services, model and tool calls and task containers export OpenTelemetry spans, and log lines carry the trace id.\n- Telegram runs as an archipelago channel extension, enabled from the Extensions page.\n- The Extensions page groups the marketplace by surface, is searchable, shows install state, and offers an update only when the catalogue has one.\n- The dashboard is rebuilt on shared components: a new Archie mark, a theme that follows the OS, task logs as a table, and layouts that fit a phone.\n\n### archie-agent\n\n- Released with archied 1.56.0; task containers export trace spans and install a repository's declared tooling before its gate."
|
||||
},
|
||||
{
|
||||
"version": "1.55.0",
|
||||
"date": "2026-10-16",
|
||||
"body": "### archied\n\n- Personas are gone: the Personas settings page, the chat Personality selector and `/personality`. A selected persona never changed what the model was told; SOUL (Settings → SOUL) is the one place to set Archie's identity and style. Stored persona settings are deleted on upgrade.\n- The shipped SOUL describes Archie as the assistant for an event-driven automation system rather than a coding assistant. A SOUL you have saved is kept as it is."
|
||||
},
|
||||
{
|
||||
"version": "1.54.3",
|
||||
"date": "2026-10-16",
|
||||
"body": "### archied\n\n- Chat can help write a workflow: it reads your workflows and the step catalog, writes a definition, and checks it the same way saving does, fixing what the check reports. It does not save; paste the YAML it gives you into the editor's YAML view and save there."
|
||||
},
|
||||
{
|
||||
"version": "1.54.2",
|
||||
"date": "2026-10-16",
|
||||
"body": "### archied\n\n- Tool calls from Gemini models (Interactions API) receive their arguments intact. Any tool that takes arguments, such as `dashboard_navigate` in chat, failed with \"invalid character '{' after top-level value\".\n\n### archie-agent\n\n- Agent steps on Gemini models (Interactions API) pass tools their arguments intact instead of failing to decode them."
|
||||
},
|
||||
{
|
||||
"version": "1.54.1",
|
||||
"date": "2026-10-16",
|
||||
"body": "### archied\n\n- Update checks, `archied update install` and `install.sh` find releases at `github.com/samcharles93/archie-releases`, so a host can update again. A host on 1.54.0 or earlier still looks in the old place and has to be upgraded to 1.54.1 by hand once."
|
||||
},
|
||||
{
|
||||
"version": "1.54.0",
|
||||
"date": "2026-10-16",
|
||||
"body": "**Upgrade note:** services now authenticate each other with TLS certificates from your own CA instead of shared tokens. Before upgrading a host whose services listen on anything but loopback (any host running agent containers), issue a certificate per service (`archied`, `archie-gateway`, `archie-messaging`, `archie-state-store`, `archie-ui`, each with its name as the DNS SAN and both server and client auth), add `[tls] ca_file` and `cert_dir` to `config.toml`, and remove every `target_token`, the `*_TOKEN` service variables and the `--token`/`--*-token` flags, including archie-ui's `-token` and `-token-file`. A unit that still passes a removed flag fails to start. See `config.example.toml`.\n\n### archied\n\n- Services authenticate each other with mutual TLS. Each process presents `<cert_dir>/<service>.pem`, peers must chain to `ca_file`, and a caller is identified by its certificate rather than by what it claims. Renewed certificates are picked up without a restart. Without `[tls]`, services listen on and dial loopback only. The harness setup terminal requires `[tls]`.\n- Every gRPC service caps the streams a connection holds, times out stalled handshakes, releases a dead client's streams, and drains for at most 10 seconds on shutdown. Messaging exits when its listener fails instead of staying up without delivering.\n- The dashboard has user accounts. First run opens browser setup for the organisation, workspace and first administrator; people then sign in with a password, a passkey or your identity provider, and account administration lives under Access. The shared dashboard token is gone; reach the dashboard remotely through an HTTPS reverse proxy.\n- `archied update install` updates a host in one transaction: it verifies the release, stages every binary, pulls the agent image by digest and backs up the database, then restarts the services in order and rolls everything back if archied is not healthy for two minutes.\n- Each workflow runs as the identity it declares, checked on every attempt along with the identity that started it. A workflow that declares none is refused, a called workflow runs as its caller's declared identity, and shipped workflows run as the instance root.\n- Test-run a workflow draft before saving it, with forge and push writes suppressed and recorded per step. The History tab lists a workflow's revisions, diffs them as YAML and on the canvas, restores one into the editor, and shows which revision each run used.\n- Start a task from the dashboard. The dashboard home shows activity and setup, and a running task has a read-only Sandbox tab that follows its container.\n- The topbar's Jump to is a command palette, settings lists open as accordions that wait for a new item to be saved, and history restores land as a draft applied from the save bar.\n- Labels, hints, alerts and empty states say what is wrong and what to do, without tutorial or marketing prose.\n- Org isolation is tighter: harness secrets, identity writes, principals, playbook dispatch and model selections in chat stay in the caller's org, instance settings are written by the system org only, and creating a source or reloading a channel is authorized against the target.\n- Binding dispatch claims its capture and enqueues the task atomically, so a capture cannot start two runs, and the run-time workflow check sees the binding event's signature and address.\n- Service-unhealthy alerts count their grace from the last report and also cover a service that went silent, and a restart no longer clears an alert still inside its grace. An invalid stored access policy raises an alert until it validates.\n- A failed cancel of a called workflow no longer leaves the caller running, retention spares captures still waiting to be dispatched, and EDA playbooks load and report at start instead of on first dispatch.\n- Chat model selection works again for provider models.\n\n### archie-agent\n\n- Each run acts as its workflow's declared identity.\n- A task snapshot carries only the model limits its aliases resolve to.\n- A build step's \"no changes\" result comes from its writable stages and clears once a commit lands.\n- Test runs suppress forge and push writes and record what they would have done.\n- The default persona is a reporting-focused identity prompt, without the one-question limit in chat."
|
||||
},
|
||||
{
|
||||
"version": "1.53.0",
|
||||
"date": "2026-10-11",
|
||||
"body": "### archied\n\n- Every organisation's data is its own. Chats, tasks, events, transitions, steps, tool calls, run statistics, event sources, event types, mappings, bindings and agent memory are read and written in the org that owns them, and a request can no longer write into another org. Rows written before orgs existed move to their owner's org on upgrade.\n- An instance admin decides what each org may reach: the models it can use, and whether it may register providers under its own credentials. Org Settings gains a Models tab and instance Models gains Org access. The system org is never restricted; another org uses nothing until it is granted.\n- Models are addressed by alias. Aliases replace model roles, one resolver serves every purpose (agent steps, implement, PR review, MCP sampling, chat, embedding, transcription), and an unknown alias fails instead of falling back to a default. The step editor and the chat picker offer aliases, and a workflow naming one that does not exist is refused when saved.\n- Chat sessions belong to one org; a chat resolves its models in the caller's org and is billed to it, and a task run from chat posts its outcome back to that chat.\n- Add a member by provider subject, or by email as a placeholder that the first sign-in the provider vouches for claims.\n- The workflow canvas authors parallel branches as lanes, adds a switch step that runs the case matching a reference, and edits a call's interface. A step shows its role, its number and its run trace.\n- The workflows list shows each workflow's running count and latest run result, the canvas reveals its data-edge handles on hover, and restoring a version asks for confirmation.\n- Store packages can auto-update: a package given the policy is moved to the catalogue's newest digest by a State Store ticker. An update asking for more authority than was accepted waits as a pending update with the running version untouched; approving it accepts the new authority, and a rollback restores the previous version with the authority accepted against it.\n- Model provider keys never enter an agent container: the runtime reaches its providers through the egress proxy, which holds the keys. A task's own credential can no longer replace the workflow definition its run is pinned to, and a package workflow's triggers, tools and forge calls are bounded by the authority accepted for the package.\n- The dashboard warns when it is reachable from off-host over plain HTTP, and the wildcard listen address counts as off-host rather than loopback. Instance health, logs, config and identities, the setup checklist and the skill catalogue are system-org only, and API requests are refused until the access chain has loaded.\n- `/approve` reaches Telegram; the router served it but nothing published it.\n- A worktree a killed container left root-owned is taken back by the daemon, and a PR review's benchmark runner works again on configured models and public PRs.\n- An unserved `/api` path returns 404 instead of the dashboard page, and an input group's select no longer loses clicks to its addon.\n\n### archie-agent\n\n- The runtime reaches model providers through the egress proxy, so provider keys stay out of the container.\n- Agent steps resolve model aliases and their own org's models and credentials, failing on an unknown alias instead of falling back.\n- A switch step runs the case matching its reference.\n- A call waiting on another step is reconciled from durable steps, so it resumes after a daemon restart rather than stranding."
|
||||
},
|
||||
{
|
||||
"version": "1.52.0",
|
||||
"date": "2026-10-09",
|
||||
"body": "### archied\n\n- The harness page's setup terminal opens a real session: it starts an ephemeral container from a Kit profile, runs the CLI's own login and captures the OAuth tokens at the provider's token endpoint. Point the dashboard at the daemon with `[services.harness].target` and a `HARNESS_TOKEN` and it stops answering 503; the terminal is created at your browser's size. Takeover of a live task is not in this release.\n- A credential's token endpoint is refused when the run is not granted that service, instead of proxy-ing the provider's real tokens into the container.\n- Settings → Profiles, Credential bindings and Playbooks are editable from the dashboard, and curator definitions can be changed and applied without a restart.\n- Settings say whether each one applies live or needs a restart, show what is consuming resources, and report whether an apply landed.\n- Status shows each service's dependency checks, the agent workers and the broker.\n- The Logs page reads recent logs from every service, not just the daemon.\n- Captures and webhook sources are scoped to the org that owns them: the list, retention and delivery authorization all act in the right org, and a workflow definition resolves in its own org.\n- Chat settings are attributed to the signed-in user, and Settings → Tokens explains when a personal token cannot be created.\n- A channel enabled after Archie started works immediately; a channel that fails on its own recovers; a failed channel is no longer reported as enabled, and stored channel settings no longer save duplicate or unnormalized values.\n- The task table sorts, the command palette no longer scrolls sideways or loses its highlight, unknown routes render a not-found page, and configuration reload failures are shown instead of passing silently.\n- A scheduled job whose payload names a dangerous command is refused.\n- A disabled model provider is never served from the ambient API key.\n- `generate_video` is backed by ai-sdk's MiniMax video provider.\n- A dashboard token is no longer written to the startup log.\n\n### archie-agent\n\n- `workflow.call`: a call is keyed on its declared step path, its key is freed once the callee reaches a terminal state, and a caller waiting on a callee releases its capacity instead of holding it.\n- `command.run` honours step retry and `on_failure`.\n- A value passed between steps keeps its declared type, and optional result booleans are enforced only when the workflow declares them.\n- Capture tools have their results checked against the declared schema.\n- A single-cycle run waits for its in-flight tasks before exiting, and identity tasks inherit live settings.\n- Kit containers run Docker's init as PID 1, so orphaned processes are reaped instead of accumulating inside a long task."
|
||||
},
|
||||
{
|
||||
"version": "1.51.1",
|
||||
"date": "2026-10-08",
|
||||
"body": "### archied\n\n- Chat with OpenAI's gpt-6 models (gpt-6-luna and the rest) works with tools; a turn failed with \"Function tools with reasoning_effort are not supported\"."
|
||||
},
|
||||
{
|
||||
"version": "1.51.0",
|
||||
"date": "2026-10-08",
|
||||
"body": "### archied\n\n- A secret engine enabled after Archie started (Bitwarden, for example) now supplies its keys straight away; providers that depended on it no longer stay disabled until a restart.\n- The dashboard chat has a microphone button: record a voice message and it is transcribed like a Telegram voice note. It shows only when a `transcription` model role is set under Settings → Models.\n- A file Archie sends in the dashboard chat is a download link for an hour, instead of a note that it can't be delivered.\n- Typing `/model` or `/personality` on its own in the dashboard chat offers the choices as buttons."
|
||||
},
|
||||
{
|
||||
"version": "1.50.1",
|
||||
"date": "2026-10-08",
|
||||
"body": "### archied\n\n- When an update is rolled back, the log names the health check that failed instead of only \"unhealthy\"."
|
||||
},
|
||||
{
|
||||
"version": "1.50.0",
|
||||
"date": "2026-10-08",
|
||||
"body": "### archied\n\n- Tools that need your approval ask for it again, and Archie can ask you a question or offer choices mid-reply. Since the services were split these never reached Telegram or the dashboard: approval-gated tools failed and questions were never asked.\n- The dashboard chat shows approvals as Approve / Always this session / Deny, choices as buttons, and questions with a reply field.\n- `/update` in the dashboard chat lists what's available with Install and Not now.\n- Settings → Status → Versions installs the update it shows; its Install button sent an empty request."
|
||||
},
|
||||
{
|
||||
"version": "1.49.4",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- Settings → Status and Settings → Extensions are split into tabs instead of one long page; the Versions table's status column ends at the card's edge.\n- Tools & MCP has one \"Add MCP server\" button; the transport is chosen in the form, and an unnamed new server is not an unsaved change.\n- Settings → Repositories shows the add field when no repositories are configured, instead of a blank page.\n- The unsaved-changes bar always rests at the bottom of the window."
|
||||
},
|
||||
{
|
||||
"version": "1.49.3",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- Settings → Status → Versions shows the Gateway as \"Update available\" with an Install button when a newer release exists; it read \"Unknown\" with no way to install. The Runtime row stays \"Unknown\" until an agent task has run.\n- The release channel buttons sit at the Updates card's right edge instead of mid-row."
|
||||
},
|
||||
{
|
||||
"version": "1.49.2",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- Carries the 1.49.0 and 1.49.1 changes, whose builds were never published. The update check reads GitHub releases directly and still offers only releases with a verifiable linux-amd64 zip."
|
||||
},
|
||||
{
|
||||
"version": "1.49.1",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- When the dashboard session expires, the page returns to the sign-in screen instead of showing errors on every page until a manual refresh."
|
||||
},
|
||||
{
|
||||
"version": "1.49.0",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- Extensions that declare no egress hosts (vault, email, gitea) reach the network again; only packages that declare their hosts are confined to them. The Accept dialog shows \"network: unrestricted\" for the rest.\n- The update check finds releases itself, and reuses a found release for ten minutes so repeated checks stay under GitHub's rate limit."
|
||||
},
|
||||
{
|
||||
"version": "1.48.1",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- **Settings → Status → Updates** now chooses only the release channel (stable, prereleases, or a pinned version). Update checks and installs always run the `archie-update-*` scripts installed beside the binaries; the dashboard can no longer set the command that runs."
|
||||
},
|
||||
{
|
||||
"version": "1.48.0",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- **Settings → Status → Updates** edits the update check and install commands. They default to the `archie-update-*` scripts installed beside the binaries, so a zip install shows **Install** on the Versions card with nothing configured. The `update_check_command` and `update_install_command` keys under `[chat.telegram]` are no longer read; remove them from `config.toml`.\n- `archie-update-install` run from a shell now reads `~/.config/archie/env`, so the pre-update backup of the bundled database no longer fails with `no password supplied`. Run it with `--auto` to install the newest release."
|
||||
},
|
||||
{
|
||||
"version": "1.47.3",
|
||||
"date": "2026-10-07",
|
||||
"body": "### archied\n\n- **Settings → Extensions**: **Accept** in the authority review now accepts the extension, and **Remove** removes it. Both previously closed the dialog without doing anything."
|
||||
},
|
||||
{
|
||||
"version": "1.47.2",
|
||||
"date": "2026-10-06",
|
||||
"body": "### archied\n\n- **Events → Inspector** now lists your capture sources with their real URLs and a **New source** button, replacing the `/webhooks/capture/<source>` placeholder. Sources no longer sit on the Bindings tab."
|
||||
},
|
||||
{
|
||||
"version": "1.47.1",
|
||||
"date": "2026-10-06",
|
||||
"body": "### archied\n\n- The bundled PostgreSQL has no network and publishes no port: the services reach it through its Unix socket under `~/.local/share/archie/postgres`, so it no longer collides with another PostgreSQL on 5432. Leaving the database question blank in `archied setup` selects it.\n- The installer does not start the services when the bundled PostgreSQL fails to start; it names the command to read its logs.\n- On hosts that restrict unprivileged user namespaces (Ubuntu 23.10+), the installer prints an AppArmor profile allowing them for the Archie binaries only."
|
||||
},
|
||||
{
|
||||
"version": "1.47.0",
|
||||
"date": "2026-10-06",
|
||||
"body": "### archied\n\n- Install with one command: `curl -fsSL https://raw.githubusercontent.com/samcharles93/archie-core/main/install.sh | bash` downloads this release, verifies its checksum and runs `archied setup`. `--from-source` builds a checkout instead.\n- `archied setup` asks for the PostgreSQL URL. Left blank, it uses the bundled Compose database with a generated password stored in `~/.config/archie/env` as `PGPASSWORD`, not in `config.toml`.\n- The bundled PostgreSQL listens on 127.0.0.1 only. A database created before this release keeps its old `archie` password; enter its URL at setup or recreate the volume.\n- The release zip carries `docker-compose.yml`.\n- Extensions need unprivileged user namespaces, which Ubuntu 23.10 and later restrict. Allow them for the Archie binaries with an AppArmor profile; from the next release the installer prints it. Do not disable the restriction system-wide.\n- fix(app): assign the temp-file close result on the error path\n- fix(webhook): set a ReadHeaderTimeout on the forge webhook receivers\n- fix(forge): refuse a review line number that does not fit an int\n- fix(storepkg): mask the tar mode to the permission bits before narrowing\n- fix(webui): navigate the Events chain once, not twice\n- feat(tools): fail the gate when docs cite a path that no longer exists\n- fix(webhookguard): verify uppercase-hex HMAC signatures\n- fix(configuration): make bot_user required, defaulted, and named\n- feat(workflow): add the command.run step type\n- fix(controlplane): an absent MCP server field inherits the file value\n- fix(build): restore the go fix fixpoint, and give the formatter one owner\n- fix(archied): restore contextcheck directives and drop unused adapter\n- feat(secretengine): serve secret engines as go-plugin extensions\n- refactor(statestore): own package for the State Store service; access reset moves to archie-state-store\n- refactor(archied): gateway owns model work; daemon drops chat runtime, tools, memory and curators\n- refactor(archiegateway): own package for the Gateway service\n- fix(services): services wait for peers instead of exiting; restarted broker keeps its endpoint\n- refactor(archieplaybooks): fold archie-playbooks into archied playbooks lint|serve\n- refactor(agentrun): agent stage contract moves to the domain layer\n- refactor(agentexec): model loop moves to agentexec/modelloop\n- fix(configuration): bindings encryption keys must use the env engine\n- feat(storepkg): fetch packages from any registry, plain HTTP on loopback only\n- feat(webui): install, accept and enable extensions from the dashboard\n- feat(presence): every service re-stamps a presence record in the State Store\n- refactor(plugin): delete Yaegi daemon plugins and plugin_dir\n- refactor(module): the log action is built in; delete the module loader and reconciler\n- refactor(skill): delete Yaegi skill scripts and the run_go_script tool\n- refactor(examples): the firewall workflow moves to archipelago\n- feat(presence): services card on the status page and archied status\n- feat(archiemessaging): verify update reports against archied's presence and restore release announcements\n- fix(configuration): an overlay stands in for a missing config file; dev overlay is complete\n- feat(access): edit org, workspace and object policies from the dashboard; refuse owner lockout\n- feat(access): instance network rules at the capture receiver; policies reload without a restart\n- feat(staterpc): attribute State Store calls to the calling service; policy audit records it\n- feat(controlplane): playbooks and agent profiles install from packages; the daemon reads eda-playbooks live\n- feat(forgeext): forge surface served by extensions; forge.type names the installed package\n- refactor(forge): github and gitea leave core; webhooks parse in the forge extension\n- feat(staterpc): the State Store derives org and actor from the principal archie-ui forwards\n- feat(channelext): chat channels served by extensions; messaging runs the enabled ones\n- refactor(channels): webhook and email run only as extensions; their channel settings go\n- feat(skills): skill packages project into a skills resource the gateway reads live\n- fix(gatewayrpc): sender_id and rate_limited cross the chat wire\n- fix(controlplane): change history names kinds and reads only the caller's org\n- feat(contracts)!: requests no longer name their org; the State Store derives it from the caller\n- feat(identity): personal API tokens, created and revoked from the dashboard, act as their owner\n- fix(archieui): a sign-in provider outage is a health issue, not a startup failure\n- feat(staterpc): one run credential per task, kept in the State Store, authorizes its store calls and its push\n- fix(forgerpc): forge calls need the run credential and reach only the run's own repository\n- feat(controlplane): identity credential grants edited from the dashboard and applied live\n- feat(daemon): a workflow that names an identity runs asLine truncated
|
||||
},
|
||||
{
|
||||
"version": "1.46.0",
|
||||
"date": "2026-10-02",
|
||||
"body": "### archied\n\n- feat(workflow): declared workflow outputs for wait:true callers\n- feat(prreview): the operator-approval gate is PRReview's own stage-list entry\n- feat(staterpc): carry the review gate and re-review rounds, with one guarded response write\n- feat(prreview): the gate records the review it holds and posts the operator's answer\n- feat(taskactions): one approval path answers the review gate from every surface\n- feat(webui): the dashboard answers the review gate, including a re-review's instructions\n- feat(daemon): resolve the producing identity's org before publishing work\n- feat(webui): block invalid settings and show a field's former value\n- fix(workflow): derive a declared output's captures need for profile selection\n- fix(storepkg): validate every declared authority grant at the package descriptor\n- feat(archied): refresh the model catalog at runtime\n- feat(mcp): answer server-initiated sampling from the chat model\n- feat(container): send registry auth on image pull\n- feat(messaging): retract ephemeral replies after their TTL\n- feat(messaging): transcribe Telegram voice notes\n- fix(egress): take a run's credential kind from its binding, not the Kit\n- feat(webui): a live-apply setting reads as applied, never as a restart\n- feat(webui): the dashboard reads harness bindings and opens the setup terminal\n- feat(gateway): list the harness page in the dashboard page registry\n- feat(webui): the harness settings page and its setup terminal\n- fix(workflow): park environment gate failures without dispatching a builder\n- feat(messaging): adapter-facing clarify, picker and approval contract\n- feat(gateway): gate admin slash commands by sender policy\n- feat(plugins): load plugin and secret-engine files without a restart\n- fix(workflow): deliver the feasibility PRD to the forge issue\n- fix(messaging): report the daemon version this process was built from\n- fix(messaging): carry an inbound attachment's bytes to the gateway turn\n- fix(daemon): resume a retry whose worktree is gone\n- fix(archied): omit the max-token bound on reasoning-class models\n- fix(logging): file a task log record under its own event time\n- fix(control-plane): unify validation for the domain-managed kinds\n- feat(webui): let the operator choose the retry worktree mode\n- feat(agent): seed a starter SOUL and upgrade only untouched templates\n- feat(controlplane): add the writable review-settings resource\n- fix(messaging): transcribe voice notes on the model-owning side of the boundary\n- fix(messaging): gate the boundary on config reads, not only package links\n- feat(messaging): restart only the channel whose settings changed\n- feat(container): apply container-runtime-policies live\n- feat(tools): reconcile MCP servers and tool settings live\n- feat(messaging): add a per-turn interactive carrier for clarify and picker\n- feat(gateway): offer ask_user when the turn's channel can carry a question\n- feat(telegram): carry clarify and picker through the text fallback\n- fix(webui): pin the dashboard validators to the control plane's\n- refactor(agent): drop the SOUL upgrade branch with no shipped template\n- feat(agentworker): answer MCP sampling from the task's model\n- fix(workflow): bind the remediate worktree before the builder runs\n- fix(config): carry max_retries into the worker TaskConfig snapshot\n- fix(agentworker): supply the guardrail engine to every task run\n\n### archie-agent\n\n- feat(workflow): declared workflow outputs for wait:true callers\n- feat(prreview): the operator-approval gate is PRReview's own stage-list entry\n- feat(staterpc): carry the review gate and re-review rounds, with one guarded response write\n- feat(prreview): the gate records the review it holds and posts the operator's answer\n- feat(taskactions): one approval path answers the review gate from every surface\n- fix(workflow): derive a declared output's captures need for profile selection\n- fix(storepkg): validate every declared authority grant at the package descriptor\n- feat(mcp): answer server-initiated sampling from the chat model\n- feat(container): send registry auth on image pull\n- feat(messaging): retract ephemeral replies after their TTL\n- feat(messaging): transcribe Telegram voice notes\n- fix(egress): take a run's credential kind from its binding, not the Kit\n- fix(workflow): park environment gate failures without dispatching a builder\n- feat(messaging): adapter-facing clarify, picker and approval contract\n- feat(plugins): load plugin and secret-engine files without a restart\n- fix(workflow): deliver the feasibility PRD to the forge issue\n- fix(messaging): carry an inbound attachment's bytes to the gateway turn\n- fix(daemon): resume a retry whose worktree is gone\n- fix(logging): file a task log record under its own event time\n- fix(control-plane): unify validation for the domain-managed kinds\n- feat(webui): let the operator choose the retry worktree mode\n- fix(messaging): transcribe Line truncated
|
||||
},
|
||||
{
|
||||
"version": "1.45.0",
|
||||
"date": "2026-09-30",
|
||||
"body": "### archied\n\n- fix(eda): reject a result map missing a field or needing a conversion\n- feat(eda): per-org workflow enable/disable gating bindings\n- feat(telegram): carry inbound media through the chat turn\n- fix(prsource): use a CodeQL-recognised containment guard when extracting archives\n- feat(store): key control-plane resources by (org, kind)\n- fix(store): refuse resource keys the audit key cannot disambiguate\n- fix(daemon): resume the task branch before container acquisition\n- feat(webui): show attachment metadata in the session transcript\n- feat(webui): name a workflow's declared inputs on the work-request form\n- feat(controlplane): carry the caller org from the request principal\n- fix(webui): the workflow handlers act in the caller's org\n- feat(kitrun): render the OAuth credential file with sentinels\n- feat(store): record accepted package authority against the pin\n- fix(workflow): the own-PR flow no longer parks on the operator-approval gate\n- feat(gateway): a TTL-bounded dedup gate for redelivered platform messages\n- feat(egress): capture the OAuth scope set and carry it to the harness secret\n- feat(kitrun): render the OAuth scopes and omit an uncaptured primary key\n- feat(store): project installed package contributions into org resources\n- feat(gateway): coalesce rapid-fire text events into one turn\n- fix(config): expand plugin, module and skills dirs like every other operator path\n- fix(webui): drop the config schema's editability advert\n- feat(webui): events counts, YAML reading, log rows and dashboard filters\n\n### archie-agent\n\n- feat(eda): per-org workflow enable/disable gating bindings\n- feat(telegram): carry inbound media through the chat turn\n- fix(prsource): use a CodeQL-recognised containment guard when extracting archives\n- feat(store): key control-plane resources by (org, kind)\n- feat(controlplane): carry the caller org from the request principal\n- feat(kitrun): render the OAuth credential file with sentinels\n- feat(store): record accepted package authority against the pin\n- fix(workflow): the own-PR flow no longer parks on the operator-approval gate\n- feat(egress): capture the OAuth scope set and carry it to the harness secret\n- feat(kitrun): render the OAuth scopes and omit an uncaptured primary key\n- feat(store): project installed package contributions into org resources"
|
||||
},
|
||||
{
|
||||
"version": "1.44.1",
|
||||
"date": "2026-09-29",
|
||||
"body": "### archied\n\nTwo fixes to tasks that could not get past their workflow definition.\n\n- **Approving a task no longer parks it again.** A task requeued under a\n different workflow kept the previous run's definition pinned, so the worker\n refused to compile the dispatch — it named `feasibility` while the row named\n `implement` — and the task parked immediately, identically on every further\n approval, which left `decline` as the only working operator action.\n The daemon now re-pins whenever the pinned definition's id disagrees with the\n task's workflow. A pin that is present, digest-valid and id-consistent is\n still a strict no-op, so an operator's own definition override survives a\n dispatch unchanged.\n- **A shipped workflow definition now reaches an existing install.** A stored\n seed was consulted only for a resource the store did not already hold, so a\n document that changed in the build never reached a database an earlier\n release had seeded. For workflow definitions that is a total outage rather\n than a stale setting: the collection validates as one document, so a stored\n step type this build no longer has failed every task's pin, whatever workflow\n the task named — and the documented recovery, removing the resource and\n restarting, wrote nothing either, because the store answered the seed's known\n request ID from a history that outlives the resource. A seed now refreshes a\n kind it wrote the newest revision of and re-creates a resource that is gone,\n while an operator's own replacement is never undone.\n\n### archie-agent\n\nThe runtime image is rebuilt with this release and links the shared workflow\npackage carrying the definition-id helper above. Hosts that run agent\ncontainers need `docker compose pull agent` after updating to pick it up."
|
||||
},
|
||||
{
|
||||
"version": "1.44.0",
|
||||
"date": "2026-09-29",
|
||||
"body": "### archied\n\nArchie can now review pull requests.\n\n- **Reviews on request and by watch.** Ask in chat or on the dashboard work form, add a repository to the watch list, or just let archie review its own PRs before it opens them. Review intensity follows a depth dial (quick/standard/deep) classified from the size of the change, and every finished review passes a verification layer — coverage-gap and cross-finding consistency checks — before it is produced.\n- **No forge credential reaches the review sandbox.** The daemon prefetches the pull request's data and rebuilds its source snapshot over the forge's HTTP API, so the agent container works from an isolated copy with no read access to the repository's credentials.\n- **Reviews stop at the operator gate before posting.** `review.precision_gate` / `approve_before_post` decide whether a finished review posts itself or parks for operator approval. With this release the parked state is a stop sign, not a checkpoint: the approve/reject/re-review responses behind the gate are not wired yet, and the gate's settings are not yet editable in the dashboard (configure them in `config.toml`). A parked review sits until that follow-up lands.\n- The adversarial self-review pass archie previously ran before opening its own PRs is superseded by this pipeline and has been removed.\n- Hardened harness input handling: harness identifiers are bounded to integer types.\n\n### archie-agent\n\nThe runtime image is rebuilt with this release; it links the shared pr-review workflow packages behind the reviews above. Hosts that run agent containers need `docker compose pull agent` after updating to pick it up."
|
||||
},
|
||||
{
|
||||
"version": "1.43.0",
|
||||
"date": "2026-09-28",
|
||||
"body": "### archied\n\n- **Organisations.** Tasks, identities and settings now belong to an org. An\n existing install is upgraded into a default org when the State Store first\n starts; the upgrade resumes if interrupted. Task de-duplication is scoped\n per org and identity.\n- **Access policies are enforced** at the dashboard, the API and task\n dispatch, with shipped roles and a rule that nothing crosses between orgs.\n Denials are recorded and reported on the health page. If a policy locks\n you out, `archied access reset --org <org>` (or `--instance`) on the State\n Store host restores the shipped defaults.\n- **Workflows can call workflows** with a `workflow.call` step. Inputs and\n call cycles are checked when the workflow is saved, and the caller waits\n on the callee's result.\n- **Runs record each step.** A run's stages and agent calls are stored as\n steps, the task detail page reads them, and stopping a task or archiving\n it goes through one cancel path. After a crash, steps left running are\n marked interrupted. Archiving a task removes its worktree.\n- **Model roles, repositories, scheduling policy, providers and agent\n profiles apply without a restart.**\n- **Kit harness profiles:**\n - `kit` is now one digest-pinned reference, a workload Kit or a published\n Kit set, not a list. **Rewrite `kit = [...]` in `config.toml` or the\n agent-profiles settings as the single reference**; a list no longer\n loads. Compose mixins by publishing a Kit set.\n - OAuth logins are handled on the host: the egress proxy refreshes tokens,\n stores them encrypted, and gives the container only placeholders.\n - A Kit's skills request mounts `skills_dir` read-only, and its\n instructions file (such as `CLAUDE.md`) is written beside the workspace,\n which is now `/archie/workspace`.\n - A run still cannot be granted the credential a Kit needs, so a Kit that\n requires one is refused at launch.\n- Rate-limited webhook deliveries get `429`.\n- `archie-gateway` and `archie-state-store` report ready to systemd.\n\n### archie-agent\n\n- Runs workflow calls, records its steps and agent calls, and runs Kit\n harness stages under the profile's Kit."
|
||||
},
|
||||
{
|
||||
"version": "1.42.0",
|
||||
"date": "2026-09-26",
|
||||
"body": "### archied\n\n- **The dashboard is rebuilt on a new Graphite theme.** Settings moved to its\n own sidebar with one save flow across every page (Channels, Tools & MCP,\n Scheduling policy, Personas and Schedules, Identities, Plugins, Container\n runtime, and a History of past changes). The top bar, Dashboard, Workflows,\n task detail, the New task dialog and the Events page are all new: Dashboard\n leads with what needs you, a run's stage rail and detail panels sit\n side by side, Workflows shows per-workflow stats including completed runs,\n and Events states capture status with a copyable capture endpoint. Live\n updates share one stream and reopen after a drop instead of going quiet.\n- **Settings changes are audited.** A field-level audit table records who\n changed what, with a view on each settings page.\n- **A task can carry a whole-run wall-clock limit**, separate from a stage's\n own budget.\n- **A run that makes no changes now ends as completed and its worktree is\n cleaned up**, rather than left in a state Workflows didn't count.\n- **Abandoning a task no longer closes its forge issue.** Only the workflow's\n own terminal outcomes do that now.\n- **A task whose container exits before the worker replies is parked**\n instead of left running with no way to finish.\n- **A worktree still holding uncommitted work is kept**, rather than reset,\n when its task reaches a terminal state.\n- **A provider's stored settings no longer get corrupted with a process-local\n placeholder in place of your configured secret reference**, and archied\n rejects a stored value shaped like one on the way back in.\n- **Kit v3 harness profiles.** A `[containers.profiles.<name>]` entry can now\n name a Kit v3 image (`kit = [...]`, pinned by digest) instead of a plain\n container image, running the task's agent stages on an external CLI --\n Claude Code, Codex, Pi, OMP or GitHub Copilot CLI -- inside an isolated\n sandbox network. This release lands the daemon-side plumbing (egress\n proxy, sandbox network, credential injection points); it does not yet ship\n a way to grant a run's identity the credential a Kit needs, so a Kit\n requiring one is refused at launch until a later release adds it.\n- `task dev` now starts the State Store and waits for it before the rest of\n the stack.\n- Every service binary the installer builds is stamped with its version.\n\n### archie-agent\n\n- Carries the same task-lifecycle fixes as archied above (no-change runs,\n parking on an early container exit, and the abandon/forge-issue fix), plus\n the Kit v3 harness runner: a stage can now drive an external CLI\n headlessly, read output from Claude Code, Codex, Pi, OMP or GitHub Copilot\n CLI, and serve it capture tools over MCP.\n- Claude's cached tokens are counted as prompt tokens, matching the built-in\n agent loop's accounting."
|
||||
},
|
||||
{
|
||||
"version": "1.41.2",
|
||||
"date": "2026-09-25",
|
||||
"body": "### archied\n\n- **`/update` no longer offers an old runtime.** The runtime has shipped under\n the release version since the version streams merged, but the update check\n still read the retired runtime tags, so a current host was offered runtime\n 1.35.0 as an update. Do not approve that offer on 1.41.1; update to 1.41.2\n instead.\n- **`/version` reports the runtime version.** Binaries from the release zip\n showed `Runtime: dev`."
|
||||
},
|
||||
{
|
||||
"version": "1.41.1",
|
||||
"date": "2026-09-25",
|
||||
"body": "### archied\n\n- **First published build of 1.41.0.** The 1.41.0 tag produced no release\n artifacts; 1.41.1 carries everything listed under 1.41.0 below, including\n the PostgreSQL 18 requirement and the removed config keys."
|
||||
},
|
||||
{
|
||||
"version": "1.41.0",
|
||||
"date": "2026-09-25",
|
||||
"body": "### archied\n\n- **Archie now stores everything in PostgreSQL 18, and `database_url` is\n required.** Tasks, events, captures, bindings, settings and chat\n conversations are served from the database `database_url` names; the State\n Store, archied and the Gateway refuse to start without it, and refuse a\n server older than PostgreSQL 18. `docker compose up -d postgres` starts a\n matching local database with the default URL in `config.example.toml`.\n- **Existing SQLite data is not carried over.** This release reads no SQLite\n file and ships no importer, so an upgraded install starts with empty task,\n event and conversation history. `db_path` is gone; `state_dir` (default\n `~/.local/share/archie`) now holds the embedded NATS store and task logs.\n- **Backups are whole-database snapshots.** `archie-state-store backup` and\n `restore` work on the PostgreSQL database through `pg_dump`/`pg_restore`,\n which must be on `PATH`. There is no automatic schema rollback: the way back\n from an upgrade is restoring the snapshot taken before it.\n- **Events carry a type, and bindings pick one.** Archie infers an event type\n from captured payloads; the Inspector shows proposed and unidentified\n events and lets you name them. Mappings are per event type and show how\n many captures they match, a source can feed several bindings, and a binding\n chooses an event type plus an optional filter. An unidentified event does\n not dispatch.\n- **Sources own webhook signing.** Each source gets a UUIDv7 path and its own\n signing secret, or can be explicitly approved to accept unsigned events. A\n new binding starts pending approval.\n- **EDA playbooks can run module actions and take workflow inputs.** Action\n playbooks run at most once per event through the dispatch ledger, a binding\n can pass inputs to its workflow, the repository is optional, and a workflow\n can name an agent profile. `archie-playbooks lint -eda-dir` checks a\n directory, and `archie-playbooks serve` publishes the same findings to your\n editor as a language server.\n- **Config keys removed.** `[agent]`, `[oidc]`, `[image]`,\n `containers.enabled`, `db_path`, and the `token_env` form of `[forge]`,\n `[artifacts]` and `[chat.telegram]` no longer exist. Write each credential as\n `token = { engine = \"env\", key = \"NAME\" }`. A leftover key is reported at\n startup as unrecognised rather than failing the load.\n- **Dashboard.** Old `#/path` links and the `/captures`, `/mappings` and\n `/bindings` addresses no longer redirect; use the Events page tabs. The live\n stream moved to `/api/stream`, so reloading `/events` serves the page.\n\n### archie-agent\n\n- The Postgres-backed wire formats, event types and workflow inputs are part\n of this image; a host that runs the agent should `docker compose pull agent`\n to pick it up."
|
||||
},
|
||||
{
|
||||
"version": "1.40.0",
|
||||
"date": "2026-09-23",
|
||||
"body": "### archied\n\n- **Every park now says what kind of intervention it needs.** A parked task\n is classified as `needs you` (a decision or fix only an operator can\n supply), `transient` (an environment problem -- container pool, storage,\n transport -- retry once it is fixed), or `terminal` (the repository or\n identity cannot act; retrying cannot succeed). The class shows beside the\n Parked badge on the dashboard, so \"needs you\" reads as a request rather\n than a failure.\n- **Operator retries and review-remediation rounds now have separate\n budgets.** An operator's manual retries no longer draw down the rounds\n Archie may spend addressing review feedback on its pull requests, and a\n round-cap park no longer makes a later retry re-park immediately.\n- **`latest` now names the newest release. A push to `main` that is not a\n release publishes `edge` and `sha-<commit>` instead. A host that was\n following `main` by pulling `latest` stops advancing at this release --\n switch it to `edge` to keep tracking `main`, or leave it on `latest` to\n follow releases.**\n\n### archie-agent\n\n- The park-classification wire format is part of this image; a host that\n runs the agent should `docker compose pull agent` to pick it up."
|
||||
},
|
||||
{
|
||||
"version": "1.39.0",
|
||||
"date": "2026-09-23",
|
||||
"body": "### archied\n\n- **Archie now acts on review comments left on its own pull requests.** A\n requested-changes review (or a standalone comment) on a PR Archie opened\n dispatches a remediation run: the smallest change that satisfies the\n feedback, committed to the same PR branch and answered in the review\n thread. Approved reviews never remediate, each reaction is its own round,\n and the exchange is bounded by the repo's `max_retries` before Archie stops\n and says so on the PR.\n- **The task run page is a master-detail view.** The run's stage rail and\n detail panels sit beside the run list, so one run's timeline is visible\n without leaving the page.\n- **Live activity groups related updates instead of stacking them by event\n kind**, so a burst of progress on one task reads as one story, and the\n stage filter resets when you switch attempts.\n- Contrast fixes on the info and subtle text tokens clear WCAG AA.\n\n### archie-agent\n\n- The review-reaction remediation path is part of this image; a host that\n runs the agent should `docker compose pull agent` to pick it up."
|
||||
},
|
||||
{
|
||||
"version": "1.38.0",
|
||||
"date": "2026-09-23",
|
||||
"body": "### archied — Event capture, mappings and bindings are PocketBase records\n\n- **Captured events, field mappings and playbook bindings live in PocketBase\n collections instead of SQLite tables.** They are ordinary records, which is\n what lets a binding be changed at runtime rather than by editing a database.\n- **A read-only operator surface over the task database ships with the State\n Store** (`archie-state-store -admin-addr`). It serves view collections over\n tasks, transitions, events, identities and resources, and refuses\n `/api/backups` and `POST /api/sql`, so it cannot rewrite state or hand out the\n database file.\n- **A binding cannot go live without approval.** It moves draft → pending\n approval → armed; one binding per source is enforced on insert, on edit and\n on approval; and an edit always returns it to pending approval. A secret left\n blank on an edit keeps the stored one rather than disarming a live binding.\n- **The workspace code-search indexer is gone.** No deployment configured it,\n and it was one more resident writer over the workspace.\n\n### archied — Editing a binding or a mapping shows on the activity stream\n\n- **A dashboard edit no longer needs a manual refresh.** A successful binding or\n mapping write announces itself on the same activity path a captured event\n already uses. The announcement carries the record id and the action and the\n dashboard refetches the record, so the signal cannot go stale.\n\n### archied — Cron schedules fire\n\n- **A cron job computes its next run and fires.** Until this release a cron\n schedule was accepted at creation and then refused at run time with\n `ErrScheduleUnsupported`, so a cron job never ran.\n- **The dialect is PocketBase's, and it differs from Vixie cron on one point.**\n Day-of-month and day-of-week are combined with AND rather than Vixie's OR, so\n `0 0 1 * 1` means Monday the 1st, not \"the 1st, or any Monday\". The\n `@daily`-style macros behave as usual. An expression that can never match,\n such as `0 0 30 2 *`, is rejected instead of being left to run forever.\n\n### archied — Tool calls are queryable\n\n- **Every completed tool call is a row in the `tool_calls` collection**, not\n only a line in the on-disk task log. The row carries the task, the attempt,\n the tool, its result or its error, and when it ran.\n- **A failed projection never fails the task.** The event is the record and the\n collection is a transcript of it, so a copy that could not be written is\n logged and counted rather than propagated.\n\n### archied — A task whose identity no longer resolves parks instead of acting as root\n\n- **A task naming an identity archie no longer knows — renamed, retired or\n removed in the control plane — no longer falls back to the root forge's\n credential.** It parks with the reason recorded. A task arriving over NATS\n with such an identity is refused before it is enqueued. A task with no\n identity is the single-identity root path and is unchanged.\n\n### archied — The PR review is published as a readable artifact\n\n- **A completed review is rendered to markdown and published to the\n collaborative editor**, so a person reads it and comments on it instead of\n reading a wall of text in a pull-request comment.\n- **Publishing never fails the review.** With `[artifacts] base_url` unset the\n sender is not constructed and publishing is a log line; a publish that fails\n is logged with its status and the same review is republished the next time it\n completes. Set `[artifacts] token` (or `WORKSPACE_INGEST_TOKEN`) to enable it.\n\n### archied — The activity feed no longer depends on row ids being monotonic\n\n- **The feed's resume cursor is opaque, and a malformed or pre-upgrade cursor\n degrades to \"from the beginning\" rather than failing the stream.** One\n consequence on upgrade: a browser holding a cursor issued before this release\n replays the backlog once.\n\n### archie-agent\n\n- **The runtime image is rebuilt by this release, and a host must pull it**\n (`docker compose pull agent`). The shared State Store contract changed shape\n in the sections above — task and event-capture id fields are strings now — and\n the two halves are versioned together, so an agent image built before this\n release does not speak to the new State Store. There are no agent behaviour\n changes of its own in this release."
|
||||
},
|
||||
{
|
||||
"version": "1.37.1",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — A recorded event names the actor in its own fields\n\n- **Event attribution survives the trip to the State Store.** The acting\n identity, its kind, and the authorising principal are carried on the event\n itself, so an audit query finds the actor in its own fields rather than only in\n the event's prose. An approval taken through the dashboard is the case that\n exposed the gap.\n\n### archied — A chat reply that contains code renders the way it was written\n\n- **A code fence closes only on a run of the same character that is at least as\n long as the one that opened it.** A four-backtick fence, a tilde fence, or a\n reply that wraps its own code in a longer fence now arrives as code instead of\n as a broken language tag or paragraphs of leaked text.\n\n### archied — A tool call is one line with its own icon\n\n- **A tool call takes a single line instead of a label plus a fenced block.**\n Telegram draws a fenced block as a full code widget — language header, copy\n button and panel — and the block parser inserts a spacer before it, so a\n handful of calls filled the screen to show a few word counts. Each call now\n shows the icon its own tool declares, and a tool that declares none renders\n without one.\n- **The status word prints only when the outcome is not success.** Every tool\n line previously read \"done\", including the ones that had not finished.\n\n### archied — Runtime dependencies updated\n\n- **Runtime dependencies updated**, including the OpenID Connect and OAuth\n libraries."
|
||||
},
|
||||
{
|
||||
"version": "1.37.0",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — A request is attributed to the identity that made it\n\n- **A browser can sign in, and an action taken through it records the person.** The dashboard validates a\n provider-issued token, resolves it to an identity, and attaches it to the request; the task-action record\n then names the actor. `Authenticate` and the sign-in callback share one resolver, so a browser sign-in\n cannot be accepted on terms a presented token would be refused on.\n- **archie issues no session.** The callback stores the provider's own token in an HttpOnly cookie and every\n later request re-verifies it, so nothing archie holds can outlive the provider's decision and there is no\n session table to expire, revoke or get wrong.\n- **The event kind describes the actor.** A person's approval records `human_approved` as that person; an\n agent's records `agent_approved`; an action with no authorising principal records `task_approved` with the\n attribution fields **empty**. Nothing is credited to an identity that did not act, and an unattributed\n action is recorded as unattributed rather than guessed.\n- The acting identity is derived from the presented credential and **never** from a request field: a body\n carrying `actor`, `actor_id`, `identity` and an `X-Archie-Actor` header still cannot choose it.\n\n### archied — A host install now works, and an update refuses a host it cannot keep consistent\n\n- `install.sh` writes and enables **all five** host units; previously it seeded only `archied.service`, so a\n fresh host ran one service of five and an operator applied the rest by hand from a runbook. The runbook is\n a description again: it names the units and points at `systemctl --user cat`.\n- **Every host binary reports its version**, and the updater reads all of them **before it can report\n \"nothing to install\"**. A host whose binaries disagree is refused, naming each one: a newer messaging\n binary beside an older state store crash-loops against a service the older store does not serve, and that\n install previously looked healthy from the updater's point of view.\n- The packaged, installer and updater command lists are pinned by a test, so a service added to one and not\n the others fails the gate instead of shipping a partial install.\n\n### archied — A release image can be traced to a commit\n\n- The publish step derives the commit by **dereferencing the ref** rather than reading `github.sha`, because\n every release tag in this repository is annotated and a tag's object id is not a commit. An immutable\n `sha-<commit>` tag is published alongside `:latest`, and a build with no release tag is stamped\n `dev+<short sha>` rather than a bare `dev` that identified nothing.\n\n### archied — Curator definitions are data, not a second registry\n\n- Curator definitions may come from configuration or code and run through **one** engine into the existing\n registry — no parallel authority and no second config reader. A definition declares its tools, and an\n unknown tool name fails rather than widening the set silently."
|
||||
},
|
||||
{
|
||||
"version": "1.36.0",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — The dashboard declares tools an in-browser agent can call\n\n- The dashboard registers **seven WebMCP tools**. Read-only: `list_tasks`, `get_task`,\n `recent_events`, `daemon_health`. Recovery: `retry_task`, `stop_task`, `cancel_task`. An agent\n operating the dashboard now reads structured state and recovers stuck work instead of scraping the\n UI.\n- Every tool wraps the same `ui/src/lib/api.ts` client the dashboard itself calls, so an agent and a\n person exercise one path rather than two.\n- `archie-ui` cannot be attributed to the agent that called it: a page can invoke its own tools, so an\n agent's call and a page script's call reach the server identically. Tools therefore record the\n signed-in identity and a source, and **never** that an agent acted.\n\n### archied — Binaries built by the development build task can be updated\n\n- `task build` passed the `installtype` stamp for three of six commands, so `archie-messaging`,\n `archie-state-store` and `archie-ui` were built without it. An unstamped binary reports `unknown`\n and the self-update path **refuses rather than guesses**, which is how an operator ends up unable to\n update with `install type is unknown` and no way forward. All six are stamped now, and a test reads\n the build task and fails naming any command line that omits it."
|
||||
},
|
||||
{
|
||||
"version": "1.35.0",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — The Messaging Service is severed from the store and workflow runtime\n\n- `cmd/archie-messaging` no longer links `modernc.org/sqlite`, `internal/store`,\n `internal/domain/workflow` or `internal/agentexec`. All four arrived through a single import of\n `internal/app/controlplane`; the client half now lives in\n `internal/infrastructure/controlplanerpc`, and the app package keeps the server, the registry, the\n seeds, the validators and the schema derivation.\n- The resource documents are type-aliased back into the app package, so there is one definition read\n under two names rather than a copy per side.\n\n### archied — Channel lifecycle reaches the dashboard\n\n- The Messaging Service reports each channel's state, recorded **per channel**: one channel's failure\n marks only itself, a channel that cannot start is marked failed **with its reason** rather than only\n logged, and one that returns is marked stopped. `internal/channels/status.Manager` reports each channel's state.\n- `PutChannelStatus`/`ListChannelStatus` carry that to the dashboard, following the config-snapshot\n split. The store **replaces the reported set**, so a channel the reporter stops mentioning is\n deleted rather than left as a stale `running`; an empty report clears the table, because hosting no\n channels is a fact worth reporting; and an id-less row is refused, since it could never be replaced\n or removed by a later report.\n- `Service.ReloadChannel` routes to the channel's own seam and refuses a channel that cannot reload\n with a reason rather than accepting and ignoring it. `ReloadSupported` was previously declared **by\n name**, so a channel could advertise reload with nothing behind it; one function now decides both.\n\n### archied — Action playbooks: a second playbook shape, with typed results\n\n- A playbook is now one of two shapes: a **workflow playbook** (exactly one `workflow` action,\n unchanged) or an **action playbook** (one or more `module` actions in order). A playbook does not\n mix them.\n- `args` and `when` share one compilation path and one evaluation context, and `actions.<id>` is typed\n by the kind that action runs, so a misspelled result field, an unknown id, a map index, `in`, a\n comprehension, or a shape-foreign key (`kind` on a `workflow` action, `workflow` on a `module`\n action) is a **load failure** rather than a dispatch failure.\n- **Action playbooks load but do not run yet.** Routing arrives with the first side-effecting\n position; the daemon warns at load rather than accepting them silently.\n- The CEL environment is built per playbook, because result typing depends on the ids a playbook\n declares.\n- `ModuleRegistry.DecodeResult` turns a kind's flat map result into its typed `Result` before a later\n expression reads it. Without it a typed read evaluated against a shape the run never produces, and\n so silently read null.\n\n### archie-agent\n\nThe sandboxed runtime links the same shared packages as archied, so this release carries the\nchannel-lifecycle store contract and the stricter action-load errors with it:\n\n- The channel-status store contract (`PutChannelStatus`/`ListChannelStatus`) and its replace-the-set\n semantics.\n- Authoritative module ids and stricter action load errors: a misspelled result field, an unknown id,\n or a dynamic `actions` read now fails the playbook load rather than the dispatch.\n\narchied and archie-agent move together in this release."
|
||||
},
|
||||
{
|
||||
"version": "1.34.0",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — Dashboard: an actionable authentication failure state\n\n- An unauthenticated **document** request now receives a self-contained HTML page with a\n paste-the-token form, instead of plain text. Previously the whole dashboard -- `index.html`, the\n bundle and every asset -- sat behind the token check, so a bookmarked bare URL returned a\n `text/plain` \"unauthorised: open the dashboard URL archied logged at startup\", the SPA never ran,\n and none of the dashboard's existing failure surfaces were reachable at all.\n- The response is still **401**, with `Cache-Control: no-store` and a CSP. It is deliberately not a\n 200: a login page served as success would be cacheable, would read as healthy to anything that\n checks status alone, and a shared cache could hand it to the wrong person.\n- API and stream callers are unaffected. `application/json`, `*/*` and `text/event-stream` requests\n keep the plain-text 401, with a test pinning that split so an XHR or an `EventSource` reconnect can\n never start receiving a page.\n- The auth banner gains a **Retry** action that re-runs the dashboard's bootstrap reads, so a\n recovered session is actionable without a browser-level reload. It deliberately does not re-drive\n the SSE stream, which already reports its own reconnect state.\n- The page's guidance stays generic: it points at the dashboard URL the daemon logs rather than\n naming where the token is stored, so the HTTP layer is not coupled to the token file's location."
|
||||
},
|
||||
{
|
||||
"version": "1.33.0",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — EDA: playbook action arguments are compiled at load (J2)\n\n- A playbook action may now declare `args`, compiled as CEL expressions when the playbook loads.\n `args` and `when` share one compilation path and one evaluation context, so an expression written\n for one works in the other.\n- **Behaviour change:** an `args` expression that does not compile is a **load failure**, not a\n runtime miss — the same reject-at-load rule already applied to a binding collision and to an\n unknown `actions.<id>`. In practice, a daemon loading a playbook with a malformed `args` block\n fails at startup rather than part-way through a dispatch.\n- Compiling several arguments now reports the **first** bad key deterministically (keys are sorted).\n Previously it ranged a map, so the reported bad key could differ between runs and the failure was\n not reproducible.\n- `args` is deliberately **inert** for now: parsed, compiled and stored, but no shipped position\n consumes it yet. A consumer arrives with the first side-effecting position.\n\n**Not yet decided:** how an `args` evaluation failure behaves at dispatch. The `when` predicate rule\n(error, skip, log) does not obviously transfer, because `args` is data rather than a predicate, and\nsilently skipping an action whose arguments failed to evaluate would be a silent failure of exactly\nthe kind this release train has been removing. It currently propagates the error to the caller, and\nthat asymmetry is documented at the code. Ratifying it against a real consumer is tracked separately."
|
||||
},
|
||||
{
|
||||
"version": "1.32.1",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — Host packaging: `archie-messaging` now ships and updates\n\n- `cmd/archie-messaging` is included in the distribution zip, and `scripts/archie-update-install`\n installs and restarts it.\n- **Why this mattered.** v1.30.0 moved Telegram, email and webhook out of `archied` and into\n `archie-messaging`, but nothing packaged the new binary. A host install that upgraded across\n v1.30.0 therefore ran on with **no messaging process at all**: `archied` logged that it stopped\n serving the telegram gateway, nothing replaced it, and Telegram stayed dead — with no error\n logged anywhere, because nothing was failing. The process simply did not exist.\n- The host component set was enumerated in four places — the zip's build loop, the zip's copy list,\n the installer's service list, and the installer's binary list — and `archie-messaging` was missing\n from all four. The duplication was the defect: a single test now derives the host-run commands\n from `cmd/` and asserts that all four lists agree with it, so adding or extracting a process fails\n until it is packaged.\n- `deployments/systemd-user-service.md` gains the messaging unit. That is load-bearing rather than\n cosmetic: the updater refuses an update when a service unit is missing and tells the operator to\n create one from that document, which previously had nothing to offer.\n\n**Upgrade note:** a host that reached v1.30.0 without a messaging unit has been running with no\nTelegram, email or webhook. Updating to this release installs and starts `archie-messaging`."
|
||||
},
|
||||
{
|
||||
"version": "1.32.0",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — EDA: playbook action ids, and a dispatch idempotency ledger\n\n- **Action ids (J1).** Every action a later action references must now carry an `id`. Ids are\n validated at load -- unique and stable-identifier-shaped -- and a `when`/`args` expression\n naming an unknown `actions.<id>` is a **load failure**, not a runtime miss, the same\n reject-at-load rule already applied to a binding collision.\n- **Reference classification is strict at load.** A map-index reference (`actions[expr]`), a\n non-literal index, and a reference to an unknown prior id are all rejected when the playbook\n loads; references are classified by identifier versus static access, and the when-compilation\n helper is shared between the load-time and runtime paths.\n- **Dispatch idempotency ledger.** A `playbook_dispatches` row records a dispatch against\n `(playbook_id, playbook_version, event_id, action_id)`, written with `INSERT OR IGNORE` and\n surfaced through the shared `store.ErrAlreadyDispatched` sentinel. Module, channel and forge\n action positions are therefore at-most-once, which is what unblocks the side-effecting\n positions that were previously rejected at load.\n- **The ledger is wired into production.** `stateStoreDeps` constructs `Deps.PlaybookDispatcher`,\n so the ledger RPCs no longer answer `Unavailable` in a running daemon. This defect was found\n by the pre-release review of this change rather than by its tests.\n\n**Behaviour change:** a playbook whose actions reference `actions.<id>` without declaring that\nid, declare a duplicate id, or index `actions` with a non-literal value now fails to load\ninstead of failing at dispatch time.\n\n### archie-agent\n\nThe sandboxed runtime links `storecontract` and `staterpc`, so it carries the dispatch-ledger\ncontract alongside archied:\n\n- The shared `store.ErrAlreadyDispatched` sentinel now describes both dedup ledgers --\n `binding_dispatches` per `(binding_id, capture_id)`, and `playbook_dispatches` per\n `(playbook_id, playbook_version, event_id, action_id)`. Each is an at-most-once guarantee.\n- `RecordPlaybookDispatch` is part of the store contract the runtime builds against.\n\narchied and archie-agent move together in this release."
|
||||
},
|
||||
{
|
||||
"version": "1.31.0",
|
||||
"date": "2026-09-22",
|
||||
"body": "### archied — Dashboard replaced: Preact -> Vue 3 + shadcn-vue\n\nThe dashboard is now a Vue 3 application built on shadcn-vue. This is the\nlarge piece of this release; it touches every page.\n\n- History routing, a grouped topbar built from components, the violet palette\n with self-hosted Geist, and a command palette with live tasks.\n- Chat is a FAB-opened panel that behaves like a chat window and scrolls its\n transcript with `MessageScroller`.\n- Task actions and dangerous approvals are deliberate; the task detail page is\n a single head strip with honest states; the run page settles its head around\n an attempts pager, which is hidden for zero or one attempt.\n- Appearance and System navigation were refined, with a four-column appearance\n grid on wide screens.\n- A copy pass removed redundant tails and restating descriptions, empty states\n derive their own titles, and a stuck log read surfaces as an error rather\n than eternal loading.\n- The capture pane is bound to the list it sits beside and reads beside it,\n not over it.\n\n### archied — Events is one page with three tabs\n\n- Inspector, Bindings and Mappings are now tabs of a single **Events** page.\n- The nav entry is always live, the tabs prune by capability, and the three old\n paths survive as bookmarks that redirect to their tab.\n- Tab selection lives in one module (`ui/src/events/tab-selection.ts`) that the\n page uses, rather than a copy of it.\n- `feat(tools)`: a capture-intake sender exists for exercising the Events\n surfaces.\n\n### archied — The channel travels with the message\n\n`SessionSource.Platform` -- the first component of the session natural key, and\nthe column `GetByChannel` filters on -- was a constant `\"web\"`, because one\nRouter serves every channel and named itself after its own. Two things followed:\nthe per-user identity policy was real code that no production call site reached\nwith a real channel name, and a curator pass's write to agent-user memory could\nnot be read back by the turn that wrote it, because that turn resolved no\n`UserID`.\n\n- The frontends now name the channel they carry (`telegram`, `email`,\n `webhook`, `web`), the channel rides the message, and the Gateway stamps the\n session from it -- falling back to its own name when a sender names none,\n which is what every existing row holds.\n- Identity resolution reads the platform off the inbound, so `carriesPersonIdentity`\n decides something in production: telegram and email resolve a person, the\n dashboard and a webhook resolve nothing, and an unknown platform fails closed.\n- **Behaviour change:** a chat whose active session came from `/new` or\n `/branch` re-resolves once, because session lookup now filters on the\n channel's real name. A chat without `/new` re-resolves onto the same\n deterministic id and heals silently.\n- Deliberately unchanged: `TurnRunnerConfig.Channel` still keys tool\n availability, so no channel gains or loses a tool in this release.\n\n### archied — Control plane: runtime administration, history, and derived schemas\n\n- The State Store's gRPC server now carries runtime administration, and each\n process reports which settings version it is running; the dashboard shows it.\n- Resource history is exposed so edits can be reviewed and rolled back, and\n resource schemas are derived from the documents they describe -- the document\n editor reads the derived schema (labels from `title`, `format: duration` ->\n `1m0s`, hints from `doc`), and the abandoned schema-driven card is deleted.\n- A live settings replacement is checked before it is switched to, the daemon's\n state surfaces are folded into one boot step, and a SIGHUP reload re-applies\n database-owned settings.\n- Forge intake settings that nothing reads are now rejected at load.\n\n### archied — Configuration: judged where it is owned\n\n- The runtime config overlay is deleted; database-owned settings are judged at\n the layer that owns them rather than on the file load path.\n- A file overlay no longer drops the fields it omits inside a map entry, and a\n kind with no stored value leaves the file's value in force.\n- The default config path is resolved in one place, and the channel document\n has its own shape.\n\n### archied — State Store: offline backup, restore, validate and rollback\n\n- New offline backup / restore / validate / rollback path.\n- `validate` runs boot's own gate; it no longer replaces the database, reads a\n kind the store does not hold as its seed, or touches the daemon's log.\n- The recovery control-plane server is built on the shared step vocabulary.\n\n### archied — Workflow: one step vocabulary and a `gate.diff-rules` replacement\n\n- The step vocabulary is owned by a family manager registered at each\n composition root, replacing `.archie/gate.go` with `gate.diff-rules`, which\n fails closed on a change it never read.\n- Workflow roots are pinned and the dead vocabulary is rLine truncated
|
||||
},
|
||||
{
|
||||
"version": "1.30.0",
|
||||
"date": "2026-09-20",
|
||||
"body": "### archied — Messaging Service extraction completed\n\nTelegram, email and webhook no longer run inside the daemon. They run in\n`archie-messaging` and reach the daemon through the Gateway's `ChatContract`\nover gRPC; the daemon builds no channel and no `gateway.Router` (#899).\n\n- The operator surface is re-wired in the extracted service: `/update` (built\n from its own `[chat.telegram]` commands), the update-report relay, the\n `show_tool_calls` projection, and `/restart`'s config reload, which\n re-resolves the token and allowlist from this service's own file and refuses\n a reload that resolves to an empty token.\n- `/version` is sourced from the Gateway through a new `ChatSnapshot.Version`\n field. `cmd/archie-messaging` deliberately takes no version ldflags, so it\n cannot report a partial upgrade as a matched one.\n- Channel configuration is validated at composition, so a configured-but-\n invalid front-end fails the service instead of being silently dropped.\n- The inbound rate limiter moves to the Gateway, which now owns the only\n Router and is therefore the one place a per-sender budget can apply to every\n channel's turns.\n\n`RunningVersions` and `ReleaseAnnouncements` are deliberately left unwired:\nboth need a component's real running version, and the only versions this\nprocess can obtain are another binary's stamps. See\n`docs/architecture/migration-decisions.md`.\n\n### archied — Configuration\n\n- `diff_cap_lines = 0` now switches the cap off, as the dashboard and the\n workflow step have always documented. It was a plain `int`, so the defaults\n pass could not tell an absent key from an explicit `0` and rewrote both to\n 400 -- the documented way to disable the cap was unreachable. **Behaviour\n change:** a config that set `0` was silently getting 400 and will now get no\n cap.\n- The same ambiguity was failing open per identity: `configForIdentity`\n assigned the identity's value unconditionally, so an identity that merely\n omitted `diff_cap_lines` overwrote the shared cap with the zero value and\n disabled the safety rail entirely. An identity now overrides only when it\n sets the key.\n- A diff-cap park no longer tells the operator to \"approve manually\". A parked\n task's actions are retry, abandon and reject, so there is no approve path out\n of diff-cap; it now names the two things that work.\n- `[health].dependency_timeout` makes the daemon's readiness probe timeout\n configurable, matching the extracted services.\n\n### archied — Chat rendering\n\n- `/status` and `/tasks` are line-oriented reports but separated lines with a\n plain newline, which is CommonMark's soft wrap: the Telegram renderer joined\n them into one run-on paragraph. The renderer implements CommonMark's hard\n line break and the reports use it. Ordinary prose still soft-wraps.\n- A park reason is capped to its first line in the `/tasks` list. It carries\n whatever the failing stage reported, which for a lint gate is a whole tool\n log; unbounded, one parked task pushed every other task out of the reply. The\n full reason is unchanged on the task, in `task_list` and on the dashboard.\n\n### archied — Review\n\n- Review findings are posted as line-anchored PR comments with suggested fixes,\n and a suggestion must be single-line -- GitHub applies a multi-line suggestion\n only up to its first line, silently corrupting the file (#891).\n- The remediate workflow handles PR review comments and requested changes.\n\n### archied — /status health surface\n\n`/status` reports the live broker connection and the last-known outcome of this\nprocess's chat-model calls, alongside the queue depth and runtime block (#892).\n\n- A provider error is flattened and capped, so a multiline or oversized error\n cannot break the one-line-per-fact layout.\n- Concurrent model calls no longer reorder: the completion time is taken before\n the lock, so the newer outcome wins rather than whichever goroutine stored\n last.\n- Curator model calls are recorded too. They bypass the chat path, so a daemon\n whose only recent model traffic was curator work reported \"no calls attempted\n yet\" while the provider was demonstrably reachable.\n- Title generation does not record health. It runs detached under its own\n bound and its error is swallowed, so a cosmetic timeout was overwriting the\n line with \"failed\".\n\n**Known limitation:** the container, poll and channel sections cannot render.\nThose facts live in the daemon, but the only Router lives in the Gateway\nprocess, which has no container pool and no poll loop. The command description\nsays what actually appears; restoring the rest needs a cross-process health\ncontract.\n\n### archied — Dashboard and containers\n\n- The served lifecycle vocabulary reaches an already-painted page, the page\n registry matches the routes, and the build verifies `ui/dist` is fresh\n instead of never looking at it (#890, #898).\n- The containLine truncated
|
||||
},
|
||||
{
|
||||
"version": "1.29.0",
|
||||
"date": "2026-09-19",
|
||||
"body": "### archied — Security\n\n- `google.golang.org/grpc` bumped past `v1.84.0` to patch\n [GO-2026-6443](https://pkg.go.dev/vuln/GO-2026-6443), a server panic via a\n missing `:authority`/`Host` header reachable through `archied`'s gRPC\n gateway server. No stable release carries the fix yet, so this pins the\n pre-release commit that does (`v1.85.0-dev.0.20260825072537-93e31b48545e`)\n until `grpc-go` cuts `v1.85.0`.\n\n### archied — Memory engine unification\n\nOne memory engine, addressed by four typed scopes (global, agent, user,\nagent-user), replaces the two disconnected stores that previously existed:\na chat-tool-written store nothing ever read back, and a curator-written store\nwith no scope model.\n\n- `internal/domain/memory` is a CRUD contract (`Create`/`Get`/`Query`/`List`/\n `Update`/`Forget`/`Revisions`) with retained revisions; updates supersede\n rather than overwrite, so a crash mid-write leaves a recoverable extra\n history entry, never a lost prior state (#886).\n- The chat turn reads its subject's scopes synchronously before the prompt is\n built, rendering recalled records into a `<memory>` block; a failing or\n panicking engine degrades to no memory block rather than failing the turn\n (#887).\n- The model writes memory through four id-addressed tools\n (`memory_create`/`update`/`delete`/`list`), scoped to the turn's own\n resolved identity -- the model chooses the scope kind, never the ids, so it\n has no path to write into another user's memory (#888).\n- The session curator now derives the agent-user scope from the session's own\n user-role messages, instead of keying facts by a session id that stops\n meaning anything once the session ends.\n- A channel with no resolvable user (dashboard, webhook) reads and writes only\n global and agent scope; a webhook's route path is never treated as a user\n identity.\n- Fixed a review finding on the read path: the per-scope record limit was\n being applied as one shared total across all scopes rather than per scope,\n and the rendered block's byte cap was checked before template escaping\n rather than after, letting the escaped block exceed it.\n\n### archied — Work intake\n\n- feat(workintake): define review reaction envelope\n- feat(workintake): authorize review reactions by owned PR\n\n### archied — Cleanup\n\n- Deleted the unwired plugin capability-host health surface\n (`Host.Health`/`Host.Manifests`/`ModuleStatus`) and the `Module.Health`\n chain it fed -- including the `mcp`/`builtin` tool-provider health\n implementations and their aggregation in `tools/provider.Registry` -- none\n of which had ever had a production caller (#882).\n\n### archie-agent\n\n- The sandboxed runtime picks up the review-reaction envelope and its\n owned-PR authorization, so an agent can only react to reviews on pull\n requests it opened itself.\n- `google.golang.org/grpc` bumped past `v1.84.0` to patch\n [GO-2026-6443](https://pkg.go.dev/vuln/GO-2026-6443) (shared dependency\n with `archied`; the pre-release commit is pinned pending a stable\n `v1.85.0`)."
|
||||
},
|
||||
{
|
||||
"version": "1.28.0",
|
||||
"date": "2026-09-19",
|
||||
"body": "### archied — Task detail and attempt attribution\n\n- New per-run task detail page, showing each attempt's own events, changes and\n configuration rather than a single merged view.\n- Events, changes and config are attributed to the attempt that produced them;\n `Event` carries `attempt` and `ReadTaskLogRequest` carries `stage`.\n- The task detail page remounts when the task id changes, so switching tasks\n does not leave the previous one's data on screen.\n\n### archied — Configuration\n\n- Services are keyed by name through a registry, so the State Store and Gateway\n listen addresses are configurable rather than fixed.\n- A partial overlay no longer clears the fields it omits — an overlay that set\n one key was wiping the rest.\n- The Services map is cloned on publish, so an overlay can no longer mutate the\n snapshot other readers are holding.\n- The service context is enforced at registration.\n\n### archied — Logging and park reasons\n\n- A parked run's reason is recorded in its own attempt log, in both the daemon\n and the workflow, so \"why did this park?\" is answerable from the task itself.\n- `TaskRegistry.Write` takes the caller's context.\n\n### archied — Worktrees and containers\n\n- Retries recover from path-type conflicts instead of failing opaquely, and the\n underlying cause is no longer masked.\n- The worktree is handed back on every sandbox exit.\n- A container's max-uptime reaper is cancelled on release, the cap stays active\n through the grace period, and teardown is claimed once rather than by\n cancelling a timer.\n\n### archied — Daemon and startup\n\n- Every identity's forge and repos are swept at startup, including the root\n forge.\n- A cancelled startup is no longer reported as an exhausted sweep budget; an\n exhausted budget names itself as the cause.\n\n### archied — Other\n\n- `grep` can use the workspace codesearch index.\n- Forge labels are matched when namespaced, so label-driven routing works for\n namespaced labels.\n- Triage is given criteria for choosing between workflows, and a workflow is\n required when a code change is needed.\n- The Telegram adapter restart callback is wired into the chat router.\n- The `ARCHIE_REACTIONS` fan-out stream is provisioned and bounded by age.\n- `archie-ui` exits cleanly when graceful shutdown overruns its deadline.\n- The dashboard's event pump retries priming until the State Store answers.\n- The update writer emits the agent version sidecar with a real newline.\n- The UI finishes its Preact port; the imperative DOM layer is deleted.\n- Collection fields decoded over the State Store gRPC contract are never nil\n slices, so an empty collection marshals as `[]` rather than `null`.\n\n### archie-agent\n\n- The sandboxed runtime picks up the attempt-attribution contract, so the events\n and changes an agent produces are recorded against the attempt that produced\n them.\n- `grep` can use the workspace codesearch index.\n- A worktree is handed back on every sandbox exit, and container teardown is\n claimed once — a released container's reaper is cancelled rather than\n re-firing during the grace period.\n- Retries recover from worktree path-type conflicts instead of failing\n opaquely.\n- A parked workflow run records its park reason in its own log.\n- Triage criteria distinguish the workflows, and a workflow is required when a\n code change is needed.\n- Namespaced forge labels match when routing by kind.\n- The `ARCHIE_REACTIONS` fan-out stream is provisioned.\n- Collection fields decoded over the State Store gRPC contract are never nil\n slices, so an empty collection marshals as `[]` rather than `null`."
|
||||
},
|
||||
{
|
||||
"version": "1.27.0",
|
||||
"date": "2026-09-17",
|
||||
"body": "### archied — Dashboard task logs\n\n- Task logs are readable from the dashboard again, through a new State Store\n read contract (`ReadTaskLog`, `StreamTaskLogContent`) rather than the UI\n process reaching into the daemon's log files. Wired server-side by the\n standalone state-store process.\n- Added `GET /api/tasks/{id}/logs/download`, serving an attempt's raw log as a\n `task-<id>-attempt-<n>.log` attachment.\n- A process that cannot read logs and an attempt that recorded no log are now\n distinguishable (\"cannot read\" answers 503, \"no log\" answers 404) instead of\n both rendering as a claim about a configuration setting.\n\n### archied — Telegram output\n\n- Tool results are summarised rather than quoted: a search reports how many\n matches came back, a truncated result reports the tool's own total. The\n renderer no longer states a count it computed from its own truncated sample.\n- Repeated successful tool calls collapse into one counted entry.\n- The tool-activity block is capped to a third of the live frame, keeps the\n newest lines, and marks what it dropped with a `+N earlier` indicator. Every\n line that fits is kept.\n- Every clamped answer marks its cut with an ellipsis, including the opening\n frame, which previously appeared to begin mid-sentence.\n- An error response from the log download no longer ships as a `.log` file.\n\n### archied — Readiness and shutdown\n\n- The disk probe reports per-filesystem results and checks the root filesystem\n as well as the work directory, so a full root is no longer invisible.\n- A path shared by several disk targets keeps the strictest requirement any\n target places on it, so an optional target can no longer mask a required one.\n- The shutdown-watchdog test no longer races the Go scheduler, which was\n intermittently failing the quality gate and parking work unrelated to it.\n\n### archied — Other\n\n- Messages persist the channel-native sender id.\n- go-telegram/bot bumped to v1.27.0, fixing a streaming bug where the multipart\n body could not be replayed and `sendMessage`/`editMessageText` failed until\n the connection dropped.\n\n### archie-agent\n\n- The per-task runtime picks up the new State Store task-log read contract, so\n the sandboxed agents share one log-reading path with the daemon and the\n dashboard."
|
||||
},
|
||||
{
|
||||
"version": "1.26.0",
|
||||
"date": "2026-09-17",
|
||||
"body": "### archied\n\n- fix(webui): publish per-identity forges so multi-identity task rows keep their links\n- feat(config): add [scheduling] config block\n- feat(configuration): translate [scheduling] into scheduling.EngineConfig\n- feat(cronevents): adapt the events bus to scheduling.Sink\n- fix(webui): count every chat front-end in the published projection\n- fix(scheduling): respect configuration ownership\n- feat(ratelimit): wire per-identity inbound rate limiting into the gateway\n- fix(tools): judge the rm guard by base name so absolute paths cannot bypass it\n- fix(store): keep an empty binding secret empty so a partial edit cannot erase it\n- fix(archied): stop advertising review_pr when no reviewer can run\n- fix(daemon): carry kind/label routing bindings to the process that routes\n- feat(configuration): add archied setup, the caller the first-run flow was built for\n- fix(configuration): stop letting a secret value be set from the command line\n- feat(configuration): let setup reference a secret without carrying its value\n- fix(archied): disable a provider whose credential is missing instead of refusing to boot\n- refactor(install): install.sh delegates config generation, and tests stop reading hand-written configs\n- fix(daemon): guard binding dispatch loop against nil dispatcher/creator\n- fix(webui): enforce CSRF/origin gate on binding and mapping mutations\n- fix(secret): recover a panicking secret engine instead of crashing\n- fix(config): deep-copy Image.Hosted/Image.Local in Config.Clone\n- fix(email): stop dropping the first paragraph of plain-text bodies\n- fix(logging): keep the live descriptor open across a failed rotation\n- feat(configuration): report config keys no decode target consumed\n- feat(archied): warn at boot when the config file has unrecognised keys\n- feat(archied): wire the scheduling ticker engine at boot\n- fix(agentworker): wire configured tool-result policy into worker's LoopRunner\n- refactor(staterpc): delete the superseded single-token auth interceptor\n- refactor(memory): delete the unreachable <memory> fence scrubber\n- fix(channels): delete unreachable Telegram webhook delivery mode\n- fix(gateway): delete unwired Router.Dangerous approval path\n- refactor(gateway): delete orphaned SessionState goal/steer/queue machinery\n- refactor(archied): delete the daemon's unused webui.Server and UI adapters\n- refactor(tools): delete unreachable dispatch/gating engine\n- feat(channels): wire chat.webhook route config through to the gateway\n- refactor(tools): delete unreachable AST-based tool discovery\n- refactor(tools): delete unused plugin-tool registration API from builtin.Registry\n- feat(channels): wire ConfigSchema/ValidateConfig into a startup validation loop\n- refactor(state): delete the dead IncrementRetryCount RPC (breaking change, accepted)\n- fix(curator): populate PassInput.Since with the prior pass time\n- fix(memory): install the threat scanner the composition root never wired\n- fix(staterpc): preserve marshal_error marker in eventDataJSON\n- fix(gate): validate finding level and share the blocking threshold\n- fix(scheduling): record a completed run so a recurring job stops re-firing every tick\n- fix(releaseupdate): don't treat empty available as deferred\n- fix(tools/provider/mcp): preserve MCP binary tool results for delivery\n- refactor(gateway): share sensitive-key markers with webhookguard\n- refactor(daemon): remove unreachable SQLite poll/drain path\n- refactor(tools/mcp): delete unreachable MCP adaptation path\n- fix(taskactions): resolve max_retries from the task's owning identity\n- fix(daemon): forward configured MCP servers to task agents\n- refactor(skill): delete dead Discover/DiscoverPlugins/Skill path\n- refactor(skillbuild): delete dead AugmentRegistry path\n- fix(builtin): bound read/edit filesystem work by DefaultToolTimeout\n- refactor(binding): delete dead Matcher.Overlaps method\n- refactor(forge): delete dead CreateIssue surface\n- fix(mcp): cancel in-flight SSE reconnect on Stop\n- fix(container): enforce MaxUptime lifetime cap with a timer\n- refactor(store): use taskstate status constants in SQL\n- fix(ui): unbreak binding approve and the two deletes, and centralise the client\n- fix(tools): stop testing on the text of other files, and ungate contractaudit\n- refactor(forge): delete the unwired RepliesAfter surface\n- refactor(config): delete the two decoded-but-unread policy fields\n\nThis release is dominated by dead-code removal and the completion of the\nscheduling capability. Roughly half the commits delete surfaces that no longer\nhad a caller: the unreachable SQLite poll/drain path, the unwired MCP\nadaptation path, the AST-based tool discovery, the superseded single-token auth\ninterceptor, and several dead forge and binding methods. The\n`IncrementRetryCount` State Store RPC is gone with them -- a breaking change to\nthe wire contract, accepted because nothing called it.\n\nThe cron/scheduling epic lands iLine truncated
|
||||
},
|
||||
{
|
||||
"version": "1.25.0",
|
||||
"date": "2026-09-15",
|
||||
"body": "### archied\n\n- fix(update): resolve releases without a checkout, and fail loudly when it cannot\n- fix(update): back up the task store the daemon actually uses, or refuse\n- fix(update): build each component from its own approved release tag\n\nComponents are independently versioned, so the newest `archied/v*` and\n`archie/v*` tags usually sit on different commits. The installer required both\ntags to resolve to one commit whenever both components changed, which refused\nevery update once the two newest releases diverged -- a deployment stuck on\n1.22.0 could not take any update. Each component now builds from its own\napproved tag.\n\n### archie-agent\n\n- chore: no user-facing changes; versioned so the 1.25.0 release tags both\n components at the same commit"
|
||||
},
|
||||
{
|
||||
"version": "1.24.0",
|
||||
"date": "2026-09-12",
|
||||
"body": "### archied\n\nMakes 1.23.0 deployable. That release split archied into separate processes,\nbut the self-updater still installed only the `archied` binary and restarted\nonly `archied.service`, so updating to it left the State Store, Gateway and UI\non the previous release. archied cannot boot without a reachable State Store,\nso the update failed its health check and rolled back. Update to this release\nrather than to 1.23.0.\n\nIf your host does not yet run the four units in\n`deployments/systemd-user-service.md`, create them first: the updater now\nrefuses, naming what is missing, instead of installing binaries onto a host it\nwould leave broken.\n\n- fix(update): install and cycle every process in the release\n- fix(telegram): stop the relay corrupting identifiers and code\n\nAlso in this release, though outside the version-stamped package closure:\n\n- ci(deploy): produce a complete distribution zip on every release. No zip was\n built for v1.23.0 at all, and the zip omitted `archie-ui`."
|
||||
},
|
||||
{
|
||||
"version": "1.23.0",
|
||||
"date": "2026-09-12",
|
||||
"body": "### archied\n\nArchied is no longer a single process. The State Store (`archie-state-store`)\nnow owns `archie.db` outright, the Gateway serves its contract over\nauthenticated gRPC, and the dashboard ships as a standalone UI Service\n(`archie-ui`). Upgrading is not a binary swap: these processes must be running\nand addressable before `archied` will start clean. See `deployments/` for the\nsupported profiles.\n\n### archied — Service decomposition\n\n- feat(contracts): add gateway service seams and protobuf toolchain\n- feat(gateway): extract ChatContract service\n- feat(gateway): delete in-process ChatContract path, make remote the only mode\n- feat(gateway): authenticate the gRPC contract and allow off-loopback listeners\n- fix(gateway): drop services.gateway.mode, remote is the only transport\n- feat(state-store): generalize storerpc as the State Store gRPC contract (#770)\n- feat(state-store): stand up archie-state-store binary and own archie.db (#771)\n- refactor(state-store): migrate capture/mapping/binding consumers to State Store (#772)\n- refactor(state-store): migrate workflow/intake/task lifecycle consumers to State Store (#773)\n- refactor(state-store): cut daemon/Gateway over to the remote State Store (#774)\n- fix(state-store): task-scope container credentials, stream large capture lists, validate Update\n- feat(archieui): standalone UI process over remote Gateway and State Store\n- refactor(archied): cut the dashboard over to the archie-ui process\n- refactor(ui): sever the archie-ui binary from every daemon runtime package\n- refactor(archied): move the update relay to the process that owns updates\n- refactor(archied): move webhook capture intake to the process that owns work intake\n- feat(archieui): mount the capture intake receiver over the State Store\n- refactor(workflow): relocate Task/Status/Source and define workflow.Store (#754)\n- refactor(store): move the producer-owned contracts to internal/contracts/store/v1\n- feat(messaging): migrate gateway session persistence onto domain types\n- feat(gateway): flip channel boundary onto messaging.Message\n\n### archied — Pull request review\n\n- feat(gateway): operator-triggered PR review with selectable reviewer model\n- feat(forge): pull request review read surface (ListReviews/ListReviewComments/ReplyToReview)\n- feat(workflow): surface adversarial review findings on the PR body\n- feat(workflow): review calibration, checked properties and style nits out of contract\n- fix(archied): share one PR reviewer across channels; harden forge and worktree\n- fix(workflow): order findings before footer; test the report stash\n\n### archied — Dashboard\n\n- feat(webui): render configuration from a published snapshot\n- feat(staterpc): carry the dashboard's configuration snapshot\n- refactor(webui): take configuration off the dashboard server\n- feat(webui): report which dashboard sections a process can serve\n- feat(webui): deliver live dashboard events by polling the State Store cursor\n- feat(webui): route dashboard task actions through the Gateway contract\n- feat(gateway): give the dashboard operator its own task-action contract\n- feat(webui): add /health and /health/detailed readiness endpoints (#717)\n- fix(webui): distinguish refused vs broken task actions, handle 401 (#753)\n\n### archied — Daemon, gateway and workflow\n\n- feat(archied): add shutdown watchdog that force-exits a hung graceful shutdown (#716)\n- feat(archied): serve the daemon's own health endpoint\n- feat(drain): honour external drain marker with instantiation epoch (#718)\n- feat(gateway): wire progressive tool disclosure (bridge tools)\n- feat(gateway): render workspace, managed repos and operator into chat env\n- feat(gateway): add session_transcript tool for full JSON export\n- feat(gateway): consolidate task actions and repair daemon default path\n- feat(eda): thread Playbook ID/Version and DispatchInput task identity\n- feat(worktree): Resume re-syncs a worktree onto its branch tip\n- fix(staterpc): attach the bearer token to State Store streams\n- fix(archieui): resolve service tokens from env, without requiring a config file\n- fix(archied): initialize conversation persistence on daemon startup\n- fix(archied): preserve channel turn ledger with remote gateway\n- fix(gateway): share NATS and session ownership\n- fix(update): probe the dashboard's real address after a self-update\n- fix(store): migrate binding owner and repo columns\n\n### archie-agent\n\nThe agent runtime now reaches task state through the State Store gRPC contract\n(`STATE_STORE_URL`/`STATE_STORE_TOKEN`, injected by the daemon) instead of the\nNATS `storerpc` transport, which is deleted. Credentials handed to a task\ncontainer are scoped to that task rather than being the daemon's own token.\nRunning a 1.23.0 daemon against an older agent image will not work; rebuild or\npull the `archie-agent` image with this release.\n\n- feat(state-store): generalize storerpc as the StateLine truncated
|
||||
},
|
||||
{
|
||||
"version": "1.22.0",
|
||||
"date": "2026-09-03",
|
||||
"body": "### archied\n\n- feat(telegram): support secret refs for bot tokens (#705)\n- fix(update): make daemon rollback schema-safe (#704)\n- fix(archied): preserve ephemeral gateway ports (#707)\n- fix(webui): bound log limit parsing and add endpoint regression coverage (#706)\n- fix(deps): upgrade x/crypto to v0.56.0 for security fixes (#708)"
|
||||
},
|
||||
{
|
||||
"version": "1.21.0",
|
||||
"date": "2026-09-03",
|
||||
"body": "### archied\n\n- feat(workflow): make kind-to-workflow routing YAML-overridable\n- feat(workflow): route arbitrary forge labels to workflows via playbook YAML\n- feat(workflow): load kind/label bindings from multiple playbook directories\n- fix(extract): regenerate stale Yaegi symbol tables; fix wfextract directive\n- feat(eda): Module position first slice -- registry + side-effect-free log kind\n- feat(eda): CEL expression environment (compile/validate at load, evaluate at dispatch)\n- feat(eda): playbook document + event coordinator, single-action workflow-kind dispatch\n- fix(skillcurator): document and scope the intentional nilerr in reviewOne\n- fix(binding): add Owner/Repo pin, fixing multi-repo dispatch\n- feat(webui): bindings dashboard UI; fix app-wide Preact render regression\n- fix(binding): split ValidateForUpdate so edits can preserve the secret\n- refactor(ui): extract Pill to ui/src/base/, closing archie-core-mlro\n- refactor(eda): extract helpers to satisfy cyclop/gocognit gates\n- fix(webui): stretch HEALTH row cards to equal height\n- fix(eda): make playbook key collision reporting deterministic\n- fix(gateway): split /status (health) and /tasks (work) apart\n\n### archie-agent\n\n- feat(workflow): make kind-to-workflow routing YAML-overridable\n- feat(workflow): route arbitrary forge labels to workflows via playbook YAML\n- feat(workflow): load kind/label bindings from multiple playbook directories\n- fix(extract): regenerate stale Yaegi symbol tables; fix wfextract directive\n- feat(eda): Module position first slice -- registry + side-effect-free log kind\n- feat(eda): playbook document + event coordinator, single-action workflow-kind dispatch\n- fix(binding): add Owner/Repo pin, fixing multi-repo dispatch\n- fix(binding): split ValidateForUpdate so edits can preserve the secret\n- refactor(eda): extract helpers to satisfy cyclop/gocognit gates\n- fix(eda): make playbook key collision reporting deterministic"
|
||||
},
|
||||
{
|
||||
"version": "1.20.0",
|
||||
"date": "2026-09-03",
|
||||
"body": "### archied\n\n- fix: baseline gate repair (go test ./... -count=1)\n- fix(logging): propagate bound slog attrs to wrapped handler in FeedHandler\n- feat(image): define provider-neutral image capability contract and config\n- fix(channels): call MarkRunning once a channel is actually up\n- fix(workflow): stop discarding baseline-fix commits as 'no changes'\n- fix(webui): wire the Logs page to per-task attempt-log detail\n- fix(workflow): net cache hits from token totals, trim gate-retry output\n- feat(workflow): dynamic triage instead of defaulting every task to implement\n- fix(gateway): stop SOUL from forging the prompt invariant tags\n- fix(curator): stop curator actions from serializing a zero timestamp\n- feat(webui): hand-author the configuration field descriptor catalog\n- feat(webui): attach the config field schema to GET /api/config\n- feat(webui): render scalar config sections generically from the schema\n- feat(webui): surface allow_concurrent/max_retries/review_enabled on the repositories card\n- feat(webui): inline editing for per-repo allow_concurrent/max_retries/review_enabled\n- feat(webui): playbook bindings -- matcher + mapping + workflow, HMAC-gated\n- fix: resolve golangci-lint funlen, nilerr, and empty branch issues\n- feat(store): encrypt playbook binding secrets at rest\n- feat(webhook): harden captured payload redaction\n- fix(store): satisfy makezero when building cipher payload\n- feat(webui): refactor chat module to Preact component and add unit tests\n\n### archie-agent\n\n- fix: baseline gate repair (go test ./... -count=1)\n- fix(logging): propagate bound slog attrs to wrapped handler in FeedHandler\n- feat(image): define provider-neutral image capability contract and config\n- fix(workflow): stop discarding baseline-fix commits as 'no changes'\n- fix(workflow): net cache hits from token totals, trim gate-retry output\n- feat(workflow): dynamic triage instead of defaulting every task to implement\n- feat(webui): playbook bindings -- matcher + mapping + workflow, HMAC-gated\n- feat(store): encrypt playbook binding secrets at rest\n- fix(store): satisfy makezero when building cipher payload"
|
||||
},
|
||||
{
|
||||
"version": "1.19.10",
|
||||
"date": "2026-09-02",
|
||||
"body": "### archied\n\n- feat(curator): session-memory curator reference implementation"
|
||||
},
|
||||
{
|
||||
"version": "1.19.9",
|
||||
"date": "2026-09-02",
|
||||
"body": "### archied\n\n- feat(memory): typed memory engine contract, registry, and registrar\n- feat(memory): builtin engine implementing the domain/memory contract\n- feat(config): config surface for memory engine selection\n- feat(daemon): wire the domain/memory engine registry at boot\n- feat(curator): bind curators to memory engines\n- fix(config): reject memory.provider instead of silently ignoring it\n- feat(curator): skill curator reference implementation\n\n### archie-agent\n\n- feat(config): config surface for memory engine selection"
|
||||
},
|
||||
{
|
||||
"version": "1.19.8",
|
||||
"date": "2026-09-02",
|
||||
"body": "### archied\n\n- fix(update): drop dev-facing wording from the unconfirmed-update message\n- fix(telegram): stop adjacent rich blocks from rendering glued together\n- fix(telegram): send undelivered-media fallback after finalize as its own message"
|
||||
},
|
||||
{
|
||||
"version": "1.19.7",
|
||||
"date": "2026-09-02",
|
||||
"body": "### archied\n\n- fix(logging): make Tail/Page allocation bound explicit for CodeQL\n\n### archie-agent\n\n- fix(logging): make Tail/Page allocation bound explicit for CodeQL"
|
||||
},
|
||||
{
|
||||
"version": "1.19.6",
|
||||
"date": "2026-09-02",
|
||||
"body": "### archied\n\n- fix(build): stamp gatewayVersion/runtimeVersion in the right package"
|
||||
},
|
||||
{
|
||||
"version": "1.19.5",
|
||||
"date": "2026-09-01",
|
||||
"body": "### archied\n\n- feat(webui): dashboard-aware chat — Archie sees the page, points you there\n- fix(telegram): drop retry_after bandaid, bump go-telegram/bot to v1.24.0\n- feat(curator): track and expose recent activity per curator\n- fix: go.mod bumped to 1.27.0 and stupid tests removed\n- refactor: remove unnecessary AI-generated scaffolding\n- refactor: go modernisation fixes\n- refactor: remove unused Operator param.\n- fix(gateway): fix broken system prompt template and scrub real telegram ID from tests\n- fix(plugin): add missing CLAUDE.md reference to plugin engine rule\n- fix(app): repoint archied wiring contract test at internal/app/archied\n- refactor(agentexec): use ai-sdk NewTypedTool for pluginToolSet and scriptToolSet\n- fix(config): standardize Provenance to pointer receivers (recvcheck)\n- refactor(lint): reduce cyclomatic/cognitive complexity in tools, workflow, webui\n- fix(app): repoint capability-host wiring contract test at internal/app/archied\n- refactor(lint): extract more helpers to clear nestif/gocyclo findings\n- refactor(lint): split AgentStage.Stage into resolveModel/buildRequest/handleResult\n- refactor(lint): split TurnRunner.Run and dispatchLocal further\n- refactor(lint): extract markdownBlockParser and list/quote helpers in richblocks.go\n- refactor(lint): extract Apply/findWalkVisitor helpers; go fix modernization\n- fix(lint): noctx fixes and dead-code cleanup\n- feat(workflow): adversarial self-review stage before PR open\n\n### archie-agent\n\n- feat(tasks): allow rejecting a task from any non-terminal state\n- feat(tasks): serve the lifecycle presentation catalog from /api/task-meta\n- fix: go.mod bumped to 1.27.0 and stupid tests removed\n- refactor: go modernisation fixes\n- refactor: remove unused Operator param.\n- fix(plugin): add missing CLAUDE.md reference to plugin engine rule\n- fix(app): repoint archied wiring contract test at internal/app/archied\n- refactor(agentexec): use ai-sdk NewTypedTool for pluginToolSet and scriptToolSet\n- refactor(lint): reduce cyclomatic/cognitive complexity in tools, workflow, webui\n- fix(app): repoint capability-host wiring contract test at internal/app/archied\n- refactor(lint): extract more helpers to clear nestif/gocyclo findings\n- refactor(lint): split AgentStage.Stage into resolveModel/buildRequest/handleResult\n- refactor(lint): extract Apply/findWalkVisitor helpers; go fix modernization\n- fix(lint): noctx fixes and dead-code cleanup\n- feat(workflow): adversarial self-review stage before PR open"
|
||||
},
|
||||
{
|
||||
"version": "1.19.4",
|
||||
"date": "2026-08-28",
|
||||
"body": "### archied\n\n- refactor(telegram): render replies as structured rich blocks"
|
||||
},
|
||||
{
|
||||
"version": "1.19.3",
|
||||
"date": "2026-08-28",
|
||||
"body": "### archied\n\n- feat(tasks): serve the lifecycle presentation catalog from /api/task-meta\n- feat(dashboard): render task actions, statuses and filters from the server catalog"
|
||||
},
|
||||
{
|
||||
"version": "1.19.2",
|
||||
"date": "2026-08-28",
|
||||
"body": "### archied\n\n- feat(tasks): allow rejecting a task from any non-terminal state"
|
||||
},
|
||||
{
|
||||
"version": "1.19.0",
|
||||
"date": "2026-08-28",
|
||||
"body": "### archied\n\n- feat(logging): cursor pagination and filtering for task_logs\n- build(deps): upgrade github.com/samcharles93/ai-sdk to v0.1.29"
|
||||
},
|
||||
{
|
||||
"version": "1.18.0",
|
||||
"date": "2026-08-28",
|
||||
"body": "### archied (released 2026-08-25)\n\n- Fix concurrent chat-turn claims so SQLite writer contention no longer leaks as `SQLITE_BUSY`.\n- Make task timelines operationally useful with stage outcomes, durations, retry context, and durable per-stage token economics.\n- Return canonical repository, issue, and pull-request URLs for each task's owning GitHub or Gitea identity.\n- Preserve per-identity commit attribution and real model context limits across daemon-to-worker dispatch.\n\n### archie-agent\n\n- feat(logging): cursor pagination and filtering for task_logs\n- build(deps): upgrade github.com/samcharles93/ai-sdk to v0.1.29"
|
||||
},
|
||||
{
|
||||
"version": "1.19.1",
|
||||
"date": "2026-08-27",
|
||||
"body": "### archied\n\n- fix(telegram): keep Markdown headings/lists as blocks and strip Markdown on plain fallback"
|
||||
},
|
||||
{
|
||||
"version": "1.17.1",
|
||||
"date": "2026-08-25",
|
||||
"body": "### archied\n\n- fix(update): remove source checkout dependency\n- fix(gateway): make UUIDv7 session references unambiguous"
|
||||
},
|
||||
{
|
||||
"version": "1.17.0",
|
||||
"date": "2026-08-25",
|
||||
"body": "### archied\n\n- fix(webui): add nil receiver guard to Server.trustForwardedHeaders\n- fix(chat): restore transcript and update replay\n\n### archie-agent\n\n- Compact task history against the selected model's real context capacity without imposing a token cap.\n- Preserve completed steps and billed usage when a later provider call fails; failed compaction now keeps the original history and continues.\n- Persist detailed agent-stage usage through the daemon-owned store before lossy live event fan-out.\n- Apply configured or forge-derived author and committer identity to sandboxed task commits."
|
||||
},
|
||||
{
|
||||
"version": "1.16.1",
|
||||
"date": "2026-08-25",
|
||||
"body": "### archie-agent\n\n- fix(agentworker): reconcile task clone ownership after commits"
|
||||
},
|
||||
{
|
||||
"version": "1.16.0",
|
||||
"date": "2026-08-25",
|
||||
"body": "### archied\n\n**The agent can hand you a file, and the dashboard works behind a reverse\nproxy.** Media delivery was fetch-by-URL only, so a file the agent produced\nlocally — a transcript, a log dump, a screenshot — was passed to Telegram as\na URL it could not fetch: the send did nothing and reported success. The new\n`send_file` tool plus upload-by-reader delivery closes that, and every layer\nthat cannot deliver now says so rather than staying silent. Dashboard\nmutations behind a TLS-terminating proxy were refused as cross-origin;\nforwarded headers are now honoured, but only under an explicit opt-in that is\noff by default.\n\n- feat(telegram): deliver a local file as an uploaded attachment, choosing\n upload-by-reader or fetch-by-URL per attachment; `send_file` resolves paths\n under the same confinement policy the read tool applies, so sending cannot\n reach what reading cannot\n- feat(gateway): `task_action` chat tool for operator task management —\n abandon, archive, retry, stop, cancel, approve and reject from chat, on the\n same action path and state machine as the dashboard\n- fix(webui): validate mutation `Origin` against the effective external\n scheme and host. `X-Forwarded-Proto`/`-Host` are honoured only when\n `web.trust_forwarded_headers` is set, which is off by default and safe only\n behind a proxy that overwrites or strips untrusted forwarded headers\n- fix(webui): report a local file the dashboard chat cannot upload as\n undelivered instead of dropping the event, which had reproduced the exact\n silent non-delivery `send_file` was built to end\n- fix(daemon): detach terminal state transitions and cleanup from a cancelled\n context, so a stopped task still records its outcome\n\n### archie-agent\n\n**Version realigned with `archied`.** This release jumps from 1.9.9 to 1.16.0\nto put the two components on matching numbers; there are no 1.10-1.15 agent\nreleases. It clears the accumulated runtime backlog in one cut rather than\nbundling it as a rider on a later change, so the list below spans several\nweeks of work rather than one session's.\n\nHighlights:\n\n- feat(nats): run an embedded server when no external NATS is configured, and\n expose the embedded broker to managed task workers\n- feat(deployment): default to managed NATS workers; the daemon requires a\n full-task worker handoff and the legacy in-process, subprocess and\n single-stage execution paths are gone\n- feat(forge): GitHub webhook receiver for immediate issue dispatch, with\n dedup regression proof; unbound webhook events are stored retention-bounded\n- feat(webui): payload field mapping -- bind JSON paths to named fields and\n preview before saving\n- feat(scheduling): ticker engine with configurable interval and pools\n- feat(storage): persist agent project state\n- feat(agent): stamp archie-agent's build and report it back to the daemon\n- feat(tools): `generate_video` via MiniMax, gated behind config, and\n `MultimodalResult.URLs` for remote-hosted media\n- feat(workflow): define the adversarial-review findings contract\n\nFixes:\n\n- fix(worktree): bind publication to dispatch grants; reset retries to a\n pristine base; reject diffs without a merge base; clean untracked files when\n `.git` is a gitdir file; post-push metadata resilience, cancellation and\n branch naming\n- fix(container): persist the npm cache for per-task MCP servers\n- fix(agentexec): recover omitted finish calls\n- fix(agentworker): move JSONL decode into storage, unblocking CI\n- fix(telegram): compact tool output and drop turn caps\n- fix(webui): give dashboard-initiated updates a phase-2 report; restore the\n provider gate and dashboard token accounting\n- refactor: remove dead `BasePlatformAdapter` code and legacy execution paths\n\nShared with archied 1.16.0 (these packages are in both closures):\n\n- feat(telegram): send local files as uploads, not fetchable URLs\n- fix(webui,sendfile): close three holes the adversarial review found\n- fix(webui): validate mutation Origin against the effective external scheme"
|
||||
},
|
||||
{
|
||||
"version": "1.15.0",
|
||||
"date": "2026-08-24",
|
||||
"body": "### archied\n\n**Autonomous workflows now have exactly one production execution path.** Every\ntask is handed complete to a scoped `archie-agent` container over core NATS;\n`archied` no longer runs an agent loop in-process. Embedded NATS is the\ndefault and generates a per-start token, binding to the resolved Docker bridge\nso managed workers can reach it; external NATS changes only broker placement.\nThe legacy `[agent]` section and `containers.enabled` still decode for\nmigration but can no longer select an execution path, and a reloaded\n`nats.url` is logged as requiring a restart. Operators upgrading from a\n`agent.mode = inprocess` configuration get the managed-worker topology\nautomatically; see `deployments/` for the supported profiles.\n\n- feat(nats): expose the embedded broker to managed task containers behind a\n generated per-start credential\n- fix(daemon): park before worktree access when the container pool or task\n transport is unavailable, rather than silently executing locally\n- refactor(agentexec): remove the in-process, subprocess and single-stage\n execution paths\n- fix(worktree): report a successful push as successful even when writing\n local upstream tracking metadata afterwards fails, so a published branch no\n longer parks the task as failed\n- fix(worktree): honour context cancellation in `CommitAll`, so a cancelled\n task can no longer stage or commit\n- fix(daemon): remove the worktree when a task completes with no changes,\n which previously leaked a full clone per no-change task; parked worktrees\n are still retained for post-mortems\n- fix(worktree): derive the branch prefix from the issue title before falling\n back to labels, matching the documented contract\n- fix(worktree): clean untracked files when `.git` is a gitdir file\n- fix(agentexec): recover agents that end a turn without the required finish\n call\n- feat(scheduling): ticker engine with a configurable interval and pools\n- fix(telegram): keep tool-call context when compacting tool output (#609)\n- feat(workflow): add the adversarial-review findings contract, where only a\n confirmed finding blocks and \"review found nothing\" is distinct from\n \"review did not run\" (contract only; no review stage runs yet)"
|
||||
},
|
||||
{
|
||||
"version": "1.14.0",
|
||||
"date": "2026-08-23",
|
||||
"body": "### archied\n\n- fix(telegram): compact tool output and drop turn caps\n- fix(update): install only approved components"
|
||||
},
|
||||
{
|
||||
"version": "1.13.0",
|
||||
"date": "2026-08-23",
|
||||
"body": "### archied\n\n- fix(telegram): render tool progress as bounded code blocks"
|
||||
},
|
||||
{
|
||||
"version": "1.12.0",
|
||||
"date": "2026-08-23",
|
||||
"body": "### archied\n\n- fix(webui): give dashboard-initiated updates a phase-2 report\n- feat(agent): stamp archie-agent's build and report it back to the daemon\n- feat(releaseupdate): enrich components with install type and reference\n- feat(webui): surface per-component update status on /api/version and Configuration"
|
||||
},
|
||||
{
|
||||
"version": "1.11.1",
|
||||
"date": "2026-08-23",
|
||||
"body": "### archied\n\n- fix(update): wire Telegram personas and survive callback cancellation\n- fix(webui): theme the Workflows 'Start work' form controls"
|
||||
},
|
||||
{
|
||||
"version": "1.11.0",
|
||||
"date": "2026-08-23",
|
||||
"body": "### archied\n\n- feat(forge): make webhook intake observable and deduplicate concurrent delivery\n- fix(telegram): preserve code fences across message splits\n- fix(gateway): replay completed-duplicate turns with their tool activity\n- feat(storage): persist agent project state across sessions\n- fix(container): persist npm cache for per-task MCP servers\n- fix(worktree): bind publication to dispatch grants, reset retries to a pristine base, and reject diffs without a merge base\n- feat(media): deliver generated media through Telegram with link fallback in the dashboard\n- feat(tools): generate videos through MiniMax, gated by provider configuration"
|
||||
},
|
||||
{
|
||||
"version": "1.10.0",
|
||||
"date": "2026-08-22",
|
||||
"body": "### archied\n\n- feat(forge): GitHub webhook receiver for immediate issue dispatch\n- feat(webhookguard): shared HMAC, rate-limit, and redaction mechanics\n- feat(nats): run an embedded server when no external NATS is configured\n- feat(capture): store unbound webhook events, retention-bounded\n- feat(webui): event inspector -- see captured payloads in the dashboard\n- feat(webui): payload field mapping -- bind JSON paths to named fields, preview before saving\n- fix(webui): stop the capture live-event notification duplicating payloads into the unbounded events table\n- fix(update): verify an update took effect instead of trusting the report (#530)\n- fix(daemon): refuse to poll on an empty label-trigger match (#529)\n- fix(gateway): stop persona from asserting unverified claims as fact (#528)\n- fix(gateway): stop ClaimTurn's insert-race branch losing its own retry read\n- fix: restore provider gate and dashboard token accounting\n- fix: address simple findings from a repo-wide golangci-lint sweep"
|
||||
},
|
||||
{
|
||||
"version": "1.9.11",
|
||||
"date": "2026-08-19",
|
||||
"body": "### archied\n\n- fix(mcp): persist npx package cache across daemon restarts"
|
||||
},
|
||||
{
|
||||
"version": "1.9.10",
|
||||
"date": "2026-08-19",
|
||||
"body": "### archied\n\n- feat(update): `/update` now streams live progress while an update installs, reports a clear version summary (previous/installed, daemon/agent) once the build succeeds, and automatically rolls back and reports the outcome if the restarted daemon fails its post-update health check"
|
||||
},
|
||||
{
|
||||
"version": "1.9.9",
|
||||
"date": "2026-08-18",
|
||||
"body": "### archied\n\n- fix(telegram): drain live renderer in concurrency test\n\n### archie-agent\n\n- chore: no user-facing changes"
|
||||
},
|
||||
{
|
||||
"version": "1.9.8",
|
||||
"date": "2026-08-17",
|
||||
"body": "### archied\n\n- chore: no user-facing changes\n\n### archie-agent\n\n- chore: no user-facing changes"
|
||||
},
|
||||
{
|
||||
"version": "1.9.7",
|
||||
"date": "2026-08-17",
|
||||
"body": "### archied\n\n- chore: no user-facing changes\n\n### archie-agent\n\n- chore: no user-facing changes"
|
||||
},
|
||||
{
|
||||
"version": "1.9.6",
|
||||
"date": "2026-08-16",
|
||||
"body": "### archied\n\n- fix(update): stamp install type and bound retry backoff\n\n### archie-agent\n\n- chore: no user-facing changes"
|
||||
},
|
||||
{
|
||||
"version": "1.9.5",
|
||||
"date": "2026-08-16",
|
||||
"body": "### archied\n\n- refactor(archied): decompose the daemon bootstrap into phased wiring (no behaviour change; splits the ~950-line run() into focused setup phases so complexity linting passes)\n- refactor(archied): extract the config overlay boot helper and thread context through chat gateway setup\n- refactor(tools): split the read executor and flatten nested config/tool fallback logic to lower complexity\n- fix(tools): avoid predeclared `max` names\n- fix(email): use context-aware test networking\n- fix(indexing): remove the unused code search test runner\n- fix(tests): use contexts and type assertions in overlay and gateway tests\n- docs(architecture): document the memory engine family\n\n### archie-agent\n\n- refactor: decompose the daemon bootstrap into phased wiring (no behaviour change; complexity-driven restructure)\n- refactor(tools): split the read executor and flatten nested config/tool fallback logic to lower complexity\n- fix(tools): avoid predeclared `max` names"
|
||||
},
|
||||
{
|
||||
"version": "1.9.4",
|
||||
"date": "2026-08-15",
|
||||
"body": "### archied\n\n- feat(gateway): polish /status command response format\n- fix(telegram): preserve URL boundaries in responses\n\n### archie-agent\n\n- chore: no user-facing changes"
|
||||
},
|
||||
{
|
||||
"version": "1.9.3",
|
||||
"date": "2026-08-15",
|
||||
"body": "### archied\n\n- fix(webui): scroll selected command into view on keyboard navigation\n- fix(logging): resolve error attrs to their message string, not {}\n- feat(agentexec,workflow): surface tool calls on the task timeline\n\n### archie-agent\n\n- fix(logging): resolve error attrs to their message string, not {}\n- fix(agentworker): back off before refetching a nak'd stage message\n- feat(agentexec,workflow): surface tool calls on the task timeline"
|
||||
},
|
||||
{
|
||||
"version": "1.9.2",
|
||||
"date": "2026-08-15",
|
||||
"body": "### archied\n\n- fix(worktree): force checkout so retry recovers from a dirty worktree\n\n### archie-agent\n\n- fix(worktree): force checkout so retry recovers from a dirty worktree"
|
||||
},
|
||||
{
|
||||
"version": "1.9.1",
|
||||
"date": "2026-08-15",
|
||||
"body": "### archied\n\n- fix(agentworker): forward workflow events across the NATS worker boundary\n- fix(webui): filter turn_completed noise from the Live Activity SSE feed\n- feat(releaseupdate): stamp install type at build time, fail closed on unknown\n\n### archie-agent\n\n- fix(agentworker): forward workflow events across the NATS worker boundary"
|
||||
},
|
||||
{
|
||||
"version": "1.9.0",
|
||||
"date": "2026-08-15",
|
||||
"body": "### archied\n\n- fix(webui): style tool-call failure from a structured field, not a string prefix\n- fix(config,webui): make show_tool_calls one cross-channel setting\n- fix(telegram): guarantee no message is stranded on gateway stop/restart\n- fix(telegram): use NewRequestWithContext to satisfy noctx\n- refactor(webui): decompose handleSSE to cut cognitive complexity\n\n### archie-agent\n\n- fix(agent): resolve git dubious-ownership in sandbox containers\n- feat(agent): mark the mounted worktree as a git safe directory\n- fix(agent): route git safe.directory setup through markWorktreeSafe\n- feat(chat): show tool calls inline and stream replies into one message\n- refactor(agent): move worker runtime into application layer\n- fix(config,webui): make show_tool_calls one cross-channel setting"
|
||||
},
|
||||
{
|
||||
"version": "1.8.0",
|
||||
"date": "2026-08-15",
|
||||
"body": "### archied\n\n- feat(archied): add -version so the installed build can be read from a shell\n- fix(webui): rebuild the Configuration page layout so values stop colliding\n- fix(webui): size Configuration key/value lists to their own content\n- fix(webui): keep Configuration rows full width, hug only the label column\n- fix(webui): cap and centre the Configuration page instead of its lists\n- fix(webui): preserve encoded redirect path characters\n- feat(chat): show tool calls inline and stream replies into one message\n- fix(chat): harden inline tool call streaming\n- refactor(agent): move worker runtime into application layer\n- fix(telegram): harden live-reply delivery against /stop and multi-byte content\n- fix(telegram): keep tool activity visible and mark failed/empty turns\n- fix(config): de-duplicate disabled-forge predicate, export ForgeDisabled"
|
||||
},
|
||||
{
|
||||
"version": "1.7.0",
|
||||
"date": "2026-08-10",
|
||||
"body": "### archied\n\n- fix(build): install ripgrep where grep.go actually needs it on PATH\n- fix(webui): Send button no longer passes its click event to sendMessage\n- feat(webui): Enter sends, Shift+Enter inserts a newline\n- fix(chat): stop showing raw 501 banner for unconfigured update-check\n- fix(chat): give chat page a real height budget instead of a floor\n- fix(workflow): carry gate output into the baseline park error\n- feat(logging): add a per-task log sink\n- feat(agentexec): publish agent-side logs to the task's system subject\n- feat(daemon): consume agent system logs into per-task sinks and the dashboard feed\n- feat(webui,gateway): add /api/tasks/{id}/logs endpoint and task_logs chat tool\n- refactor(gateway): persist conversations in sqlite\n- refactor(store): replace legacy persistence with SQLite\n- fix(webui): tighten configuration KV row spacing\n- fix(gateway): harden session recovery paths\n- refactor(daemon,webui): make Daemon.Cfg and webui.Server.Cfg reload-safe\n- feat(config): SIGHUP-triggered reload with requires-restart warnings\n- fix(config): share one config Holder between daemon and dashboard; re-apply model catalog on reload\n- fix(config): complete the reloadable allowlist and pin it against ForTask\n- feat(config): runtime config overlay store, PATCH /api/config, and the `--no-config-overlay` recovery flag\n- feat(webui): inline config editing on the Configuration page\n- feat(config): surface overlay state, shadowed keys, and per-row reset\n- fix(config): close review blocker on the PATCH path; deep-copy snapshots; atomics for shared state\n- fix(config): preserve nil slices in Clone to avoid spurious reload warnings"
|
||||
},
|
||||
{
|
||||
"version": "1.4.0",
|
||||
"date": "2026-08-10",
|
||||
"body": "### archied (released 2026-07-31)\n\n- fix(secrets): wire provider credentials through engines\n\n### archie-agent\n\n- feat(gateway): tool-approval gate, session tools for chat, and /delete command\n- feat(gateway): make chat turns durable and idempotent\n- feat(webui): lifecycle-safe task controls with atomic retry and archive\n- feat(logging,workflow): daemon log feed and executable workflow registry\n- fix(store,gateway): taskstate constants and mobile jump-to search\n- feat(webui,gateway): wire config, channel, log-feed, and work-intake seams\n- fix(build): install ripgrep where grep.go actually needs it on PATH\n- fix(workflow): carry gate output into the baseline park error\n- feat(logging): add a per-task log sink\n- feat(agentexec): publish agent-side logs to the task's system subject\n- feat(daemon): consume agent system logs into per-task sinks and the dashboard feed\n- feat(webui,gateway): add /api/tasks/{id}/logs endpoint and task_logs chat tool\n- refactor(store): replace legacy persistence with SQLite\n- refactor(daemon,webui): make Daemon.Cfg and webui.Server.Cfg reload-safe\n- feat(config): SIGHUP-triggered reload with requires-restart warnings\n- feat(config): surface overlay state, shadowed keys, and per-row reset\n- fix(config): close review blocker on the PATCH path; deep-copy snapshots; atomics for shared state\n- fix(config): preserve nil slices in Clone to avoid spurious reload warnings"
|
||||
},
|
||||
{
|
||||
"version": "1.6.0",
|
||||
"date": "2026-08-09",
|
||||
"body": "### archied\n\n- feat(gateway): tool-approval gate, session tools for chat, and /delete command\n- fix(webui): close open-redirect in dashboard token-exchange handler\n- feat(gateway): make chat turns durable and idempotent\n- feat(webui): lifecycle-safe task controls with atomic retry and archive\n- feat(config,channels): format-neutral config resolution and truthful channel state\n- feat(logging,workflow): daemon log feed and executable workflow registry\n- fix(store,gateway): taskstate constants and mobile jump-to search\n- feat(webui,gateway): wire config, channel, log-feed, and work-intake seams\n- fix(ui): hide inactive chat command menu"
|
||||
},
|
||||
{
|
||||
"version": "1.5.0",
|
||||
"date": "2026-08-08",
|
||||
"body": "### archied\n\n- feat(curator): engine family contract, registry, and runtime\n- feat(curator): trigger accounting — primary-input wake path\n- feat(setup): interactive setup steps with a TTY-gated prompter\n- feat(webui): rebuild the dashboard and add chat\n- feat(daemon): identity-scoped isolation plus gateway session titles and /delete\n- feat(logging): optional rotating log file\n- feat(configuration): export Validate for the setup flow\n- fix(gateway): durable message identity with a SQLite store\n- fix(gateway): consistent message ordering and paged search\n- fix(gateway): stop /compress destroying history it should have kept\n- fix(gateway): do not answer a redelivered message twice\n- fix(gateway): claim the session slot before writing it, not after\n- fix(gateway): keep /topic off from poisoning the session cache\n- fix(gateway): resolve the most recently active session, not an arbitrary one\n- fix(gateway): give branch-inherited messages their own identity\n- fix(gateway): make both backends agree on newest-first\n- fix(store): honour the transition guard in production persistence\n- fix(store): move ID counters away from the reserved metadata namespace\n- fix(store): surface task timestamps and tag the summary structs\n- fix(telegram): pause the update loop when rate limited\n- fix(memory): fail startup on an unusable memory directory\n- fix(tools): let an optional provider fail without taking the daemon down\n- fix(tools): report a cancelled find walk as an error, not empty results\n- fix(worktree): name the missing forge credential when a push fails\n- fix(tomlwrite): recognise table headers carrying a trailing comment\n- fix: close the duplicate-work loop and the dead paths around it\n- perf(tools): drop the embedded ripgrep binaries\n- refactor: one definition of what approving or declining a task means\n- refactor: move workflow into its own domain"
|
||||
},
|
||||
{
|
||||
"version": "1.3.0",
|
||||
"date": "2026-08-08",
|
||||
"body": "### archied (released 2026-07-31)\n\n- fix(memory): replace framework-specific names with generic equivalents\n- feat: unify provider and model selection\n\n### archie-agent\n\n- feat(curator): engine family contract, registry, and runtime\n- feat(curator): trigger accounting — primary-input wake path\n- feat(logging): optional rotating log file\n- feat(daemon): identity-scoped isolation\n- fix(secrets): wire provider credentials through engines\n- fix(store): surface task timestamps and tag the summary structs\n- fix(tools): let an optional provider fail without taking the daemon down\n- fix(tools): report a cancelled find walk as an error, not empty results\n- fix(worktree): name the missing forge credential when a push fails\n- fix: close the duplicate-work loop and the dead paths around it\n- perf(tools): drop the embedded ripgrep binaries\n- refactor: one definition of what approving or declining a task means\n- refactor: move workflow into its own domain"
|
||||
},
|
||||
{
|
||||
"version": "1.4.1",
|
||||
"date": "2026-07-31",
|
||||
"body": "### archied\n\n- fix(catalog): match SDK provider fallback"
|
||||
},
|
||||
{
|
||||
"version": "1.3.1",
|
||||
"date": "2026-07-31",
|
||||
"body": "### archied\n\n- fix(telegram): omit empty model picker markup"
|
||||
},
|
||||
{
|
||||
"version": "1.2.0",
|
||||
"date": "2026-07-31",
|
||||
"body": "### archied\n\n- feat: add MCP client capabilities to archied and archie-agent\n- fix: handleSummary ignores errors from WorkflowStats/StageStats/TokensByDay\n- feat: establish Archie identity and use stable callback tokens\n- refactor(telegram): keep one model selector command\n- fix: handleSSE silently swallows EventsSince backlog fetch errors\n- fix: Transition() ignores `from` status guard, allowing lost updates\n- fix: skillscript.Run ignores context, cannot be canceled/timed out\n- feat(telegram): report installed component versions\n- feat(telegram): add approved component updates\n- fix: LoadDir: no timeout around Yaegi Eval can hang daemon startup\n- feat(chat): real system prompt for Archie — identity, tools, env\n- feat(indexing): port tau's codesearch workspace index\n- fix(indexing): surface index config properly and stop silent degradation\n- refactor(worktree): replace git shell-out with go-git v6\n- fix(worktreerpc): bound handler contexts and drop the git binary from tests\n- refactor(nats): rebuild as infrastructure/eventbus/nats with real boundaries\n- refactor: route tasks on a typed kind, not forge labels\n- fix(natsrpc): make RegisterAll wait for the server to see subscriptions\n- refactor(config): move loading into infrastructure/configuration\n- fix(telegram): publish all executable session commands in menu and help\n- fix(telegram): publish the restored gateway commands\n- refactor: add internal/eventbus as the broker-neutral messaging contract\n- fix(chat): operator name from config, session wiring, prompt rules\n- feat(tools): lift tau's file and shell tools into the tool registry\n- feat: make /stop cancel the running chat turn\n- fix: kill the whole process group when a shell command is cancelled\n- feat: refuse unrecoverable shell commands\n- feat: make /stop reach running agent tasks\n- fix(chat): temper prompt brevity rules with warmth\n- fix: use errors.Is/As for context errors and cleanup\n- fix(grep): distinguish ripgrep exit 1 from a failed search\n- fix(archied): disable the forge on a missing credential, not the daemon\n- fix: restore /model parsing and close the 6d4e0be autofix audit\n- feat: embed config.example.toml and add comment-preserving TOML writer\n- fix(docker): install unzip and Node 24 so MCP servers can start\n- fix(docker): slim both images and repair unreachable Go tooling\n- fix(container): write the task boot brief under .git\n- fix(telegram): drop pending updates before long polling\n\n### archie-agent\n\n- feat: add MCP client capabilities to archied and archie-agent\n- fix: Transition() ignores `from` status guard, allowing lost updates\n- fix: skillscript.Run ignores context, cannot be canceled/timed out\n- fix: LoadDir: no timeout around Yaegi Eval can hang daemon startup\n- fix(indexing): surface index config properly and stop silent degradation\n- refactor(worktree): replace git shell-out with go-git v6\n- fix(worktreerpc): bound handler contexts and drop the git binary from tests\n- refactor(nats): rebuild as infrastructure/eventbus/nats with real boundaries\n- refactor: route tasks on a typed kind, not forge labels\n- fix(natsrpc): make RegisterAll wait for the server to see subscriptions\n- refactor(config): move loading into infrastructure/configuration\n- refactor: add internal/eventbus as the broker-neutral messaging contract\n- feat(tools): lift tau's file and shell tools into the tool registry\n- feat: make /stop cancel the running chat turn\n- fix: kill the whole process group when a shell command is cancelled\n- feat: refuse unrecoverable shell commands\n- feat: make /stop reach running agent tasks\n- fix: use errors.Is/As for context errors and cleanup\n- fix(grep): distinguish ripgrep exit 1 from a failed search\n- fix(docker): slim both images and repair unreachable Go tooling\n- fix(container): write the task boot brief under .git"
|
||||
},
|
||||
{
|
||||
"version": "1.1.0",
|
||||
"date": "2026-07-27",
|
||||
"body": "### archied\n\n- feat: add the Telegram gateway with persistent sessions, topic-thread support, streamed rich replies, typing indicators, and Markdown rendering\n- feat: add `/spawn`, `/approve`, and `/cancel` for chat-driven task control\n- feat: provide a comprehensive `/help` guide whose command list stays aligned with Telegram's published menu and Archie's executable command surface\n- feat: add `/provider` and provider-filtered `/model` selectors that switch the provider and model used by subsequent live chat turns\n- feat: include the active provider and full model reference in `/status`\n- feat: notify authorized Telegram users once when a newly tagged component release is installed\n- feat: add `/restart` to reload and relaunch the Telegram gateway without interrupting in-flight daemon tasks\n- feat: add deny-by-default Telegram sender authorization and native command-menu publication\n- feat: connect Desktop Commander through Archie's managed MCP client so chat can use workspace file and process tools\n- feat: add multi-identity daemon configuration, persona routing, an email channel, and webhook platform support\n- feat: add durable task, session, message, and memory persistence\n- feat: add memory synchronization, prefetch, context scrubbing, threat scanning, and built-in memory tools\n- feat: add tool guardrails, classification, budgets, availability filtering, and disclosure controls\n- feat: add feature-based YAML configuration with `conf.d` overlay loading\n- feat: add typed secret-engine registration and Yaegi extension support\n- fix: reject unknown slash commands locally instead of allowing the LLM to fabricate command behavior\n- fix: publish Telegram commands to default, private-chat, and group-chat scopes so stale commands inherited with the bot token cannot shadow Archie's menu\n- fix: drain the SDK's full event stream so streamed Telegram replies cannot deadlock\n- fix: use standard newline-delimited JSON framing for MCP stdio clients\n- fix: make MCP stdio shutdown and timeout handling race-safe\n- fix: restore legacy `[forge].token_env` compatibility and required container environment passthrough\n- fix: make the agent-container Docker network explicitly configurable\n\n### archie-agent\n\n- feat: add streamed agent execution with typed message events\n- feat: add MCP client transports and managed tool-provider discovery\n- feat: add memory context scrubbing and normalized memory tool schemas\n- feat: add plugin metadata extraction from `metadata.archie.plugins`\n- feat: add configurable container networking for daemon-launched runtimes\n- fix: preserve valid UTF-8 when clipping runtime output\n- fix: make MCP stdio lifecycle, retries, and timeout handling race-safe\n- fix: enforce a zero-finding lint and vet baseline"
|
||||
},
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"date": "2026-07-22",
|
||||
"body": "### archied\n\n- feat: ship the resident forge-polling daemon, deterministic workflow engine, isolated worktrees, quality gates, Gitea integration, Docker/NATS worker split, plugin loading, and skills support\n- feat: publish `archied` and `archie-agent` container images to the Gitea registry\n\n### archie-agent\n\n- feat: ship the isolated agent runtime, NATS RPC boundary, workflow execution, skills, and plugin support\n- feat: publish the `archie-agent` container image to the Gitea registry"
|
||||
}
|
||||
]
|
||||
@@ -1,414 +0,0 @@
|
||||
# External agent harnesses
|
||||
|
||||
**Status:** Approved **Scope:** the harness model and, in "Session contract",
|
||||
the duplex session that the setup terminal and the run-scoped live view both
|
||||
use. Code cites this file for both (`ui/src/harness/SetupTerminal.vue`,
|
||||
`internal/infrastructure/postgres/queries/harness_secrets.sql`).
|
||||
|
||||
## Decision
|
||||
|
||||
A workflow stage can run on an external coding-agent CLI instead of the built-in
|
||||
agent loop: Claude Code, Codex, Pi, OMP, GitHub Copilot CLI, or any other CLI
|
||||
packaged as a Docker Sandbox Kit v3. Each authenticates with an API key or the
|
||||
operator's subscription login, and can carry the operator's own skills, plugins,
|
||||
subagents and instructions.
|
||||
|
||||
Two boundaries hold regardless of what the harness does:
|
||||
|
||||
- **The real credential never enters the container.** The container sees
|
||||
sentinel values; archie's egress proxy substitutes the real credential on
|
||||
outbound requests and performs OAuth refresh on the host.
|
||||
- **Archie's workflow guarantees are enforced outside the harness.** Git,
|
||||
protected paths, read-only stages, gates and budgets are checked by archie
|
||||
around the process and against the worktree afterwards.
|
||||
|
||||
## Kits
|
||||
|
||||
A harness is packaged as a Kit v3 image: an OCI image whose
|
||||
`vnd.docker.sandbox.kit.descriptor` manifest annotation declares what the
|
||||
harness needs. Archie reads descriptors with the published
|
||||
`github.com/docker/sandbox-kit-spec/v3/spec` package and does not maintain its
|
||||
own descriptor format. Published Kits run unmodified.
|
||||
|
||||
Archie is a partial Kit runtime. It implements these capability types:
|
||||
|
||||
| Type | Archie behaviour |
|
||||
| ------------------ | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `credential@1` | Proxy-managed only, described below. |
|
||||
| `network-policy@1` | Enforced by the egress proxy. |
|
||||
| `volume@1` | A Docker volume keyed by WorkflowExecution, deleted with it. |
|
||||
| `lifecycle@1` | Install and startup hooks run on container create. |
|
||||
| `agent-sessions@1` | The headless `prompt` and `resume` invocations for the stage. |
|
||||
| `agent-skills@1` | Discovery paths for bundled skills and optional shared skills; host access is always read-only. |
|
||||
| `agent-skill@1` | Selected image-bundled skills copied into the declared discovery paths. |
|
||||
| `agent-context@1` | The resolved discovery directory, defaulting beside the workspace; preserve instructions outside Archie-managed sections. |
|
||||
| `resources@1` | Container CPU and memory limits. |
|
||||
|
||||
Every other type fails closed: a required entry refuses the launch, an optional
|
||||
one is skipped and recorded on the step. `credential@1` with `passthrough: true`
|
||||
and any credential for a forge service are refused.
|
||||
|
||||
The operator's own setup (plugins, subagents, instructions, settings) is a mixin
|
||||
Kit, published with the harness Kit as a Kit set: the set merges their layers
|
||||
into one image. It is versioned image content, rewritten on every create, never
|
||||
state a run can modify.
|
||||
|
||||
## Contract
|
||||
|
||||
A harness run is a second implementation of `agentexec.Runner`. It takes the
|
||||
same `Request` and returns the same `Result`, so workflows, the daemon and the
|
||||
State Store do not know which runner ran a stage.
|
||||
|
||||
`agent-sessions@1` supplies the invocation. Archie supplies, per CLI, an output
|
||||
adapter that translates the CLI's JSON output stream into `ToolCallReporter`
|
||||
calls, `Usage` and a session ID. A CLI with no adapter can run stages with no
|
||||
capture tools, reporting no usage; its token budget falls back to wall clock.
|
||||
|
||||
Workflow definition validation rejects, at load time, a stage whose needs the
|
||||
selected harness cannot meet: capture tools without an adapter, or a gate retry
|
||||
without a `resume` verb.
|
||||
|
||||
## Selection
|
||||
|
||||
A harness is an agent profile. `docs/prds/event-automation.md` defines a profile
|
||||
as the execution environment a workflow selects; a harness profile names one Kit
|
||||
pinned by digest, a workload Kit or a published Kit set, in place of a container
|
||||
image. Archie runs that Kit's image and composes no Kits itself; a bare mixin is
|
||||
refused. Everything else about profiles holds: a workflow names its profile, a
|
||||
stage may name a different one, and a profile holds no secrets.
|
||||
|
||||
`archie-agent` builds the stage's runner from the stage's profile: the ai-sdk
|
||||
agent loop for an image profile, the harness runner for a Kit profile. Image
|
||||
profiles, and every workflow already written against them, are unchanged. A Kit
|
||||
profile named by no workflow is a validation error.
|
||||
|
||||
A stage naming a different profile than its workflow's is a separate run, not a
|
||||
mid-container runner switch: a Kit task runs in one container provisioned for
|
||||
one profile (Container layout), so a stage that needs a different one is its own
|
||||
callee, started the way `workflow.call` already starts one
|
||||
(`docs/prds/event-automation.md` "Workflows call workflows"), with its own agent
|
||||
profile resolved off its own task row. This needs no mechanism beyond
|
||||
`workflow.call` plus per-task profile resolution (`daemon.pinTaskProfile`), both
|
||||
of which already treat every task's profile independently of any caller's -- see
|
||||
`TestWorkflowCallerConformance` (staterpc) for the callee's independent
|
||||
`Workflow` field and `TestWorkflowCallGivesACalleeItsOwnProfile` (daemon) for
|
||||
the Kit-vs-image runner selection that independence produces.
|
||||
|
||||
Profiles are org resources in the State Store, so a Kit profile belongs to one
|
||||
org, is granted to its workspaces like any profile, and applies without a
|
||||
restart.
|
||||
|
||||
## Organisations
|
||||
|
||||
`docs/prds/orgs-and-access.md` is the boundary; a harness adds nothing that
|
||||
crosses it.
|
||||
|
||||
- A Kit profile, its credential bindings and its OAuth tokens belong to one org.
|
||||
No record is shared between orgs.
|
||||
- A harness run is a run like any other: it acts as the workflow's identity,
|
||||
under the run credential issued at dispatch.
|
||||
- The egress proxy injects a credential only when the run credential carries the
|
||||
secret the binding names. A Kit that declares a service the identity is not
|
||||
granted gets no credential: a required one refuses the launch, an optional one
|
||||
is skipped.
|
||||
- A Kit's network policy is what the Kit asks for; the identity's network grants
|
||||
are what the org allows. The proxy enforces the intersection.
|
||||
- Concurrency slots are counted per binding within its org.
|
||||
|
||||
## Credentials
|
||||
|
||||
A credential binding maps a Kit's `credential@1` `service` name to an org
|
||||
secret, which the org grants to identities like any secret. The secret holds one
|
||||
of:
|
||||
|
||||
- **API key:** a value in the org's secret store.
|
||||
- **OAuth:** tokens captured by the setup terminal, stored in the State Store
|
||||
under the at-rest envelope of `binding-secret-encryption.md` with its own
|
||||
domain separator.
|
||||
|
||||
The egress proxy resolves the binding for each request against the run
|
||||
credential. The container gets the Kit's sentinel in the named variable or
|
||||
credential file. OAuth refresh happens at the proxy, which intercepts the Kit's
|
||||
`tokenEndpoint`, so a refreshed token is written to the State Store and never
|
||||
returned to the container.
|
||||
|
||||
Runs sharing an OAuth binding share its subscription's rate limit.
|
||||
`max_concurrent` on the binding (default 1) caps its simultaneous runs. A stage
|
||||
waiting for a slot is `pending`, not `running`.
|
||||
|
||||
## Session contract
|
||||
|
||||
A **session** is a duplex PTY into a Kit container the daemon owns. One concept
|
||||
covers both targets; only the address, the lifetime and the established egress
|
||||
phase differ.
|
||||
|
||||
| | Setup session | Run session (deferred) |
|
||||
| --------- | ------------------------------------------------------------- | ------------------------------ |
|
||||
| Address | `{org, profile}` | `{org, task, attempt}` |
|
||||
| Container | ephemeral, from the profile's Kit | the task's running container |
|
||||
| Purpose | run the CLI's own login so the proxy captures the tokens | watch and optionally take over |
|
||||
| Lifetime | bounded by the session TTL; the container is removed on close | bounded by the task |
|
||||
|
||||
- **Transport.** The daemon serves `harness.v1.HarnessService`, a bidi gRPC
|
||||
stream, and the dashboard implements its `HarnessTerminal` interface
|
||||
(`internal/webui`) over that client; the browser's WebSocket route is
|
||||
unchanged. The contract lives on the daemon because the daemon owns
|
||||
containers: the dashboard process must not link `internal/container`,
|
||||
`internal/app/archied` or `internal/agentexec`.
|
||||
- **Authorisation.** Opening a session is the `update` action on the secret,
|
||||
decided by the dashboard's authorizer before the route runs
|
||||
(`internal/webui/authorize.go`). The dashboard then dials the daemon with the
|
||||
harness service token. The daemon does not re-authorise an operator; it trusts the
|
||||
asserted `{org, profile}` exactly as the task-action RPC trusts an asserted
|
||||
actor. Because that authority is a shell in a container holding an org's
|
||||
credential, the harness listener requires `HARNESS_TOKEN` even on loopback,
|
||||
unlike the State Store's loopback convention.
|
||||
- **Egress phase.** Token interception is filtered by phase (`oauth.go`'s
|
||||
`rule.runtime == atRun`), and `EnterRuntime` is one-way. A setup session
|
||||
therefore follows a run's lifecycle exactly: install hooks at the install
|
||||
phase, `EnterRuntime` before the shell. A credential whose token endpoint must
|
||||
be captured declares `phase: runtime`; a credential capturing at install phase
|
||||
is captured by the install hooks that run before the switch.
|
||||
- **Credentials.** Capture is gated: the proxy intercepts a token endpoint only
|
||||
for a service the session is granted (`Proxy.granted`). A setup session has no
|
||||
task, so the daemon registers a session grant: its proxy token resolves to
|
||||
`{org, the Kit's declared credential services the org binds}`. That is the
|
||||
intersection the `update`-on-secret authorisation covers. The real token never
|
||||
enters the container: the response is sentinelized and stored as the org's
|
||||
harness secret.
|
||||
- **Container discipline.** The setup container runs a keepalive entrypoint with
|
||||
an empty `Config.Env`; the PTY is an exec as the Kit's harness user with the
|
||||
harness env and nothing inherited from any worker. No worktree is mounted. It
|
||||
is acquired through the container pool, so it carries the `archie-daemon`
|
||||
label, the concurrency cap and the max-uptime reaper; the session TTL is the
|
||||
smaller bound. Closing revokes the egress session, removes the sandbox network
|
||||
and the Kit volumes, then releases the container.
|
||||
- **Kit unavailable.** The daemon serves the contract only when it has a
|
||||
container pool and a Kit launcher; otherwise there is no listener, and a
|
||||
client's refused connection is gRPC's `Unavailable`. The dashboard's existing
|
||||
failure surface is the honest degrade; `/api/harness`'s `terminal` field means
|
||||
"a client is configured", not "the daemon can run a Kit".
|
||||
- **Run target.** `RunTarget{task_id, attempt}` opens a read-only view of a
|
||||
running task's sandbox; it ships as the peek. The daemon resolves the pair
|
||||
itself, so the dashboard never learns a container name: the task store says
|
||||
whether the task is `running` and which attempt is current, and the Kit
|
||||
launcher names the container `kitrun.TaskContainer(task_id, attempt)` (one
|
||||
container per attempt, removed when the run ends; volumes remain task-scoped
|
||||
for retries). A finished or unknown task, a task that is not running, an
|
||||
attempt other than the running one, or a container that is gone is `NotFound`
|
||||
with the reason in the message; an unreachable task store or container engine
|
||||
is `Unavailable`. The view follows the container's stdout and stderr,
|
||||
including the harness output forwarded by the worker, carries no stdin and no
|
||||
exec, and ends when the task's container ends or the client leaves, so it
|
||||
confers no authority over the container. A read-only tail of the existing
|
||||
per-attempt logs was rejected: those refresh only on task state changes and
|
||||
are the daemon's account, not the sandbox's. Mid-stream failures are shown as
|
||||
a reason in the terminal before it closes.
|
||||
- **Authorisation.** The dashboard route `GET /api/tasks/{id}/sandbox` is
|
||||
decided as `read-logs` on the task before the handler runs, so a caller sees
|
||||
a sandbox exactly when they may read that task's log. The daemon checks that
|
||||
the task belongs to the asserted org before following output.
|
||||
- **Grants.** The view takes no grant of its own. The run's egress session
|
||||
(its proxy token, install then `EnterRuntime`) already belongs to the run
|
||||
and is revoked by `Launcher.Release` when the task ends; the view reads
|
||||
after that phase switch and dies with the container.
|
||||
- **Credentials.** The sandbox holds sentinels, never real credentials: API
|
||||
keys are `egress.Sentinel` (`credentials.go`), and an OAuth token set is
|
||||
sentinelised in the response and swapped back by the proxy only on a granted
|
||||
service's resource host in the matching phase (`oauth.go`, `injectOAuth`).
|
||||
The proxy runs in the daemon outside the container, so a shell in the
|
||||
container sees only sentinels.
|
||||
- **Takeover (interactive PTY into a running task) is out of scope for this
|
||||
issue.** It needs the dangerous-command authority (#1574) to
|
||||
gate it, and that authority is not wired for it: the harness listener has no
|
||||
approval step; `ToolSetOptions.Approval` in `internal/agentexec/modelloop`
|
||||
is never set by a caller, so task runs never build approval-required tools;
|
||||
approvals reach an operator only on the chat paths (dashboard ask, Telegram,
|
||||
Gateway). Takeover would also need an audit record naming the actor, task,
|
||||
attempt and open/close times, and revocation tied to task end (the exec is
|
||||
closed with the container). Those follow the setup session's shape
|
||||
(`harnesssession.Session`, `container.ExecPTY`) once the authority exists.
|
||||
- **Audit.** Opening and closing a session and a successful capture are recorded
|
||||
with the asserted org and profile. A run view's open and close are logged with
|
||||
the task and attempt; it reads output only, so it has no takeover record.
|
||||
|
||||
Each session is the only interactive path into a harness container.
|
||||
|
||||
## Egress
|
||||
|
||||
Only Kit profiles run on the egress path. An image profile keeps the network
|
||||
access its identity is granted, because workflows such as a network investigator
|
||||
need raw DNS, ICMP and arbitrary TCP that no HTTP proxy carries.
|
||||
|
||||
- **Sandbox network.** Each Kit run gets its own internal Docker bridge on which
|
||||
the host holds no address. Host services, including those listening on every
|
||||
interface, are unreachable from it by any address.
|
||||
- **Relay.** One relay container, `archie-agent relay`, sits on the sandbox
|
||||
networks under a fixed alias and on the host-reachable network. It forwards
|
||||
three fixed ports, to the proxy, NATS and the State Store, and can reach
|
||||
nothing else. It holds no secrets.
|
||||
- **Proxy.** The proxy runs inside `archied`, listening on the host gateway of
|
||||
the host-reachable network. It terminates TLS with a per-daemon CA installed
|
||||
into the container at create, identifies the container by a per-run proxy
|
||||
password distinct from the worker's run grant, and applies that run's network
|
||||
policy and credential inject rules. Upstream dials refuse loopback, and refuse
|
||||
internal addresses unless the policy names the exact IP, so an allowed name
|
||||
cannot resolve back into the host.
|
||||
|
||||
## Container layout
|
||||
|
||||
A Kit task runs in one container, from the Kit composition's image, on the
|
||||
task's sandbox network. The worker and every harness invocation share it; they
|
||||
are separated by user, not by container, so a run's cost scales with the run and
|
||||
not with how many agents it fans out to.
|
||||
|
||||
- **Worker.** Archie mounts its own `archie-agent` binary read-only and runs it
|
||||
as the container's entrypoint, as root. It holds the task's NATS and State
|
||||
Store credentials in its own environment and in root-only files, runs the
|
||||
workflow, and serves `archie-agent mcp`. The Kit image's entrypoint is not
|
||||
PID 1.
|
||||
- **Harness.** Every invocation runs as the Kit's user (the image's `User`,
|
||||
default uid 1000) with an explicit environment: the Kit's variables, the proxy
|
||||
environment and the credential sentinels, and nothing inherited from the
|
||||
worker. That user cannot read the worker's environment or files, or trace it.
|
||||
Sibling invocations in one run share the user and the worktree.
|
||||
- **Hooks.** `lifecycle@1` install and startup hooks run as the user each
|
||||
declares, before the worker accepts work.
|
||||
- **Mounts.** The task worktree at the Kit's workspace directory, owned by the
|
||||
Kit's user, and the read-only skills store. Nothing else from the host.
|
||||
- **Network.** The relay forwards three fixed ports on the sandbox network: the
|
||||
egress proxy, NATS and the State Store. The worker reaches NATS and the State
|
||||
Store with its credentials; a harness can open those ports but holds no
|
||||
credential either accepts.
|
||||
- **Volumes.** `volume@1` paths persist for the life of the WorkflowExecution,
|
||||
which covers session resume across gate iterations and retries. They are not
|
||||
shared between executions.
|
||||
|
||||
## Archie tools inside the harness
|
||||
|
||||
Capture tools return a stage's structured results through `archie-agent mcp`, a
|
||||
stdio MCP server. The same command forwards central-tool discovery and calls
|
||||
over Streamable HTTP to `http://archie.tools/mcp` through the egress proxy.
|
||||
Claude Code, Codex, Pi, OMP and GitHub Copilot CLI register it using their
|
||||
native MCP configuration. Registration files are per-stage and outside the
|
||||
worktree; the Kit's bundled settings remain intact. A CLI that exits without
|
||||
initializing the required MCP server fails the stage.
|
||||
|
||||
`archied` handles that exact endpoint inside the authenticated task proxy; it is
|
||||
not a listener or an upstream network destination. It is available only during
|
||||
task runtime, never during install or a setup session. The harness supplies a
|
||||
sentinel, and the proxy injects a separate random gateway token held only on the
|
||||
host. Ending the proxy session revokes that token and cancels active calls.
|
||||
|
||||
The proxy reaches `archie-gateway` through its authenticated gRPC contract. The
|
||||
Gateway derives the task, execution principal and org from a live run grant on
|
||||
every request. Its tool list is bounded by the profile in that org and the
|
||||
package's accepted tool authority, checked again at invocation. Workspace tools,
|
||||
chat file delivery, conversation-only tools and tools that require an
|
||||
unavailable approver are not served. Tool result limits apply without exposing
|
||||
host spill paths; media is returned as MCP content.
|
||||
|
||||
Task MCP providers run in the Gateway with task-bound sessions and sampling.
|
||||
Sampling uses the task's model and credentials, records task usage and refuses
|
||||
revoked grants. It does not use the chat identity or chat model. The worker does
|
||||
not start another copy of those providers for Kit tasks. The harness's own
|
||||
built-in tools remain outside Archie's tool-result limits.
|
||||
|
||||
## Enforcement around the harness
|
||||
|
||||
| Property | Enforcement |
|
||||
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Model never runs git | No forge credential can be bound. Archie records `HEAD` and every ref before the run; any change fails the step (`failed`, policy class). The workflow commits the stage's changes. |
|
||||
| Protected paths | A diff touching a `Protection` path fails the step. |
|
||||
| Read-only stage | Any worktree diff fails the step. |
|
||||
| Gate | Archie runs the stage's gate after the harness exits. On failure it resumes the session with the gate output, up to the stage's iteration budget. |
|
||||
| Budget | Archie kills the process on wall-clock timeout, or when streamed usage passes the token budget. |
|
||||
| Cancellation | Cancelling the step kills the process group, then the container. |
|
||||
| Egress | Only the proxy is reachable; the Kit's network policy decides the rest. |
|
||||
|
||||
Harness settings that deny git or protected paths are added where the CLI
|
||||
supports them, to save wasted turns. They are never the enforcement.
|
||||
|
||||
## Execution tree
|
||||
|
||||
A harness run is one `agent` StepExecution. Subagents the harness spawns
|
||||
internally are not recorded as children. Their usage is included in the step's
|
||||
`tokens_used` when the adapter reports it.
|
||||
|
||||
## Agents never hold a harness
|
||||
|
||||
An Agent reaches a harness only by invoking a Workflow whose stage names it. No
|
||||
Agent tool, chat tool or capability exposes a harness, its setup terminal or its
|
||||
credential. The stage boundary is what carries the container, the git and path
|
||||
checks, the gate and the budget; a harness outside a stage has none of them.
|
||||
|
||||
## Out of scope
|
||||
|
||||
- Chat through a harness. The gateway chat loop stays on the built-in runtime.
|
||||
- `network-policy@2` HTTP method and path rules; a Kit requiring it is refused.
|
||||
- Recording the harness's internal subagents as StepExecutions.
|
||||
- Cost in currency.
|
||||
- Choosing a harness automatically per task.
|
||||
|
||||
## Plan
|
||||
|
||||
1. Descriptor resolution with the Kit spec package; capability support table and
|
||||
fail-closed refusal.
|
||||
2. Egress proxy: internal network, per-daemon CA, per-container token,
|
||||
`network-policy@1`.
|
||||
3. `credential@1`: API-key bindings, sentinel rendering, inject rules.
|
||||
4. Harness `Runner`: container create with worktree, volumes, lifecycle hooks
|
||||
and the mounted `archie-agent`; `agent-sessions@1` invocation; worktree
|
||||
checks for git, protected paths and read-only; budget and cancellation.
|
||||
5. Claude Code output adapter; `archie-agent mcp`; gate-and-resume loop.
|
||||
6. Kit profiles, runner selection from the stage's profile, and definition
|
||||
validation.
|
||||
7. OAuth bindings as org secrets: token-endpoint interception, encrypted
|
||||
storage, per-binding concurrency; dashboard setup terminal.
|
||||
8. Output adapters for Codex, Pi, OMP and GitHub Copilot CLI.
|
||||
|
||||
## Verification
|
||||
|
||||
- Every named adapter discovers and calls a permitted central tool through the
|
||||
proxy and records a local capture. A guessed tool outside the profile or
|
||||
accepted package authority is refused.
|
||||
- The gateway token never appears in the container, generated MCP files,
|
||||
worktree, logs or events. It is not the container's proxy password.
|
||||
- A permission change after discovery takes effect at the next call; ending the
|
||||
proxy session cancels active calls, and a revoked grant cannot execute tools
|
||||
or sample a model.
|
||||
- Bundled skills remain visible with shared skills missing or disabled; shared
|
||||
mounts are per-skill and read-only. Explicit context directories preserve
|
||||
non-managed instructions and refuse symlinked staging paths.
|
||||
- The same workflow definition completes on `builtin` and on the Claude Code Kit
|
||||
with the same `Result` shape and captures.
|
||||
- After `/login` in the setup terminal, the container's credential file holds
|
||||
only sentinels, the State Store holds the encrypted token, and a task run
|
||||
authenticates.
|
||||
- A real API key or OAuth token never appears in the container environment,
|
||||
filesystem, worktree, task log or event stream.
|
||||
- A request to a host outside the Kit's runtime allow list fails, including a
|
||||
direct connection that bypasses the proxy settings.
|
||||
- A harness instructed to `git commit` fails its step, and the task branch is
|
||||
unchanged.
|
||||
- A harness edit to a protected test file fails the step in a TDD fix stage.
|
||||
- A read-only feasibility stage that writes a file fails.
|
||||
- A file a run writes into a Kit-managed path such as the CLI's settings file is
|
||||
gone on the next execution.
|
||||
- A Kit requiring an unsupported capability is refused at launch with the
|
||||
capability named.
|
||||
- A stage with a failing gate resumes the same session with the gate output,
|
||||
then succeeds or exhausts its iterations.
|
||||
- Two tasks sharing an OAuth binding with `max_concurrent = 1` run one at a
|
||||
time; the second waits as `pending`.
|
||||
- Stopping a run kills the harness process and removes the container.
|
||||
- A harness invocation cannot read the worker's NATS or State Store credential
|
||||
from its environment, its files or `/proc`.
|
||||
- A run fanning out to many agent invocations uses one container.
|
||||
- A Kit profile in org A cannot be selected, and its binding cannot be resolved,
|
||||
by a workflow in org B.
|
||||
- A harness run whose identity is not granted a Kit's required credential is
|
||||
refused at launch; the proxy never injects a secret outside the run
|
||||
credential.
|
||||
- The firewall investigation example runs unchanged on an image profile with
|
||||
direct network access.
|
||||
@@ -4,11 +4,11 @@
|
||||
persistently takes on development of archie-core itself. This file records a
|
||||
desired state, not an implementation or a product: nothing below exists unless
|
||||
the "Built today" section says so. The plan is tracked as epic #1769 with child
|
||||
issues #1770–#1775. This file is a record, not a mechanism: agents only see
|
||||
what is in their context, so verify every claim here against the code before
|
||||
acting on it — where they disagree, the code wins. The boundary below is
|
||||
load-bearing only where it is enforced (the gate, access control, the daemon's
|
||||
git monopoly) and stated in `AGENTS.md`; everywhere else this file is a pointer.
|
||||
issues #1770–#1775. This file is a record, not a mechanism: agents only see what
|
||||
is in their context, so verify every claim here against the code before acting
|
||||
on it — where they disagree, the code wins. The boundary below is load-bearing
|
||||
only where it is enforced (the gate, access control, the daemon's git monopoly)
|
||||
and stated in `AGENTS.md`; everywhere else this file is a pointer.
|
||||
|
||||
## Built today
|
||||
|
||||
@@ -17,8 +17,8 @@ workflows, the adversarial self-review stage before a PR opens (epic #1348,
|
||||
closed), the prbench judge for review quality with its acceptance bar, canary
|
||||
releases judged on the installed release (releaseupdate), and the curator
|
||||
engine. What does not exist is the loop itself: no self-intake curator, no
|
||||
approved-issue auto-run, no judge for diffs, no outcome distillation, no
|
||||
canary routing specific to self-directed changes.
|
||||
approved-issue auto-run, no judge for diffs, no outcome distillation, no canary
|
||||
routing specific to self-directed changes.
|
||||
|
||||
## Decision
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ certification.
|
||||
## Transport and authority
|
||||
|
||||
The browser uses HTTP/JSON and SSE to the UI service. The UI service calls State
|
||||
Store, Gateway, Messaging and Harness through their gRPC contracts. Only the
|
||||
Store, Gateway, Messaging and the daemon through their gRPC contracts. Only the
|
||||
State Store opens the task/control-plane/account database; Gateway owns
|
||||
conversation storage. Browser HTTP handlers never open either database.
|
||||
|
||||
@@ -54,35 +54,35 @@ accounts by unverified email, or create an administrator.
|
||||
|
||||
## Enforcement inventory
|
||||
|
||||
| Location | Enforcement | Regression evidence |
|
||||
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Browser credential gate: `webui/auth.go`, `accounts.go` | Account session or verified provider identity; shared dashboard token is not a person when accounts are enabled. No API data before authentication. | `TestAccountBoundary`, `TestAccountSessionFailureIsClosed` |
|
||||
| Browser policy gate: `webui/authorize.go` | Resolve principal from stored identity; evaluate action against stored org/workspace and resource kind before handler. Missing chain refuses. | `TestHTTPPolicyCannotBeBypassed`, `TestAuthorizeRefusesWithoutAChain`, `TestAuthorizeRecord`, `TestTaskAuthorizationUsesStoredAttributes`, `TestAuthorizeCreateIn` |
|
||||
| Instance-only HTTP surfaces: `webui/instance_only.go`, server route registration | Hide instance-owned configuration and diagnostics from another org; policy still applies first. | `TestInstanceOnlyHidesTheInstanceFromOtherOrgs`, `TestInstanceAdminOrgs` |
|
||||
| First setup: `webui/accounts.go`, `postgres/accounts.go` | Initial organization, workspace, instance URL, admin identity and password commit together. Transaction lock closes bootstrap after first account; later requests require `manage_members`. | Disposable PostgreSQL smoke verification for bootstrap race and rollback; account policy tests below |
|
||||
| Account creation: `webui/accounts.go`, `staterpc/accounts.go`, `postgres/accounts.go` | Cedar `manage_members` at HTTP and RPC; target org is authenticated context. New local accounts cannot request owner role. | `TestAccountManagementUsesPolicy`, `TestAccountBoundary` |
|
||||
| Local passwords and sessions: `identity/password.go`, `postgres/accounts.go` | Argon2id, independent salts, length/common-password checks, generic login refusal, account throttling, session hashes and expiry, revocation on logout/password change/suspension. | `TestPasswordVerification`, `TestAccountBoundary`; disposable PostgreSQL session verification |
|
||||
| Transport and CSRF: `webui/accounts.go`, `api_tasks.go` | Password/account mutations require HTTPS or localhost development, JSON, custom CSRF header and same-origin requests. Forwarded headers require explicit trusted-proxy configuration. | `TestAuthenticationTransport`, existing mutation security tests |
|
||||
| Personal account routes: `webui/accounts.go` | Active signed-in person; principal supplied by server. Password change verifies current password. Sensitive authenticator changes require recent sign-in. No caller-supplied target identity. | `TestAccountBoundary` |
|
||||
| Recovery: `postgres/account_security.go`, `webui/accounts.go` | Fresh authenticated owner generates a hashed, one-use recovery secret. Redemption replaces password and revokes all sessions atomically. No email-existence disclosure. | Disposable PostgreSQL recovery verification |
|
||||
| Passkeys: `postgres/passkeys.go`, `webui/passkeys.go` | Configured RP origin, browser-bound one-use expiring challenge, verified credential signature and user verification. Enrollment/management belong to caller. Credential counters persist under a row lock. | Disposable browser virtual-authenticator verification; task-grant denial tests |
|
||||
| OIDC: `infrastructure/oidc`, `archieui/account_oidc.go`, `webui/auth.go` | Discovery and signed ID token with issuer/client audience/expiry, PKCE, state and nonce. Verified subject resolves to active identity. Browser-local session cannot outlive provider token, and provider credential remains checked. | `TestBrowserFlowVerifiesIDToken`, `TestProviderOutageIsUnavailableThenRecovers`, subject-claim tests; no external provider acceptance implied |
|
||||
| OIDC settings: `webui/accounts.go`, `postgres/authentication.go` | Instance ownership plus policy; recent sign-in for changes. Public URL cannot change while enrolled passkeys would be orphaned. | `TestAccountBoundary`, `TestAuthenticationSettingsRejectUntrustedOrigins` |
|
||||
| Org membership/workspaces/agent assignment: `webui/api_orgs.go`, `staterpc/orgs.go`, `postgres/orgs.go` | Own org or instance-owner relationship, allowed role vocabulary, membership escalation/last-owner guards, tenant-scoped SQL. | `TestOrgRPCsActInTheCallersOrg`, `TestSetMembershipRefusesUnknownRole`, org HTTP tests |
|
||||
| Personal API tokens: `webui/api_personal_tokens.go`, `staterpc/personal_tokens.go`, `postgres/personal_tokens.go` | Token owner comes from principal; store only token hash; revoke only caller's binding. | `TestPersonalTokensWithoutPerson`, `TestPersonalTokenOwner` |
|
||||
| gRPC caller attribution: `rpcidentity/identity.go` | Authenticated service may forward a principal; State Store resolves memberships/org itself. Task grant metadata is stripped. | `TestCallerAttribution` |
|
||||
| Agent/task gRPC: `staterpc/task_grants.go` | Durable task-scoped grant, explicit allowed RPC and target task, no definition-pin replacement, no account RPCs. | `TestTaskCredentialsCannotManageAccounts`, `TestTaskCredentialCannotReplaceItsPin`, `TestRecordUsageAuthority`, `TestWorkerPresenceAuthority` |
|
||||
| Chat HTTP: `webui/api_chat.go` | Server stamps sender and person thread; lists/read/turns/cancel/persona verify session ownership. Browser cannot submit another sender identity. | `TestWebChatOwnership`, `TestWebChatSenderCannotBeSuppliedByBrowser`; HTTP deny matrix |
|
||||
| Chat history, slash commands and model session tools: `gateway/session_store_postgres.go` | Store filters `Get`, `List`, `GetByChannel`; shared read/write guards check person ownership as well as org. A saved session cannot change its conversation source to claim another person's history. Service curation runs without a person principal. | `TestSessionVisibility`; PostgreSQL smoke for history isolation |
|
||||
| Chat questions/approvals: `webui/api_chat_ask.go` | Waiting question is bound to the initiating person, in addition to its unguessable ID. | `TestChatQuestionBelongsToInitiatingPerson` |
|
||||
| Chat downloads: `webui/api_chat_files.go` | Offered file token expires and is bound to the initiating person; requests cannot supply a filesystem path. | `TestChatFileDownload` |
|
||||
| Per-person memory: `archiegateway/chat_identity.go`, gateway memory tools, `sessioncurator` | Verified web sender identity scopes reads/writes. Curator refuses unidentified or mixed participants instead of guessing a person. | Gateway memory and session-curator tests |
|
||||
| Workflow/task actions: `webui/api_tasks.go`, `domain/taskactions`, `staterpc` | Policy and stored workspace before action; domain transition, authority and durable dispatch guards remain in force. | HTTP deny matrix, task action/domain tests, task grant tests |
|
||||
| Incoming webhooks: `captureintake`, access delivery engine | Verify HMAC before parsing; derive source/org from stored source; evaluate source delivery policies and egress rules. No browser-user credential is inferred. | Capture tests, `TestAuthorizeDelivery` |
|
||||
| Control-plane configuration, secrets, harness and extensions | Browser policy and instance-only restrictions where registered; service contracts carry principal/org; task grants cannot invoke administrative RPCs. | HTTP deny matrix, `TestAdministrationRoutes`, `TestChannelReloadRoute`, `TestConfineHarnessOrg` |
|
||||
| Location | Enforcement | Regression evidence |
|
||||
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Browser credential gate: `webui/auth.go`, `accounts.go` | Account session or verified provider identity; shared dashboard token is not a person when accounts are enabled. No API data before authentication. | `TestAccountBoundary`, `TestAccountSessionFailureIsClosed` |
|
||||
| Browser policy gate: `webui/authorize.go` | Resolve principal from stored identity; evaluate action against stored org/workspace and resource kind before handler. Missing chain refuses. | `TestHTTPPolicyCannotBeBypassed`, `TestAuthorizeRefusesWithoutAChain`, `TestAuthorizeRecord`, `TestTaskAuthorizationUsesStoredAttributes`, `TestAuthorizeCreateIn` |
|
||||
| Instance-only HTTP surfaces: `webui/instance_only.go`, server route registration | Hide instance-owned configuration and diagnostics from another org; policy still applies first. | `TestInstanceOnlyHidesTheInstanceFromOtherOrgs`, `TestInstanceAdminOrgs` |
|
||||
| First setup: `webui/accounts.go`, `postgres/accounts.go` | Initial organization, workspace, instance URL, admin identity and password commit together. Transaction lock closes bootstrap after first account; later requests require `manage_members`. | Disposable PostgreSQL smoke verification for bootstrap race and rollback; account policy tests below |
|
||||
| Account creation: `webui/accounts.go`, `staterpc/accounts.go`, `postgres/accounts.go` | Cedar `manage_members` at HTTP and RPC; target org is authenticated context. New local accounts cannot request owner role. | `TestAccountManagementUsesPolicy`, `TestAccountBoundary` |
|
||||
| Local passwords and sessions: `identity/password.go`, `postgres/accounts.go` | Argon2id, independent salts, length/common-password checks, generic login refusal, account throttling, session hashes and expiry, revocation on logout/password change/suspension. | `TestPasswordVerification`, `TestAccountBoundary`; disposable PostgreSQL session verification |
|
||||
| Transport and CSRF: `webui/accounts.go`, `api_tasks.go` | Password/account mutations require HTTPS or localhost development, JSON, custom CSRF header and same-origin requests. Forwarded headers require explicit trusted-proxy configuration. | `TestAuthenticationTransport`, existing mutation security tests |
|
||||
| Personal account routes: `webui/accounts.go` | Active signed-in person; principal supplied by server. Password change verifies current password. Sensitive authenticator changes require recent sign-in. No caller-supplied target identity. | `TestAccountBoundary` |
|
||||
| Recovery: `postgres/account_security.go`, `webui/accounts.go` | Fresh authenticated owner generates a hashed, one-use recovery secret. Redemption replaces password and revokes all sessions atomically. No email-existence disclosure. | Disposable PostgreSQL recovery verification |
|
||||
| Passkeys: `postgres/passkeys.go`, `webui/passkeys.go` | Configured RP origin, browser-bound one-use expiring challenge, verified credential signature and user verification. Enrollment/management belong to caller. Credential counters persist under a row lock. | Disposable browser virtual-authenticator verification; task-grant denial tests |
|
||||
| OIDC: `infrastructure/oidc`, `archieui/account_oidc.go`, `webui/auth.go` | Discovery and signed ID token with issuer/client audience/expiry, PKCE, state and nonce. Verified subject resolves to active identity. Browser-local session cannot outlive provider token, and provider credential remains checked. | `TestBrowserFlowVerifiesIDToken`, `TestProviderOutageIsUnavailableThenRecovers`, subject-claim tests; no external provider acceptance implied |
|
||||
| OIDC settings: `webui/accounts.go`, `postgres/authentication.go` | Instance ownership plus policy; recent sign-in for changes. Public URL cannot change while enrolled passkeys would be orphaned. | `TestAccountBoundary`, `TestAuthenticationSettingsRejectUntrustedOrigins` |
|
||||
| Org membership/workspaces/agent assignment: `webui/api_orgs.go`, `staterpc/orgs.go`, `postgres/orgs.go` | Own org or instance-owner relationship, allowed role vocabulary, membership escalation/last-owner guards, tenant-scoped SQL. | `TestOrgRPCsActInTheCallersOrg`, `TestSetMembershipRefusesUnknownRole`, org HTTP tests |
|
||||
| Personal API tokens: `webui/api_personal_tokens.go`, `staterpc/personal_tokens.go`, `postgres/personal_tokens.go` | Token owner comes from principal; store only token hash; revoke only caller's binding. | `TestPersonalTokensWithoutPerson`, `TestPersonalTokenOwner` |
|
||||
| gRPC caller attribution: `rpcidentity/identity.go` | Authenticated service may forward a principal; State Store resolves memberships/org itself. Task grant metadata is stripped. | `TestCallerAttribution` |
|
||||
| Agent/task gRPC: `staterpc/task_grants.go` | Durable task-scoped grant, explicit allowed RPC and target task, no definition-pin replacement, no account RPCs. | `TestTaskCredentialsCannotManageAccounts`, `TestTaskCredentialCannotReplaceItsPin`, `TestRecordUsageAuthority`, `TestWorkerPresenceAuthority` |
|
||||
| Chat HTTP: `webui/api_chat.go` | Server stamps sender and person thread; lists/read/turns/cancel/persona verify session ownership. Browser cannot submit another sender identity. | `TestWebChatOwnership`, `TestWebChatSenderCannotBeSuppliedByBrowser`; HTTP deny matrix |
|
||||
| Chat history, slash commands and model session tools: `gateway/session_store_postgres.go` | Store filters `Get`, `List`, `GetByChannel`; shared read/write guards check person ownership as well as org. A saved session cannot change its conversation source to claim another person's history. Service curation runs without a person principal. | `TestSessionVisibility`; PostgreSQL smoke for history isolation |
|
||||
| Chat questions/approvals: `webui/api_chat_ask.go` | Waiting question is bound to the initiating person, in addition to its unguessable ID. | `TestChatQuestionBelongsToInitiatingPerson` |
|
||||
| Chat downloads: `webui/api_chat_files.go` | Offered file token expires and is bound to the initiating person; requests cannot supply a filesystem path. | `TestChatFileDownload` |
|
||||
| Per-person memory: `archiegateway/chat_identity.go`, gateway memory tools, `sessioncurator` | Verified web sender identity scopes reads/writes. Curator refuses unidentified or mixed participants instead of guessing a person. | Gateway memory and session-curator tests |
|
||||
| Workflow/task actions: `webui/api_tasks.go`, `domain/taskactions`, `staterpc` | Policy and stored workspace before action; domain transition, authority and durable dispatch guards remain in force. | HTTP deny matrix, task action/domain tests, task grant tests |
|
||||
| Incoming webhooks: `captureintake`, access delivery engine | Verify HMAC before parsing; derive source/org from stored source; evaluate source delivery policies and egress rules. No browser-user credential is inferred. | Capture tests, `TestAuthorizeDelivery` |
|
||||
| Control-plane configuration, secrets and extensions | Browser policy and instance-only restrictions where registered; service contracts carry principal/org; task grants cannot invoke administrative RPCs. | HTTP deny matrix, `TestAdministrationRoutes`, `TestChannelReloadRoute` |
|
||||
| Audit feed: `webui/api_audit.go`, `domain/audit` | `read_audit` on the `audit` resource; org scope and the instance-wide exception come from the authenticated principal, never the query string. Export carries the same grant, needs an explicit range of at most a year, and is rate-limited per identity, one at a time. Redaction runs in the State Store adapter before an entry crosses gRPC. | `TestReadAuditRoleBoundary`, `TestAuditRoutesFollowTheReadAuditRole`, `TestHTTPPolicyCannotBeBypassed`, `TestAuditErrorMapping`, `TestAuditCSVCellNeutralisesFormulas` |
|
||||
| Live HTTP/SSE and diagnostics | Authenticated policy gate applies before stream creation; org-scoped event reads; instance logs require administrative visibility. | HTTP deny matrix, instance-only tests, `TestServiceLogsRequireInstanceCredential` |
|
||||
| Background schedules, dispatch, curation | Service/agent authority, not an implicit browser user. Task-scoped grants and org scopes remain distinct from initiating operator attribution. | Existing dispatch, grant, memory and org-scope tests |
|
||||
| Live HTTP/SSE and diagnostics | Authenticated policy gate applies before stream creation; org-scoped event reads; instance logs require administrative visibility. | HTTP deny matrix, instance-only tests, `TestServiceLogsRequireInstanceCredential` |
|
||||
| Background schedules, dispatch, curation | Service/agent authority, not an implicit browser user. Task-scoped grants and org scopes remain distinct from initiating operator attribution. | Existing dispatch, grant, memory and org-scope tests |
|
||||
|
||||
The policy HTTP matrix enumerates each registered protected route. It checks
|
||||
both anonymous refusal and refusal by an explicit Cedar forbid, using the real
|
||||
@@ -146,8 +146,6 @@ action/resource; the handler may impose a stricter record or instance boundary.
|
||||
| GET | `/api/event-types` |
|
||||
| GET | `/api/extensions` |
|
||||
| GET | `/api/extensions/catalogue` |
|
||||
| GET | `/api/harness/bindings` |
|
||||
| GET | `/api/harness/terminal` |
|
||||
| GET | `/api/identities` |
|
||||
| GET | `/api/logs` |
|
||||
| GET | `/api/mappings` |
|
||||
|
||||
+2
-1
@@ -84,7 +84,8 @@ console or page error fails the check. One module covers one behaviour;
|
||||
families share a prefix: `audit-*` for the audit page (redirect,
|
||||
filters, revert, runtime, views-export, retention-live, phone),
|
||||
`workflow-*` for the canvas (loading, validation, phone-layout, logic),
|
||||
`chat-composer` for chat input.
|
||||
`chat-composer` for chat input, `chat-dock-*` for the chat dock (pin, drag-cancel,
|
||||
layout, resize, drafts, picker, phone).
|
||||
|
||||
`routes` loads every static route and flags text with stray leading,
|
||||
trailing or doubled spaces. `seeded` checks the seed is visible.
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = async ({ page, go, shot, fail, settled, tolerate }) => {
|
||||
await go('/tasks');
|
||||
await page.getByRole('button', { name: 'Jump to', exact: true }).click();
|
||||
await page.getByRole('option', { name: 'New task', exact: true }).click();
|
||||
const dialog = page.getByRole('dialog');
|
||||
const dialog = page.getByRole('dialog', { name: 'New task' });
|
||||
await dialog.waitFor();
|
||||
await settled();
|
||||
const bounds = await dialog.boundingBox();
|
||||
@@ -40,8 +40,8 @@ module.exports = async ({ page, go, shot, fail, settled, tolerate }) => {
|
||||
assert.ok(await skip.evaluate(el => el === document.activeElement), 'Skip link is not the first keyboard stop');
|
||||
await page.keyboard.press('Enter');
|
||||
assert.equal(await page.evaluate(() => document.activeElement?.id), 'main-content');
|
||||
await page.getByRole('button', { name: 'Toggle Sidebar', exact: true }).click();
|
||||
await page.getByRole('navigation', { name: 'Sections', exact: true }).getByRole('link', { name: 'Tasks', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Sections', exact: true }).click();
|
||||
await page.getByRole('menuitem', { name: 'Tasks', exact: true }).click();
|
||||
await page.waitForFunction(() => document.activeElement?.id === 'main-content', null, { timeout: 5000 }).catch(() => {});
|
||||
assert.equal(await page.evaluate(() => document.activeElement?.id), 'main-content', 'route navigation did not focus main');
|
||||
await page.getByRole('button', { name: 'Jump to', exact: true }).click();
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// The chat composer: IME confirmation never submits the draft, Shift+Enter
|
||||
// inserts a newline, and ordinary Enter submits and clears.
|
||||
// inserts a newline, ordinary Enter submits and clears, and # attaches a task.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
module.exports = async ({ page, go, shot, tolerate }) => {
|
||||
tolerate(/api\/tasks/);
|
||||
await go('/events');
|
||||
const composer = page.getByRole('textbox', { name: 'Message Archie', exact: true });
|
||||
const composer = page.getByRole('combobox', { name: 'Message Archie', exact: true });
|
||||
await composer.waitFor();
|
||||
await composer.fill('Composition in progress');
|
||||
const sent = [];
|
||||
@@ -24,5 +25,46 @@ module.exports = async ({ page, go, shot }) => {
|
||||
await composer.press('Enter');
|
||||
assert.equal((await request).postDataJSON().text, 'Ordinary Enter submits');
|
||||
assert.equal(await composer.inputValue(), '');
|
||||
|
||||
let failTasks = true;
|
||||
await page.route('**/api/tasks?*', async route => {
|
||||
if (failTasks) return route.fulfill({ status: 500, contentType: 'text/plain', body: 'task store down' });
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify([
|
||||
{ id: 1861, title: "Chat composer: '#' context dropdown", status: 'running' },
|
||||
{ id: 1842, title: 'Retry stalled task runs', status: 'done' },
|
||||
]),
|
||||
});
|
||||
});
|
||||
|
||||
const tasksPalette = page.getByRole('listbox', { name: 'Tasks' });
|
||||
await composer.fill('Look at #');
|
||||
await tasksPalette.getByRole('alert').waitFor();
|
||||
assert.equal(await tasksPalette.getByRole('option').count(), 0);
|
||||
|
||||
failTasks = false;
|
||||
await tasksPalette.getByRole('button', { name: 'Retry' }).click();
|
||||
await tasksPalette.getByRole('option').first().waitFor();
|
||||
assert.equal(await tasksPalette.getByRole('option').count(), 2);
|
||||
|
||||
await composer.press('Escape');
|
||||
await tasksPalette.waitFor({ state: 'hidden' });
|
||||
|
||||
await composer.fill('Look at #184 now');
|
||||
await composer.evaluate(el => el.setSelectionRange(12, 12));
|
||||
await composer.dispatchEvent('input');
|
||||
await tasksPalette.getByRole('option').first().waitFor();
|
||||
assert.equal(await tasksPalette.getByRole('option').count(), 1);
|
||||
await composer.press('Tab');
|
||||
await tasksPalette.waitFor({ state: 'hidden' });
|
||||
assert.equal(await composer.inputValue(), 'Look at now');
|
||||
await page.getByRole('list', { name: 'Attached tasks' }).getByText('#1842').waitFor();
|
||||
|
||||
const tagged = page.waitForRequest('**/api/chat/stream');
|
||||
await composer.press('Enter');
|
||||
const text = (await tagged).postDataJSON().text;
|
||||
assert.ok(text.startsWith('Look at now') && text.includes('#1842 Retry stalled task runs'), text);
|
||||
assert.equal(await page.getByRole('list', { name: 'Attached tasks' }).count(), 0);
|
||||
await shot('chat-composition');
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
// Each conversation keeps its own unsent text and attached tasks. Starting a
|
||||
// new chat opens an empty composer, switching back restores the earlier
|
||||
// draft, and hiding and reopening the conversation loses nothing.
|
||||
const assert = require('node:assert/strict');
|
||||
const h = require('./helpers/chat-dock.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await page.route('**/api/tasks?*', (route) =>
|
||||
route.fulfill({ contentType: 'application/json', body: JSON.stringify([{ id: 1861, title: 'Task picker', status: 'running' }]) }),
|
||||
);
|
||||
await h.load(page, go);
|
||||
await h.expand(page);
|
||||
const composer = h.composerOf(page);
|
||||
const tags = page.getByRole('list', { name: 'Attached tasks' });
|
||||
|
||||
await composer.fill('draft for the first chat');
|
||||
await composer.fill('#');
|
||||
await page.getByRole('listbox', { name: 'Tasks' }).getByRole('option').first().click();
|
||||
await tags.getByText('#1861').waitFor();
|
||||
await composer.fill('draft for the first chat');
|
||||
|
||||
await page.getByRole('button', { name: 'New chat' }).click();
|
||||
await h.until(async () => (await composer.inputValue()) === '' && (await tags.count()) === 0, 'a new chat inherited the first chat draft');
|
||||
await composer.fill('draft for the second chat');
|
||||
|
||||
await h.hideOf(page).click();
|
||||
await h.expand(page);
|
||||
assert.equal(await composer.inputValue(), 'draft for the second chat', 'hiding the conversation lost the draft');
|
||||
|
||||
const pick = async (index) => {
|
||||
await page.getByRole('combobox', { name: 'Conversation' }).click();
|
||||
await page.getByRole('option').nth(index).click();
|
||||
};
|
||||
await pick(1);
|
||||
await h.until(async () => (await composer.inputValue()) === 'draft for the first chat', 'switching back did not restore the first draft');
|
||||
await tags.getByText('#1861').waitFor();
|
||||
await shot('first-chat-draft');
|
||||
|
||||
await pick(0);
|
||||
await h.until(async () => (await composer.inputValue()) === 'draft for the second chat', 'switching forward did not restore the second draft');
|
||||
assert.equal(await tags.count(), 0, 'the first chat task tag leaked into the second chat');
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
// A drag the browser cancels (a touch turned into a scroll, a lost pointer)
|
||||
// leaves the dock where it was: nothing pins, nothing stays offset, and the
|
||||
// next drag still works.
|
||||
const assert = require('node:assert/strict');
|
||||
const h = require('./helpers/chat-dock.cjs');
|
||||
|
||||
module.exports = async ({ page, go }) => {
|
||||
await h.load(page, go);
|
||||
await h.expand(page);
|
||||
const dock = h.dockOf(page);
|
||||
const before = await dock.boundingBox();
|
||||
const header = dock.locator('div.cursor-grab');
|
||||
|
||||
await h.dragTo(page, 1430);
|
||||
const dragging = await dock.getAttribute('style');
|
||||
assert.ok(/translate/.test(dragging || ''), 'the drag never started, so cancelling it proves nothing');
|
||||
await header.dispatchEvent('pointercancel');
|
||||
await page.mouse.up();
|
||||
|
||||
await h.until(async () => !/translate/.test((await dock.getAttribute('style')) || ''), 'the dock stayed offset after the drag was cancelled');
|
||||
assert.deepEqual(await dock.boundingBox(), before, 'cancelling the drag moved the dock');
|
||||
assert.equal((await h.saved(page)).side, null, 'a cancelled drag pinned the dock');
|
||||
|
||||
await h.dragTo(page, 1430);
|
||||
await page.mouse.up();
|
||||
await h.until(async () => (await h.saved(page)).side === 'right', 'a drag after a cancelled one did not pin');
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
// The saved dock layout: a stored mode and width are honoured, widths outside
|
||||
// the allowed range are clamped, unreadable JSON falls back to a usable
|
||||
// floating dock that saves again, and visiting phone width never overwrites
|
||||
// the desktop choice.
|
||||
const assert = require('node:assert/strict');
|
||||
const h = require('./helpers/chat-dock.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, tolerate }) => {
|
||||
tolerate(/JSON|SyntaxError/);
|
||||
const dock = h.dockOf(page);
|
||||
|
||||
await h.load(page, go, JSON.stringify({ mode: 'left', w: 500 }));
|
||||
await h.expand(page);
|
||||
let box = await dock.boundingBox();
|
||||
h.near(box.x, 0, 'saved left pin');
|
||||
h.near(box.width, 500, 'saved width');
|
||||
assert.ok((await h.mainRect(page)).x >= 499, 'page did not reflow beside the restored dock');
|
||||
|
||||
await h.load(page, go, JSON.stringify({ mode: 'right', w: -4 }));
|
||||
await h.expand(page);
|
||||
h.near((await dock.boundingBox()).width, 320, 'a negative width clamps to the minimum');
|
||||
|
||||
await h.load(page, go, JSON.stringify({ mode: 'right', w: 9999 }));
|
||||
await h.expand(page);
|
||||
h.near((await dock.boundingBox()).width, 720, 'a huge width clamps to the maximum');
|
||||
|
||||
await h.load(page, go, '{broken');
|
||||
await h.expand(page);
|
||||
box = await dock.boundingBox();
|
||||
assert.ok(box.height < 900 && box.x > 0 && box.x + box.width < 1440, 'unreadable layout did not fall back to a floating dock');
|
||||
await h.composerOf(page).fill('still usable');
|
||||
await h.dragTo(page, 1430);
|
||||
await page.mouse.up();
|
||||
await h.until(async () => (await h.saved(page)).mode === 'right', 'the dock did not save a layout over the unreadable one');
|
||||
await shot('recovered');
|
||||
|
||||
await h.load(page, go, JSON.stringify({ mode: 'left', w: 460 }));
|
||||
const layout = await h.stored(page);
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await h.expand(page);
|
||||
box = await dock.boundingBox();
|
||||
assert.ok(box.x >= 0 && box.x + box.width <= 390, 'the dock overflows the phone viewport');
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
assert.equal(await h.stored(page), layout, 'visiting phone width rewrote the saved layout');
|
||||
await h.until(async () => Math.abs((await dock.boundingBox()).width - 460) <= 1, 'the desktop layout did not return after phone width');
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
// The chat dock at phone width: the bar and the open conversation fit the
|
||||
// screen on a few pages, a stored desktop pin is ignored, the composer stays
|
||||
// reachable, and the dock adds no sideways scroll. The page's own overflow is
|
||||
// phone-overflow's to report, so the dock is measured against the page
|
||||
// without it.
|
||||
const assert = require('node:assert/strict');
|
||||
const h = require('./helpers/chat-dock.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, tolerate }) => {
|
||||
tolerate(/extensions\/catalogue/);
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
const fits = async (label) => {
|
||||
const { scroll, bare, inner } = await page.evaluate(() => {
|
||||
const root = document.querySelector('aside[aria-label="Chat with Archie"]').parentElement;
|
||||
const scroll = document.documentElement.scrollWidth;
|
||||
root.style.display = 'none';
|
||||
const bare = document.documentElement.scrollWidth;
|
||||
root.style.display = '';
|
||||
return { scroll, bare, inner: window.innerWidth };
|
||||
});
|
||||
assert.ok(scroll <= Math.max(bare, inner), `${label}: the dock widens the page (${scroll} > ${Math.max(bare, inner)})`);
|
||||
const box = await h.dockOf(page).boundingBox();
|
||||
assert.ok(box.x >= 0 && box.x + box.width <= inner, `${label}: dock leaves the screen (${box.x}..${box.x + box.width})`);
|
||||
assert.ok(box.y >= 0 && box.y + box.height <= 844, `${label}: dock leaves the screen vertically`);
|
||||
};
|
||||
|
||||
for (const path of ['/events', '/account', '/org/agents']) {
|
||||
await h.load(page, go, JSON.stringify({ side: 'right', width: 420 }));
|
||||
await go(path);
|
||||
await fits(`${path} collapsed`);
|
||||
await h.expand(page);
|
||||
await fits(`${path} open`);
|
||||
assert.equal(await page.evaluate(() => document.documentElement.style.getPropertyValue('--chat-pin-r')), '0px', `${path}: the page reserved room for a pin on a phone`);
|
||||
const composer = await h.composerOf(page).boundingBox();
|
||||
assert.ok(composer.y + composer.height <= 844 && composer.x >= 0 && composer.x + composer.width <= 390, `${path}: composer is off screen`);
|
||||
assert.equal(await h.dividerOf(page).count(), 0, `${path}: a phone shows the pin divider`);
|
||||
await h.composerOf(page).fill('A long unbroken line '.repeat(20));
|
||||
await fits(`${path} long draft`);
|
||||
await shot(path);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
// The # task picker by keyboard: arrows move the selection and wrap, Enter
|
||||
// attaches the selected task, Escape closes the picker and leaves the
|
||||
// conversation open, and an IME confirmation Enter never picks.
|
||||
const assert = require('node:assert/strict');
|
||||
const h = require('./helpers/chat-dock.cjs');
|
||||
|
||||
const tasks = [
|
||||
{ id: 1861, title: 'Task picker', status: 'running' },
|
||||
{ id: 1842, title: 'Retry stalled task runs', status: 'done' },
|
||||
{ id: 1830, title: 'Filter forge text', status: 'queued' },
|
||||
];
|
||||
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await page.route('**/api/tasks?*', (route) => route.fulfill({ contentType: 'application/json', body: JSON.stringify(tasks) }));
|
||||
await h.load(page, go);
|
||||
await h.expand(page);
|
||||
const composer = h.composerOf(page);
|
||||
const palette = page.getByRole('listbox', { name: 'Tasks' });
|
||||
const options = palette.getByRole('option');
|
||||
const selected = () => options.evaluateAll((els) => els.findIndex((el) => el.getAttribute('aria-selected') === 'true'));
|
||||
const tags = page.getByRole('list', { name: 'Attached tasks' });
|
||||
|
||||
await composer.fill('Look at #');
|
||||
await options.first().waitFor();
|
||||
assert.equal(await options.count(), 3);
|
||||
assert.equal(await selected(), 0);
|
||||
await shot('picker');
|
||||
|
||||
await composer.press('ArrowDown');
|
||||
assert.equal(await selected(), 1);
|
||||
assert.equal(await composer.getAttribute('aria-activedescendant'), 'slash-palette-option-1');
|
||||
await composer.press('ArrowUp');
|
||||
await composer.press('ArrowUp');
|
||||
assert.equal(await selected(), 2, 'ArrowUp from the first row did not wrap to the last');
|
||||
await composer.press('ArrowDown');
|
||||
assert.equal(await selected(), 0, 'ArrowDown from the last row did not wrap to the first');
|
||||
await composer.press('ArrowDown');
|
||||
|
||||
for (const event of [{ isComposing: true }, { keyCode: 229 }]) {
|
||||
await composer.dispatchEvent('keydown', { key: 'Enter', bubbles: true, cancelable: true, ...event });
|
||||
assert.equal(await options.count(), 3, 'an IME confirmation closed the picker');
|
||||
assert.equal(await tags.count(), 0, 'an IME confirmation attached a task');
|
||||
}
|
||||
|
||||
await composer.press('Enter');
|
||||
await palette.waitFor({ state: 'hidden' });
|
||||
await tags.getByText('#1842').waitFor();
|
||||
assert.equal(await tags.getByRole('listitem').count(), 1);
|
||||
assert.equal(await composer.inputValue(), 'Look at ', 'the # token stayed in the text');
|
||||
assert.ok(await composer.evaluate((el) => document.activeElement === el), 'focus left the composer');
|
||||
|
||||
await composer.fill('Look at #');
|
||||
await options.first().waitFor();
|
||||
await composer.press('Escape');
|
||||
await palette.waitFor({ state: 'hidden' });
|
||||
assert.equal(await h.hideOf(page).isVisible(), true, 'Escape on the picker also closed the conversation');
|
||||
await composer.press('Escape');
|
||||
await h.hideOf(page).waitFor({ state: 'hidden' });
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
// Pinning the chat dock: dragging its header to an edge pins it there and the
|
||||
// page reflows beside it; double-clicking the header unpins it; hiding the
|
||||
// conversation gives the page back its width; the choice survives a reload.
|
||||
const assert = require('node:assert/strict');
|
||||
const h = require('./helpers/chat-dock.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await h.load(page, go);
|
||||
await h.expand(page);
|
||||
const dock = h.dockOf(page);
|
||||
const free = await h.mainRect(page);
|
||||
const floating = await dock.boundingBox();
|
||||
assert.ok(floating.height < 900, 'the dock starts as a floating card');
|
||||
|
||||
await h.dragTo(page, 1430);
|
||||
await page.mouse.up();
|
||||
await h.until(async () => (await h.saved(page)).side === 'right', 'dragging to the right edge did not pin right');
|
||||
const right = await dock.boundingBox();
|
||||
h.near(right.x + right.width, 1440, 'right pin touches the right edge');
|
||||
h.near(right.height, 900, 'a pinned dock is full height');
|
||||
const reflowed = await h.mainRect(page);
|
||||
assert.ok(reflowed.x + reflowed.width <= right.x + 1, `page content runs under the pinned dock: ${reflowed.x + reflowed.width} > ${right.x}`);
|
||||
assert.ok(reflowed.width < free.width, 'the page did not give up any width');
|
||||
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth), 'pinning made the page scroll sideways');
|
||||
await shot('pinned-right');
|
||||
|
||||
await page.reload();
|
||||
await h.expand(page);
|
||||
await h.until(async () => Math.abs((await dock.boundingBox()).x - right.x) <= 1, 'the right pin did not survive a reload');
|
||||
|
||||
await h.hideOf(page).click();
|
||||
await h.until(async () => Math.abs((await h.mainRect(page)).width - free.width) <= 1, 'hiding the conversation kept the page narrowed');
|
||||
await h.expand(page);
|
||||
await h.until(async () => Math.abs((await dock.boundingBox()).x - right.x) <= 1, 'reopening did not restore the pin');
|
||||
|
||||
const strip = await h.grip(page);
|
||||
await page.mouse.dblclick(strip.x, strip.y);
|
||||
await h.until(async () => (await h.saved(page)).side === null, 'double-clicking the header did not unpin');
|
||||
assert.ok((await dock.boundingBox()).height < 900, 'an unpinned dock is a floating card again');
|
||||
h.near((await h.mainRect(page)).width, free.width, 'the page returns to its full width');
|
||||
|
||||
await h.dragTo(page, 10);
|
||||
await page.mouse.up();
|
||||
await h.until(async () => (await h.saved(page)).side === 'left', 'dragging to the left edge did not pin left');
|
||||
const left = await dock.boundingBox();
|
||||
h.near(left.x, 0, 'left pin touches the left edge');
|
||||
assert.ok((await h.mainRect(page)).x >= left.x + left.width - 1, 'page content runs under the left-pinned dock');
|
||||
await shot('pinned-left');
|
||||
|
||||
await page.mouse.dblclick((await h.grip(page)).x, (await h.grip(page)).y);
|
||||
await h.until(async () => (await h.saved(page)).side === null, 'double-clicking did not unpin the left pin');
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
// The pinned dock's divider is a keyboard separator: the arrow toward the
|
||||
// page widens the dock, the arrow away narrows it, both stop at the allowed
|
||||
// range, and the width is saved.
|
||||
const assert = require('node:assert/strict');
|
||||
const h = require('./helpers/chat-dock.cjs');
|
||||
|
||||
const width = (page) => h.dockOf(page).boundingBox().then((b) => Math.round(b.width));
|
||||
const value = (page) => h.dividerOf(page).getAttribute('aria-valuenow').then(Number);
|
||||
|
||||
module.exports = async ({ page, go }) => {
|
||||
const divider = h.dividerOf(page);
|
||||
for (const [side, grow, shrink] of [['right', 'ArrowLeft', 'ArrowRight'], ['left', 'ArrowRight', 'ArrowLeft']]) {
|
||||
await h.load(page, go, JSON.stringify({ side, width: 420 }));
|
||||
await h.expand(page);
|
||||
await divider.focus();
|
||||
assert.equal(await value(page), 420);
|
||||
assert.equal(await divider.getAttribute('aria-valuemin'), '320');
|
||||
|
||||
await page.keyboard.press(grow);
|
||||
await h.until(async () => (await value(page)) === 436 && (await width(page)) === 436, `${side}: ${grow} did not widen by 16`);
|
||||
await page.keyboard.press(shrink);
|
||||
await page.keyboard.press(shrink);
|
||||
await h.until(async () => (await value(page)) === 404 && (await width(page)) === 404, `${side}: ${shrink} did not narrow by 16`);
|
||||
assert.equal((await h.saved(page)).width, 404, `${side}: the width was not saved`);
|
||||
|
||||
await page.keyboard.press('ArrowUp');
|
||||
assert.equal(await value(page), 404, `${side}: a vertical arrow resized the dock`);
|
||||
|
||||
for (let i = 0; i < 12; i++) await page.keyboard.press(shrink);
|
||||
await h.until(async () => (await width(page)) === 320, `${side}: the dock narrowed past its minimum`);
|
||||
assert.equal(await value(page), 320);
|
||||
|
||||
for (let i = 0; i < 30; i++) await page.keyboard.press(grow);
|
||||
await h.until(async () => (await width(page)) === 720, `${side}: the dock widened past its maximum`);
|
||||
assert.equal(await value(page), 720);
|
||||
}
|
||||
};
|
||||
@@ -12,8 +12,7 @@ module.exports = async ({ page, go, shot }) => {
|
||||
agent = await response.json();
|
||||
};
|
||||
const openSettings = async () => {
|
||||
await go('/workflows');
|
||||
await page.getByRole('button', { name: /^implement/ }).click();
|
||||
await go('/workflows/implement');
|
||||
const runPicker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
if (await runPicker.count()) { await runPicker.click(); await page.getByRole('option', { name: 'Definition', exact: true }).click(); }
|
||||
await page.locator('.vue-flow__node').filter({ hasText: 'Workflow' }).first().click();
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// Shared handles for the chat dock checks: the dock's own storage key, its
|
||||
// landmarks, and the pointer gestures that pin it.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const KEY = 'archie.chat.dock.v2';
|
||||
|
||||
const dockOf = (page) => page.getByRole('complementary', { name: 'Chat with Archie' });
|
||||
const composerOf = (page) => page.getByRole('combobox', { name: 'Message Archie', exact: true });
|
||||
const hideOf = (page) => page.getByRole('button', { name: 'Hide conversation' });
|
||||
const dividerOf = (page) => page.getByRole('separator', { name: 'Resize chat' });
|
||||
|
||||
const stored = (page) => page.evaluate((key) => localStorage.getItem(key), KEY);
|
||||
const saved = async (page) => JSON.parse(await stored(page));
|
||||
|
||||
// Loads /events with the given stored layout (a string, or null for none).
|
||||
async function load(page, go, layout = null) {
|
||||
await go('/events');
|
||||
await page.evaluate(([key, value]) => (value === null ? localStorage.removeItem(key) : localStorage.setItem(key, value)), [KEY, layout]);
|
||||
await go('/events');
|
||||
}
|
||||
|
||||
// Focusing the composer is how the operator opens the conversation.
|
||||
async function expand(page) {
|
||||
await composerOf(page).focus();
|
||||
await hideOf(page).waitFor();
|
||||
}
|
||||
|
||||
// Retries an assertion until it holds: the dock settles over a few frames.
|
||||
async function until(check, message, timeout = 5000) {
|
||||
const end = Date.now() + timeout;
|
||||
let last;
|
||||
for (;;) {
|
||||
try {
|
||||
const ok = await check();
|
||||
if (ok) return;
|
||||
last = ok;
|
||||
} catch (e) {
|
||||
last = e;
|
||||
}
|
||||
if (Date.now() > end) throw new Error(`${message}${last instanceof Error ? `: ${last.message}` : ''}`);
|
||||
await new Promise((r) => setTimeout(r, 50));
|
||||
}
|
||||
}
|
||||
|
||||
const near = (a, b, message, tolerance = 1) => assert.ok(Math.abs(a - b) <= tolerance, `${message}: ${a} is not within ${tolerance} of ${b}`);
|
||||
|
||||
// The empty strip at the top of the header, where a drag starts.
|
||||
async function grip(page) {
|
||||
const box = await dockOf(page).boundingBox();
|
||||
return { x: box.x + box.width / 2, y: box.y + 8 };
|
||||
}
|
||||
|
||||
async function dragTo(page, x, steps = 10) {
|
||||
const from = await grip(page);
|
||||
await page.mouse.move(from.x, from.y);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(x, from.y, { steps });
|
||||
return from;
|
||||
}
|
||||
|
||||
const mainRect = (page) => page.locator('#main-content').boundingBox();
|
||||
|
||||
module.exports = { KEY, dockOf, composerOf, hideOf, dividerOf, stored, saved, load, expand, until, near, grip, dragTo, mainRect };
|
||||
@@ -10,7 +10,7 @@ module.exports=async({page,go,shot,tolerate})=>{
|
||||
if(new URL(route.request().url()).searchParams.has('workflow')) await route.fulfill({status:200,contentType:'application/json',body:'unreadable response'});
|
||||
else await route.continue();
|
||||
});
|
||||
await go('/workflows');
|
||||
await go('/workflows/implement');
|
||||
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor();
|
||||
await page.getByRole('tab',{name:/^Runs/}).click();
|
||||
assert.equal(await page.getByText('No runs yet',{exact:true}).count(),0);
|
||||
|
||||
@@ -8,7 +8,7 @@ module.exports = async ({ page, go, shot, tolerate }) => {
|
||||
tolerate(ABSENT);
|
||||
await go('/');
|
||||
assert.equal((await selectOrg(page, ORG.beta)).status(), 204);
|
||||
await go('/workflows?workflow=feasibility');
|
||||
await go('/workflows/feasibility');
|
||||
const origin = new URL(page.url()).origin;
|
||||
const headers = { 'X-Archie-CSRF': '1', Origin: origin };
|
||||
const created = await page.request.post(`${origin}/api/bindings`, {
|
||||
@@ -22,7 +22,7 @@ module.exports = async ({ page, go, shot, tolerate }) => {
|
||||
assert.equal(created.status(), 201, `binding on the built-in schedule mapping refused: ${await created.text()}`);
|
||||
const binding = await created.json();
|
||||
assert.equal(binding.org_id, ORG.beta);
|
||||
await go('/workflows?workflow=feasibility');
|
||||
await go('/workflows/feasibility');
|
||||
await page.getByText('Starts when').first().waitFor();
|
||||
await shot('beta-trigger');
|
||||
} finally {
|
||||
|
||||
@@ -7,7 +7,7 @@ module.exports = async ({ page, go, shot }) => {
|
||||
await go('/workflows');
|
||||
assert.equal(await page.getByText('No workflows', { exact: true }).count(), 0, 'loading presented as empty');
|
||||
await page.getByText('Loading workflows…', { exact: true }).waitFor({ state: 'hidden' });
|
||||
await page.getByRole('button', { name: /^implement/ }).click();
|
||||
await page.getByRole('link', { name: /^implement/ }).click();
|
||||
assert.equal(await page.getByText(/workflow implement has no steps/).count(), 0, 'late definition left an empty canvas');
|
||||
await page.locator('.vue-flow__node').filter({ hasText: 'Repository' }).first().waitFor();
|
||||
await shot('loaded');
|
||||
|
||||
@@ -29,25 +29,28 @@ module.exports = async ({ page, go, shot, settled }) => {
|
||||
const definition = resource.resource.value.definitions.find(entry => entry.id === 'feasibility');
|
||||
definition.yaml = definition.yaml.replace(/\bid: assess\b/, 'id: Write a Product Requirement Document').replaceAll('steps.assess.', 'steps.Write a Product Requirement Document.');
|
||||
await page.route('**/api/control-plane/resources/workflow-definitions', route => route.fulfill({ json: resource }));
|
||||
await go('/workflows?workflow=feasibility');
|
||||
await page.getByRole('tab', { name: 'YAML', exact: true }).click();
|
||||
await go('/workflows/feasibility');
|
||||
await page.getByRole('tab', { name: 'History', exact: true }).click();
|
||||
const yaml = await page.getByLabel('Workflow YAML', { exact: true }).inputValue();
|
||||
assert.ok(yaml.includes('id: write-a-product-requirement-document'));
|
||||
assert.ok(yaml.includes('steps.write-a-product-requirement-document.result'));
|
||||
assert.ok(!yaml.includes('steps.Write a Product Requirement Document'));
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).click();
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).first().click();
|
||||
const definitionPicker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
if (await definitionPicker.count()) { await definitionPicker.click(); await page.getByRole('option', { name: 'Definition', exact: true }).click(); }
|
||||
const approval = page.locator('.vue-flow__node').filter({ hasText: 'Approval' }).first();
|
||||
await panTo(approval);
|
||||
await approval.click();
|
||||
const chip = approval.getByRole('button', { name: 'write-a-product-requirement-document', exact: true });
|
||||
await chip.waitFor();
|
||||
await chip.click();
|
||||
assert.match(await approval.getByLabel('Plan', { exact: true }).inputValue(), /steps\.write-a-product-requirement-document\.summary/);
|
||||
await shot('legacy-reference');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.getByRole('tab', { name: 'YAML', exact: true }).click();
|
||||
await page.getByRole('tab', { name: 'History', exact: true }).click();
|
||||
const field = page.getByLabel('Workflow YAML', { exact: true });
|
||||
await field.fill((await field.inputValue()).replace('type: repo.prepare', 'type: repo.prepare\n when: not-a-valid-expression'));
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).click();
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).first().click();
|
||||
const problem = page.locator('.vue-flow__node').filter({ hasText: 'Prepare worktree' }).first().locator('svg.text-danger');
|
||||
await problem.waitFor();
|
||||
const toolbarProblem = page.getByRole('status').filter({ has: page.locator('svg') });
|
||||
@@ -68,7 +71,7 @@ module.exports = async ({ page, go, shot, settled }) => {
|
||||
await page.route('**/api/tasks/999999/*?*', route => route.fulfill({ json: {} }));
|
||||
await page.route('**/api/tasks/999999/debug', route => route.fulfill({ json: {} }));
|
||||
await page.route('**/api/tasks/999999/attempts', route => route.fulfill({ json: { attempts: [{ attempt: 1, stages: [{ name: 'Write a Product Requirement Document', status: 'failed', error: 'Historical failure' }] }] } }));
|
||||
await go('/workflows?workflow=feasibility');
|
||||
await go('/workflows/feasibility');
|
||||
const picker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
await picker.waitFor();
|
||||
assert.match(await picker.innerText(), /Run #999999/);
|
||||
@@ -89,7 +92,7 @@ module.exports = async ({ page, go, shot, settled }) => {
|
||||
await page.getByRole('option', { name: 'Definition', exact: true }).click();
|
||||
assert.equal(await picker.innerText(), 'Definition');
|
||||
await shot('definition-picker');
|
||||
await go('/workflows?workflow=triage');
|
||||
await go('/workflows/triage');
|
||||
const runPicker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
if (await runPicker.count()) { await runPicker.click(); await page.getByRole('option', { name: 'Definition', exact: true }).click(); }
|
||||
await page.locator('.vue-flow').hover();
|
||||
@@ -105,14 +108,14 @@ module.exports = async ({ page, go, shot, settled }) => {
|
||||
await target.press('Home');
|
||||
await shot('dynamic-handoff');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.getByRole('tab', { name: 'YAML', exact: true }).click();
|
||||
await page.getByRole('tab', { name: 'History', exact: true }).click();
|
||||
assert.ok((await page.getByLabel('Workflow YAML', { exact: true }).inputValue()).includes('steps.classify.result.alternative'));
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).click();
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).first().click();
|
||||
await panTo(handoff);
|
||||
await handoff.click();
|
||||
await target.fill('implement');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.getByRole('tab', { name: 'YAML', exact: true }).click();
|
||||
await page.getByRole('tab', { name: 'History', exact: true }).click();
|
||||
assert.ok((await page.getByLabel('Workflow YAML', { exact: true }).inputValue()).includes('workflow: implement'));
|
||||
};
|
||||
@@ -6,8 +6,23 @@ const assert = require('node:assert/strict');
|
||||
|
||||
module.exports = async ({ page, go, shot, settled }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
// The list is a page at phone width: rows open the workflow, and the
|
||||
// enabled switch is on the row and on the workflow page.
|
||||
await go('/workflows');
|
||||
const row = page.getByRole('link', { name: /^implement/ });
|
||||
await row.waitFor();
|
||||
const listWidth = await page.evaluate(() => ({ scrollWidth: document.documentElement.scrollWidth, width: innerWidth }));
|
||||
assert.equal(listWidth.scrollWidth, listWidth.width, 'workflow list scrolls horizontally');
|
||||
await shot('list');
|
||||
await page.getByRole('switch', { name: 'implement enabled' }).waitFor();
|
||||
await row.click();
|
||||
await page.waitForURL(/\/workflows\/implement$/);
|
||||
await page.locator('.workflow-canvas').waitFor();
|
||||
await page.getByRole('switch', { name: 'implement enabled' }).waitFor();
|
||||
await go('/workflows?workflow=implement');
|
||||
assert.match(page.url(), /\/workflows\/implement$/, 'legacy ?workflow= link did not reach the workflow page');
|
||||
for (const workflow of ['implement', 'feasibility']) {
|
||||
await go(`/workflows?workflow=${workflow}`);
|
||||
await go(`/workflows/${workflow}`);
|
||||
const canvas = page.locator('.workflow-canvas');
|
||||
await canvas.waitFor();
|
||||
const dimensions = await page.evaluate(() => ({
|
||||
@@ -31,14 +46,17 @@ module.exports = async ({ page, go, shot, settled }) => {
|
||||
left: el.getBoundingClientRect().left, right: el.getBoundingClientRect().right,
|
||||
})));
|
||||
assert.ok(nodes.every(node => node.left >= box.x && node.right <= box.x + box.width), 'branch lanes clipped horizontally');
|
||||
const controls = await page.getByRole('button', { name: 'Zoom in', exact: true }).boundingBox();
|
||||
const flow = await canvas.locator('.vue-flow').boundingBox();
|
||||
assert.ok(controls.y >= flow.y + flow.height, 'zoom control overlays graph');
|
||||
const controls = await page.getByRole('group', { name: 'Zoom', exact: true }).boundingBox();
|
||||
const covered = await page.locator('.vue-flow__node').evaluateAll((elements, c) => elements.some((el) => {
|
||||
const r = el.getBoundingClientRect();
|
||||
return r.left < c.x + c.width && r.right > c.x && r.top < c.y + c.height && r.bottom > c.y;
|
||||
}), controls);
|
||||
assert.ok(!covered, 'zoom controls cover a step');
|
||||
await shot(workflow);
|
||||
const step = page.locator('.vue-flow__node').filter({ hasText: 'Prepare worktree' }).first();
|
||||
assert.equal(await step.locator('[data-slot="badge"]').innerText(), 'Prepare worktree');
|
||||
assert.match(await step.innerText(), /^\d+\.\s+Prepare worktree$/);
|
||||
await step.click();
|
||||
const dialog = page.getByRole('dialog');
|
||||
const dialog = page.locator('[role="dialog"][data-slot="dialog-content"]');
|
||||
await dialog.waitFor();
|
||||
const dialogBox = await dialog.boundingBox();
|
||||
assert.ok(dialogBox.x >= 0 && dialogBox.x + dialogBox.width <= 390, 'step editor exceeds phone width');
|
||||
@@ -47,19 +65,19 @@ module.exports = async ({ page, go, shot, settled }) => {
|
||||
await shot(`${workflow}-step`);
|
||||
await page.keyboard.press('Escape');
|
||||
await run.click();
|
||||
await page.getByRole('dialog').waitFor();
|
||||
await page.locator('[role="dialog"][data-slot="dialog-content"]').waitFor();
|
||||
await shot(`${workflow}-run`);
|
||||
await page.keyboard.press('Escape');
|
||||
}
|
||||
// YAML must not make the page scroll at phone width.
|
||||
await go('/workflows?workflow=feasibility');
|
||||
await page.getByRole('tab', { name: 'YAML', exact: true }).click();
|
||||
await go('/workflows/feasibility');
|
||||
await page.getByRole('tab', { name: 'History', exact: true }).click();
|
||||
await settled();
|
||||
const yamlPage = await page.evaluate(() => ({
|
||||
scrollHeight: document.documentElement.scrollHeight, height: innerHeight,
|
||||
}));
|
||||
assert.equal(yamlPage.scrollHeight, yamlPage.height, 'YAML causes page scroll');
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).click();
|
||||
await page.getByRole('tab', { name: 'Canvas', exact: true }).first().click();
|
||||
// A pinned historical run keeps its header visible on the canvas.
|
||||
const response = await page.request.get(new URL('/api/control-plane/resources/workflow-definitions', page.url()).href);
|
||||
const resource = await response.json();
|
||||
@@ -73,7 +91,7 @@ module.exports = async ({ page, go, shot, settled }) => {
|
||||
await page.route('**/api/tasks/999999/*?*', route => route.fulfill({ json: {} }));
|
||||
await page.route('**/api/tasks/999999/debug', route => route.fulfill({ json: {} }));
|
||||
await page.route('**/api/tasks/999999/attempts', route => route.fulfill({ json: { attempts: [{ attempt: 1, stages: [] }] } }));
|
||||
await go('/workflows?workflow=feasibility');
|
||||
await go('/workflows/feasibility');
|
||||
const picker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
await picker.waitFor();
|
||||
assert.match(await picker.innerText(), /Run #999999/);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
const assert = require('node:assert/strict');
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await go('/workflows');
|
||||
await page.getByRole('button', {name:/^implement/}).click();
|
||||
await go('/workflows/implement');
|
||||
const runPicker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
if (await runPicker.count()) { await runPicker.click(); await page.getByRole('option', { name: 'Definition', exact: true }).click(); }
|
||||
await page.locator('.vue-flow__node').filter({hasText:'Prepare worktree'}).first().click();
|
||||
const more=page.getByRole('button',{name:'More',exact:true}).filter({hasText:'More'});
|
||||
if (await more.getAttribute('aria-expanded')==='false') await more.click();
|
||||
const condition=page.getByLabel('Run only when', {exact:true});
|
||||
await condition.fill('what');
|
||||
await page.getByRole('alert').filter({hasText:'when must name'}).first().waitFor();
|
||||
@@ -17,7 +18,7 @@ module.exports = async ({ page, go, shot }) => {
|
||||
await page.getByLabel('Run only when',{exact:true}).focus();
|
||||
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor({state:'hidden'});
|
||||
await page.getByRole('combobox',{name:'Unit',exact:true}).selectOption('m');
|
||||
await page.getByRole('tab',{name:'YAML',exact:true}).click();
|
||||
await page.getByRole('tab',{name:'History',exact:true}).click();
|
||||
assert.match(await page.getByLabel('Workflow YAML',{exact:true}).inputValue(), /backoff: 30s/);
|
||||
await shot('validated');
|
||||
};
|
||||
+15
-1
@@ -72,7 +72,10 @@ start_pg() {
|
||||
prepare() {
|
||||
mkdir -p "$dir"/{bin,logs,pids} "$XDG_CONFIG_HOME/archie" "$XDG_DATA_HOME" "$XDG_STATE_HOME"
|
||||
[ -f "$XDG_CONFIG_HOME/archie/config.toml" ] || cp "$repo/config.example.toml" "$XDG_CONFIG_HOME/archie/config.toml"
|
||||
sed "s#^database_url = .*#database_url = \"postgres://archie@127.0.0.1:$pgport/archie?sslmode=disable\"#" \
|
||||
# The services serve from the least-privilege role and migrate as the schema
|
||||
# owner; initdb's archie role is the throwaway server's superuser only.
|
||||
sed -e "s#^database_url = .*#database_url = \"postgres://archie_runtime@127.0.0.1:$pgport/archie?sslmode=disable\"#" \
|
||||
-e "s#^migration_database_url = .*#migration_database_url = \"postgres://archie_migrator@127.0.0.1:$pgport/archie?sslmode=disable\"#" \
|
||||
"$repo/deployments/dev.toml" >"$dir/dev.toml"
|
||||
local version
|
||||
version=$(git -C "$repo" describe --tags --exact-match --match 'v[0-9]*' 2>/dev/null || true)
|
||||
@@ -101,6 +104,16 @@ start_service() {
|
||||
spawn "$1" "$repo" "$dir/bin/$1" -config-overlay "$dir/dev.toml"
|
||||
}
|
||||
|
||||
# provision_roles creates the least-privilege roles the stack connects as. The
|
||||
# throwaway server runs with trust auth, so the role URLs' passwords are never
|
||||
# checked; they are here only because provision sets the role password it reads.
|
||||
provision_roles() {
|
||||
"$dir/bin/archie-state-store" provision \
|
||||
-admin-url "postgres://archie@127.0.0.1:$pgport/archie?sslmode=disable" \
|
||||
-runtime-url "postgres://archie_runtime:e2e@127.0.0.1:$pgport/archie?sslmode=disable" \
|
||||
-migration-url "postgres://archie_migrator:e2e@127.0.0.1:$pgport/archie?sslmode=disable"
|
||||
}
|
||||
|
||||
stop_pid() {
|
||||
local f=$1 pid
|
||||
[ -f "$f" ] || return 0
|
||||
@@ -123,6 +136,7 @@ start() {
|
||||
trap 'trap - ERR; stop' ERR
|
||||
prepare
|
||||
start_pg 9>&-
|
||||
provision_roles
|
||||
start_service archie-state-store
|
||||
wait_port 9091 archie-state-store 90
|
||||
local s
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
# Gitea agent-run view
|
||||
|
||||
Untracked reference copies — deploy by hand onto the gitea container.
|
||||
|
||||
Renders inside Gitea's own Actions page (real `base/head` / `repo/header`
|
||||
/ `base/footer`, real `.Repository`/`.CurWorkflow` context) via the
|
||||
`body_inner_post.tmpl` hook — no full-file template override needed.
|
||||
Confirmed 2026-07-22 that this hook receives the same per-page context
|
||||
as `templates/repo/actions/list.tmpl`.
|
||||
|
||||
## Files → destinations
|
||||
|
||||
| file | destination on gitea container | role |
|
||||
| ---------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------- |
|
||||
| `extra_tabs.tmpl` | `$GITEA_CUSTOM/templates/custom/extra_tabs.tmpl` | adds the "Agent Run" repo tab |
|
||||
| `body_inner_post.tmpl` | `$GITEA_CUSTOM/templates/custom/body_inner_post.tmpl` | loads the CDN CSS/JS + agent-monitor.js, gated on the sentinel |
|
||||
| `agent-monitor.js` | `$GITEA_CUSTOM/public/assets/agent-monitor.js` | swaps the runs-list segment's content for the terminal, opens the SSE connection |
|
||||
|
||||
`$GITEA_CUSTOM` is usually `/data/gitea` in the container — confirm via
|
||||
Site Administration > Configuration, or `gitea help`.
|
||||
|
||||
Restart Gitea after copying either file (custom/templates is only read
|
||||
at startup unless `RUN_MODE = dev`).
|
||||
|
||||
## How it fits together
|
||||
|
||||
`extra_tabs.tmpl` links to the real `/actions` route with a sentinel
|
||||
`?workflow=__agent_monitor__`. Gitea's Actions handler happily sets
|
||||
`.CurWorkflow` to that string (it doesn't validate it matches a real
|
||||
workflow file) and renders the stock page as normal — sidebar, run-count
|
||||
bar, "0 workflow runs" panel, all real Gitea markup. `body_inner_post.tmpl`
|
||||
then fires on that same page, sees the sentinel, and loads
|
||||
`agent-monitor.js`, which:
|
||||
|
||||
1. finds the real `.ui.attached.segment` inside `.flex-container-main`
|
||||
— the element list.tmpl already sizes correctly to hold the runs
|
||||
list — and swaps its content for the terminal, rather than hiding or
|
||||
duplicating anything
|
||||
2. hides the run-count/filter bar directly above that segment (nothing
|
||||
to filter once the terminal's showing)
|
||||
3. styles the segment as a floating rounded card (border radius, shadow)
|
||||
4. mounts the xterm.js terminal inside it and opens the SSE connection
|
||||
|
||||
The sidebar is deliberately left alone — it's real, always-current Gitea
|
||||
markup (actual workflow files, actual routes). An earlier version tried
|
||||
hiding it and hardcoding a lookalike sidebar instead; that goes stale the
|
||||
moment a workflow is added/renamed, so it was dropped in favour of this.
|
||||
Nesting the terminal inside other stock wrapper classes (e.g.
|
||||
`.ui.top.attached.header`, meant for the slim counter bar) also produced
|
||||
a tiny clipped box in testing — reason `.ui.attached.segment` specifically
|
||||
is the target now.
|
||||
|
||||
**Why the terminal logic is a separate `.js` file, not inline in the
|
||||
template:** Gitea's CSP requires a per-request nonce for inline
|
||||
`<script>` blocks, and that nonce isn't exposed to custom/templates.
|
||||
External `<script src>` tags match the `*` already in `script-src` and
|
||||
load with zero CSP changes — discovered the hard way when the first
|
||||
inline-script version got silently blocked by the browser.
|
||||
|
||||
No stock Gitea file is copied or overridden, so there's nothing to
|
||||
re-diff on version bumps — this is the whole reason the hook route won
|
||||
out over overriding `list.tmpl`.
|
||||
|
||||
## Before it'll actually connect
|
||||
|
||||
`body_inner_post.tmpl` reads `internal/webui`'s `GET /events` SSE
|
||||
stream. Two things need doing on the archie-core side first:
|
||||
|
||||
1. **Reachability** — the browser loads Gitea's origin, so it needs a
|
||||
path to the webui SSE endpoint. Either reverse-proxy `/events` under
|
||||
Gitea's own host (cleanest — avoids CORS entirely), or add CORS
|
||||
headers to `handleSSE` in `internal/webui/webui.go` for Gitea's
|
||||
origin, and set `?webui=` on the tab link (or edit `WEBUI_BASE` in
|
||||
the template) to point at it.
|
||||
2. **Auth** — `internal/webui`'s own doc comment says "it has no auth" —
|
||||
this whole path is trusted-network only right now, same as the
|
||||
dashboard. Don't expose it publicly without adding one.
|
||||
|
||||
`/events` has no server-side repo/task filter; `agent-monitor.js`
|
||||
filters client-side on `event.repo`, so it still receives every task's
|
||||
events over the wire — fine at current volume, revisit if that stream
|
||||
gets busy.
|
||||
|
||||
Note: the `[cors]` section in Gitea's own `app.ini` does NOT help here —
|
||||
it controls CORS headers Gitea sends to let _other_ origins call Gitea's
|
||||
API, not the reverse (the browser, loaded from Gitea's origin, fetching
|
||||
archie-core's separate `internal/webui` server). The CORS header needs
|
||||
to live on that webui response, or use the reverse-proxy route instead.
|
||||
@@ -1,158 +0,0 @@
|
||||
// Copy to: $GITEA_CUSTOM/public/assets/agent-monitor.js
|
||||
// Referenced from body_inner_post.tmpl via
|
||||
// <script src="{{AppSubUrl}}/assets/agent-monitor.js" data-repo="{{.Repository.FullName}}">
|
||||
// rather than an inline <script> block — Gitea's CSP header requires a
|
||||
// per-request nonce for inline scripts that custom/templates has no way
|
||||
// to supply, but external script sources match the "*" already present
|
||||
// in script-src, so this loads fine with no CSP changes needed.
|
||||
//
|
||||
// Doesn't hide or duplicate list.tmpl's sidebar — that's real,
|
||||
// always-current Gitea markup. Instead it swaps the CONTENT of the
|
||||
// existing ".ui.attached.segment" (the element list.tmpl already sizes
|
||||
// correctly to hold the runs list) for the terminal. Nesting the
|
||||
// terminal inside other stock wrapper classes instead (e.g.
|
||||
// ".ui.top.attached.header", meant for the slim run-count bar) is what
|
||||
// produced a tiny clipped box in earlier testing — this element is the
|
||||
// right one.
|
||||
(function () {
|
||||
const scriptTag = document.currentScript;
|
||||
const repoFilter = scriptTag ? scriptTag.dataset.repo : "";
|
||||
console.log("[agent-monitor] loaded, repo=", repoFilter);
|
||||
|
||||
// Primary selector matches list.tmpl's structure; fall back to a looser
|
||||
// one (drop the .flex-container-main ancestor requirement) and finally
|
||||
// to "last .ui.attached.segment on the page" in case a workflow_dispatch
|
||||
// block or markup drift shifted things — log which one hit so a failed
|
||||
// match is visible in the console instead of silently doing nothing.
|
||||
const candidates = [
|
||||
".repository.actions .flex-container-main .ui.attached.segment",
|
||||
".repository.actions .ui.attached.segment",
|
||||
".ui.attached.segment",
|
||||
];
|
||||
let segment = null;
|
||||
for (const sel of candidates) {
|
||||
const found = document.querySelectorAll(sel);
|
||||
if (found.length) {
|
||||
segment = found[found.length - 1]; // last match = likely the runs-list one
|
||||
console.log(
|
||||
"[agent-monitor] matched selector:",
|
||||
sel,
|
||||
"(",
|
||||
found.length,
|
||||
"candidate(s))",
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!segment) {
|
||||
console.warn(
|
||||
"[agent-monitor] no .ui.attached.segment found on page — markup shape changed, nothing to swap",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// The run-count/filter bar sits directly above the segment; hide it,
|
||||
// there's nothing meaningful to filter once we're showing the terminal.
|
||||
const counterBar = segment.previousElementSibling;
|
||||
if (counterBar && counterBar.classList.contains("flex-left-right")) {
|
||||
counterBar.style.display = "none";
|
||||
}
|
||||
|
||||
segment.innerHTML = "";
|
||||
Object.assign(segment.style, {
|
||||
padding: "12px",
|
||||
borderRadius: "10px",
|
||||
overflow: "hidden",
|
||||
boxShadow: "0 2px 10px rgba(0,0,0,0.35)",
|
||||
background: "#1e1e1e",
|
||||
border: "none",
|
||||
height: "70vh",
|
||||
boxSizing: "border-box",
|
||||
});
|
||||
|
||||
const el = document.createElement("div");
|
||||
Object.assign(el.style, { height: "100%", width: "100%" });
|
||||
segment.appendChild(el);
|
||||
|
||||
// TODO: point this at wherever internal/webui (archie-core's SSE
|
||||
// dashboard) is reachable from the browser — reverse-proxy it under
|
||||
// this same host to avoid CORS. Override per-load with ?webui=.
|
||||
const WEBUI_BASE =
|
||||
new URLSearchParams(location.search).get("webui") ||
|
||||
"https://gitea.example.com/agent-events";
|
||||
|
||||
const term = new Terminal({
|
||||
convertEol: true,
|
||||
disableStdin: true,
|
||||
cursorBlink: false,
|
||||
fontSize: 13,
|
||||
});
|
||||
term.open(el);
|
||||
|
||||
// FitAddon sizes xterm's internal viewport (rows/cols) to match the
|
||||
// container's actual pixel size — without it xterm falls back to a
|
||||
// default 80x24 grid that doesn't match our div, which is what made
|
||||
// the terminal look mismatched/"out of place" against the card.
|
||||
if (window.FitAddon) {
|
||||
const fit = new window.FitAddon.FitAddon();
|
||||
term.loadAddon(fit);
|
||||
fit.fit();
|
||||
window.addEventListener("resize", () => fit.fit());
|
||||
}
|
||||
|
||||
term.writeln(
|
||||
`\x1b[90mconnecting to ${WEBUI_BASE} (repo=${repoFilter})...\x1b[0m`,
|
||||
);
|
||||
|
||||
function colorFor(stage) {
|
||||
switch (stage) {
|
||||
case "error":
|
||||
return "\x1b[31m";
|
||||
case "done":
|
||||
return "\x1b[32m";
|
||||
default:
|
||||
return "\x1b[36m";
|
||||
}
|
||||
}
|
||||
|
||||
function render(e) {
|
||||
if (repoFilter && e.repo && e.repo !== repoFilter) return;
|
||||
const ts = new Date().toLocaleTimeString();
|
||||
const tag = [e.workflow, e.stage].filter(Boolean).join(":");
|
||||
term.writeln(
|
||||
`\x1b[90m${ts}\x1b[0m ${colorFor(e.stage)}[${tag || "event"}]\x1b[0m ${e.detail || ""}`,
|
||||
);
|
||||
if (e.data && Object.keys(e.data).length) {
|
||||
term.writeln(`\x1b[90m ${JSON.stringify(e.data)}\x1b[0m`);
|
||||
}
|
||||
}
|
||||
|
||||
// A new line per failed attempt spams the screen when the endpoint is
|
||||
// unreachable for a while (each retry is 3s apart, but it adds up).
|
||||
// Print the "lost" message once per disconnect, then just tick dots on
|
||||
// the same line so it still reads as "trying," not a wall of red text.
|
||||
let retrying = false;
|
||||
function connect() {
|
||||
const es = new EventSource(WEBUI_BASE + "/events");
|
||||
es.onopen = () => {
|
||||
if (retrying) term.writeln("\x1b[32m connected\x1b[0m");
|
||||
retrying = false;
|
||||
};
|
||||
es.onmessage = (msg) => {
|
||||
try {
|
||||
render(JSON.parse(msg.data));
|
||||
} catch {}
|
||||
};
|
||||
es.onerror = () => {
|
||||
es.close();
|
||||
if (!retrying) {
|
||||
term.writeln("\x1b[31mconnection lost, retrying...\x1b[0m");
|
||||
retrying = true;
|
||||
} else {
|
||||
term.write("\x1b[31m.\x1b[0m");
|
||||
}
|
||||
setTimeout(connect, 3000);
|
||||
};
|
||||
}
|
||||
connect();
|
||||
})();
|
||||
@@ -1,36 +0,0 @@
|
||||
{{/*
|
||||
Copy to: $GITEA_CUSTOM/templates/custom/body_inner_post.tmpl
|
||||
This is an optional hook file Gitea looks for if present (like
|
||||
extra_links.tmpl) — nothing to diff against upstream, no maintenance
|
||||
burden across Gitea version bumps, unlike overriding list.tmpl outright.
|
||||
|
||||
Confirmed empirically (2026-07-22): this hook gets the SAME per-page
|
||||
context as templates/repo/actions/list.tmpl — .CurWorkflow, .Repository
|
||||
etc. are all real values here, not a stripped-down base context.
|
||||
|
||||
Renders the agent terminal in place of the normal Actions runs list
|
||||
when the tab link's sentinel ?workflow=__agent_monitor__ is present.
|
||||
|
||||
Does NOT hide or rebuild list.tmpl's sidebar/menu — that's real,
|
||||
always-current Gitea markup (actual workflow files, actual routes) and
|
||||
duplicating it here as static HTML would go stale the moment a
|
||||
workflow is added/renamed/removed. Only the runs-list segment itself
|
||||
(".ui.attached.segment" inside ".flex-container-main") gets its
|
||||
content swapped for the terminal — done in JS (agent-monitor.js), not
|
||||
here, since that's the element list.tmpl already sized correctly to
|
||||
hold content; nesting the terminal inside other stock wrapper classes
|
||||
(e.g. ".ui.top.attached.header", meant for a slim counter bar) is what
|
||||
caused the tiny clipped box in testing.
|
||||
|
||||
The JS logic itself lives in the external agent-monitor.js (loaded via
|
||||
<script src>, not inline) because Gitea's CSP requires a per-request
|
||||
nonce for inline <script> blocks that custom/templates has no way to
|
||||
supply — external script sources match the "*" already in script-src
|
||||
and load fine without touching Gitea's CSP config at all.
|
||||
*/}}
|
||||
{{if eq $.CurWorkflow "__agent_monitor__"}}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5/css/xterm.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/xterm@5/lib/xterm.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0/lib/addon-fit.js"></script>
|
||||
<script src="{{AppSubUrl}}/assets/agent-monitor.js" data-repo="{{.Repository.FullName}}"></script>
|
||||
{{end}}
|
||||
@@ -1,18 +0,0 @@
|
||||
{{/*
|
||||
Copy to: $GITEA_CUSTOM/templates/custom/extra_tabs.tmpl
|
||||
(on the gitea container: /data/gitea/templates/custom/extra_tabs.tmpl,
|
||||
or wherever GITEA_CUSTOM points — check Site Administration > Configuration)
|
||||
|
||||
Adds an "Agent Run" tab to the repo header, matching the markup Gitea
|
||||
uses for its own tabs (see templates/repo/header.tmpl upstream).
|
||||
Restart Gitea after copying (custom/templates is only read at startup
|
||||
unless RUN_MODE = dev).
|
||||
|
||||
Links into the real Actions list route with a sentinel ?workflow= value
|
||||
that list.tmpl (see list.tmpl in this same directory) intercepts to
|
||||
render agent_monitor.tmpl instead of the normal runs list — real
|
||||
head/header/footer, no separate static page or route needed.
|
||||
*/}}
|
||||
<a class="item" href="{{AppSubUrl}}/{{.Repository.OwnerName}}/{{.Repository.Name}}/actions?workflow=__agent_monitor__">
|
||||
{{svg "octicon-play" 16 "tw-mr-2"}}Agent Run
|
||||
</a>
|
||||
@@ -3,17 +3,17 @@ module github.com/samcharles93/archie-core
|
||||
go 1.27.3
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.25.3 // indirect
|
||||
cel.dev/expr v0.26.0 // indirect
|
||||
filippo.io/hpke v0.4.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.4 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.5.2 // indirect
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0 // indirect
|
||||
github.com/antithesishq/antithesis-sdk-go v0.9.0 // indirect
|
||||
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.5 // indirect
|
||||
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
||||
github.com/containerd/log v0.2.0 // indirect
|
||||
github.com/containerd/platforms v1.0.0-rc.5 // indirect
|
||||
github.com/danielgtaylor/huma/v2 v2.40.0 // indirect
|
||||
github.com/distribution/reference v0.6.0 // indirect
|
||||
github.com/docker/go-connections v0.8.2 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
@@ -22,7 +22,7 @@ require (
|
||||
github.com/felixge/httpsnoop v1.1.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.10.0 // indirect
|
||||
github.com/go-git/gcfg/v2 v2.0.2 // indirect
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 // indirect
|
||||
github.com/go-json-experiment/json v1.27.2 // indirect
|
||||
github.com/go-logr/logr v1.4.4 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
||||
@@ -37,11 +37,9 @@ require (
|
||||
github.com/kevinburke/ssh_config v1.6.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.16 // indirect
|
||||
github.com/mattn/go-isatty v0.0.24 // indirect
|
||||
github.com/mfridman/interpolate v0.0.2 // indirect
|
||||
github.com/mfridman/interpolate v0.2.0 // indirect
|
||||
github.com/minio/highwayhash v1.0.4 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/nats-io/jwt/v2 v2.8.3 // indirect
|
||||
github.com/nats-io/nkeys v0.4.17 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/oklog/run v1.2.0 // indirect
|
||||
github.com/philhofer/fwd v1.2.1 // indirect
|
||||
@@ -51,7 +49,6 @@ require (
|
||||
github.com/segmentio/encoding v0.5.4 // indirect
|
||||
github.com/sergi/go-diff v1.4.0 // indirect
|
||||
github.com/sethvargo/go-retry v0.5.0 // indirect
|
||||
github.com/sirupsen/logrus v1.10.2 // indirect
|
||||
github.com/tinylib/msgp v1.6.5 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
|
||||
@@ -60,21 +57,21 @@ require (
|
||||
go.opentelemetry.io/otel/metric v1.47.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.6 // indirect
|
||||
golang.org/x/exp v0.0.0-20261106192419-47ce03d25ef0 // indirect
|
||||
golang.org/x/sync v0.24.0 // indirect
|
||||
golang.org/x/text v0.43.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20261112160707-e95cf140231d // indirect
|
||||
golang.org/x/sync v0.25.0 // indirect
|
||||
golang.org/x/text v0.44.0 // indirect
|
||||
golang.org/x/time v0.16.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261104224025-d1e00e9f33ab // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/cel-go v0.33.2
|
||||
filippo.io/age v1.3.2
|
||||
github.com/BurntSushi/toml v1.6.0
|
||||
github.com/cedar-policy/cedar-go v1.9.0
|
||||
github.com/ai-openshell/sdk-go v0.1.8
|
||||
github.com/cedar-policy/cedar-go v1.9.1
|
||||
github.com/containerd/errdefs v1.0.0
|
||||
github.com/coreos/go-oidc/v3 v3.21.0
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.12
|
||||
github.com/go-git/go-billy/v6 v6.0.0-beta.1
|
||||
github.com/go-git/go-git/v6 v6.0.0-beta.1
|
||||
github.com/go-jose/go-jose/v4 v4.1.9
|
||||
@@ -85,17 +82,21 @@ require (
|
||||
github.com/hashicorp/go-hclog v1.6.3
|
||||
github.com/hashicorp/go-plugin v1.8.0
|
||||
github.com/hiddeco/sshsig v0.2.0
|
||||
github.com/jackc/pgx/v5 v5.12.0
|
||||
github.com/klauspost/compress v1.20.3
|
||||
github.com/jackc/pgx/v5 v5.13.0
|
||||
github.com/jmoiron/sqlx v1.4.0
|
||||
github.com/klauspost/compress v1.20.4
|
||||
github.com/moby/moby/api v1.56.1
|
||||
github.com/moby/moby/client v0.6.2
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0
|
||||
github.com/nats-io/nats-server/v2 v2.15.2
|
||||
github.com/nats-io/jwt/v2 v2.8.3
|
||||
github.com/nats-io/nats-server/v2 v2.15.3
|
||||
github.com/nats-io/nats.go v1.55.0
|
||||
github.com/nats-io/nkeys v0.4.17
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.1.1
|
||||
github.com/pressly/goose/v3 v3.29.0
|
||||
github.com/samcharles93/ai-sdk v0.6.0
|
||||
github.com/pressly/goose/v3 v3.30.1
|
||||
github.com/samcharles93/ai-sdk v0.8.1
|
||||
github.com/synadia-io/callout.go v0.2.3
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0
|
||||
go.opentelemetry.io/otel v1.47.0
|
||||
@@ -104,12 +105,13 @@ require (
|
||||
go.opentelemetry.io/otel/sdk v1.47.0
|
||||
go.opentelemetry.io/otel/trace v1.47.0
|
||||
go.opentelemetry.io/proto/otlp v1.11.1
|
||||
golang.org/x/crypto v0.58.1-0.20261009181718-2f1f834330b2
|
||||
golang.org/x/mod v0.42.0
|
||||
golang.org/x/crypto v0.59.0
|
||||
golang.org/x/mod v0.43.0
|
||||
golang.org/x/net v0.62.0
|
||||
golang.org/x/oauth2 v0.37.0
|
||||
golang.org/x/sys v0.49.0
|
||||
golang.org/x/term v0.47.0
|
||||
golang.org/x/oauth2 v0.38.0
|
||||
golang.org/x/sys v0.50.0
|
||||
golang.org/x/term v0.48.0
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c
|
||||
google.golang.org/grpc v1.86.0-dev
|
||||
google.golang.org/protobuf v1.36.12
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
|
||||
@@ -1,29 +1,40 @@
|
||||
cel.dev/cel-go v0.32.0 h1:irvpFKr5EuGPyxeME03ERh0rii1TX+BDAnB9eL3IvNk=
|
||||
cel.dev/cel-go v0.32.0/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU=
|
||||
c2sp.org/CCTV/age v0.0.0-20260829155415-4448f2097b2d h1:Blprhc2SbChNZtWcU+BLTM4YdoqYAS9V7cJgOwJKyAs=
|
||||
c2sp.org/CCTV/age v0.0.0-20260829155415-4448f2097b2d/go.mod h1:SrHC2C7r5GkDk8R+NFVzYy/sdj0Ypg9htaPXQq5Cqeo=
|
||||
cel.dev/cel-go v0.33.2 h1:eAcEdBguc6AFrGbPOyE0g168Uey4kKFW9J6qsBLSeMU=
|
||||
cel.dev/cel-go v0.33.2/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU=
|
||||
cel.dev/expr v0.25.3 h1:A2jO8jwOugrrovveCWfj0KEZOfqiLgAcwjpHPhzIGw0=
|
||||
cel.dev/expr v0.25.3/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
|
||||
cel.dev/expr v0.26.0 h1:oLXvOF0jiYA5A/tmzU91pLEWZkKynhLJlC9Gw7PrKvs=
|
||||
cel.dev/expr v0.26.0/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
|
||||
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
|
||||
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
|
||||
filippo.io/age v1.3.2 h1:r6RSZLFSMm6rzKepZ7ZAYkKCu14f3/Me8c7uKYh7C8c=
|
||||
filippo.io/age v1.3.2/go.mod h1:TH/Yr2sSRhCKbaH4XPxpUV0Us8Gv6txYUpiZQWz8Evk=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
|
||||
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
|
||||
filippo.io/hpke v0.4.0 h1:p575VVQ6ted4pL+it6M00V/f2qTZITO0zgmdKCkd5+A=
|
||||
filippo.io/hpke v0.4.0/go.mod h1:EmAN849/P3qdeK+PCMkDpDm83vRHM5cDipBJ8xbQLVY=
|
||||
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
|
||||
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/Microsoft/go-winio v0.6.4 h1:kJF2pamtYCWXf0xAT8sAkwKC0pMl2HYBrRPHAqyUc+g=
|
||||
github.com/Microsoft/go-winio v0.6.4/go.mod h1:1xl5JXG4ze/m74GH6Dc4Mwxfc3VL5siRVQjIAlHH07U=
|
||||
github.com/ProtonMail/go-crypto v1.5.2 h1:cucYnvqcY7UOXVD//mSyjeaPY0SSN3v5cDkYPxumINk=
|
||||
github.com/ProtonMail/go-crypto v1.5.2/go.mod h1:/RaSu30DaKO4RY+XdV/ACcCcZkGr7AhUIduq5sjzzCo=
|
||||
github.com/ai-openshell/sdk-go v0.1.8 h1:p5i7VAZxlB/tzWy6KQWkdvX3cLIu8x0AinUx1X6wp+s=
|
||||
github.com/ai-openshell/sdk-go v0.1.8/go.mod h1:nYYe/HYeEct0KG5YyF2dbLHjUWb7EEA+I1lLi6A8j14=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0 h1:bVV5ZAuwaREn4klRSJusYaA+A7NXq8Qi9C/knCaQ2N4=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.9.0 h1:JQpWOgYSYBb9HqgPtaXBswHxZFmOnXRsPFDI0yeCJWM=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.9.0/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
|
||||
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
|
||||
github.com/aricart/nst.go v0.2.0 h1:vfC+upJofU7OFJZM5Ph+HNko1XfJtVuSE6Q7FCQmT3g=
|
||||
github.com/aricart/nst.go v0.2.0/go.mod h1:13ztPOEw3Jz0/LT8yDi5wZB+T4Lsj3Uhkc17CyZthII=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw=
|
||||
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
|
||||
github.com/cedar-policy/cedar-go v1.8.0 h1:9gcU7EHXwHC2RMdpph68yTAkdB3behTTssC+kt4GoS8=
|
||||
github.com/cedar-policy/cedar-go v1.8.0/go.mod h1:h5+3CVW1oI5LXVskJG+my9TFCYI5yjh/+Ul3EJie6MI=
|
||||
github.com/cedar-policy/cedar-go v1.9.0 h1:p6KSbPT0E79gO5mXNdwAqbDPn4ypz7gX5WV0ScLWmFc=
|
||||
github.com/cedar-policy/cedar-go v1.9.0/go.mod h1:+pmZnfwQkIUKO9qHzoL2wg8Q6xn7c9le15sexhinvVw=
|
||||
github.com/cedar-policy/cedar-go v1.9.1 h1:wkcJD04aFpc/+ZObLQsFXYkfvrQsuW8DOEPEb8r62AE=
|
||||
github.com/cedar-policy/cedar-go v1.9.1/go.mod h1:xF1pHCQW69SIyMguq5BX1ZP9CwdessfnZELtjUpyW7U=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
@@ -34,12 +45,10 @@ github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG
|
||||
github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
|
||||
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
|
||||
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
|
||||
github.com/containerd/log v0.2.0 h1:BewD/umNgVnoczglOpX8eRMyEy5t5iPlu5AIpnWDONc=
|
||||
github.com/containerd/log v0.2.0/go.mod h1:/M7L7CXKcPTfNC74XzaK+5H5KbO5+4lJVpuVI6vRLoM=
|
||||
github.com/containerd/platforms v1.0.0-rc.5 h1:vXd569rDrz8LeMXzAnBsy6LADV5YtsD8oyaRarxdmSU=
|
||||
github.com/containerd/platforms v1.0.0-rc.5/go.mod h1:lKlMXyLybmBedS/JJm11uDofzI8L2v0J2ZbYvNsbq1A=
|
||||
github.com/coreos/go-oidc/v3 v3.21.0 h1:wZo4Q9Pum8dYEj0eMUPrqR+kvuGkeUplbLpNCkBqoWM=
|
||||
github.com/coreos/go-oidc/v3 v3.21.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
|
||||
github.com/danielgtaylor/huma/v2 v2.40.0 h1:429ynr7/T9Iar+8P6NSsjcKwCRgaXvPKvqIFmbeL6vE=
|
||||
github.com/danielgtaylor/huma/v2 v2.40.0/go.mod h1:x+utAArLHnM93jq2Wy7nLYkVorUF1vYML2hoPVb/5yo=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
|
||||
@@ -48,10 +57,6 @@ github.com/docker/go-connections v0.8.2 h1:9d9DEokx5W7qlr0shkFXIxEA7+TTD+llwzcyk
|
||||
github.com/docker/go-connections v0.8.2/go.mod h1:no1qkHdjq7kLMGUXYAduOhYPSJxxvgWBh7ogVvptn3Q=
|
||||
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
||||
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.8 h1:ay2XEj0yW3uzsNwN3KXS/c4nlneHONFKaHlrVhu2WCQ=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.8/go.mod h1:4G6VgFAp9eaQkwy7DbZbOfWRD/Mjvc/TnEtQBRRMEsA=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.12 h1:ZPkgVmmfBTEYUdVpEHVFF8BxTXFrYONQ3cDTgAc/JXc=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.12/go.mod h1:s/lMVROKewN90s0OQ4WrOi6v3+IBDtRI75Hmol8rG4Y=
|
||||
github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg=
|
||||
github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI=
|
||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||
@@ -61,8 +66,6 @@ github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=
|
||||
github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE=
|
||||
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
|
||||
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
|
||||
github.com/fxamacker/cbor/v2 v2.9.6 h1:NHZPxuUjJXQjX9itA785y/5NKSlI4HQ+S7noZsmI7hs=
|
||||
github.com/fxamacker/cbor/v2 v2.9.6/go.mod h1:4EaZp6ClVunETjQ4GHmGNzysDK91Lr+r6Yz6tJqzVCw=
|
||||
github.com/fxamacker/cbor/v2 v2.10.0 h1:HVF3T5vYwLqO81ebPirWEPNv2SMrUMD3HLnKgEr6uWE=
|
||||
github.com/fxamacker/cbor/v2 v2.10.0/go.mod h1:uSwlToFuT9BZAKRxxVm3qQC8DR4tlWl7D6pf20iRYH4=
|
||||
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
|
||||
@@ -75,17 +78,18 @@ github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1 h1:gmqi2jvsreu0s8JMLylYDFq4s
|
||||
github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1/go.mod h1:ECf1MqJlBdYpKggBrOXjo/0EnvRZx6D++I86UYjPgAQ=
|
||||
github.com/go-git/go-git/v6 v6.0.0-beta.1 h1:1t+vJYGDBN6f9GRWskgWx5UjXPFUa7wfffZZZ2C5GtA=
|
||||
github.com/go-git/go-git/v6 v6.0.0-beta.1/go.mod h1:ugDlr38Wwc+fOw85J+Oluh5TNXQtJgYMcriOljg3l4s=
|
||||
github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4=
|
||||
github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-jose/go-jose/v4 v4.1.9 h1:pKfeQkig1NmgK4hJrZYXLEYURXfoJB61Larw0uIW4gY=
|
||||
github.com/go-jose/go-jose/v4 v4.1.9/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 h1:UADEEmDKgfXbtnGJZ97beY5XLo9ZechG1nlU4KnRrkE=
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
||||
github.com/go-json-experiment/json v1.27.2 h1:rZIyqYh+Qq+nEa+Y5iwohr8h7G/MfLJqu2CD4/ZONqM=
|
||||
github.com/go-json-experiment/json v1.27.2/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
|
||||
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME=
|
||||
github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/go-webauthn/webauthn v0.18.2 h1:0BeftmEHU7i3Dv0VFwBtidy/ba37Vcdjvqst9EYu8Sk=
|
||||
@@ -106,8 +110,6 @@ github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+
|
||||
github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.32.0 h1:QMILzF8BA7xftE4zVORkRrlv08m12St3csK4RsyRgRs=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.32.0/go.mod h1:+ZQ6iUL8+ATyxGDQNuRKpNwJFdGDUi0e7E1QL9MvI7U=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.33.0 h1:5T5Ns3kMpWr+z3s5ZA0e7ljVyWNVNxK76sHPAxi5D1k=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.33.0/go.mod h1:oWNYw09cH8wl8fFgC5hKlBLxR4XfKy2KQpP8MJjeCcc=
|
||||
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
|
||||
@@ -122,18 +124,18 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg=
|
||||
github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
|
||||
github.com/jackc/pgx/v5 v5.12.0 h1:hWwax8YiGT0YiN50U1oIDn5kgR7KC2tG3rmavwpPkxY=
|
||||
github.com/jackc/pgx/v5 v5.12.0/go.mod h1:u2Fi6no03HCSBYE+ZVdLxbwdu3xyi2vU+K/YNJioSds=
|
||||
github.com/jackc/pgx/v5 v5.13.0 h1:Hl08k64maU0nrRyVUEbwCnK6/gT0EhMrtAqBHz9/gA4=
|
||||
github.com/jackc/pgx/v5 v5.13.0/go.mod h1:u2Fi6no03HCSBYE+ZVdLxbwdu3xyi2vU+K/YNJioSds=
|
||||
github.com/jackc/puddle/v2 v2.2.3 h1:f8HoREISb3l5eO9coPgK7U3hKLhWGokOFVcThl5jrao=
|
||||
github.com/jackc/puddle/v2 v2.2.3/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=
|
||||
github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8=
|
||||
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
|
||||
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
|
||||
github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY=
|
||||
github.com/kevinburke/ssh_config v1.6.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
|
||||
github.com/klauspost/compress v1.20.3 h1:zWNoFqq/lSuYQRim3dUXlXeA0IqwuZGicdG5ZTfY5j4=
|
||||
github.com/klauspost/compress v1.20.3/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||
github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI=
|
||||
github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
@@ -141,6 +143,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.16 h1:+2YjeAe7xP1OQbZW1jERPWWCDLlNqFNCvjiqGiAt84A=
|
||||
@@ -149,10 +153,14 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
|
||||
github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
|
||||
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
|
||||
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
|
||||
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/mfridman/interpolate v0.2.0 h1:HM9ID8p6CUxoMJX+fECOtGQ2Mu7TW/GIMPyu48nnvUg=
|
||||
github.com/mfridman/interpolate v0.2.0/go.mod h1:8SfDy95IaPNnIokZh9mvIppmc3fGl8fx+Gu7uusuO9Q=
|
||||
github.com/minio/highwayhash v1.0.4 h1:asJizugGgchQod2ja9NJlGOWq4s7KsAWr5XUc9Clgl4=
|
||||
github.com/minio/highwayhash v1.0.4/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
||||
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||
github.com/moby/moby/api v1.56.1 h1:PpWkvVPB7Fr/No8w+TfyJ/I6rWZ2YPZhT3JorIg+06c=
|
||||
@@ -161,20 +169,16 @@ github.com/moby/moby/client v0.6.2 h1:ekSPlMccrZGcw6Scb8T9D39qE0mB+XupU/yS0zNw9N
|
||||
github.com/moby/moby/client v0.6.2/go.mod h1:DGcnO7qmPJrqobx/ggQgQ/AUk+2wgVdQv7uxB0/mEsc=
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0 h1:KIvahhYqwtbeniWVPs3TcXEA7b8jEtwfBpOTAI+Urx4=
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts=
|
||||
github.com/nats-io/jwt/v2 v2.8.2 h1:XXRgB60MSTnqsRwejQurVDs/hcv2dkt+86GjI+I/bMc=
|
||||
github.com/nats-io/jwt/v2 v2.8.2/go.mod h1:Ag/56sq9OblL4JgdYufDd16Egb17Kr/8WwwuO/forVc=
|
||||
github.com/nats-io/jwt/v2 v2.8.3 h1:pqImTmlqH2zPHKNdRXO0YRyWif2diGRlrtLFJ2RxM2I=
|
||||
github.com/nats-io/jwt/v2 v2.8.3/go.mod h1:OOY2rP/UU8tcfoqhbHmBKcNdpFMKvmxIkmFFa16M4wI=
|
||||
github.com/nats-io/nats-server/v2 v2.15.1 h1:fK3AeYFIji1Smng60jB0hVoAPZezA/UzsaI3BqXFNEI=
|
||||
github.com/nats-io/nats-server/v2 v2.15.1/go.mod h1:yeuYRtKVKIFtmMz2/YPk+6hvmNBnk+WwTUzErBdH6IE=
|
||||
github.com/nats-io/nats-server/v2 v2.15.2 h1:yLsgt2kslgymvxvjFq1WGWck5hkat2YYfbXvQ145tzU=
|
||||
github.com/nats-io/nats-server/v2 v2.15.2/go.mod h1:VXHCZgDglV5wO2B8ZE58yG2HzqxQxYUbQqibUh5Xcr8=
|
||||
github.com/nats-io/nats-server/v2 v2.15.3 h1:IgHIKL4DYN9mEfwtPcdM39muvXG8v9FBADQn0f4Whs0=
|
||||
github.com/nats-io/nats-server/v2 v2.15.3/go.mod h1:6Xv7yIatdWlcqIzqFkW1uC78c5o8vG3dBrhazEF8WDA=
|
||||
github.com/nats-io/nats.go v1.55.0 h1:Ng8QKHdvdHIWoaiq0+d/aH1BWkxvcJxWJ0Y/9BPKx3M=
|
||||
github.com/nats-io/nats.go v1.55.0/go.mod h1:y+DZoD1oBOYfZTU681eTUiUjI0vbqYGixNVFHcjHJ0k=
|
||||
github.com/nats-io/nkeys v0.4.16 h1:rd5oAuLOb8mnAycB0xleuEBNS1pVVnN0fv/FF34Eypg=
|
||||
github.com/nats-io/nkeys v0.4.16/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs=
|
||||
github.com/nats-io/nkeys v0.4.17 h1:JAJrlDhOyQqOt0a1eg4cbIZ1Kc7+vmkCigAltpwQpVA=
|
||||
github.com/nats-io/nkeys v0.4.17/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs=
|
||||
github.com/nats-io/nsc/v2 v2.10.3-0.20250110165315-eeda721ecff6 h1:V1uh9L3rGIUeYoMd0/EZY2Tvy5+1CkgGpDRx8t3+PNY=
|
||||
github.com/nats-io/nsc/v2 v2.10.3-0.20250110165315-eeda721ecff6/go.mod h1:ScomAvx1cgjiXzW3WpGo9x/lLENkwELhewCcok/GTU8=
|
||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk=
|
||||
@@ -192,14 +196,14 @@ github.com/pjbgf/sha1cd v0.7.0/go.mod h1:pKR5Li+qTCo+ebqITZfwPlJGoCFCvSO00qxjbNt
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pressly/goose/v3 v3.29.0 h1:dtEnBCT7CqkHIUCdgrXsrmeisaN8gFkRU4Y5OEwif4o=
|
||||
github.com/pressly/goose/v3 v3.29.0/go.mod h1:plA4aP4+u+Q3FMTgbFbhF8TuAWpAdfWpoFGkJsIFWh0=
|
||||
github.com/pressly/goose/v3 v3.30.1 h1:KO28meBdbAUIdMbTP7bl9dp1FYZGXcYWb2O7miT09lE=
|
||||
github.com/pressly/goose/v3 v3.30.1/go.mod h1:CHGwuG2acDerUaXwz2i5T18VSauXpYDiL4WxzDvcOIM=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/samcharles93/ai-sdk v0.6.0 h1:ANHutwvl/K233Dkflc2vKT48qsXRT1iRwjL5S1Dm+jY=
|
||||
github.com/samcharles93/ai-sdk v0.6.0/go.mod h1:NNkiUZ2qfezDHhmF8zHibKsPgpU8b5jphDQ0n2t1KL0=
|
||||
github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g=
|
||||
github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs=
|
||||
github.com/samcharles93/ai-sdk v0.8.1 h1:9mxfaudUhQDqAEdmrOVX9yXcCWMTYvkNl6LRSICxP8k=
|
||||
github.com/samcharles93/ai-sdk v0.8.1/go.mod h1:NNkiUZ2qfezDHhmF8zHibKsPgpU8b5jphDQ0n2t1KL0=
|
||||
github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0=
|
||||
github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
|
||||
github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0=
|
||||
@@ -208,8 +212,6 @@ github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
|
||||
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||
github.com/sethvargo/go-retry v0.5.0 h1:JYfFKmVJ8ER06GReN1efzc5cm52BrVsFVzmcHiKJwfY=
|
||||
github.com/sethvargo/go-retry v0.5.0/go.mod h1:tvsjdKG6xfiCx4LSiUZ06kcv38xvdVQwv8R6/VnnVWg=
|
||||
github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo=
|
||||
github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
@@ -217,6 +219,10 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
|
||||
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
|
||||
github.com/synadia-io/callout.go v0.2.3 h1:22u8sIIdpkKuyySXqEWvGAkAQ4tMBnvLtpVPNBdbj6Y=
|
||||
github.com/synadia-io/callout.go v0.2.3/go.mod h1:IDVofaME9xzbBO5nUvEL59Ml0jGd6gAsF1qC4Nm6Pn8=
|
||||
github.com/synadia-io/jwt-auth-builder.go v0.0.9 h1:UmXQ0JsqiA7sboE0VC46YEqrGAFA4MYHnhw54uYKRi8=
|
||||
github.com/synadia-io/jwt-auth-builder.go v0.0.9/go.mod h1:0XPmvG3TihNkiM3ZFVtcCAzv0oBgFtjnw/lb/h8NHs0=
|
||||
github.com/tinylib/msgp v1.6.5 h1:iAH6XTP7BpzErjBZlujJQXxA+GmRi2YWs6M4KdLtNbE=
|
||||
github.com/tinylib/msgp v1.6.5/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
|
||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||
@@ -253,26 +259,20 @@ go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
|
||||
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||
go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
|
||||
go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
|
||||
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
|
||||
golang.org/x/crypto v0.58.1-0.20261009181718-2f1f834330b2 h1:zGDaB+/Mus2mScKvZ23k+W9NAUbP56sNM9SptgvWI5A=
|
||||
golang.org/x/crypto v0.58.1-0.20261009181718-2f1f834330b2/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
|
||||
golang.org/x/exp v0.0.0-20261014143641-f0251eb4aa3e h1:HgI6W1OolKK6tcV74is+rl9SMT0njsHlp0TbQiGXI/A=
|
||||
golang.org/x/exp v0.0.0-20261014143641-f0251eb4aa3e/go.mod h1:DBoxwWhjaW8DJJw/YeM4zpeOKMC1FMXSblsYy+1mFSw=
|
||||
golang.org/x/exp v0.0.0-20261106192419-47ce03d25ef0 h1:1GO4fJiyGakz0Liu2Ve1qPAwQYPkKlG1Q8iO2CYjtFA=
|
||||
golang.org/x/exp v0.0.0-20261106192419-47ce03d25ef0/go.mod h1:J3U+E8RzytcGvwz+uJuAP4zULJ2TkAQBnmPZMexpdXs=
|
||||
golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg=
|
||||
golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs=
|
||||
golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c=
|
||||
golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U=
|
||||
golang.org/x/exp v0.0.0-20261112160707-e95cf140231d h1:YGnTHliLVZi5alOPp2qu0ggfMT1g+Dp13ZVpReekWYM=
|
||||
golang.org/x/exp v0.0.0-20261112160707-e95cf140231d/go.mod h1:J3U+E8RzytcGvwz+uJuAP4zULJ2TkAQBnmPZMexpdXs=
|
||||
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
|
||||
golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY=
|
||||
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
|
||||
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
|
||||
golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
|
||||
golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
|
||||
golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA=
|
||||
golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||
golang.org/x/oauth2 v0.38.0 h1:uW7XQbcu1eoiQS7uMJvLOjPMl04bTbmY1VeRPxvbspI=
|
||||
golang.org/x/oauth2 v0.38.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
|
||||
golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs=
|
||||
golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -280,29 +280,22 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
|
||||
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||
golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM=
|
||||
golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY=
|
||||
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
|
||||
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
|
||||
golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs=
|
||||
golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||
golang.org/x/term v0.48.0 h1:G6UU1eiSB8nl3DzeUGt7Mg+2SctI8tPS6Z5/mBt6cOk=
|
||||
golang.org/x/term v0.48.0/go.mod h1:BRDLHCZr2SUjIeBHHpRyQeC9xzSAVbzY2rvKgafnHf4=
|
||||
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
|
||||
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
|
||||
golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE=
|
||||
golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s=
|
||||
golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs=
|
||||
golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs=
|
||||
golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a h1:Yqozs0FNPRoPGS4hNGlrNwRENWr5H5nVG9sN/f+5640=
|
||||
golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs=
|
||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261019180522-ce908d29299b h1:nB3spRIaSPtxJpxb0k41yljROvm2Jrwfs2pSNdKS5y8=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261019180522-ce908d29299b/go.mod h1:9N4vtjEwvgQKEdlFVQO0M44ErhecQ9DCSQfGoZ51M6w=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261026165753-2ffab32bce7e h1:e789sLZjeTdc02ZCQGTSzHOu0fR73+dwPQVKUp67Z88=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261026165753-2ffab32bce7e/go.mod h1:vHV3wJM9WZyfV7GyB+OQGq5dWVrFwCDxapPK4WlRD88=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261104224025-d1e00e9f33ab h1:n6IDWZ1RzI/NberLoLLFNrjl1H45uhc4+WYsUf5lPPc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261104224025-d1e00e9f33ab/go.mod h1:vHV3wJM9WZyfV7GyB+OQGq5dWVrFwCDxapPK4WlRD88=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b h1:6WNWHZk91dp4gZ25642OALkuG1UVNZbwENJD19DnB8k=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab h1:8sYjjefPfQ+FZEh1ZwBAqK/NifJVhOxut8nRh3SJzZM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c h1:ofk4SEqvpf6M5VWh88xRp42IYgdVOh7gffebnDj3OqU=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OzYcNQzaMRKcOFRMtyLzG/cfW1SmS2eh+7UmOLLFblk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c h1:XXChExL+Tm7Ubp0x0VXUEncPLHrkXIgoVWqnxmKNbAA=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
google.golang.org/grpc v1.86.0-dev h1:FLq7hcApuJeJ70J9+k0FvmXsNCwS8B2/MeAfYdy3GHY=
|
||||
google.golang.org/grpc v1.86.0-dev/go.mod h1:Ovl0ECo4xx5r4kn/6d4BPSNB7OIFuu6EAjOzjtVAKaM=
|
||||
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||
@@ -318,14 +311,14 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
|
||||
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
|
||||
modernc.org/libc v1.78.0 h1:Lpm+e9K6ruVYEGwWfuBO1xXtYEaXDouFOG1SuWjFDP4=
|
||||
modernc.org/libc v1.78.0/go.mod h1:wvxR55nOF2/66NkJoNV7/coXBTCvT3HR22rcqW6lOuA=
|
||||
modernc.org/libc v1.80.2 h1:3+a4fJZvvzg920ZC0mOepnKPGn7cqCaVeDxm/UnrM1A=
|
||||
modernc.org/libc v1.80.2/go.mod h1:pvo25Rs3OJEbDqhUV9jdEGevxeLJrJeDmNid/AcQV1g=
|
||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||
modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=
|
||||
modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||
modernc.org/sqlite v1.60.1 h1:/blz53O951KWFOso4QQvEs/Fq6cDBKLtMVrYNSeJVKw=
|
||||
modernc.org/sqlite v1.60.1/go.mod h1:1dIoEagfDE72QytD5scH1lxARtaUgKgHC/NuApA27r0=
|
||||
modernc.org/sqlite v1.62.0 h1:gMaCjSM1qpl+iOjiWhR1LYP3zqrYDI+5GYLGt6veP2g=
|
||||
modernc.org/sqlite v1.62.0/go.mod h1:Jzjh1mt4s0HuQ0KvtB1LIuHiGRmU2D5pgj8dUhW7/SE=
|
||||
oras.land/oras-go/v2 v2.7.0 h1:0bXRBBSqYgPSjZRrhJbT71Rb465c+rdlft2xdQPxLtQ=
|
||||
oras.land/oras-go/v2 v2.7.0/go.mod h1:imXEFiYkTZUVVYkfv/r5GVmWeiLkGtNQA8FU4F/sjKs=
|
||||
pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
|
||||
|
||||
+75
-6
@@ -91,6 +91,17 @@ export ARCHIE_INSTANCE="${INSTANCE}"
|
||||
ARCHIE_CONFIG_DIR="${XDG_CONFIG_HOME}/${INSTANCE}"
|
||||
ARCHIE_DATA_DIR="${XDG_DATA_HOME}/${INSTANCE}"
|
||||
ENV_FILE="${ARCHIE_CONFIG_DIR}/env"
|
||||
# The database roles a bundled install serves from: the least-privilege role
|
||||
# the services connect as, and the role that owns the schema and runs
|
||||
# migrations. The names mirror postgres.RuntimeRole/MigrationRole, which setup
|
||||
# writes into the bundled configuration.
|
||||
RUNTIME_ROLE=archie_runtime
|
||||
MIGRATION_ROLE=archie_migrator
|
||||
# The credential the bundled PostgreSQL is created with and the installer uses
|
||||
# once, to create the two roles. It lives in this Compose-only file, which the
|
||||
# systemd units never load, so no service holds a credential that owns the
|
||||
# cluster.
|
||||
PG_ADMIN_ENV="${ARCHIE_DATA_DIR}/postgres.env"
|
||||
|
||||
# unit maps a base unit name to this instance's: unchanged for the default
|
||||
# instance, suffixed with the name after archie- otherwise.
|
||||
@@ -219,9 +230,8 @@ else
|
||||
fi
|
||||
|
||||
TOPOLOGY_UNITS="$(tr -d '\n' <"${STAGE}/release.json" | sed -n 's/.*"units": *\[\([^]]*\)\].*/\1/p' | tr -d '" ' | tr , ' ')"
|
||||
# Binaries that run beside the units without a service of their own: a Kit run
|
||||
# mounts archie-agent from archied's directory, so it must be installed with
|
||||
# them and replaced with them.
|
||||
# Binaries that run beside the units without a service of their own are
|
||||
# installed and replaced with them.
|
||||
TOPOLOGY_BINARIES="$(tr -d '\n' <"${STAGE}/release.json" | sed -n 's/.*"binaries": *\[\([^]]*\)\].*/\1/p' | tr -d '" ' | tr , ' ')"
|
||||
for cmd in ${TOPOLOGY_UNITS} ${TOPOLOGY_BINARIES}; do
|
||||
install -m755 "${STAGE}/${cmd}" "${ARCHIE_BIN_DIR}/${cmd}"
|
||||
@@ -266,10 +276,55 @@ else
|
||||
echo " [SKIP] ${ARCHIE_CONFIG_DIR}/config.toml already exists. Re-run 'archied setup' to change it."
|
||||
fi
|
||||
|
||||
# provision_database reconciles the two database roles a bundled install
|
||||
# serves from: an archie_migrator that owns the schema and runs goose, and an
|
||||
# archie_runtime with row access only. It also moves the superuser password out
|
||||
# of the env file the units load: a config written before the split connects as
|
||||
# the bundled superuser, so its password is rotated to the Compose-only one
|
||||
# once the roles exist. Idempotent, so re-running the installer reconciles an
|
||||
# already-split install.
|
||||
provision_database() {
|
||||
local role_pw admin_pw connect_pw split=false
|
||||
role_pw="$(sed -n "s/^PGPASSWORD='\([^']*\)'$/\1/p" "${ENV_FILE}" | tail -n1)"
|
||||
admin_pw="$(sed -n "s/^POSTGRES_PASSWORD='\([^']*\)'$/\1/p" "${PG_ADMIN_ENV}" | tail -n1)"
|
||||
if [ -z "${role_pw}" ] || [ -z "${admin_pw}" ]; then
|
||||
echo " [WARN] Cannot provision database roles: ${ENV_FILE} needs PGPASSWORD and ${PG_ADMIN_ENV} needs POSTGRES_PASSWORD." >&2
|
||||
return
|
||||
fi
|
||||
if ! grep -q '^migration_database_url' "${ARCHIE_CONFIG_DIR}/config.toml"; then
|
||||
split=true
|
||||
fi
|
||||
# A pre-split install authenticates as the superuser with the env file's
|
||||
# PGPASSWORD; a split one authenticates with the Compose-only password.
|
||||
if [ "${split}" = true ]; then connect_pw="${role_pw}"; else connect_pw="${admin_pw}"; fi
|
||||
echo "==> Provisioning the database roles..."
|
||||
if ! PGPASSWORD="${connect_pw}" ARCHIE_NEW_ADMIN_PASSWORD="${admin_pw}" \
|
||||
"${ARCHIE_BIN_DIR}/archie-state-store" provision \
|
||||
-admin-url "postgres://archie@/archie?host=${PG_SOCKET_DIR}" \
|
||||
-runtime-url "postgres://${RUNTIME_ROLE}:${role_pw}@/archie?host=${PG_SOCKET_DIR}" \
|
||||
-migration-url "postgres://${MIGRATION_ROLE}:${role_pw}@/archie?host=${PG_SOCKET_DIR}" \
|
||||
-rotate-admin-password-env ARCHIE_NEW_ADMIN_PASSWORD; then
|
||||
echo " [WARN] Database role provisioning failed; not restarting the services until it succeeds. Re-run the installer once the database accepts the admin credential." >&2
|
||||
AUTO_START=false
|
||||
return
|
||||
fi
|
||||
if [ "${split}" = true ]; then
|
||||
if grep -q '^database_url = "postgres://archie@' "${ARCHIE_CONFIG_DIR}/config.toml"; then
|
||||
sed -i "s#^database_url = \"postgres://archie@#database_url = \"postgres://${RUNTIME_ROLE}@#" "${ARCHIE_CONFIG_DIR}/config.toml"
|
||||
sed -i "/^database_url = /a migration_database_url = \"postgres://${MIGRATION_ROLE}@/archie?host=${PG_SOCKET_DIR}\"" "${ARCHIE_CONFIG_DIR}/config.toml"
|
||||
echo " [OK] config.toml now connects as ${RUNTIME_ROLE} and migrates as ${MIGRATION_ROLE}."
|
||||
else
|
||||
echo " [WARN] Could not move database_url to ${RUNTIME_ROLE}; set database_url and migration_database_url by hand." >&2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 4. PostgreSQL. Every service fails closed without it. The bundled database
|
||||
# has no network at all: the services reach it through its Unix socket,
|
||||
# mounted at PG_SOCKET_DIR, so it publishes no port and cannot collide with
|
||||
# another PostgreSQL. Its password is the PGPASSWORD setup generated.
|
||||
# another PostgreSQL. The superuser it is created with is only the installer's
|
||||
# bootstrap credential; the services connect as the two provisioned roles and
|
||||
# read their password from the env file's PGPASSWORD as before.
|
||||
PG_SOCKET_DIR="${ARCHIE_DATA_DIR}/postgres"
|
||||
PG_COMPOSE="${ARCHIE_DATA_DIR}/postgres.yml"
|
||||
if ! grep -qF "host=${PG_SOCKET_DIR}" "${ARCHIE_CONFIG_DIR}/config.toml"; then
|
||||
@@ -280,6 +335,15 @@ elif ! command -v docker &>/dev/null; then
|
||||
else
|
||||
echo "==> Starting the bundled PostgreSQL 18..."
|
||||
mkdir -p "${PG_SOCKET_DIR}"
|
||||
# The superuser password is generated here rather than reused from setup: it
|
||||
# is the one credential that must never be in the env file the units load.
|
||||
# Written before the first start so a failed run can be retried with it.
|
||||
if [ ! -f "${PG_ADMIN_ENV}" ]; then
|
||||
previous_umask="$(umask)"
|
||||
umask 077
|
||||
printf "POSTGRES_PASSWORD='%s'\n" "$(od -An -N24 -tx1 /dev/urandom | tr -d ' \n')" >"${PG_ADMIN_ENV}"
|
||||
umask "${previous_umask}"
|
||||
fi
|
||||
cat >"${PG_COMPOSE}" <<'EOF'
|
||||
services:
|
||||
postgres:
|
||||
@@ -287,7 +351,7 @@ services:
|
||||
network_mode: none
|
||||
environment:
|
||||
POSTGRES_USER: archie
|
||||
POSTGRES_PASSWORD: ${PGPASSWORD:-}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}
|
||||
POSTGRES_DB: archie
|
||||
POSTGRES_INITDB_ARGS: --auth-local=scram-sha-256
|
||||
PGDATA: /var/lib/postgresql/data/pgdata
|
||||
@@ -304,10 +368,12 @@ services:
|
||||
volumes:
|
||||
pg_data:
|
||||
EOF
|
||||
if ! docker compose -p "${INSTANCE}" --env-file "${ENV_FILE}" -f "${PG_COMPOSE}" up -d --wait; then
|
||||
if ! docker compose -p "${INSTANCE}" --env-file "${PG_ADMIN_ENV}" -f "${PG_COMPOSE}" up -d --wait; then
|
||||
echo " [WARN] The bundled PostgreSQL did not start, so the services are installed but not started." >&2
|
||||
echo " Check: docker compose -p "${INSTANCE}" -f ${PG_COMPOSE} logs" >&2
|
||||
AUTO_START=false
|
||||
else
|
||||
provision_database
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -495,6 +561,9 @@ echo "Installation Details:"
|
||||
echo " - Binaries : ${ARCHIE_BIN_DIR}/{archied,archie-state-store,archie-gateway,archie-ui,archie-messaging}"
|
||||
echo " - Config : ${ARCHIE_CONFIG_DIR}/config.toml"
|
||||
echo " - Secrets : ${ENV_FILE}"
|
||||
if [ -f "${PG_ADMIN_ENV}" ]; then
|
||||
echo " - DB admin : ${PG_ADMIN_ENV} # compose-only, never loaded by the units"
|
||||
fi
|
||||
echo " - Data : ${ARCHIE_DATA_DIR}/"
|
||||
echo ""
|
||||
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
const mcpConfigPlaceholder = "{{.MCPConfig}}"
|
||||
|
||||
// captureRecord is one accepted capture call, as the MCP server appends it
|
||||
// to the captures file.
|
||||
type captureRecord struct {
|
||||
Tool string `json:"tool"`
|
||||
Args json.RawMessage `json:"args"`
|
||||
}
|
||||
|
||||
// AcceptCapture decides whether one capture call is kept. Both the built-in
|
||||
// loop and the harness path use it, and the harness path applies it twice:
|
||||
// in the MCP server, and again when the worker reads the captures back.
|
||||
func AcceptCapture(spec agentrun.CaptureTool, accepted int, value json.RawMessage) (string, bool) {
|
||||
if spec.MaxCalls > 0 && accepted >= spec.MaxCalls {
|
||||
return fmt.Sprintf("%s rejected: maximum call count is %d", spec.Name, spec.MaxCalls), false
|
||||
}
|
||||
if !json.Valid(value) {
|
||||
return spec.Name + " rejected: arguments are not valid JSON", false
|
||||
}
|
||||
if rejection, ok := ValidateCaptureArgs(spec, value); !ok {
|
||||
return rejection, false
|
||||
}
|
||||
return spec.Name + " recorded", true
|
||||
}
|
||||
|
||||
func serveHarnessMCP(ctx context.Context, specs []agentrun.CaptureTool, sink io.Writer, t mcp.Transport, server *mcp.Server, central bool) error {
|
||||
if central {
|
||||
cleanup, err := addCentralTools(ctx, server, specs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer cleanup()
|
||||
}
|
||||
var mu sync.Mutex
|
||||
accepted := map[string]int{}
|
||||
for _, spec := range specs {
|
||||
schema := spec.Parameters
|
||||
if len(schema) == 0 {
|
||||
schema = json.RawMessage(`{"type":"object"}`)
|
||||
}
|
||||
server.AddTool(&mcp.Tool{Name: spec.Name, Description: spec.Description, InputSchema: schema},
|
||||
func(_ context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
args := append(json.RawMessage(nil), req.Params.Arguments...)
|
||||
reply, ok := AcceptCapture(spec, accepted[spec.Name], args)
|
||||
if ok {
|
||||
line, err := json.Marshal(captureRecord{Tool: spec.Name, Args: args})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err := sink.Write(append(line, '\n')); err != nil {
|
||||
return nil, fmt.Errorf("record %s: %w", spec.Name, err)
|
||||
}
|
||||
accepted[spec.Name]++
|
||||
}
|
||||
return &mcp.CallToolResult{Content: []mcp.Content{&mcp.TextContent{Text: reply}}}, nil
|
||||
})
|
||||
}
|
||||
return server.Run(ctx, t)
|
||||
}
|
||||
|
||||
// readCaptures reads a captures file back into a stage's captures. The file
|
||||
// is writable by the harness user, so nothing in it is trusted: every record
|
||||
// is checked again, and anything that is not an accepted call of a declared
|
||||
// tool is dropped.
|
||||
func readCaptures(path string, specs []agentrun.CaptureTool) (map[string][]json.RawMessage, error) {
|
||||
raw, err := os.ReadFile(path)
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
byName := make(map[string]agentrun.CaptureTool, len(specs))
|
||||
for _, s := range specs {
|
||||
byName[s.Name] = s
|
||||
}
|
||||
captures := map[string][]json.RawMessage{}
|
||||
scanner := bufio.NewScanner(bytes.NewReader(raw))
|
||||
scanner.Buffer(make([]byte, 64*1024), 16*1024*1024)
|
||||
for scanner.Scan() {
|
||||
var rec captureRecord
|
||||
if json.Unmarshal(scanner.Bytes(), &rec) != nil {
|
||||
continue
|
||||
}
|
||||
spec, declared := byName[rec.Tool]
|
||||
if !declared {
|
||||
continue
|
||||
}
|
||||
if _, ok := AcceptCapture(spec, len(captures[rec.Tool]), rec.Args); ok {
|
||||
captures[rec.Tool] = append(captures[rec.Tool], rec.Args)
|
||||
}
|
||||
}
|
||||
if len(captures) == 0 {
|
||||
return nil, scanner.Err()
|
||||
}
|
||||
return captures, scanner.Err()
|
||||
}
|
||||
|
||||
// ServeCaptureFiles serves the capture tools listed in specPath, appending
|
||||
// accepted calls to capturesPath. The files are the ones prepareCaptures
|
||||
// writes, so this package owns their format end to end.
|
||||
func ServeCaptureFiles(ctx context.Context, specPath, capturesPath string, t mcp.Transport) error {
|
||||
raw, err := os.ReadFile(specPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var spec harnessMCPSpec
|
||||
if err := json.Unmarshal(raw, &spec); err != nil {
|
||||
return fmt.Errorf("capture tool spec: %w", err)
|
||||
}
|
||||
sink, err := os.OpenFile(capturesPath, os.O_WRONLY|os.O_APPEND, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer sink.Close()
|
||||
server := mcp.NewServer(&mcp.Implementation{Name: "archie", Version: "1"}, nil)
|
||||
var ready atomic.Bool
|
||||
server.AddReceivingMiddleware(func(next mcp.MethodHandler) mcp.MethodHandler {
|
||||
return func(ctx context.Context, method string, req mcp.Request) (mcp.Result, error) {
|
||||
result, err := next(ctx, method, req)
|
||||
if err == nil && (method == "tools/list" || method == "tools/call") && !ready.Load() {
|
||||
// A call is already recorded by now, so a failed marker must not
|
||||
// turn it into a tool error; the runner reports the missing marker.
|
||||
if os.WriteFile(capturesPath+".ready", nil, 0o600) == nil {
|
||||
ready.Store(true)
|
||||
}
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
})
|
||||
return serveHarnessMCP(ctx, spec.Captures, sink, t, server, spec.CentralTools)
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// AdapterClaudeCode names the Claude Code stream-json output adapter.
|
||||
const AdapterClaudeCode = "claude-code"
|
||||
|
||||
// Adapters for the other supported CLIs' JSON output streams.
|
||||
const (
|
||||
AdapterCodex = "codex"
|
||||
AdapterPi = "pi"
|
||||
AdapterOMP = "omp"
|
||||
AdapterCopilot = "copilot"
|
||||
)
|
||||
|
||||
// HarnessAdapter is what archie knows about one CLI: how to read its output
|
||||
// stream and how to register archie's MCP server with it.
|
||||
type HarnessAdapter struct {
|
||||
NewOutput func() HarnessOutput
|
||||
MCPConfig []string
|
||||
}
|
||||
|
||||
var harnessAdapters = map[string]HarnessAdapter{
|
||||
AdapterClaudeCode: {
|
||||
NewOutput: func() HarnessOutput { return newClaudeCodeHarnessOutput() },
|
||||
MCPConfig: []string{"--mcp-config", mcpConfigPlaceholder},
|
||||
},
|
||||
AdapterCodex: {NewOutput: func() HarnessOutput { return &codexHarnessOutput{} }, MCPConfig: []string{"-c", mcpConfigPlaceholder}},
|
||||
AdapterPi: {NewOutput: func() HarnessOutput { return &piHarnessOutput{} }, MCPConfig: []string{"--extension", mcpConfigPlaceholder}},
|
||||
AdapterOMP: {NewOutput: func() HarnessOutput { return &piHarnessOutput{} }, MCPConfig: []string{"--extension", mcpConfigPlaceholder}},
|
||||
AdapterCopilot: {
|
||||
NewOutput: func() HarnessOutput { return newCopilotHarnessOutput() },
|
||||
MCPConfig: []string{"--additional-mcp-config", "@" + mcpConfigPlaceholder},
|
||||
},
|
||||
}
|
||||
|
||||
// LookupHarnessAdapter returns the named adapter. The empty name is a CLI
|
||||
// with no adapter: it reports nothing and serves no capture tools.
|
||||
func LookupHarnessAdapter(name string) (HarnessAdapter, bool) {
|
||||
a, ok := harnessAdapters[name]
|
||||
return a, ok
|
||||
}
|
||||
|
||||
// HarnessStages runs every stage of a task on one harness: a Kit task's
|
||||
// container is built from its harness, so no stage in it runs anywhere else.
|
||||
type HarnessStages struct {
|
||||
Runner agentrun.Runner
|
||||
Spec agentrun.HarnessSpec
|
||||
}
|
||||
|
||||
func (r HarnessStages) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
spec := r.Spec
|
||||
req.Harness = &spec
|
||||
return r.Runner.Run(ctx, workspace, req, report)
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/tasktools"
|
||||
)
|
||||
|
||||
type harnessMCPSpec struct {
|
||||
Captures []agentrun.CaptureTool `json:"captures"`
|
||||
CentralTools bool `json:"central_tools"`
|
||||
}
|
||||
|
||||
// Each adapter registers one stdio bridge; it holds only proxy credentials
|
||||
// and sentinels, and never writes invocation configuration into the worktree.
|
||||
func harnessMCPRegistration(adapter, dir, configPath string, server map[string]any) (string, error) {
|
||||
switch adapter {
|
||||
case AdapterCodex:
|
||||
args, err := json.Marshal(server["args"])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
command, ok := server["command"].(string)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("MCP command is missing")
|
||||
}
|
||||
return "mcp_servers.archie={command=" + strconv.Quote(command) + ",args=" + string(args) + ",env={HTTP_PROXY=" + strconv.Quote(harnessMCPEnvironmentValue(server)) + "},required=true}", nil
|
||||
case AdapterPi:
|
||||
server["exposure"] = "direct"
|
||||
definition, err := json.Marshal(server)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
path := filepath.Join(dir, "archie-mcp.ts")
|
||||
script := "export default function(pi) { if (typeof pi.registerMcpServer !== 'function') throw new Error('This Pi version does not support native MCP registration'); pi.registerMcpServer('archie', " + string(definition) + "); }\n"
|
||||
if err := os.WriteFile(path, []byte(script), 0o644); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return path, nil
|
||||
case AdapterOMP:
|
||||
// OMP discovers .mcp.json in an explicitly loaded extension package.
|
||||
path := filepath.Join(dir, "index.ts")
|
||||
if err := os.WriteFile(path, []byte("export default function() {}\n"), 0o644); err != nil {
|
||||
return "", err
|
||||
}
|
||||
data, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(dir, ".mcp.json"), data, 0o644); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return dir, nil
|
||||
default:
|
||||
return configPath, nil
|
||||
}
|
||||
}
|
||||
|
||||
type centralTransport struct{ base http.RoundTripper }
|
||||
|
||||
func (t centralTransport) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
if r.URL.String() != tasktools.Endpoint {
|
||||
return nil, fmt.Errorf("central tool request names an unexpected endpoint")
|
||||
}
|
||||
r = r.Clone(r.Context())
|
||||
r.Header.Set("Authorization", "Bearer "+tasktools.Sentinel)
|
||||
return t.base.RoundTrip(r)
|
||||
}
|
||||
|
||||
func addCentralTools(ctx context.Context, server *mcp.Server, captures []agentrun.CaptureTool) (func(), error) {
|
||||
proxy, err := url.Parse(os.Getenv("HTTP_PROXY"))
|
||||
if err != nil || proxy.Host == "" {
|
||||
return nil, fmt.Errorf("central tools require the task egress proxy")
|
||||
}
|
||||
transport := &http.Transport{Proxy: http.ProxyURL(proxy)}
|
||||
client := mcp.NewClient(&mcp.Implementation{Name: "archie-harness", Version: "1"}, nil)
|
||||
session, err := client.Connect(ctx, &mcp.StreamableClientTransport{Endpoint: tasktools.Endpoint, HTTPClient: &http.Client{Transport: centralTransport{base: transport}, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}, DisableStandaloneSSE: true, MaxRetries: -1, MaxEventSize: -1}, nil)
|
||||
if err != nil {
|
||||
transport.CloseIdleConnections()
|
||||
return nil, fmt.Errorf("connect central tools: %w", err)
|
||||
}
|
||||
closeSession := func() { _ = session.Close(); transport.CloseIdleConnections() }
|
||||
names := map[string]bool{}
|
||||
for _, spec := range captures {
|
||||
names[spec.Name] = true
|
||||
}
|
||||
for tool, err := range session.Tools(ctx, nil) {
|
||||
if err != nil {
|
||||
closeSession()
|
||||
return nil, fmt.Errorf("list central tools: %w", err)
|
||||
}
|
||||
if names[tool.Name] {
|
||||
closeSession()
|
||||
return nil, fmt.Errorf("central tool %q collides with a capture tool", tool.Name)
|
||||
}
|
||||
server.AddTool(tool, func(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
||||
return session.CallTool(ctx, &mcp.CallToolParams{Name: req.Params.Name, Arguments: req.Params.Arguments})
|
||||
})
|
||||
}
|
||||
return closeSession, nil
|
||||
}
|
||||
|
||||
func harnessMCPEnvironment(env []string) map[string]string {
|
||||
out := map[string]string{}
|
||||
for _, entry := range env {
|
||||
if value, ok := strings.CutPrefix(entry, "HTTP_PROXY="); ok {
|
||||
out["HTTP_PROXY"] = value
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func harnessMCPEnvironmentValue(server map[string]any) string {
|
||||
env, _ := server["env"].(map[string]string)
|
||||
return env["HTTP_PROXY"]
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
//go:build unix
|
||||
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// Some CLIs log an unsupported MCP configuration but still exit successfully.
|
||||
func TestHarnessRequiresMCPInitialization(t *testing.T) {
|
||||
for _, central := range []bool{false, true} {
|
||||
t.Run(map[bool]string{false: "captures", true: "central tools"}[central], func(t *testing.T) {
|
||||
workspace, err := os.MkdirTemp("", "archie-mcp-regression-") //nolint:usetesting // The harness user cannot traverse testing's private parent directory.
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll(workspace)
|
||||
for _, args := range [][]string{{"init", "-q"}, {"-c", "user.name=fixture", "-c", "user.email=fixture@example.invalid", "commit", "--allow-empty", "-q", "-m", "fixture"}} {
|
||||
cmd := exec.CommandContext(t.Context(), "git", append([]string{"-C", workspace}, args...)...)
|
||||
if raw, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("git fixture %v: %s", err, raw)
|
||||
}
|
||||
}
|
||||
h := &agentrun.HarnessSpec{Launch: []string{"sh", "-c", "exit 0", "harness"}, Prompt: []string{"{{.Prompt}}"}, MCPConfig: []string{"{{.MCPConfig}}"}, Env: []string{"PATH=/usr/bin:/bin"}, CentralTools: central}
|
||||
if os.Geteuid() == 0 {
|
||||
h.User = "65534"
|
||||
}
|
||||
req := agentrun.Request{Version: agentrun.ProtocolVersion, TaskID: 7, Attempt: 1, Stage: "test", Mission: "return a result", Model: "fixture/model", Harness: h}
|
||||
if !central {
|
||||
req.CaptureTools = []agentrun.CaptureTool{{Name: "capture_result", Parameters: json.RawMessage(`{"type":"object"}`)}}
|
||||
}
|
||||
result, err := NewHarnessRunner().Run(t.Context(), workspace, req, agentrun.Reporter{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if result.Status == agentrun.StatusPassed || result.StopReason != StopExited {
|
||||
t.Fatalf("unsupported MCP silently passed: %+v", result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// claudeCodeHarnessOutput reads Claude Code's newline-delimited stream-json
|
||||
// output. It keeps tool-use IDs until the corresponding user tool_result
|
||||
// arrives and retains assistant usage as a fallback for interrupted runs.
|
||||
type claudeCodeHarnessOutput struct {
|
||||
sessionID string
|
||||
pending map[string]string
|
||||
|
||||
messageUsage agentrun.Usage
|
||||
seenMessages map[string]struct{}
|
||||
hasResult bool
|
||||
resultUsage agentrun.Usage
|
||||
}
|
||||
|
||||
func newClaudeCodeHarnessOutput() *claudeCodeHarnessOutput {
|
||||
return &claudeCodeHarnessOutput{
|
||||
pending: make(map[string]string),
|
||||
seenMessages: make(map[string]struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
SessionID string `json:"session_id"`
|
||||
Message json.RawMessage `json:"message"`
|
||||
Usage json.RawMessage `json:"usage"`
|
||||
}
|
||||
if json.Unmarshal(line, &event) != nil {
|
||||
return
|
||||
}
|
||||
if event.SessionID != "" {
|
||||
o.sessionID = event.SessionID
|
||||
}
|
||||
|
||||
switch event.Type {
|
||||
case "assistant":
|
||||
o.assistant(event.Message)
|
||||
case "user":
|
||||
o.user(event.Message, report)
|
||||
case "result":
|
||||
if usage, ok := decodeClaudeUsage(event.Usage); ok {
|
||||
o.resultUsage = usage
|
||||
o.hasResult = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage) {
|
||||
var message struct {
|
||||
ID string `json:"id"`
|
||||
Usage json.RawMessage `json:"usage"`
|
||||
Content []struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Input any `json:"input"`
|
||||
} `json:"content"`
|
||||
}
|
||||
if json.Unmarshal(raw, &message) != nil {
|
||||
return
|
||||
}
|
||||
if usage, ok := decodeClaudeUsage(message.Usage); ok && (message.ID == "" || o.markMessage(message.ID)) {
|
||||
o.messageUsage = addUsage(o.messageUsage, usage)
|
||||
}
|
||||
for _, block := range message.Content {
|
||||
if block.Type == "tool_use" && block.ID != "" && block.Name != "" {
|
||||
o.pending[block.ID] = block.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) user(raw json.RawMessage, report agentrun.Reporter) {
|
||||
var message struct {
|
||||
Content []struct {
|
||||
Type string `json:"type"`
|
||||
ToolUseID string `json:"tool_use_id"`
|
||||
Content json.RawMessage `json:"content"`
|
||||
IsError bool `json:"is_error"`
|
||||
} `json:"content"`
|
||||
}
|
||||
if json.Unmarshal(raw, &message) != nil {
|
||||
return
|
||||
}
|
||||
for _, block := range message.Content {
|
||||
if block.Type != "tool_result" || block.ToolUseID == "" {
|
||||
continue
|
||||
}
|
||||
tool, ok := o.pending[block.ToolUseID]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
delete(o.pending, block.ToolUseID)
|
||||
report.ReportToolCall(agentrun.ToolCallReport{
|
||||
Tool: tool, Detail: ClipToolCallDetail(claudeResultContent(block.Content)),
|
||||
Failed: block.IsError,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) markMessage(id string) bool {
|
||||
if _, seen := o.seenMessages[id]; seen {
|
||||
return false
|
||||
}
|
||||
o.seenMessages[id] = struct{}{}
|
||||
return true
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) SessionID() string { return o.sessionID }
|
||||
|
||||
func (o *claudeCodeHarnessOutput) Usage() agentrun.Usage {
|
||||
if o.hasResult {
|
||||
return o.resultUsage
|
||||
}
|
||||
return o.messageUsage
|
||||
}
|
||||
|
||||
func decodeClaudeUsage(raw json.RawMessage) (agentrun.Usage, bool) {
|
||||
var fields struct {
|
||||
InputTokens int `json:"input_tokens"`
|
||||
OutputTokens int `json:"output_tokens"`
|
||||
CacheReadInputTokens int `json:"cache_read_input_tokens"`
|
||||
CacheCreationInputTokens int `json:"cache_creation_input_tokens"`
|
||||
}
|
||||
if len(raw) == 0 || bytes.Equal(bytes.TrimSpace(raw), []byte("null")) || json.Unmarshal(raw, &fields) != nil {
|
||||
return agentrun.Usage{}, false
|
||||
}
|
||||
return usageFromFields(fields.InputTokens, fields.OutputTokens, fields.CacheReadInputTokens, fields.CacheCreationInputTokens), true
|
||||
}
|
||||
|
||||
// usageFromFields folds cache reads and writes into PromptTokens, as the
|
||||
// built-in loop's Anthropic provider does: Claude's input_tokens excludes
|
||||
// them, and budgets must count a harness run the way they count a built-in
|
||||
// one.
|
||||
func usageFromFields(input, output, cacheRead, cacheCreation int) agentrun.Usage {
|
||||
prompt := input + cacheRead + cacheCreation
|
||||
return agentrun.Usage{
|
||||
PromptTokens: prompt, CompletionTokens: output, TotalTokens: prompt + output,
|
||||
CachedTokens: cacheRead, CacheCreationTokens: cacheCreation,
|
||||
}
|
||||
}
|
||||
|
||||
func claudeResultContent(raw json.RawMessage) string {
|
||||
var content string
|
||||
if json.Unmarshal(raw, &content) == nil {
|
||||
return content
|
||||
}
|
||||
var blocks []struct {
|
||||
Type string `json:"type"`
|
||||
Text string `json:"text"`
|
||||
}
|
||||
if json.Unmarshal(raw, &blocks) != nil {
|
||||
return ""
|
||||
}
|
||||
texts := make([]string, 0, len(blocks))
|
||||
for _, block := range blocks {
|
||||
if block.Type == "text" {
|
||||
texts = append(texts, block.Text)
|
||||
}
|
||||
}
|
||||
return strings.Join(texts, "\n")
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// codexHarnessOutput reads `codex exec --json`. Each tool item is reported
|
||||
// when its item.completed event arrives; usage comes from turn.completed, so
|
||||
// a run killed mid-turn reports none.
|
||||
type codexHarnessOutput struct {
|
||||
threadID string
|
||||
usage agentrun.Usage
|
||||
}
|
||||
|
||||
func (o *codexHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
ThreadID string `json:"thread_id"`
|
||||
Usage *struct {
|
||||
InputTokens int `json:"input_tokens"`
|
||||
CachedInputTokens int `json:"cached_input_tokens"`
|
||||
CacheWriteTokens int `json:"cache_write_input_tokens"`
|
||||
OutputTokens int `json:"output_tokens"`
|
||||
} `json:"usage"`
|
||||
Item codexItem `json:"item"`
|
||||
}
|
||||
if json.Unmarshal(line, &event) != nil {
|
||||
return
|
||||
}
|
||||
switch event.Type {
|
||||
case "thread.started":
|
||||
o.threadID = event.ThreadID
|
||||
case "turn.completed":
|
||||
if u := event.Usage; u != nil {
|
||||
// Codex follows OpenAI: input_tokens already includes cached input.
|
||||
o.usage = addUsage(o.usage, agentrun.Usage{
|
||||
PromptTokens: u.InputTokens, CompletionTokens: u.OutputTokens,
|
||||
TotalTokens: u.InputTokens + u.OutputTokens,
|
||||
CachedTokens: u.CachedInputTokens, CacheCreationTokens: u.CacheWriteTokens,
|
||||
})
|
||||
}
|
||||
case "item.completed":
|
||||
if call, ok := event.Item.report(); ok {
|
||||
report.ReportToolCall(call)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type codexItem struct {
|
||||
Type string `json:"type"`
|
||||
Status string `json:"status"`
|
||||
AggregatedOutput string `json:"aggregated_output"`
|
||||
Tool string `json:"tool"`
|
||||
Result *struct {
|
||||
Content []struct {
|
||||
Type string `json:"type"`
|
||||
Text string `json:"text"`
|
||||
} `json:"content"`
|
||||
} `json:"result"`
|
||||
Error *struct {
|
||||
Message string `json:"message"`
|
||||
} `json:"error"`
|
||||
Changes []struct {
|
||||
Path string `json:"path"`
|
||||
} `json:"changes"`
|
||||
Query string `json:"query"`
|
||||
}
|
||||
|
||||
func (item codexItem) report() (agentrun.ToolCallReport, bool) {
|
||||
call := agentrun.ToolCallReport{Tool: item.Type, Failed: item.Status == "failed"}
|
||||
switch item.Type {
|
||||
case "command_execution":
|
||||
call.Detail = item.AggregatedOutput
|
||||
case "mcp_tool_call":
|
||||
call.Tool = item.Tool
|
||||
switch {
|
||||
case item.Error != nil:
|
||||
call.Detail, call.Failed = item.Error.Message, true
|
||||
case item.Result != nil:
|
||||
texts := make([]string, 0, len(item.Result.Content))
|
||||
for _, block := range item.Result.Content {
|
||||
if block.Type == "text" {
|
||||
texts = append(texts, block.Text)
|
||||
}
|
||||
}
|
||||
call.Detail = strings.Join(texts, "\n")
|
||||
}
|
||||
case "file_change":
|
||||
paths := make([]string, 0, len(item.Changes))
|
||||
for _, change := range item.Changes {
|
||||
paths = append(paths, change.Path)
|
||||
}
|
||||
call.Detail = strings.Join(paths, "\n")
|
||||
case "web_search":
|
||||
call.Detail = item.Query
|
||||
default:
|
||||
return agentrun.ToolCallReport{}, false
|
||||
}
|
||||
call.Detail = ClipToolCallDetail(call.Detail)
|
||||
return call, true
|
||||
}
|
||||
|
||||
func (o *codexHarnessOutput) SessionID() string { return o.threadID }
|
||||
func (o *codexHarnessOutput) Usage() agentrun.Usage { return o.usage }
|
||||
@@ -1,60 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// copilotHarnessOutput reads GitHub Copilot CLI's `--output-format json`.
|
||||
// The stream carries no token counts, so a Copilot run reports no usage and
|
||||
// its budget is wall clock.
|
||||
type copilotHarnessOutput struct {
|
||||
sessionID string
|
||||
pending map[string]string
|
||||
}
|
||||
|
||||
func newCopilotHarnessOutput() *copilotHarnessOutput {
|
||||
return &copilotHarnessOutput{pending: make(map[string]string)}
|
||||
}
|
||||
|
||||
func (o *copilotHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
SessionID string `json:"sessionId"`
|
||||
Data struct {
|
||||
ToolCallID string `json:"toolCallId"`
|
||||
ToolName string `json:"toolName"`
|
||||
MCPToolName string `json:"mcpToolName"`
|
||||
Success bool `json:"success"`
|
||||
Result struct {
|
||||
Content string `json:"content"`
|
||||
} `json:"result"`
|
||||
} `json:"data"`
|
||||
}
|
||||
if json.Unmarshal(line, &event) != nil {
|
||||
return
|
||||
}
|
||||
switch event.Type {
|
||||
case "result":
|
||||
o.sessionID = event.SessionID
|
||||
case "tool.execution_start":
|
||||
name := event.Data.MCPToolName
|
||||
if name == "" {
|
||||
name = event.Data.ToolName
|
||||
}
|
||||
if event.Data.ToolCallID != "" && name != "" {
|
||||
o.pending[event.Data.ToolCallID] = name
|
||||
}
|
||||
case "tool.execution_complete":
|
||||
tool, ok := o.pending[event.Data.ToolCallID]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
delete(o.pending, event.Data.ToolCallID)
|
||||
report.ReportToolCall(agentrun.ToolCallReport{Tool: tool, Detail: ClipToolCallDetail(event.Data.Result.Content), Failed: !event.Data.Success})
|
||||
}
|
||||
}
|
||||
|
||||
func (o *copilotHarnessOutput) SessionID() string { return o.sessionID }
|
||||
func (o *copilotHarnessOutput) Usage() agentrun.Usage { return agentrun.Usage{} }
|
||||
@@ -1,66 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// piHarnessOutput reads `--mode json` from Pi and OMP, which share the
|
||||
// event stream. Usage is summed from each assistant message_end, so an
|
||||
// interrupted run still reports what it spent.
|
||||
type piHarnessOutput struct {
|
||||
sessionID string
|
||||
usage agentrun.Usage
|
||||
}
|
||||
|
||||
func (o *piHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
ToolName string `json:"toolName"`
|
||||
IsError bool `json:"isError"`
|
||||
Result struct {
|
||||
Content []struct {
|
||||
Type string `json:"type"`
|
||||
Text string `json:"text"`
|
||||
} `json:"content"`
|
||||
} `json:"result"`
|
||||
Message struct {
|
||||
Role string `json:"role"`
|
||||
Usage *struct {
|
||||
Input int `json:"input"`
|
||||
Output int `json:"output"`
|
||||
CacheRead int `json:"cacheRead"`
|
||||
CacheWrite int `json:"cacheWrite"`
|
||||
} `json:"usage"`
|
||||
} `json:"message"`
|
||||
}
|
||||
if json.Unmarshal(line, &event) != nil {
|
||||
return
|
||||
}
|
||||
switch event.Type {
|
||||
case "session":
|
||||
o.sessionID = event.ID
|
||||
case "message_end":
|
||||
// Pi's input excludes cache reads and writes, as Claude's does.
|
||||
if u := event.Message.Usage; event.Message.Role == "assistant" && u != nil {
|
||||
o.usage = addUsage(o.usage, usageFromFields(u.Input, u.Output, u.CacheRead, u.CacheWrite))
|
||||
}
|
||||
case "tool_execution_end":
|
||||
if event.ToolName == "" {
|
||||
return
|
||||
}
|
||||
texts := make([]string, 0, len(event.Result.Content))
|
||||
for _, block := range event.Result.Content {
|
||||
if block.Type == "text" {
|
||||
texts = append(texts, block.Text)
|
||||
}
|
||||
}
|
||||
report.ReportToolCall(agentrun.ToolCallReport{Tool: event.ToolName, Detail: ClipToolCallDetail(strings.Join(texts, "\n")), Failed: event.IsError})
|
||||
}
|
||||
}
|
||||
|
||||
func (o *piHarnessOutput) SessionID() string { return o.sessionID }
|
||||
func (o *piHarnessOutput) Usage() agentrun.Usage { return o.usage }
|
||||
@@ -1,30 +0,0 @@
|
||||
//go:build !unix
|
||||
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// setProcessGroup falls back to killing the harness process alone where
|
||||
// process groups are unavailable.
|
||||
func setProcessGroup(*exec.Cmd) {}
|
||||
|
||||
// reapGroup has nothing to do where process groups are unavailable.
|
||||
func reapGroup(*exec.Cmd) {}
|
||||
|
||||
// runAsHarnessUser refuses a named harness user where user switching is
|
||||
// unavailable, rather than running the harness as the worker.
|
||||
func runAsHarnessUser(_ *exec.Cmd, name string) error {
|
||||
if name != "" {
|
||||
return errors.New("harness user switching is unsupported on this platform")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ownForHarness has nothing to do where the harness runs as the worker.
|
||||
func ownForHarness(string, ...string) error { return nil }
|
||||
|
||||
// ownTreeForHarness has nothing to do where the harness runs as the worker.
|
||||
func ownTreeForHarness(string, string) error { return nil }
|
||||
@@ -1,126 +0,0 @@
|
||||
//go:build unix
|
||||
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// setProcessGroup puts the harness in its own process group and makes
|
||||
// cancellation kill the whole group.
|
||||
func setProcessGroup(cmd *exec.Cmd) {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
cmd.Cancel = func() error { return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) }
|
||||
}
|
||||
|
||||
// reapGroup kills whatever the command left running in its process group, so a
|
||||
// daemonised child cannot outlive the invocation that started it.
|
||||
func reapGroup(cmd *exec.Cmd) {
|
||||
if cmd.Process != nil {
|
||||
_ = syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
|
||||
}
|
||||
}
|
||||
|
||||
// runAsHarnessUser drops the invocation to the Kit's user. A worker running
|
||||
// as root refuses to start a harness with no user, because the harness would
|
||||
// then share the worker's user and could read its credentials.
|
||||
func runAsHarnessUser(cmd *exec.Cmd, name string) error {
|
||||
if name == "" {
|
||||
if os.Geteuid() == 0 {
|
||||
return errors.New("harness has no user and the worker runs as root; refusing to give the harness the worker's privileges")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
cred, err := harnessCredential(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cmd.SysProcAttr.Credential = cred
|
||||
return nil
|
||||
}
|
||||
|
||||
// harnessCredential resolves a user name or "uid[:gid]" to a credential.
|
||||
// Root is refused whichever way it is named. IDs are bounded to 31 bits so
|
||||
// they convert to int for os.Chown on every platform.
|
||||
func harnessCredential(name string) (*syscall.Credential, error) {
|
||||
uidText, gidText, hasGid := strings.Cut(name, ":")
|
||||
uid, uidErr := strconv.ParseUint(uidText, 10, 31)
|
||||
var cred syscall.Credential
|
||||
if uidErr == nil {
|
||||
cred.Uid, cred.Gid = uint32(uid), uint32(uid)
|
||||
} else {
|
||||
u, err := user.Lookup(uidText)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("harness user %q: %w", uidText, err)
|
||||
}
|
||||
id, err := strconv.ParseUint(u.Uid, 10, 31)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("harness user %q has non-numeric uid %q", uidText, u.Uid)
|
||||
}
|
||||
group, err := strconv.ParseUint(u.Gid, 10, 31)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("harness user %q has non-numeric gid %q", uidText, u.Gid)
|
||||
}
|
||||
cred.Uid, cred.Gid = uint32(id), uint32(group)
|
||||
}
|
||||
if hasGid {
|
||||
gid, err := strconv.ParseUint(gidText, 10, 31)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("harness group %q is not numeric", gidText)
|
||||
}
|
||||
cred.Gid = uint32(gid)
|
||||
}
|
||||
if cred.Uid == 0 {
|
||||
return nil, fmt.Errorf("harness user %q is root; a harness never runs with the worker's privileges", name)
|
||||
}
|
||||
return &cred, nil
|
||||
}
|
||||
|
||||
// ownForHarness gives paths to the harness user when the worker is root, so
|
||||
// the harness's MCP server can write its captures.
|
||||
func ownForHarness(name string, paths ...string) error {
|
||||
if name == "" || os.Geteuid() != 0 {
|
||||
return nil
|
||||
}
|
||||
cred, err := harnessCredential(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, p := range paths {
|
||||
if err := os.Chown(p, int(cred.Uid), int(cred.Gid)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ownTreeForHarness gives the worktree to the harness user when the worker
|
||||
// is root, except .git: the harness edits files and never writes the
|
||||
// repository, so its refs and config stay the worker's.
|
||||
func ownTreeForHarness(name, root string) error {
|
||||
if name == "" || os.Geteuid() != 0 {
|
||||
return nil
|
||||
}
|
||||
cred, err := harnessCredential(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if d.IsDir() && d.Name() == ".git" && path != root {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return os.Lchown(path, int(cred.Uid), int(cred.Gid))
|
||||
})
|
||||
}
|
||||
@@ -1,550 +0,0 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
git "github.com/go-git/go-git/v6"
|
||||
"github.com/go-git/go-git/v6/plumbing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// Harness outcomes beyond StatusPassed. The strings match the built-in
|
||||
// loop's, so a stage reads the same whichever runner ran it.
|
||||
const (
|
||||
StatusParked = "parked"
|
||||
StopTimedOut = "timed_out"
|
||||
StopPolicy = "policy_violation"
|
||||
StopGate = "gate_failed"
|
||||
StopExited = "harness_exited"
|
||||
)
|
||||
|
||||
const (
|
||||
promptPlaceholder = "{{.Prompt}}"
|
||||
sessionPlaceholder = "{{.SessionID}}"
|
||||
stderrTailBytes = 2000
|
||||
killGrace = 2 * time.Second
|
||||
)
|
||||
|
||||
// HarnessOutput reads one harness invocation's standard output. An adapter
|
||||
// knows its CLI's stream format; it reports tool calls as they complete and
|
||||
// the session to resume.
|
||||
type HarnessOutput interface {
|
||||
Line(line []byte, report agentrun.Reporter)
|
||||
SessionID() string
|
||||
Usage() agentrun.Usage
|
||||
}
|
||||
|
||||
// HarnessRunner runs a stage on an external coding-agent CLI. Archie's
|
||||
// guarantees do not depend on the CLI obeying its prompt: the runner checks
|
||||
// the worktree and the repository's refs and configuration after every
|
||||
// invocation, runs the gate itself, and owns the process's lifetime.
|
||||
type HarnessRunner struct{}
|
||||
|
||||
// NewHarnessRunner returns a runner that reads each invocation with the
|
||||
// adapter the request names.
|
||||
func NewHarnessRunner() *HarnessRunner { return &HarnessRunner{} }
|
||||
|
||||
func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
if err := validateHarness(req); err != nil {
|
||||
return agentrun.Result{}, err
|
||||
}
|
||||
if err := ownTreeForHarness(req.Harness.User, workspace); err != nil {
|
||||
return agentrun.Result{}, fmt.Errorf("give the worktree to the harness user: %w", err)
|
||||
}
|
||||
mcpConfig, capturesPath, cleanup, err := r.prepareCaptures(req)
|
||||
if err != nil {
|
||||
return agentrun.Result{}, err
|
||||
}
|
||||
defer cleanup()
|
||||
res, err := r.run(ctx, workspace, req, mcpConfig, report)
|
||||
if capturesPath != "" {
|
||||
if res.Status == agentrun.StatusPassed {
|
||||
if _, readyErr := os.Stat(capturesPath + ".ready"); readyErr != nil {
|
||||
return park(res, StopExited, "harness did not initialize Archie MCP; check CLI MCP support and startup errors"), err
|
||||
}
|
||||
}
|
||||
captures, readErr := readCaptures(capturesPath, req.CaptureTools)
|
||||
if readErr != nil {
|
||||
return res, errors.Join(err, fmt.Errorf("read captures: %w", readErr))
|
||||
}
|
||||
res.Captures = captures
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.Request, mcpConfig string, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
res := agentrun.Result{Version: agentrun.ProtocolVersion, TaskID: req.TaskID, Attempt: req.Attempt, Stage: req.Stage}
|
||||
before, err := snapshotRepo(workspace)
|
||||
if err != nil {
|
||||
return agentrun.Result{}, fmt.Errorf("snapshot workspace before harness: %w", err)
|
||||
}
|
||||
runCtx := ctx
|
||||
if req.Budget.WallClock > 0 {
|
||||
var cancel context.CancelFunc
|
||||
runCtx, cancel = context.WithTimeout(ctx, req.Budget.WallClock)
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
maxIterations := 1
|
||||
if len(req.Harness.Resume) > 0 || len(req.Harness.Continue) > 0 {
|
||||
maxIterations = max(1, req.Gate.MaxConsecutiveFailures)
|
||||
}
|
||||
prompt := harnessPrompt(workspace, req)
|
||||
verb := req.Harness.Prompt
|
||||
session := ""
|
||||
for {
|
||||
res.Iterations++
|
||||
out := r.output(req.Harness.Adapter)
|
||||
exitErr := invoke(runCtx, workspace, req.Harness, harnessArgv(req.Harness, verb, prompt, session, mcpConfig), out, report)
|
||||
if id := out.SessionID(); id != "" {
|
||||
session = id
|
||||
}
|
||||
res.Usage = addUsage(res.Usage, out.Usage())
|
||||
res.TokensUsed = res.Usage.TotalTokens
|
||||
if ctx.Err() != nil {
|
||||
return res, ctx.Err()
|
||||
}
|
||||
|
||||
res, stopped, err := settle(runCtx, workspace, before, req, res, exitErr)
|
||||
if err != nil || stopped {
|
||||
return res, err
|
||||
}
|
||||
|
||||
gateOutput, gateErr := runHarnessGate(runCtx, req.Harness, req.Gate.Commands, workspace)
|
||||
if gateErr == nil {
|
||||
res.Status = agentrun.StatusPassed
|
||||
return res, nil
|
||||
}
|
||||
if runCtx.Err() != nil {
|
||||
return park(res, StopTimedOut, "harness exceeded its wall-clock budget during the gate"), nil
|
||||
}
|
||||
if res.Iterations >= maxIterations {
|
||||
return park(res, StopGate, gateOutput), nil
|
||||
}
|
||||
verb = resumeVerb(req.Harness, session)
|
||||
if len(verb) == 0 {
|
||||
return park(res, StopGate, gateOutput), nil
|
||||
}
|
||||
prompt = "The quality gate failed. Fix the cause, then stop.\n\n" + gateOutput
|
||||
}
|
||||
}
|
||||
|
||||
// settle checks one finished invocation. Guarantees come first: a policy
|
||||
// violation parks the step even when the invocation also timed out or
|
||||
// failed, because what the harness did matters more than how it ended.
|
||||
func settle(runCtx context.Context, workspace string, before repoState, req agentrun.Request, res agentrun.Result, exitErr error) (agentrun.Result, bool, error) {
|
||||
after, err := snapshotRepo(workspace)
|
||||
if err != nil {
|
||||
return res, true, fmt.Errorf("snapshot workspace after harness: %w", err)
|
||||
}
|
||||
res.Changes = changedPaths(before, after)
|
||||
// An exhausted budget is an outcome of the step, not a runner error.
|
||||
outOfTime := errors.Is(runCtx.Err(), context.DeadlineExceeded)
|
||||
switch violation := policyViolation(before, after, res.Changes, req); {
|
||||
case violation != "":
|
||||
return park(res, StopPolicy, violation), true, nil
|
||||
case outOfTime:
|
||||
return park(res, StopTimedOut, "harness exceeded its wall-clock budget"), true, nil
|
||||
case exitErr != nil:
|
||||
return park(res, StopExited, exitErr.Error()), true, nil
|
||||
}
|
||||
return res, false, nil
|
||||
}
|
||||
|
||||
func (r *HarnessRunner) output(adapter string) HarnessOutput {
|
||||
if a, ok := LookupHarnessAdapter(adapter); ok {
|
||||
return a.NewOutput()
|
||||
}
|
||||
return silentOutput{}
|
||||
}
|
||||
|
||||
func validateHarness(req agentrun.Request) error {
|
||||
if err := req.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
h := req.Harness
|
||||
if h == nil || len(h.Launch) == 0 {
|
||||
return errors.New("harness runner needs a harness spec with a launch command")
|
||||
}
|
||||
if !slices.ContainsFunc(h.Prompt, func(s string) bool { return strings.Contains(s, promptPlaceholder) }) {
|
||||
return fmt.Errorf("harness prompt verb must carry %s, or the mission is never passed", promptPlaceholder)
|
||||
}
|
||||
if _, ok := LookupHarnessAdapter(h.Adapter); h.Adapter != "" && !ok {
|
||||
return fmt.Errorf("harness output adapter %q is unknown", h.Adapter)
|
||||
}
|
||||
if req.Gate.MaxConsecutiveFailures > 1 && len(h.Resume) == 0 && len(h.Continue) == 0 {
|
||||
return errors.New("stage retries its gate but the harness declares no resume or continue verb")
|
||||
}
|
||||
if len(h.Resume) > 0 && !slices.ContainsFunc(h.Resume, func(s string) bool { return strings.Contains(s, sessionPlaceholder) }) {
|
||||
return fmt.Errorf("harness resume verb must carry %s", sessionPlaceholder)
|
||||
}
|
||||
if (len(req.CaptureTools) > 0 || h.CentralTools) && !slices.ContainsFunc(h.MCPConfig, func(s string) bool { return strings.Contains(s, mcpConfigPlaceholder) }) {
|
||||
return errors.New("stage needs Archie tools but the harness registers no MCP server; its results would be lost")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// harnessArgv is the launch command, then the verb, then the prompt verb
|
||||
// when the verb is a resume or continue, with placeholders substituted as
|
||||
// raw values rather than shell text.
|
||||
func harnessArgv(h *agentrun.HarnessSpec, verb []string, prompt, session, mcpConfig string) []string {
|
||||
argv := slices.Clone(h.Launch)
|
||||
tails := [][]string{verb}
|
||||
if !slices.Equal(verb, h.Prompt) {
|
||||
tails = append(tails, h.Prompt)
|
||||
}
|
||||
if mcpConfig != "" {
|
||||
tails = append([][]string{h.MCPConfig}, tails...)
|
||||
}
|
||||
for _, tail := range tails {
|
||||
for _, arg := range tail {
|
||||
arg = strings.ReplaceAll(arg, promptPlaceholder, prompt)
|
||||
arg = strings.ReplaceAll(arg, sessionPlaceholder, session)
|
||||
arg = strings.ReplaceAll(arg, mcpConfigPlaceholder, mcpConfig)
|
||||
argv = append(argv, arg)
|
||||
}
|
||||
}
|
||||
return argv
|
||||
}
|
||||
|
||||
// resumeVerb continues the session the last invocation reported, falling
|
||||
// back to the most recent session when the CLI reported none. It returns nil
|
||||
// when neither is possible: resuming with an empty session ID would start a
|
||||
// broken command.
|
||||
func resumeVerb(h *agentrun.HarnessSpec, sessionID string) []string {
|
||||
if len(h.Resume) > 0 && sessionID != "" {
|
||||
return slices.Clone(h.Resume)
|
||||
}
|
||||
if len(h.Continue) > 0 {
|
||||
return slices.Clone(h.Continue)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// invoke runs one harness invocation in its own process group, feeding
|
||||
// stdout to out line by line. Cancelling ctx kills the whole group, so a
|
||||
// CLI's children cannot outlive the step.
|
||||
func invoke(ctx context.Context, workspace string, h *agentrun.HarnessSpec, argv []string, out HarnessOutput, report agentrun.Reporter) error {
|
||||
cmd := exec.CommandContext(ctx, argv[0], argv[1:]...)
|
||||
cmd.Dir = workspace
|
||||
cmd.WaitDelay = killGrace
|
||||
// A nil Env would inherit the worker's environment and its credentials.
|
||||
cmd.Env = append([]string{}, h.Env...)
|
||||
setProcessGroup(cmd)
|
||||
if err := runAsHarnessUser(cmd, h.User); err != nil {
|
||||
return err
|
||||
}
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var stderr tailBuffer
|
||||
cmd.Stderr = io.MultiWriter(&stderr, os.Stderr)
|
||||
if err := cmd.Start(); err != nil {
|
||||
return fmt.Errorf("start harness: %w", err)
|
||||
}
|
||||
// Keep the raw harness activity visible in the container's live output.
|
||||
output := io.TeeReader(stdout, os.Stdout)
|
||||
scanner := bufio.NewScanner(output)
|
||||
scanner.Buffer(make([]byte, 64*1024), 16*1024*1024)
|
||||
for scanner.Scan() {
|
||||
out.Line(scanner.Bytes(), report)
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
// Stop the CLI rather than leave it writing into a pipe nobody parses.
|
||||
_ = cmd.Cancel()
|
||||
_, _ = io.Copy(io.Discard, output)
|
||||
_ = cmd.Wait()
|
||||
return fmt.Errorf("read harness output: %w", err)
|
||||
}
|
||||
waitErr := cmd.Wait()
|
||||
reapGroup(cmd)
|
||||
if err := waitErr; err != nil {
|
||||
if ctx.Err() != nil {
|
||||
return ctx.Err()
|
||||
}
|
||||
return fmt.Errorf("harness exited: %w: %s", err, strings.TrimSpace(stderr.String()))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func harnessPrompt(workspace string, req agentrun.Request) string {
|
||||
var b strings.Builder
|
||||
b.WriteString(req.Mission)
|
||||
b.WriteString("\n\n## Rules\n\n")
|
||||
b.WriteString(ProjectScopedRules(workspace, req.ExtraRules))
|
||||
b.WriteString("\nDo not run git commands that change history, refs or configuration. Archie commits your changes.")
|
||||
if req.ReadOnly {
|
||||
b.WriteString("\nThis stage is read-only. Do not create, modify or delete any file.")
|
||||
}
|
||||
if patterns := slices.Concat(req.Protection.Suffixes, req.Protection.Globs); len(patterns) > 0 {
|
||||
b.WriteString("\nDo not modify files matching: " + strings.Join(patterns, ", "))
|
||||
}
|
||||
if len(req.Gate.Commands) > 0 {
|
||||
b.WriteString("\nYour work must pass these commands:")
|
||||
for _, c := range req.Gate.Commands {
|
||||
b.WriteString("\n- " + strings.Join(c.Argv, " "))
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(req.Notes) != "" {
|
||||
b.WriteString("\n\n## Notes\n\n" + req.Notes)
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// runHarnessGate runs the gate commands confined like the harness: they
|
||||
// execute code the harness just wrote, so they get its user, its environment
|
||||
// and its process group rather than the worker's.
|
||||
func runHarnessGate(ctx context.Context, h *agentrun.HarnessSpec, commands []agentrun.Command, workspace string) (string, error) {
|
||||
for _, c := range commands {
|
||||
if len(c.Argv) == 0 {
|
||||
continue
|
||||
}
|
||||
cmd := exec.CommandContext(ctx, c.Argv[0], c.Argv[1:]...)
|
||||
cmd.Dir = workspace
|
||||
cmd.WaitDelay = killGrace
|
||||
cmd.Env = append([]string{}, h.Env...)
|
||||
setProcessGroup(cmd)
|
||||
if err := runAsHarnessUser(cmd, h.User); err != nil {
|
||||
return "", err
|
||||
}
|
||||
output, err := cmd.CombinedOutput()
|
||||
reapGroup(cmd)
|
||||
switch {
|
||||
case c.ExpectFailure && err == nil:
|
||||
return fmt.Sprintf("[%s] expected this command to fail, but it passed:\n%s", c.Name, clipGate(output)),
|
||||
fmt.Errorf("gate %s: expected failure", c.Name)
|
||||
case !c.ExpectFailure && err != nil:
|
||||
return fmt.Sprintf("[%s] %s\n%s", c.Name, strings.Join(c.Argv, " "), clipGate(output)), fmt.Errorf("gate %s: %w", c.Name, err)
|
||||
}
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func clipGate(out []byte) string {
|
||||
const limit = 4000
|
||||
s := strings.TrimSpace(string(out))
|
||||
if len(s) <= limit {
|
||||
return s
|
||||
}
|
||||
return s[:limit/2] + "\n...[truncated]...\n" + s[len(s)-limit/2:]
|
||||
}
|
||||
|
||||
func park(res agentrun.Result, stop, detail string) agentrun.Result {
|
||||
res.Status, res.StopReason, res.Detail = StatusParked, stop, detail
|
||||
return res
|
||||
}
|
||||
|
||||
func addUsage(a, b agentrun.Usage) agentrun.Usage {
|
||||
return agentrun.Usage{
|
||||
PromptTokens: a.PromptTokens + b.PromptTokens,
|
||||
CompletionTokens: a.CompletionTokens + b.CompletionTokens,
|
||||
TotalTokens: a.TotalTokens + b.TotalTokens,
|
||||
CachedTokens: a.CachedTokens + b.CachedTokens,
|
||||
CacheCreationTokens: a.CacheCreationTokens + b.CacheCreationTokens,
|
||||
}
|
||||
}
|
||||
|
||||
// repoState is what the runner compares across an invocation: every ref
|
||||
// (HEAD included), the repository configuration, and a content hash of each
|
||||
// path git reports as not clean.
|
||||
type repoState struct {
|
||||
refs map[string]string
|
||||
config string
|
||||
dirty map[string]string
|
||||
}
|
||||
|
||||
func snapshotRepo(workspace string) (repoState, error) {
|
||||
repo, err := git.PlainOpen(workspace)
|
||||
if err != nil {
|
||||
return repoState{}, err
|
||||
}
|
||||
state := repoState{refs: map[string]string{}, dirty: map[string]string{}}
|
||||
if head, err := repo.Storer.Reference(plumbing.HEAD); err == nil {
|
||||
state.refs[plumbing.HEAD.String()] = head.String()
|
||||
}
|
||||
iter, err := repo.References()
|
||||
if err != nil {
|
||||
return repoState{}, err
|
||||
}
|
||||
if err := iter.ForEach(func(ref *plumbing.Reference) error {
|
||||
state.refs[ref.Name().String()] = ref.String()
|
||||
return nil
|
||||
}); err != nil {
|
||||
return repoState{}, err
|
||||
}
|
||||
cfg, err := repo.Config()
|
||||
if err != nil {
|
||||
return repoState{}, err
|
||||
}
|
||||
raw, err := cfg.Marshal()
|
||||
if err != nil {
|
||||
return repoState{}, err
|
||||
}
|
||||
state.config = string(raw)
|
||||
wt, err := repo.Worktree()
|
||||
if err != nil {
|
||||
return repoState{}, err
|
||||
}
|
||||
status, err := wt.Status()
|
||||
if err != nil {
|
||||
return repoState{}, err
|
||||
}
|
||||
for path, st := range status {
|
||||
if st.Worktree == git.Unmodified && st.Staging == git.Unmodified {
|
||||
continue
|
||||
}
|
||||
state.dirty[path] = contentHash(filepath.Join(workspace, path))
|
||||
}
|
||||
return state, nil
|
||||
}
|
||||
|
||||
func contentHash(path string) string {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return "absent"
|
||||
}
|
||||
sum := sha256.Sum256(data)
|
||||
return hex.EncodeToString(sum[:])
|
||||
}
|
||||
|
||||
// changedPaths is every path whose state differs across the invocation. A
|
||||
// path already dirty and left untouched is not a change of this run.
|
||||
func changedPaths(before, after repoState) []string {
|
||||
var changed []string
|
||||
for path := range mergeKeys(before.dirty, after.dirty) {
|
||||
if before.dirty[path] != after.dirty[path] {
|
||||
changed = append(changed, path)
|
||||
}
|
||||
}
|
||||
slices.Sort(changed)
|
||||
return changed
|
||||
}
|
||||
|
||||
func mergeKeys(a, b map[string]string) map[string]struct{} {
|
||||
keys := make(map[string]struct{}, len(a)+len(b))
|
||||
for k := range maps.Keys(a) {
|
||||
keys[k] = struct{}{}
|
||||
}
|
||||
for k := range maps.Keys(b) {
|
||||
keys[k] = struct{}{}
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
func policyViolation(before, after repoState, changes []string, req agentrun.Request) string {
|
||||
if !maps.Equal(before.refs, after.refs) {
|
||||
var moved []string
|
||||
for name := range mergeKeys(before.refs, after.refs) {
|
||||
if before.refs[name] != after.refs[name] {
|
||||
moved = append(moved, name)
|
||||
}
|
||||
}
|
||||
slices.Sort(moved)
|
||||
return "the harness changed git refs: " + strings.Join(moved, ", ")
|
||||
}
|
||||
if before.config != after.config {
|
||||
return "the harness changed the git configuration"
|
||||
}
|
||||
if req.ReadOnly && len(changes) > 0 {
|
||||
return "the harness wrote in a read-only stage: " + strings.Join(changes, ", ")
|
||||
}
|
||||
if protected := ProtectionMatcher(req.Protection, false); protected != nil {
|
||||
var hit []string
|
||||
for _, path := range changes {
|
||||
if protected(path) {
|
||||
hit = append(hit, path)
|
||||
}
|
||||
}
|
||||
if len(hit) > 0 {
|
||||
return "the harness modified protected paths: " + strings.Join(hit, ", ")
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type silentOutput struct{}
|
||||
|
||||
func (silentOutput) Line([]byte, agentrun.Reporter) {}
|
||||
func (silentOutput) SessionID() string { return "" }
|
||||
func (silentOutput) Usage() agentrun.Usage { return agentrun.Usage{} }
|
||||
|
||||
// tailBuffer keeps the last stderrTailBytes written to it.
|
||||
type tailBuffer struct{ buf bytes.Buffer }
|
||||
|
||||
func (t *tailBuffer) Write(p []byte) (int, error) {
|
||||
t.buf.Write(p)
|
||||
if extra := t.buf.Len() - stderrTailBytes; extra > 0 {
|
||||
t.buf.Next(extra)
|
||||
}
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (t *tailBuffer) String() string { return t.buf.String() }
|
||||
|
||||
// prepareCaptures writes the capture tools' spec and an MCP config pointing
|
||||
// the CLI at archie's MCP server, and creates the captures file the server
|
||||
// appends to. The directory belongs to the harness user, whose MCP server
|
||||
// writes into it.
|
||||
func (r *HarnessRunner) prepareCaptures(req agentrun.Request) (config, captures string, cleanup func(), err error) {
|
||||
cleanup = func() {}
|
||||
if len(req.CaptureTools) == 0 && !req.Harness.CentralTools {
|
||||
return "", "", cleanup, nil
|
||||
}
|
||||
dir, err := os.MkdirTemp("", "archie-captures-")
|
||||
if err != nil {
|
||||
return "", "", cleanup, err
|
||||
}
|
||||
cleanup = func() { _ = os.RemoveAll(dir) }
|
||||
fail := func(err error) (string, string, func(), error) {
|
||||
cleanup()
|
||||
return "", "", func() {}, err
|
||||
}
|
||||
spec, err := json.Marshal(harnessMCPSpec{Captures: req.CaptureTools, CentralTools: req.Harness.CentralTools})
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
specPath, capturesPath, configPath := filepath.Join(dir, "tools.json"), filepath.Join(dir, "captures.jsonl"), filepath.Join(dir, "mcp.json")
|
||||
self, err := os.Executable()
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
server := map[string]any{
|
||||
"env": harnessMCPEnvironment(req.Harness.Env),
|
||||
"command": self,
|
||||
"args": []string{"mcp", "-spec", specPath, "-captures", capturesPath},
|
||||
}
|
||||
cfg, err := json.Marshal(map[string]any{"mcpServers": map[string]any{"archie": server}})
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
for path, content := range map[string][]byte{specPath: spec, configPath: cfg, capturesPath: nil} {
|
||||
if err := os.WriteFile(path, content, 0o600); err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
}
|
||||
if err := ownForHarness(req.Harness.User, dir, specPath, configPath, capturesPath); err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
registration, err := harnessMCPRegistration(req.Harness.Adapter, dir, configPath, server)
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
return registration, capturesPath, cleanup, nil
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
//go:build unix
|
||||
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
func TestHarnessLiveOutput(t *testing.T) {
|
||||
if os.Getenv("ARCHIE_TEST_HARNESS_OUTPUT") == "1" {
|
||||
adapter := &codexHarnessOutput{}
|
||||
user := ""
|
||||
if os.Geteuid() == 0 {
|
||||
user = "65534"
|
||||
}
|
||||
err := invoke(t.Context(), "/tmp", &agentrun.HarnessSpec{User: user}, []string{"sh", "-c", `printf '%s\n' '{"type":"thread.started","thread_id":"live-thread"}'; printf '%s\n' 'live diagnostic' >&2`}, adapter, agentrun.Reporter{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if adapter.SessionID() != "live-thread" {
|
||||
t.Fatal("forwarding lost the adapter input")
|
||||
}
|
||||
return
|
||||
}
|
||||
cmd := exec.CommandContext(t.Context(), os.Args[0], "-test.run=^TestHarnessLiveOutput$")
|
||||
cmd.Env = append(os.Environ(), "ARCHIE_TEST_HARNESS_OUTPUT=1")
|
||||
got, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("harness: %v: %s", err, got)
|
||||
}
|
||||
for _, want := range []string{"live-thread", "live diagnostic"} {
|
||||
if !strings.Contains(string(got), want) {
|
||||
t.Errorf("worker output %q is missing %q", got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,3 +177,17 @@ func isNonEmptyString(object map[string]json.RawMessage, field string) bool {
|
||||
raw, ok := object[field]
|
||||
return ok && json.Unmarshal(raw, &text) == nil && strings.TrimSpace(text) != ""
|
||||
}
|
||||
|
||||
// AcceptCapture decides whether one capture call is kept.
|
||||
func AcceptCapture(spec agentrun.CaptureTool, accepted int, value json.RawMessage) (string, bool) {
|
||||
if spec.MaxCalls > 0 && accepted >= spec.MaxCalls {
|
||||
return fmt.Sprintf("%s rejected: maximum call count is %d", spec.Name, spec.MaxCalls), false
|
||||
}
|
||||
if !json.Valid(value) {
|
||||
return spec.Name + " rejected: arguments are not valid JSON", false
|
||||
}
|
||||
if rejection, ok := ValidateCaptureArgs(spec, value); !ok {
|
||||
return rejection, false
|
||||
}
|
||||
return spec.Name + " recorded", true
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
"github.com/samcharles93/archie-core/internal/prompts"
|
||||
)
|
||||
|
||||
// missionWithHistory puts the conversation of an earlier run of the stage
|
||||
@@ -17,8 +18,7 @@ func missionWithHistory(req agentrun.Request) string {
|
||||
return req.Mission
|
||||
}
|
||||
var b strings.Builder
|
||||
b.WriteString("<previous_run>\nAn earlier run of this stage stopped at its step budget and was approved to continue. " +
|
||||
"Its conversation follows and its edits are already in the worktree. Continue from where it stopped; do not start over.\n\n")
|
||||
b.WriteString("<previous_run>\n" + prompts.ResumeRun() + "\n\n")
|
||||
for _, e := range entries {
|
||||
switch e.Kind {
|
||||
case agentrun.TranscriptModel:
|
||||
|
||||
@@ -3,17 +3,21 @@ package modelloop
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"net/http"
|
||||
"slices"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/agentloop"
|
||||
"github.com/samcharles93/ai-sdk/core"
|
||||
errx "github.com/samcharles93/ai-sdk/error"
|
||||
"github.com/samcharles93/ai-sdk/runtime"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/agentexec"
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
"github.com/samcharles93/archie-core/internal/taskstate"
|
||||
"github.com/samcharles93/archie-core/internal/tools"
|
||||
)
|
||||
|
||||
@@ -73,11 +77,12 @@ func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Req
|
||||
return agentrun.Result{}, fmt.Errorf("build central tool set: %w", err)
|
||||
}
|
||||
captureTools := captureToolSet(req.CaptureTools, captures)
|
||||
var modelHooks []core.ModelHook
|
||||
var toolHooks []core.ToolHook
|
||||
log := r.logger(req)
|
||||
progress := newProgressLog(log)
|
||||
modelHooks, toolHooks := []core.ModelHook{progress}, []core.ToolHook{progress}
|
||||
if report.Transcript != nil {
|
||||
recorder := newTranscript(report.Transcript)
|
||||
modelHooks, toolHooks = []core.ModelHook{recorder}, []core.ToolHook{recorder}
|
||||
modelHooks, toolHooks = append(modelHooks, recorder), append(toolHooks, recorder)
|
||||
}
|
||||
res, err := r.run(ctx, agentloop.Config{
|
||||
Runtime: r.runtime,
|
||||
@@ -109,13 +114,29 @@ func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Req
|
||||
),
|
||||
ModelHooks: modelHooks,
|
||||
ToolHooks: toolHooks,
|
||||
Logger: r.logger(req),
|
||||
Logger: log,
|
||||
})
|
||||
result := resultFromRun(req, res, notes.appended, captures)
|
||||
if cause := context.Cause(ctx); cause != nil {
|
||||
return result, cause
|
||||
}
|
||||
return result, err
|
||||
return result, providerBlocked(err)
|
||||
}
|
||||
|
||||
// providerBlocked marks a provider refusal the operator must fix: a rejected
|
||||
// credential, or an account without credit. Retrying either fails the same way.
|
||||
func providerBlocked(err error) error {
|
||||
failure, ok := errors.AsType[*errx.ProviderError](err)
|
||||
if !ok {
|
||||
return err
|
||||
}
|
||||
switch failure.StatusCode {
|
||||
case http.StatusUnauthorized, http.StatusForbidden:
|
||||
return &agentrun.BlockedError{Blocker: taskstate.BlockerModelCredential, Err: err}
|
||||
case http.StatusPaymentRequired:
|
||||
return &agentrun.BlockedError{Blocker: taskstate.BlockerModelCredit, Err: err}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func resultFromRun(req agentrun.Request, res agentloop.Result, appended []string, captures map[string][]json.RawMessage) agentrun.Result {
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package modelloop
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/chat"
|
||||
"github.com/samcharles93/ai-sdk/core"
|
||||
)
|
||||
|
||||
// progressLog writes one task-log line per model call and tool call as it
|
||||
// finishes. agentloop logs its per-step lines only after the run returns, so
|
||||
// without this the operator sees nothing for the length of the stage.
|
||||
type progressLog struct {
|
||||
log *slog.Logger
|
||||
|
||||
mu sync.Mutex
|
||||
started map[string]time.Time
|
||||
}
|
||||
|
||||
func newProgressLog(log *slog.Logger) *progressLog {
|
||||
return &progressLog{log: log, started: map[string]time.Time{}}
|
||||
}
|
||||
|
||||
func (p *progressLog) ModelCallStarted(context.Context, chat.Request) {}
|
||||
|
||||
func (p *progressLog) ModelCallFinished(ctx context.Context, _ chat.Request, resp *chat.Response, err error, latency time.Duration, usage *chat.Usage) {
|
||||
attrs := []any{"latency_ms", latency.Milliseconds()}
|
||||
if usage != nil {
|
||||
attrs = append(attrs, "prompt_tokens", usage.PromptTokens, "completion_tokens", usage.CompletionTokens)
|
||||
}
|
||||
if err != nil {
|
||||
p.log.WarnContext(ctx, "agent model call failed", append(attrs, "err", err)...)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
attrs = append(attrs, "tool_calls", len(resp.ToolCalls))
|
||||
}
|
||||
p.log.InfoContext(ctx, "agent model call", attrs...)
|
||||
}
|
||||
|
||||
func (p *progressLog) BeforeToolExecute(_ context.Context, call *core.ToolCall) (*core.Skip, error) {
|
||||
p.mu.Lock()
|
||||
p.started[call.ToolCallID] = time.Now()
|
||||
p.mu.Unlock()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (p *progressLog) AfterToolExecute(ctx context.Context, call core.ToolCall, result *core.ToolResult) {
|
||||
p.mu.Lock()
|
||||
started, ok := p.started[call.ToolCallID]
|
||||
delete(p.started, call.ToolCallID)
|
||||
p.mu.Unlock()
|
||||
attrs := []any{"tool", call.ToolName}
|
||||
if ok {
|
||||
attrs = append(attrs, "latency_ms", time.Since(started).Milliseconds())
|
||||
}
|
||||
if result.Error != "" {
|
||||
p.log.WarnContext(ctx, "agent tool call failed", append(attrs, "err", clip(result.Error, nil))...)
|
||||
return
|
||||
}
|
||||
p.log.InfoContext(ctx, "agent tool call", attrs...)
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/samcharles93/ai-sdk/chat"
|
||||
|
||||
protocol "github.com/samcharles93/archie-core/internal/tools/mcp"
|
||||
protocol "github.com/samcharles93/archie-core/internal/tools/provider/mcp"
|
||||
)
|
||||
|
||||
// DefaultSamplingMaxTokens bounds a server-requested completion when the
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
func TestTranscriptToolEntryRedactsAndClips(t *testing.T) {
|
||||
const jwt = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcmNoaWUifQ.c2lnbmF0dXJlc2lnbmF0dXJl"
|
||||
const pem = "-----BEGIN RSA PRIVATE KEY-----\nMIIEow\n-----END RSA PRIVATE KEY-----"
|
||||
const pem = "-----BEGIN RSA PRIVATE KEY-----\nMIIEow\n-----END RSA PRIVATE KEY-----" //nolint:gosec // G101: a fake key the redaction must catch.
|
||||
long := strings.Repeat("x", transcriptFieldLimit+10)
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package agentworker
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/agentexec"
|
||||
)
|
||||
|
||||
// RunCaptureMCP serves a stage's capture tools to its harness over stdio
|
||||
// until the harness closes the connection or ctx is cancelled.
|
||||
func RunCaptureMCP(ctx context.Context, specPath, capturesPath string) error {
|
||||
return agentexec.ServeCaptureFiles(ctx, specPath, capturesPath, &mcp.StdioTransport{})
|
||||
}
|
||||
@@ -111,13 +111,19 @@ func (h *hybridTrees) HasUncommittedChanges(ctx context.Context, dir string) (bo
|
||||
|
||||
var _ workflow.Trees = (*hybridTrees)(nil)
|
||||
|
||||
// chownTree recursively lchowns dir to uid:gid.
|
||||
// chownTree recursively lchowns dir to uid:gid, through a root so a symlink
|
||||
// swapped in mid-walk cannot point it outside dir.
|
||||
func chownTree(dir string, uid, gid int) error {
|
||||
return filepath.WalkDir(dir, func(path string, _ fs.DirEntry, err error) error {
|
||||
root, err := os.OpenRoot(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = root.Close() }()
|
||||
return fs.WalkDir(root.FS(), ".", func(path string, _ fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Lchown(path, uid, gid)
|
||||
return root.Lchown(path, uid, gid)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -184,10 +190,6 @@ func applyToolLimits(agent agentrun.Runner, policy config.ToolPolicy, allow []st
|
||||
// shared model runtime (the one its MCP providers answer sampling from); the
|
||||
// registry path reuses it rather than building a second one.
|
||||
func stageRunners(req taskrun.Request, mcpSet *taskmcp.Set, newRunner runnerFactory, llm *runtime.Runtime, log *slog.Logger) (agentrun.Runner, error) {
|
||||
if req.Harness != nil {
|
||||
// The built-in loop has no route to a model from a Kit container.
|
||||
return agentexec.HarnessStages{Runner: agentexec.NewHarnessRunner(), Spec: *req.Harness}, nil
|
||||
}
|
||||
var agent agentrun.Runner
|
||||
if mcpSet != nil && mcpSet.Registry != nil {
|
||||
agent = modelloop.NewLoopRunner(llm, log, mcpSet.Registry)
|
||||
@@ -345,7 +347,7 @@ func CompilePinnedWorkflow(req *taskrun.Request, steps *workflow.Manager) (workf
|
||||
}
|
||||
|
||||
func taskMCPProviders(ctx context.Context, req taskrun.Request, deps taskDependencies, log *slog.Logger) (*runtime.Runtime, *taskmcp.Set) {
|
||||
if req.Harness != nil || len(req.MCPServers) == 0 {
|
||||
if len(req.MCPServers) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
llm := modelloop.NewRuntimeOver(deps.modelTransport, req.Providers, req.Cfg.ModelLimits, nil)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/agentexec"
|
||||
@@ -35,9 +36,8 @@ func (e *StartupError) Unwrap() error { return e.Err }
|
||||
|
||||
// Settings are process-derived inputs for one worker runtime.
|
||||
type Settings struct {
|
||||
NATSURL string
|
||||
NATSToken string
|
||||
WorkDir string
|
||||
NATSURL string
|
||||
WorkDir string
|
||||
|
||||
// StateStoreTarget and StateStoreToken are the daemon-injected State Store
|
||||
// gRPC endpoint and bearer token. StateStoreTarget is required: the legacy
|
||||
@@ -126,10 +126,16 @@ func run(ctx context.Context, settings Settings, log *slog.Logger, dependencies
|
||||
return &StartupError{Operation: "model proxy", Err: err}
|
||||
}
|
||||
}
|
||||
// Commands run with no directory of their own run in the worktree. The
|
||||
// runtime's starting directory is not it: an OpenShell sandbox starts
|
||||
// elsewhere, and a resumed stage carries no directory.
|
||||
if err := os.Chdir(workDir); err != nil {
|
||||
return &StartupError{Operation: "enter worktree", Err: err}
|
||||
}
|
||||
dependencies.markSafe(ctx, workDir, log)
|
||||
|
||||
// The task is known before connecting: without a broker token the
|
||||
// worker logs in as its task, with its run credential.
|
||||
// The task is known before connecting: the worker logs in as its task,
|
||||
// with its run credential.
|
||||
taskID, err := dependencies.bootID(workDir)
|
||||
if err != nil {
|
||||
log.ErrorContext(ctx, "task boot failed", "err", err)
|
||||
@@ -137,7 +143,6 @@ func run(ctx context.Context, settings Settings, log *slog.Logger, dependencies
|
||||
}
|
||||
transport, err := dependencies.connect(ctx, agentnats.Config{
|
||||
URL: settings.NATSURL,
|
||||
Token: settings.NATSToken,
|
||||
TaskID: taskID,
|
||||
StateStoreURL: settings.StateStoreTarget,
|
||||
StateStoreToken: settings.StateStoreToken,
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package archie
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/danielgtaylor/huma/v2"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/buildinfo"
|
||||
"github.com/samcharles93/archie-core/internal/platform/httpapi"
|
||||
"github.com/samcharles93/archie-core/modules/approvals"
|
||||
"github.com/samcharles93/archie-core/modules/connectors"
|
||||
"github.com/samcharles93/archie-core/modules/deliveries"
|
||||
"github.com/samcharles93/archie-core/modules/drafts"
|
||||
"github.com/samcharles93/archie-core/modules/events"
|
||||
"github.com/samcharles93/archie-core/modules/governance"
|
||||
"github.com/samcharles93/archie-core/modules/judgement"
|
||||
"github.com/samcharles93/archie-core/modules/runs"
|
||||
"github.com/samcharles93/archie-core/modules/system"
|
||||
)
|
||||
|
||||
// apiModules are the modules that serve the HTTP API.
|
||||
type apiModules struct {
|
||||
settings *governance.Module
|
||||
conns *connectors.Module
|
||||
system *system.Module
|
||||
tell *deliveries.Module
|
||||
allow *approvals.Module
|
||||
classes *judgement.Classes
|
||||
policies *judgement.Policies
|
||||
hear *events.Module
|
||||
judge *judgement.Module
|
||||
engine *runs.Engine
|
||||
drafts *drafts.Module
|
||||
}
|
||||
|
||||
func (m apiModules) register(api huma.API) {
|
||||
m.settings.Register(api)
|
||||
m.conns.Register(api)
|
||||
m.system.Register(api)
|
||||
m.tell.Register(api)
|
||||
m.allow.Register(api)
|
||||
m.classes.Register(api, m.allow)
|
||||
m.policies.Register(api)
|
||||
m.hear.Register(api)
|
||||
m.judge.Register(api)
|
||||
m.engine.Register(api, orgID, m.hear, m.judge, m.allow)
|
||||
m.drafts.Register(api)
|
||||
}
|
||||
|
||||
// Document returns the API's OpenAPI document as YAML. It makes the same
|
||||
// registrations the server does, on modules with nothing behind them, so it
|
||||
// needs no database.
|
||||
func Document() ([]byte, error) {
|
||||
api := httpapi.New(http.NewServeMux(), buildinfo.Version, "")
|
||||
apiModules{
|
||||
settings: &governance.Module{}, conns: &connectors.Module{}, system: &system.Module{},
|
||||
tell: &deliveries.Module{}, allow: &approvals.Module{}, classes: &judgement.Classes{},
|
||||
policies: &judgement.Policies{}, hear: &events.Module{}, judge: &judgement.Module{},
|
||||
engine: &runs.Engine{}, drafts: &drafts.Module{},
|
||||
}.register(api)
|
||||
return api.OpenAPI().YAML()
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package archie
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"filippo.io/age"
|
||||
"github.com/BurntSushi/toml"
|
||||
)
|
||||
|
||||
// Config is the bootstrap configuration: only what the binary needs before it
|
||||
// can reach its database. Everything else is a setting in the control plane.
|
||||
type Config struct {
|
||||
Listen string `toml:"listen"`
|
||||
Database DatabaseConfig `toml:"database"`
|
||||
// AdminTokenSHA256 is the hex SHA-256 of the bootstrap admin token that
|
||||
// guards /api/ until identities exist. The token itself is never stored.
|
||||
AdminTokenSHA256 string `toml:"admin_token_sha256"`
|
||||
// AgeIdentity ("AGE-SECRET-KEY-1...") seals and opens the credentials
|
||||
// Archie keeps. Losing it loses them, unless a backup recipient's key
|
||||
// survives.
|
||||
AgeIdentity string `toml:"age_identity"`
|
||||
// AgeBackupRecipients ("age1...") can also open every sealed credential.
|
||||
AgeBackupRecipients []string `toml:"age_backup_recipients"`
|
||||
}
|
||||
|
||||
// DatabaseConfig holds the two connection URLs. The owner runs migrations at
|
||||
// boot and nothing else; the runtime URL never holds DDL rights.
|
||||
type DatabaseConfig struct {
|
||||
URL string `toml:"url"`
|
||||
OwnerURL string `toml:"owner_url"`
|
||||
}
|
||||
|
||||
var adminHash = regexp.MustCompile(`^[0-9a-f]{64}$`)
|
||||
|
||||
var adminLine = regexp.MustCompile(`(?m)^\s*admin_token_sha256\s*=.*$`)
|
||||
|
||||
// WriteAdminHash replaces the admin token hash in the config at path, keeping
|
||||
// every other line. The hash is the only value written: the old token and the
|
||||
// old hash are never read back or logged.
|
||||
func WriteAdminHash(path, hash string) error {
|
||||
if !adminHash.MatchString(hash) {
|
||||
return errors.New("an admin token hash is a hex SHA-256")
|
||||
}
|
||||
raw, err := os.ReadFile(path) //nolint:gosec // the path is the config the binary was started with.
|
||||
if err != nil {
|
||||
return fmt.Errorf("read config %s: %w", path, err)
|
||||
}
|
||||
line := `admin_token_sha256 = "` + hash + `"`
|
||||
next := string(raw)
|
||||
if adminLine.MatchString(next) {
|
||||
next = adminLine.ReplaceAllString(next, line)
|
||||
} else {
|
||||
next = strings.TrimRight(next, "\n") + "\n" + line + "\n"
|
||||
}
|
||||
if !strings.HasSuffix(next, "\n") {
|
||||
next += "\n"
|
||||
}
|
||||
return writeConfig(path, []byte(next))
|
||||
}
|
||||
|
||||
// writeConfig replaces path atomically, so a crash leaves either the old file
|
||||
// or the new one.
|
||||
func writeConfig(path string, data []byte) error {
|
||||
dir := filepath.Dir(path)
|
||||
file, err := os.CreateTemp(dir, ".config-*")
|
||||
if err != nil {
|
||||
return fmt.Errorf("write config %s: %w", path, err)
|
||||
}
|
||||
name := file.Name()
|
||||
defer func() { _ = os.Remove(name) }()
|
||||
if err := file.Chmod(0o600); err != nil {
|
||||
_ = file.Close()
|
||||
return fmt.Errorf("write config %s: %w", path, err)
|
||||
}
|
||||
if _, err := file.Write(data); err != nil {
|
||||
_ = file.Close()
|
||||
return fmt.Errorf("write config %s: %w", path, err)
|
||||
}
|
||||
if err := file.Sync(); err != nil {
|
||||
_ = file.Close()
|
||||
return fmt.Errorf("write config %s: %w", path, err)
|
||||
}
|
||||
if err := file.Close(); err != nil {
|
||||
return fmt.Errorf("write config %s: %w", path, err)
|
||||
}
|
||||
if err := os.Rename(name, path); err != nil {
|
||||
return fmt.Errorf("write config %s: %w", path, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DatabaseHost is the host a database URL names, without credentials or the
|
||||
// database name. It is what the dashboard shows.
|
||||
func DatabaseHost(raw string) string {
|
||||
u, err := url.Parse(raw)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return u.Host
|
||||
}
|
||||
|
||||
// DefaultConfigPath is ${XDG_CONFIG_HOME:-~/.config}/archie/config.toml.
|
||||
func DefaultConfigPath() string {
|
||||
dir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
return filepath.Join("archie", "config.toml")
|
||||
}
|
||||
return filepath.Join(dir, "archie", "config.toml")
|
||||
}
|
||||
|
||||
// NewAgeIdentity writes a new age identity to w, for a config's age_identity.
|
||||
func NewAgeIdentity(w io.Writer) error {
|
||||
id, err := age.GenerateX25519Identity()
|
||||
if err != nil {
|
||||
return fmt.Errorf("generate age identity: %w", err)
|
||||
}
|
||||
_, err = fmt.Fprintln(w, id.String())
|
||||
return err
|
||||
}
|
||||
|
||||
// LoadConfig reads and validates the bootstrap config at path.
|
||||
func LoadConfig(path string) (Config, error) {
|
||||
cfg := Config{Listen: "127.0.0.1:8080"}
|
||||
if _, err := toml.DecodeFile(path, &cfg); err != nil {
|
||||
return Config{}, fmt.Errorf("read config %s: %w", path, err)
|
||||
}
|
||||
if err := cfg.validate(); err != nil {
|
||||
return Config{}, fmt.Errorf("config %s: %w", path, err)
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func (c Config) validate() error {
|
||||
var errs []error
|
||||
if c.Listen == "" {
|
||||
errs = append(errs, errors.New("listen is empty"))
|
||||
}
|
||||
if c.Database.URL == "" {
|
||||
errs = append(errs, errors.New("database.url is required"))
|
||||
}
|
||||
// The owner URL has no fallback to the runtime URL: a runtime connection
|
||||
// that can run DDL defeats the role split.
|
||||
if c.Database.OwnerURL == "" {
|
||||
errs = append(errs, errors.New("database.owner_url is required"))
|
||||
}
|
||||
if c.AgeIdentity == "" {
|
||||
errs = append(errs, errors.New("age_identity is required"))
|
||||
}
|
||||
if !adminHash.MatchString(c.AdminTokenSHA256) {
|
||||
errs = append(errs, errors.New("admin_token_sha256 must be a hex SHA-256"))
|
||||
}
|
||||
if c.Database.URL != "" && c.Database.URL == c.Database.OwnerURL {
|
||||
errs = append(errs, errors.New("database.url and database.owner_url must name different roles"))
|
||||
}
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package archie
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestWriteAdminHashReplacesOnlyTheHash guards token rotation: the config keeps
|
||||
// every other value, the old hash is gone, and the file is not left readable.
|
||||
func TestWriteAdminHashReplacesOnlyTheHash(t *testing.T) {
|
||||
const oldHash = "1111111111111111111111111111111111111111111111111111111111111111"
|
||||
const newHash = "2222222222222222222222222222222222222222222222222222222222222222"
|
||||
path := filepath.Join(t.TempDir(), "config.toml")
|
||||
before := "listen = \":8080\"\nadmin_token_sha256 = \"" + oldHash + "\"\n"
|
||||
if err := os.WriteFile(path, []byte(before), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := WriteAdminHash(path, newHash); err != nil {
|
||||
t.Fatalf("rotate: %v", err)
|
||||
}
|
||||
|
||||
got, err := os.ReadFile(path) //nolint:gosec // a test fixture in t.TempDir.
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
text := string(got)
|
||||
switch {
|
||||
case strings.Contains(text, oldHash):
|
||||
t.Fatal("the old hash is still in the config")
|
||||
case !strings.Contains(text, newHash):
|
||||
t.Fatal("the new hash was not written")
|
||||
case !strings.Contains(text, `listen = ":8080"`):
|
||||
t.Fatal("rotation changed another setting")
|
||||
}
|
||||
info, err := os.Stat(path) //nolint:gosec // a test fixture in t.TempDir.
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if info.Mode().Perm() != 0o600 {
|
||||
t.Fatalf("config mode is %o, want 600", info.Mode().Perm())
|
||||
}
|
||||
}
|
||||
|
||||
// TestWriteAdminHashAddsAMissingLine guards a config written before the hash
|
||||
// was set.
|
||||
func TestWriteAdminHashAddsAMissingLine(t *testing.T) {
|
||||
const hash = "3333333333333333333333333333333333333333333333333333333333333333"
|
||||
path := filepath.Join(t.TempDir(), "config.toml")
|
||||
if err := os.WriteFile(path, []byte("listen = \":8080\"\n"), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := WriteAdminHash(path, hash); err != nil {
|
||||
t.Fatalf("rotate: %v", err)
|
||||
}
|
||||
got, err := os.ReadFile(path) //nolint:gosec // a test fixture in t.TempDir.
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(got), hash) {
|
||||
t.Fatal("the hash was not added")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
// Package archie is the composition root of the single Archie binary. It loads
|
||||
// the bootstrap config, migrates and opens the database, and serves until the
|
||||
// context ends. Modules wire themselves in here as they land.
|
||||
package archie
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/samcharles93/ai-sdk/runtime"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/buildinfo"
|
||||
"github.com/samcharles93/archie-core/internal/platform/health"
|
||||
"github.com/samcharles93/archie-core/internal/platform/httpapi"
|
||||
"github.com/samcharles93/archie-core/internal/platform/hub"
|
||||
"github.com/samcharles93/archie-core/internal/platform/pg"
|
||||
"github.com/samcharles93/archie-core/modules/approvals"
|
||||
"github.com/samcharles93/archie-core/modules/connectors"
|
||||
"github.com/samcharles93/archie-core/modules/dashboard"
|
||||
"github.com/samcharles93/archie-core/modules/deliveries"
|
||||
"github.com/samcharles93/archie-core/modules/drafts"
|
||||
"github.com/samcharles93/archie-core/modules/events"
|
||||
"github.com/samcharles93/archie-core/modules/governance"
|
||||
"github.com/samcharles93/archie-core/modules/judgement"
|
||||
"github.com/samcharles93/archie-core/modules/memory"
|
||||
"github.com/samcharles93/archie-core/modules/runs"
|
||||
"github.com/samcharles93/archie-core/modules/system"
|
||||
"github.com/samcharles93/archie-core/ui"
|
||||
)
|
||||
|
||||
const shutdownGrace = 10 * time.Second
|
||||
|
||||
// Run boots the binary from the config at configPath and blocks until ctx ends
|
||||
// or the server fails.
|
||||
func Run(ctx context.Context, configPath string) error {
|
||||
log := slog.New(slog.NewJSONHandler(os.Stdout, nil)).With("service", "archie", "version", buildinfo.Version)
|
||||
|
||||
cfg, err := LoadConfig(configPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := pg.Migrate(ctx, log, cfg.Database.OwnerURL, cfg.Database.URL, schemas); err != nil {
|
||||
return err
|
||||
}
|
||||
db, err := pg.Open(ctx, cfg.Database.URL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = db.Close() }()
|
||||
|
||||
checks := health.NewRegistry()
|
||||
checks.Register("database", db.PingContext)
|
||||
mux := http.NewServeMux()
|
||||
checks.Routes(mux)
|
||||
api := httpapi.New(mux, buildinfo.Version, cfg.AdminTokenSHA256)
|
||||
|
||||
runtime.RegisterBuiltinClasses()
|
||||
settings := governance.NewModule(db, log.With("module", "governance"), orgID)
|
||||
|
||||
conns, err := connectors.NewModule(db, log.With("module", "connectors"), orgID, connectors.Sealing{
|
||||
Identity: cfg.AgeIdentity, Backups: cfg.AgeBackupRecipients,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer conns.Close()
|
||||
if err := conns.Start(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
checks.Register("connectors", conns.Ready)
|
||||
// A model's key is a credential name resolved through the sealed store.
|
||||
settings.UseCredentials(conns)
|
||||
|
||||
sys := system.New(system.Bootstrap{
|
||||
Listen: cfg.Listen, Database: DatabaseHost(cfg.Database.URL), Schemas: len(schemas),
|
||||
AdminPrefix: cfg.AdminTokenSHA256[:8], AdminSet: cfg.AdminTokenSHA256 != "",
|
||||
Sealing: cfg.AgeIdentity != "",
|
||||
}, func(hash string) error { return WriteAdminHash(configPath, hash) }, log.With("module", "system"))
|
||||
|
||||
live := hub.New()
|
||||
// Messages go to the composer and to every accepted connector that delivers
|
||||
// them.
|
||||
tell := deliveries.NewModule(db, log.With("module", "deliveries"), orgID, live, conns)
|
||||
|
||||
engine := runs.New(db, log.With("module", "runs"), runs.Options{Owner: owner()})
|
||||
// A workflow takes its context from the run handle, as a handler takes it
|
||||
// from the request.
|
||||
classes := judgement.NewClasses(db, log.With("module", "judgement"), orgID)
|
||||
// An approval request is carried by deliveries, and its answer wakes the run
|
||||
// that is waiting on it.
|
||||
allow := approvals.NewModule(db, log.With("module", "approvals"), orgID, tell, engine, classes, settings, settings)
|
||||
policies := judgement.NewPolicies(db, log.With("module", "judgement"), orgID)
|
||||
// An answer a channel delivers is an event, and settles its request.
|
||||
hear := events.NewModule(db, log.With("module", "events"), orgID, conns, engine, allow, tell)
|
||||
hear.Routes(mux)
|
||||
judge := newJudgement(db, log, conns, classes, policies, settings, hear)
|
||||
if err := useWorkflows(ctx, engine, runs.Deps{Settings: settings, Toolbox: conns, Judge: judge, Approver: allow, Notifier: tell, Memory: memory.NewModule(db, orgID)}); err != nil {
|
||||
return err
|
||||
}
|
||||
apiModules{
|
||||
settings: settings, conns: conns, system: sys, tell: tell, allow: allow, classes: classes, policies: policies,
|
||||
hear: hear, judge: judge, engine: engine, drafts: drafts.NewModule(db, log.With("module", "drafts"), orgID, hear, engine, policies),
|
||||
}.register(api)
|
||||
dashboard.Routes(mux, ui.DistDirFS)
|
||||
|
||||
return serveWithWork(ctx, log, cfg.Listen, mux, engine.Work, hear.Work, tell.Work)
|
||||
}
|
||||
|
||||
// serveWithWork serves mux while the loops run, and stops the loops once it
|
||||
// returns.
|
||||
func serveWithWork(ctx context.Context, log *slog.Logger, addr string, mux *http.ServeMux, loops ...func(context.Context)) error {
|
||||
ctx, stop := context.WithCancel(ctx)
|
||||
defer stop()
|
||||
wait := work(ctx, loops...)
|
||||
err := serve(ctx, log, addr, mux)
|
||||
stop()
|
||||
wait()
|
||||
return err
|
||||
}
|
||||
|
||||
// useWorkflows gives the engine what workflow steps use and installs the
|
||||
// workflow that ships with the binary.
|
||||
func useWorkflows(ctx context.Context, engine *runs.Engine, deps runs.Deps) error {
|
||||
engine.Use(deps)
|
||||
if _, err := engine.Install(ctx, orgID, "investigate", runs.InvestigateDocument(), "starter"); err != nil {
|
||||
return fmt.Errorf("install the investigate workflow: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// work runs each loop until ctx ends and returns a function that waits for
|
||||
// them all.
|
||||
func work(ctx context.Context, loops ...func(context.Context)) func() {
|
||||
var workers sync.WaitGroup
|
||||
for _, loop := range loops {
|
||||
workers.Go(func() { loop(ctx) })
|
||||
}
|
||||
return workers.Wait
|
||||
}
|
||||
|
||||
// newJudgement returns the judgement module with its hard rules, data guards
|
||||
// and change-request rules. A failed action tightens its class.
|
||||
func newJudgement(db *sqlx.DB, log *slog.Logger, conns *connectors.Module, classes *judgement.Classes, policies *judgement.Policies, settings *governance.Module, heard judgement.Events) *judgement.Module {
|
||||
guards := []judgement.Guard{
|
||||
judgement.Impact{Lookup: judgement.RecordedFacts{Source: conns, People: settings}, Defaults: settings},
|
||||
judgement.Reversibility{},
|
||||
judgement.Precedent{Classes: classes},
|
||||
judgement.Provenance{Events: heard},
|
||||
judgement.Timing{Calendar: settings},
|
||||
judgement.Cost{Budgets: settings, Counts: judgement.NewSpend(db, orgID)},
|
||||
judgement.Freeze{Freezes: settings},
|
||||
}
|
||||
judge := judgement.NewModule(db, log.With("module", "judgement"), orgID, conns, []judgement.HardRule{policies}, guards, classes)
|
||||
judge.UseExtensions(conns)
|
||||
judge.UseChangeRules(policies)
|
||||
return judge
|
||||
}
|
||||
|
||||
// orgID is the one organisation until hosting is multi-tenant.
|
||||
const orgID = "default"
|
||||
|
||||
// schemas are the module schemas the runtime role is granted DML on.
|
||||
var schemas = []string{"runs", "connectors", "events", "governance", "deliveries", "judgement", "approvals", "memory", "drafts"}
|
||||
|
||||
// owner names this process in run leases.
|
||||
func owner() string {
|
||||
host, err := os.Hostname()
|
||||
if err != nil {
|
||||
host = "archie"
|
||||
}
|
||||
return host + ":" + strconv.Itoa(os.Getpid())
|
||||
}
|
||||
|
||||
func serve(ctx context.Context, log *slog.Logger, addr string, handler http.Handler) error {
|
||||
var lc net.ListenConfig
|
||||
listener, err := lc.Listen(ctx, "tcp", addr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("listen on %s: %w", addr, err)
|
||||
}
|
||||
server := &http.Server{
|
||||
Handler: handler,
|
||||
ReadHeaderTimeout: 10 * time.Second,
|
||||
BaseContext: func(net.Listener) context.Context { return ctx },
|
||||
}
|
||||
failed := make(chan error, 1)
|
||||
go func() { failed <- server.Serve(listener) }()
|
||||
log.InfoContext(ctx, "serving", "addr", listener.Addr().String())
|
||||
|
||||
select {
|
||||
case err := <-failed:
|
||||
return fmt.Errorf("serve: %w", err)
|
||||
case <-ctx.Done():
|
||||
}
|
||||
shutdownCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), shutdownGrace)
|
||||
defer cancel()
|
||||
if err := server.Shutdown(shutdownCtx); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
return fmt.Errorf("shut down: %w", err)
|
||||
}
|
||||
log.InfoContext(ctx, "stopped")
|
||||
return nil
|
||||
}
|
||||
+143
-100
@@ -11,6 +11,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -32,8 +33,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/alert"
|
||||
"github.com/samcharles93/archie-core/internal/domain/applystatus"
|
||||
"github.com/samcharles93/archie-core/internal/domain/health"
|
||||
"github.com/samcharles93/archie-core/internal/domain/identity"
|
||||
"github.com/samcharles93/archie-core/internal/domain/org"
|
||||
"github.com/samcharles93/archie-core/internal/domain/presence"
|
||||
"github.com/samcharles93/archie-core/internal/domain/scheduling"
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
@@ -44,10 +43,10 @@ import (
|
||||
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/eventbus/nats"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/extension"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/issuerpc"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/kitrun"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/logrpc"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/messagingrpc"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/modelcatalog"
|
||||
@@ -95,7 +94,10 @@ type boot struct {
|
||||
// dialed to the standalone archie-state-store gRPC service at
|
||||
// [services.state].target. It is set by openStateStoreAdapter, which
|
||||
// requires [services.state].target to be set.
|
||||
stateStore storecontract.TaskStore
|
||||
stateStore storecontract.TaskStore
|
||||
// stateClient is stateStore's concrete type, which the daemon's typed store
|
||||
// fields are assigned from directly.
|
||||
stateClient *staterpc.Client
|
||||
taskModels daemon.TaskModels
|
||||
taskInstructions daemon.TaskInstructions
|
||||
// accessChain is the daemon's policy engine, built once from the stored
|
||||
@@ -154,21 +156,21 @@ type boot struct {
|
||||
// the embedded server's ClientURL(). Recorded so Daemon.ConnectedNATS
|
||||
// carries the real endpoint rather than an empty config URL.
|
||||
natsURL string
|
||||
// natsToken is the credential the daemon's client connected with at
|
||||
// startup. Embedded mode generates it; external mode resolves it once.
|
||||
natsToken string
|
||||
|
||||
containerPool *container.Pool
|
||||
// kitLauncher starts Kit profile tasks; nil when the egress path cannot
|
||||
// be built on this host.
|
||||
kitLauncher *kitrun.Launcher
|
||||
// taskRuntime is what task agents run in: the container pool, or an
|
||||
// OpenShell gateway's sandboxes. Nil parks every task.
|
||||
taskRuntime daemon.TaskRuntime
|
||||
// sandboxes provisions each task container's isolated network and runs
|
||||
// the egress relay that is its only way out.
|
||||
sandboxes *egress.Networks
|
||||
// modelEgress gives native tasks model access through the egress proxy;
|
||||
// nil when the proxy cannot start.
|
||||
modelEgress daemon.ModelEgress
|
||||
// sessionGrants records live setup sessions' granted credential services
|
||||
// for the egress proxy's resolver.
|
||||
sessionGrants *sessionGrants
|
||||
storeBackend storage.Backend
|
||||
// egressProxyAddr is where the egress proxy listens, the address the relay
|
||||
// forwards its proxy port to. Empty when the proxy is not running.
|
||||
egressProxyAddr string
|
||||
storeBackend storage.Backend
|
||||
|
||||
// runtimeVersions records the version of every control-plane kind boot's
|
||||
// layering applied. Set once at boot before the runtime-resource watches
|
||||
@@ -295,6 +297,7 @@ func (b *boot) openStateStoreAdapter(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
b.stateStore = client
|
||||
b.stateClient = client
|
||||
if alerts, ok := b.stateStore.(alert.Store); ok {
|
||||
b.credentialWatch = &credentialWatch{reporter: alert.Reporter{Raiser: alerts, Log: b.log, By: "archied"}}
|
||||
}
|
||||
@@ -324,7 +327,7 @@ func (b *boot) openAccessChain(ctx context.Context) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("state store policy reader unavailable")
|
||||
}
|
||||
live := infraaccess.NewPending(ctx, source.PoliciesVersion, source.ListPolicies, b.log)
|
||||
live := infraaccess.NewPending(source.PoliciesVersion, source.ListPolicies, b.log)
|
||||
if err := live.Reload(ctx); err != nil {
|
||||
b.log.WarnContext(ctx, "workflow policies unavailable; execution remains denied", "err", err)
|
||||
}
|
||||
@@ -346,14 +349,14 @@ func (b *boot) handleRequeue(ctx context.Context, requeue int64, once bool) (boo
|
||||
return !once, nil
|
||||
}
|
||||
|
||||
func (b *boot) seedSoul(cfgPath string) {
|
||||
func (b *boot) seedSoul(ctx context.Context, cfgPath string) {
|
||||
result, err := configuration.SeedSoul(cfgPath, agent.ShippedSoul())
|
||||
if err != nil {
|
||||
b.log.Warn("soul: starter file unavailable", "err", err)
|
||||
b.log.WarnContext(ctx, "soul: starter file unavailable", "err", err)
|
||||
return
|
||||
}
|
||||
if result.Action == configuration.SoulCreated {
|
||||
b.log.Info("soul: starter file written", "path", result.Path, "action", result.Action)
|
||||
b.log.InfoContext(ctx, "soul: starter file written", "path", result.Path, "action", result.Action)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,6 +386,9 @@ func (b *boot) connectNATS(ctx context.Context) error { // embedded broker disco
|
||||
log.ErrorContext(ctx, "nats credentials", "err", err)
|
||||
return err
|
||||
}
|
||||
if err := b.startCallout(ctx, url, natsToken); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
endpoint, readErr := servicekit.ReadNATSEndpoint(cfg.StateDir)
|
||||
if readErr == nil {
|
||||
@@ -440,7 +446,6 @@ func (b *boot) connectNATS(ctx context.Context) error { // embedded broker disco
|
||||
}
|
||||
b.natsClient = natsClient
|
||||
b.natsURL = url
|
||||
b.natsToken = natsToken
|
||||
b.addCleanup(func() { natsClient.Close() })
|
||||
b.addCleanup(func() { reactionClient.Close() })
|
||||
b.reactionClient = reactionClient
|
||||
@@ -448,14 +453,59 @@ func (b *boot) connectNATS(ctx context.Context) error { // embedded broker disco
|
||||
return nil
|
||||
}
|
||||
|
||||
// startCallout makes the external broker defer every login to archie, so a task
|
||||
// container logs in with its run credential and reaches only its own subjects.
|
||||
// It runs before any other login, because those are decided here.
|
||||
func (b *boot) startCallout(ctx context.Context, url, token string) error {
|
||||
seed := os.Getenv(b.cfg.NATS.CalloutIssuerSeedEnv)
|
||||
if seed == "" {
|
||||
return fmt.Errorf("%s is required when nats.callout_issuer_seed_env is configured", b.cfg.NATS.CalloutIssuerSeedEnv)
|
||||
}
|
||||
opts := nats.CalloutOptions{URL: url, Token: token, IssuerSeed: seed}
|
||||
if b.stateStoreGrants != nil {
|
||||
opts.Tasks = taskBroker{runs: b.stateStoreGrants.Client}
|
||||
}
|
||||
svc, err := nats.StartCallout(ctx, opts, b.log)
|
||||
if err != nil {
|
||||
b.log.ErrorContext(ctx, "nats callout start failed", "err", err)
|
||||
return err
|
||||
}
|
||||
b.addCleanup(svc.Close)
|
||||
return nil
|
||||
}
|
||||
|
||||
// natsHost is the address the embedded broker binds. OpenShell sandboxes run
|
||||
// on the host network and reach the broker by the services host name, so it
|
||||
// binds the address that name resolves to; Docker containers reach it on the
|
||||
// bridge gateway.
|
||||
func natsHost(ctx context.Context, cfg config.Config, pool *container.Pool) (string, error) {
|
||||
shell := cfg.Containers.OpenShell
|
||||
if cfg.Containers.Runtime == config.RuntimeOpenShell && shell.ServicesHost != "" {
|
||||
addrs, err := net.DefaultResolver.LookupHost(ctx, shell.ServicesHost)
|
||||
if err != nil || len(addrs) == 0 {
|
||||
return "", fmt.Errorf("embedded nats: resolve services host %s: %w", shell.ServicesHost, err)
|
||||
}
|
||||
for _, a := range addrs {
|
||||
if ip := net.ParseIP(a); ip != nil && ip.To4() != nil {
|
||||
return a, nil
|
||||
}
|
||||
}
|
||||
return addrs[0], nil
|
||||
}
|
||||
if pool != nil {
|
||||
return pool.HostGateway(), nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (b *boot) startEmbeddedNATS(ctx context.Context) (string, string, error) {
|
||||
cfg, log := b.cfg, b.log
|
||||
if cfg.StateDir == "" {
|
||||
return "", "", errors.New("embedded nats: state_dir is required")
|
||||
}
|
||||
host := ""
|
||||
if b.containerPool != nil {
|
||||
host = b.containerPool.HostGateway()
|
||||
host, err := natsHost(ctx, cfg, b.containerPool)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
// A restarted broker keeps the previous endpoint, so the Gateway and
|
||||
// running agents reconnect to it instead of a broker that no longer exists.
|
||||
@@ -489,10 +539,31 @@ func (b *boot) startEmbeddedNATS(ctx context.Context) (string, string, error) {
|
||||
}
|
||||
|
||||
func (b *boot) setupContainers(ctx context.Context) func() {
|
||||
containerPool, storeBackend, closeDocker := startContainers(ctx, b.cfgHolder, b.secrets, b.log)
|
||||
containerPool, sandboxes, storeBackend, closeDocker := startContainers(ctx, b.cfgHolder, b.secrets, b.log)
|
||||
b.containerPool = containerPool
|
||||
b.sandboxes = sandboxes
|
||||
b.storeBackend = storeBackend
|
||||
return closeDocker
|
||||
b.taskRuntime = daemon.DockerRuntime(containerPool)
|
||||
if b.cfg.Containers.Runtime != config.RuntimeOpenShell {
|
||||
return closeDocker
|
||||
}
|
||||
rt, client, closeOpenShell, err := startOpenShell(ctx, b.cfgHolder, b.secrets, b.log)
|
||||
if err != nil {
|
||||
b.log.ErrorContext(ctx, "autonomous workflows unavailable: openshell runtime", "err", err)
|
||||
b.taskRuntime = nil
|
||||
return closeDocker
|
||||
}
|
||||
b.taskRuntime = daemon.OpenShellRuntime(rt)
|
||||
settings := b.cfg.Containers.OpenShell
|
||||
bindings := runCredentialResolver{runs: b.stateStoreGrants.Client, models: b.taskModels, config: b.cfgHolder, secrets: b.secrets, credentials: b.credentialWatch}
|
||||
egress := newOpenShellModelEgress(client, settings.Workspace, b.cfg.Instance, b.secrets, bindings, b.log)
|
||||
b.modelEgress = egress
|
||||
sweepCtx, cancel := context.WithTimeout(ctx, 15*time.Second)
|
||||
defer cancel()
|
||||
if err := egress.Sweep(sweepCtx); err != nil {
|
||||
b.log.WarnContext(ctx, "openshell: orphaned gateway providers remain", "err", err)
|
||||
}
|
||||
return func() { closeOpenShell(); closeDocker() }
|
||||
}
|
||||
|
||||
// setupGatewayClient dials the Gateway, which owns every model call.
|
||||
@@ -528,17 +599,17 @@ func (b *boot) buildWorktreeManager() {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *boot) registerNATSRPC() error {
|
||||
func (b *boot) registerNATSRPC(ctx context.Context) error {
|
||||
log := b.log
|
||||
if b.natsClient == nil {
|
||||
return nil
|
||||
}
|
||||
coreConn, err := b.natsClient.CoreConn()
|
||||
if err != nil {
|
||||
log.Error("nats connection unavailable for task RPC", "err", err)
|
||||
log.ErrorContext(ctx, "nats connection unavailable for task RPC", "err", err)
|
||||
return err
|
||||
}
|
||||
unsubscribe, err := registerTaskRPCServers(coreConn, func(ctx context.Context, t *workflow.Task, op string) (daemon.RepositoryAccess, error) {
|
||||
unsubscribe, err := registerTaskRPCServers(ctx, coreConn, func(ctx context.Context, t *workflow.Task, op string) (daemon.RepositoryAccess, error) {
|
||||
if b.d == nil {
|
||||
return daemon.RepositoryAccess{}, errors.New("repository connections starting")
|
||||
}
|
||||
@@ -550,40 +621,40 @@ func (b *boot) registerNATSRPC() error {
|
||||
return b.messaging.Deliver(ctx, org, channel, chatID, text)
|
||||
}, b.stateStoreGrants.Client, installedAuthorities{b.stateStoreGrants.Client}, log)
|
||||
if err != nil {
|
||||
log.Error("task RPC server registration failed", "err", err)
|
||||
log.ErrorContext(ctx, "task RPC server registration failed", "err", err)
|
||||
return err
|
||||
}
|
||||
b.addCleanup(unsubscribe)
|
||||
|
||||
stopLogs, err := logrpc.RegisterDaemon(coreConn, b.logFeed, log)
|
||||
stopLogs, err := logrpc.RegisterDaemon(ctx, coreConn, b.logFeed, log)
|
||||
if err != nil {
|
||||
return fmt.Errorf("register daemon logs: %w", err)
|
||||
}
|
||||
b.addCleanup(stopLogs)
|
||||
unsubscribeSystemLogs, err := subscribeSystemLogs(coreConn, b.taskLogs, log)
|
||||
unsubscribeSystemLogs, err := subscribeSystemLogs(ctx, coreConn, b.taskLogs, log)
|
||||
if err != nil {
|
||||
log.Error("system log subscribe failed", "err", err)
|
||||
log.ErrorContext(ctx, "system log subscribe failed", "err", err)
|
||||
return err
|
||||
}
|
||||
b.addCleanup(unsubscribeSystemLogs)
|
||||
|
||||
unsubscribeAgentEvents, err := subscribeAgentEvents(coreConn, b.bus, log)
|
||||
unsubscribeAgentEvents, err := subscribeAgentEvents(ctx, coreConn, b.bus, log)
|
||||
if err != nil {
|
||||
log.Error("agent event subscribe failed", "err", err)
|
||||
log.ErrorContext(ctx, "agent event subscribe failed", "err", err)
|
||||
return err
|
||||
}
|
||||
b.addCleanup(unsubscribeAgentEvents)
|
||||
|
||||
unsubscribeTaskActions, err := taskactions.Register(coreConn, b.taskActions(), log)
|
||||
unsubscribeTaskActions, err := taskactions.Register(ctx, coreConn, b.taskActions(), log)
|
||||
if err != nil {
|
||||
log.Error("gateway task action register failed", "err", err)
|
||||
log.ErrorContext(ctx, "gateway task action register failed", "err", err)
|
||||
return err
|
||||
}
|
||||
b.addCleanup(unsubscribeTaskActions)
|
||||
|
||||
unsubscribeIssues, err := (&issuerpc.Server{Forge: b.issueForge, Log: log}).Register(coreConn)
|
||||
unsubscribeIssues, err := (&issuerpc.Server{Forge: b.issueForge, Log: log}).Register(ctx, coreConn)
|
||||
if err != nil {
|
||||
log.Error("issue RPC register failed", "err", err)
|
||||
log.ErrorContext(ctx, "issue RPC register failed", "err", err)
|
||||
return err
|
||||
}
|
||||
b.addCleanup(unsubscribeIssues)
|
||||
@@ -595,81 +666,55 @@ func (b *boot) issueForge(ctx context.Context, owner, repo string) (forge.IssueF
|
||||
return b.repositoryForge(ctx, owner, repo)
|
||||
}
|
||||
|
||||
func (b *boot) buildDaemon() {
|
||||
func (b *boot) buildDaemon(ctx context.Context) {
|
||||
log := b.log
|
||||
b.d = &daemon.Daemon{
|
||||
workspaces, _ := b.stateStore.(access.WorkspaceLister)
|
||||
d := &daemon.Daemon{
|
||||
ResolveRepository: b.repositoryAccess,
|
||||
Cfg: b.cfgHolder,
|
||||
ConnectedNATS: daemon.NATSEndpoint{URL: b.natsURL, Token: b.natsToken, Scoped: b.cfg.NATS.Mode != config.NATSModeExternal},
|
||||
ConnectedStateStore: daemon.StateStoreEndpoint{URL: strings.TrimSpace(b.cfg.Services.Get(config.ServiceNameState).Target), CA: b.stateStoreCA()},
|
||||
ConnectedNATS: daemon.NATSEndpoint{URL: b.natsURL},
|
||||
ConnectedStateStore: daemon.StateStoreEndpoint{URL: strings.TrimSpace(b.cfg.Services.Get(config.ServiceNameState).Target), CA: b.stateStoreCA(ctx)},
|
||||
Store: b.stateStore,
|
||||
Identity: daemon.NewIdentityGate(b.stateClient, b.stateClient, b.accessChain, b.stateClient, b.stateClient, b.orgPrincipals, workspaces, log),
|
||||
PlaybookLedger: b.stateClient,
|
||||
Bus: b.bus,
|
||||
Forge: b.forgeClient,
|
||||
Trees: b.trees,
|
||||
PackageAuthorities: installedAuthorities{b.stateStoreGrants.Client},
|
||||
Storage: b.storeBackend,
|
||||
Log: log,
|
||||
Tasks: b.natsClient,
|
||||
Reactions: b.reactionClient,
|
||||
TaskTransport: b.natsClient,
|
||||
RunCredentials: b.stateStoreGrants,
|
||||
ContainerPool: b.containerPool,
|
||||
KitLauncher: b.kitLauncher,
|
||||
Runtime: b.taskRuntime,
|
||||
ModelEgress: b.modelEgress,
|
||||
TaskModels: b.taskModels,
|
||||
TaskInstructions: b.taskInstructions,
|
||||
IssueSources: b.issueSources,
|
||||
OrgPrincipals: b.orgPrincipals,
|
||||
TaskLogs: b.taskLogs,
|
||||
AgentStatus: b.agentStatus,
|
||||
WorkflowDefinitions: b.workflowDefinitions,
|
||||
WorkflowEnablement: b.controlPlane,
|
||||
Playbooks: b.livePlaybooks(),
|
||||
}
|
||||
|
||||
if identities, ok := b.stateStore.(identity.Repository); ok {
|
||||
b.d.IdentityRepository = identities
|
||||
}
|
||||
if assignments, ok := b.stateStore.(org.AgentAssignments); ok {
|
||||
b.d.AgentAssignments = assignments
|
||||
}
|
||||
|
||||
if ms, ok := b.stateStore.(storecontract.MappingStore); ok {
|
||||
b.d.Mappings = ms
|
||||
}
|
||||
|
||||
if bs, ok := b.stateStore.(storecontract.BindingStore); ok {
|
||||
b.d.Bindings = bs
|
||||
}
|
||||
|
||||
if bd, ok := b.stateStore.(storecontract.BindingDispatcher); ok {
|
||||
b.d.BindingDispatcher = bd
|
||||
}
|
||||
|
||||
if mm, ok := b.stateStore.(storecontract.MappingMatchRecorder); ok {
|
||||
b.d.MappingMatches = mm
|
||||
}
|
||||
|
||||
if btc, ok := b.stateStore.(storecontract.BindingTaskCreator); ok {
|
||||
b.d.BindingTaskCreator = btc
|
||||
}
|
||||
b.d.WithdrawTask = b.taskActions().Withdraw
|
||||
|
||||
b.d.Access = b.accessChain
|
||||
if principals, ok := b.stateStore.(access.PrincipalSource); ok {
|
||||
b.d.Principals = principals
|
||||
}
|
||||
if denials, ok := b.stateStore.(access.DenialRecorder); ok {
|
||||
b.d.Denials = denials
|
||||
}
|
||||
b.d.PlaybookLedger = playbookLedger(b.stateStore, b.log)
|
||||
}
|
||||
|
||||
func playbookLedger(source any, log *slog.Logger) storecontract.PlaybookDispatcher {
|
||||
if pd, ok := source.(storecontract.PlaybookDispatcher); ok {
|
||||
return pd
|
||||
}
|
||||
log.Warn("eda action playbooks will not run: no dispatch ledger is wired")
|
||||
return nil
|
||||
d.ReviewScanner = daemon.NewReviewScanner(b.stateStore, b.reactionClient, b.natsClient.PublishUnique, b.bus, d, d.Identity, d, b.repositoryForge, log)
|
||||
d.BindingDispatch = daemon.NewBindingDispatch(daemon.BindingDispatchDeps{
|
||||
Store: b.stateStore,
|
||||
Mappings: b.stateClient,
|
||||
Bindings: b.stateClient,
|
||||
Dispatcher: b.stateClient,
|
||||
Matches: b.stateClient,
|
||||
Creator: b.stateClient,
|
||||
Enablement: b.controlPlane,
|
||||
Definitions: b.workflowDefinitions,
|
||||
Access: d.Identity,
|
||||
Denials: d.Identity,
|
||||
Cfg: b.cfgHolder,
|
||||
Orgs: d.Identity,
|
||||
OrgPrincipals: b.orgPrincipals,
|
||||
Log: log,
|
||||
})
|
||||
d.WireTaskBus()
|
||||
d.IssuePoller = daemon.NewIssuePoller(b.cfgHolder, b.stateStore, log, b.issueSources, b.taskActions().Withdraw, d.TaskBus.PublishTask, d.Identity, d.BindingDispatch)
|
||||
b.d = d
|
||||
}
|
||||
|
||||
func (b *boot) publishConfig(ctx context.Context, cfg config.Config) {
|
||||
@@ -752,13 +797,11 @@ func (b *boot) startServices(ctx context.Context) error {
|
||||
|
||||
func (b *boot) setupBackends(ctx context.Context) error {
|
||||
closeContainers := b.setupContainers(ctx)
|
||||
// Registered before the Kit launcher so its cleanups (the harness
|
||||
// listener and the egress relay) run first: cleanups unwind LIFO, and a
|
||||
// session teardown needs the Docker client the pool still owns.
|
||||
b.addCleanup(closeContainers)
|
||||
err := b.connectNATS(ctx)
|
||||
if err == nil {
|
||||
b.setupKitLauncher(ctx)
|
||||
if err == nil && b.cfg.Containers.Runtime != config.RuntimeOpenShell {
|
||||
b.setupModelEgress(ctx)
|
||||
b.startEgressRelay(ctx)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -772,7 +815,7 @@ func exitCode(err error) int {
|
||||
|
||||
func (b *boot) runLoop(ctx context.Context, once bool) error {
|
||||
b.health.markServing()
|
||||
b.announceReady()
|
||||
b.announceReady(ctx)
|
||||
if once {
|
||||
b.d.RunOnce(ctx)
|
||||
return nil
|
||||
@@ -850,10 +893,10 @@ const playbookRefreshInterval = 30 * time.Second
|
||||
|
||||
// stateStoreCA is the CA a task container verifies the State Store with;
|
||||
// nil without [tls].
|
||||
func (b *boot) stateStoreCA() []byte {
|
||||
func (b *boot) stateStoreCA(ctx context.Context) []byte {
|
||||
id, err := servicekit.Identity(b.cfg.TLS, presence.Daemon)
|
||||
if err != nil {
|
||||
b.log.Warn("state store CA for containers", "err", err)
|
||||
b.log.WarnContext(ctx, "state store CA for containers", "err", err)
|
||||
return nil
|
||||
}
|
||||
return id.CAPEM()
|
||||
|
||||
@@ -240,8 +240,10 @@ func (b *boot) startLiveSettings(ctx context.Context) error {
|
||||
// entries (boot.reconcileToolSettings, its consumer); a removed MCP server
|
||||
// really disconnects, because it is a child process with a Stop. ContainerRuntimePoliciesKind is on it because both consumers
|
||||
// re-read the published config: the container pool takes its image, pull
|
||||
// policy, network, max-uptime and concurrency cap per acquire, and the daemon's
|
||||
// dispatcher is resized after the publish (applyRuntimeResourceUpdate below).
|
||||
// policy, max-uptime and concurrency cap per acquire, and the daemon's
|
||||
// dispatcher is resized after the publish (applyRuntimeResourceUpdate below);
|
||||
// a change to the task runtime itself is refused until restart
|
||||
// (refuseRuntimeChange).
|
||||
// PluginSettingsKind is on the list because its only consumer is the directory
|
||||
// reconciliation, which reads the running config each tick; a removed plugin
|
||||
// or engine still cannot unload, so that kind reports the removal rather than
|
||||
@@ -366,6 +368,13 @@ func (b *boot) applyRuntimeResourceUpdate(ctx context.Context, kind string, upda
|
||||
return err
|
||||
}
|
||||
}
|
||||
if kind == controlplanestore.ContainerRuntimePoliciesKind {
|
||||
if err := b.refuseRuntimeChange(ctx); err != nil {
|
||||
b.applyStatus.Report(ctx, kind, update.Version, err)
|
||||
b.log.ErrorContext(ctx, "container runtime policies refused; the running settings stay", "version", update.Version, "err", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
base := b.cfgHolder.Get()
|
||||
// Boot publishes before the model catalog is merged in, so the snapshot
|
||||
// this read returns can lack the catalog's model limits and discovered
|
||||
@@ -405,10 +414,57 @@ func (b *boot) applyRuntimeResourceUpdate(ctx context.Context, kind string, upda
|
||||
// dispatcher is created later from the config the next drain reads.
|
||||
func (b *boot) resizeTaskDispatcher(maxConcurrency int) {
|
||||
if b.d != nil {
|
||||
b.d.ResizeTaskDispatcher(maxConcurrency)
|
||||
b.d.TaskBus.ResizeTaskDispatcher(maxConcurrency)
|
||||
}
|
||||
}
|
||||
|
||||
// refuseRuntimeChange refuses a stored container-runtime-policies document
|
||||
// that changes the task runtime or its OpenShell gateway: the daemon chose and
|
||||
// connected its runtime at boot, so such a change applies on restart.
|
||||
func (b *boot) refuseRuntimeChange(ctx context.Context) error {
|
||||
var stored struct {
|
||||
Runtime string `json:"runtime"`
|
||||
OpenShell config.OpenShellConfig `json:"openshell"`
|
||||
}
|
||||
_, found, err := b.controlPlane.Query(ctx, controlplanestore.ContainerRuntimePoliciesKind, func(value []byte) error {
|
||||
return json.Unmarshal(value, &stored)
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("read container runtime policies: %w", err)
|
||||
}
|
||||
if !found {
|
||||
return nil
|
||||
}
|
||||
running := b.cfgHolder.Get().Containers
|
||||
if runtimeName(stored.Runtime) != runtimeName(running.Runtime) || bootOnlyOpenShell(stored.OpenShell) != bootOnlyOpenShell(running.OpenShell) {
|
||||
return fmt.Errorf("the task runtime applies on restart: stored %q, running %q", runtimeName(stored.Runtime), runtimeName(running.Runtime))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// openShellBoot is the part of the OpenShell settings read once at boot; the
|
||||
// egress hosts are read per task.
|
||||
type openShellBoot struct {
|
||||
address, workspace, servicesHost string
|
||||
caFile, certFile, keyFile string
|
||||
token config.SecretRef
|
||||
}
|
||||
|
||||
func bootOnlyOpenShell(c config.OpenShellConfig) openShellBoot {
|
||||
return openShellBoot{
|
||||
address: c.Address, workspace: c.Workspace, servicesHost: c.ServicesHost,
|
||||
caFile: c.CAFile, certFile: c.CertFile, keyFile: c.KeyFile, token: c.Token,
|
||||
}
|
||||
}
|
||||
|
||||
// runtimeName is runtime with the empty default spelled out.
|
||||
func runtimeName(runtime string) string {
|
||||
if runtime == "" {
|
||||
return config.RuntimeDocker
|
||||
}
|
||||
return runtime
|
||||
}
|
||||
|
||||
// refuseSkillsDirChange refuses a stored plugin-settings document whose
|
||||
// skills_dir differs from the value in force. skills_dir is the one directory
|
||||
// with no live consumer, so a change to it stays a restart-scoped edit rather
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package archied
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/servicekit"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
daemonpb "github.com/samcharles93/archie-core/internal/contracts/daemon/v1"
|
||||
"github.com/samcharles93/archie-core/internal/domain/access"
|
||||
"github.com/samcharles93/archie-core/internal/domain/presence"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/rpcidentity"
|
||||
)
|
||||
|
||||
// setupDaemonRPC serves the daemon contract. Without certificates it binds
|
||||
// only loopback.
|
||||
func (b *boot) setupDaemonRPC(ctx context.Context) {
|
||||
conn := b.cfg.Services.Get(config.ServiceNameDaemon)
|
||||
listen, err := servicekit.ResolveListen(config.ServiceNameDaemon, "", conn.Listen)
|
||||
if err != nil {
|
||||
b.log.WarnContext(ctx, "daemon contract disabled", "err", err)
|
||||
return
|
||||
}
|
||||
id, err := servicekit.Identity(b.cfg.TLS, presence.Daemon)
|
||||
if err != nil {
|
||||
b.log.WarnContext(ctx, "daemon contract disabled", "err", err)
|
||||
return
|
||||
}
|
||||
creds, err := id.ServerOption(listen, false)
|
||||
if err != nil {
|
||||
b.log.WarnContext(ctx, "daemon contract disabled", "err", err)
|
||||
return
|
||||
}
|
||||
ln, err := (&net.ListenConfig{}).Listen(ctx, "tcp", listen)
|
||||
if err != nil {
|
||||
b.log.WarnContext(ctx, "daemon contract disabled: listen", "err", err)
|
||||
return
|
||||
}
|
||||
workspaces, _ := b.stateStore.(access.WorkspaceLister)
|
||||
callers := rpcidentity.Callers{Principals: b.d.Identity.Principals(), Workspaces: workspaces}
|
||||
srv := grpc.NewServer(append(servicekit.ServerLimits(), creds, grpc.ChainUnaryInterceptor(callers.Unary()), grpc.ChainStreamInterceptor(callers.Stream()))...)
|
||||
daemonpb.RegisterDaemonServiceServer(srv, &repositoryServer{boot: b})
|
||||
go func() {
|
||||
if err := srv.Serve(ln); err != nil && !errors.Is(err, grpc.ErrServerStopped) {
|
||||
b.log.ErrorContext(ctx, "daemon contract listener stopped", "err", err)
|
||||
}
|
||||
}()
|
||||
b.addCleanup(func() {
|
||||
timer := time.AfterFunc(10*time.Second, srv.Stop)
|
||||
srv.GracefulStop()
|
||||
timer.Stop()
|
||||
_ = ln.Close()
|
||||
})
|
||||
b.log.InfoContext(ctx, "daemon contract serving", "addr", ln.Addr().String())
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package archied
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/daemon"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
|
||||
)
|
||||
|
||||
// startEgressRelay removes the sandbox networks and relay a previous daemon
|
||||
// left, then starts the relay: the only peer on every task container's
|
||||
// sandbox network, forwarding to NATS, the State Store and the model proxy.
|
||||
// Boot carries on when it cannot start; each task then parks on the failed
|
||||
// sandbox attach rather than starting with no way out.
|
||||
func (b *boot) startEgressRelay(ctx context.Context) {
|
||||
if b.containerPool == nil || b.sandboxes == nil {
|
||||
return
|
||||
}
|
||||
log := b.log
|
||||
if err := b.sandboxes.Sweep(ctx); err != nil {
|
||||
log.WarnContext(ctx, "egress relay: stale sandbox networks remain", "err", err)
|
||||
}
|
||||
stateStore := ""
|
||||
if target := strings.TrimSpace(b.cfg.Services.Get(config.ServiceNameState).Target); target != "" {
|
||||
addr, err := daemon.RelayStateStoreTarget(target, b.containerPool.HostGateway())
|
||||
if err != nil {
|
||||
log.ErrorContext(ctx, "egress relay: task containers cannot reach the state store", "err", err)
|
||||
}
|
||||
stateStore = addr
|
||||
}
|
||||
cmd, err := egress.RelayCommand(b.egressProxyAddr, egress.Endpoints{NATS: b.natsURL, StateStore: stateStore})
|
||||
if err != nil {
|
||||
log.ErrorContext(ctx, "egress relay not started: task containers cannot run", "err", err)
|
||||
return
|
||||
}
|
||||
spec := egress.RelaySpec{
|
||||
Image: b.cfg.Containers.Image,
|
||||
Entrypoint: []string{"archie-agent"},
|
||||
Cmd: cmd,
|
||||
Network: b.containerPool.NetworkName(),
|
||||
}
|
||||
if err := b.sandboxes.Start(ctx, spec); err != nil {
|
||||
log.ErrorContext(ctx, "egress relay not started: task containers cannot run", "err", err)
|
||||
return
|
||||
}
|
||||
b.addCleanup(func() {
|
||||
closeCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 10*time.Second)
|
||||
defer cancel()
|
||||
if err := b.sandboxes.Close(closeCtx); err != nil {
|
||||
log.WarnContext(ctx, "egress relay remove failed", "err", err)
|
||||
}
|
||||
})
|
||||
log.InfoContext(ctx, "egress relay started", "network", spec.Network, "proxy", b.egressProxyAddr != "", "state_store", stateStore != "")
|
||||
}
|
||||
Loaded 100 of 1146 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user