Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c42f64bfa | ||
|
|
d74216c6b7
|
||
|
|
0b7ce448ab
|
||
|
|
2fb8c09a00
|
||
|
|
0442f1849f
|
||
|
|
cf049797b0
|
||
|
|
18e6fe6af6
|
||
|
|
e8a84d3e41
|
||
|
|
c5f4541cbf
|
||
|
|
369e5038ca
|
||
|
|
66862a1bab
|
||
|
|
25dcdb2d19
|
||
|
|
1830a89898
|
||
|
|
6e718e165a
|
||
|
|
0a37b551f5
|
||
|
|
864b87faa6
|
||
|
|
d55d8580cf
|
||
|
|
63229d1711
|
||
|
|
56044476fc | ||
|
|
796bfd0045
|
||
|
|
abcb72a76a
|
||
|
|
443a7a501b
|
||
|
|
88e86776e8
|
||
|
|
e10bb161fe
|
||
|
|
3b525b7482
|
||
|
|
c2cc10ebfa
|
||
|
|
2f8076d7f8
|
||
|
|
c180a2debb
|
||
|
|
5356745968
|
||
|
|
5b5059615b
|
||
|
|
bca1f3b412 | ||
|
|
3af96fd818
|
||
|
|
1043982529
|
||
|
|
6abfe32540 | ||
|
|
1f9807a99c
|
||
|
|
b2edf1fa8b
|
||
|
|
bb897e76b8 | ||
|
|
07062352b4 | ||
|
|
856c15858b
|
||
|
|
69a46249cc
|
||
|
|
6f10ecc04f
|
||
|
|
d6ca6a72a5
|
||
|
|
243832fee6
|
||
|
|
e8c2c844a8
|
||
|
|
6220387ed6
|
||
|
|
efd3eb2854
|
||
|
|
c78063eba0 | ||
|
|
0e931485a0
|
||
|
|
1bf536d4ab
|
||
|
|
2181b5fd08
|
||
|
|
a4a7c96da6
|
||
|
|
a7f6e517ad
|
||
|
|
812d9004a7
|
||
|
|
ebc6dd67e6
|
||
|
|
949457689c
|
||
|
|
0cb035555f
|
||
|
|
a5974d0ea0
|
||
|
|
1ea15462c0
|
||
|
|
9d8f364af1
|
||
|
|
c87b0c31e1 | ||
|
|
c5802cf86d | ||
|
|
4f2338810b | ||
|
|
f8da67348c | ||
|
|
003771ca48 | ||
|
|
f7926cde15 | ||
|
|
3a05b3ecd0 | ||
|
|
6031a7a14b | ||
|
|
ad9ec16844 | ||
|
|
3977eaad68 | ||
|
|
3b6de96782 | ||
|
|
decc86fd08 | ||
|
|
5485dc4690 | ||
|
|
57865b51f4 | ||
|
|
0a1aa8b3c2 | ||
|
|
7c8114bc55 | ||
|
|
aa57377c7f | ||
|
|
8aa65bc7b4 | ||
|
|
a781fde566 | ||
|
|
3b372b4a91 | ||
|
|
066522cf5d | ||
|
|
ec9bf5feb2 | ||
|
|
dfb37fb4f2 | ||
|
|
86c2909a57 | ||
|
|
b5482857f8 | ||
|
|
0c137d9319 | ||
|
|
59827b19bd | ||
|
|
34179f0f9f | ||
|
|
9c193aeebb | ||
|
|
1cd8955d23 | ||
|
|
004e38b8eb | ||
|
|
c5991a560e | ||
|
|
04ce0f9056 | ||
|
|
e5cb0ac00b | ||
|
|
abe4c488cf | ||
|
|
973541f344 | ||
|
|
3c4b7b5877 | ||
|
|
8fbfb3c99f | ||
|
|
3b33d164c7 | ||
|
|
292597660f | ||
|
|
ba3a26af3c | ||
|
|
4bb473c0b0 | ||
|
|
c3d49cbc6c | ||
|
|
e831edb005 | ||
|
|
3db2654188 | ||
|
|
afdb4b203f | ||
|
|
6f57d38669 | ||
|
|
d60995af43 | ||
|
|
472d9d8b10 | ||
|
|
11b89354a6 | ||
|
|
8150df8d81 | ||
|
|
b8e080301c | ||
|
|
2d87e9f587 | ||
|
|
749baa3e5d | ||
|
|
90deba8472 | ||
|
|
9498fad064 | ||
|
|
6ca5c7f851 | ||
|
|
dfce3360b2 | ||
|
|
58629ea03a | ||
|
|
5b3b88ed3d | ||
|
|
62dbac9247 | ||
|
|
a8aad28239 | ||
|
|
9d633855f4 | ||
|
|
56ac50931e | ||
|
|
3e437d4275 | ||
|
|
c9951c085c | ||
|
|
59c6f0e4c0 | ||
|
|
9460f51e07 | ||
|
|
3ac5b97706 | ||
|
|
1add0fca32 | ||
|
|
0d8c48cbf4 | ||
|
|
e41b7606d6 | ||
|
|
ad2ceaaec2 | ||
|
|
c3b636bf72 | ||
|
|
98acd6aad0 | ||
|
|
8f7743c73d | ||
|
|
60a19ab15e | ||
|
|
dc1e45ff82 | ||
|
|
5fefd1902f | ||
|
|
45ed5b2faf | ||
|
|
f0fac7899f | ||
|
|
c7e12b56d0 | ||
|
|
087aa45349 | ||
|
|
4cc22ac5e0 | ||
|
|
7f0ecaa192 | ||
|
|
a203cbc03b | ||
|
|
17c07a31fe | ||
|
|
87100c4aba | ||
|
|
5498c97e3d | ||
|
|
3ff6867e84 | ||
|
|
7c050eef14 | ||
|
|
d98abad8bb | ||
|
|
9e92beb4cc | ||
|
|
ca597c3678 | ||
|
|
63476393d7 | ||
|
|
9d930436c5 | ||
|
|
be0f6f5ab7 | ||
|
|
66daa071a5 | ||
|
|
ca44b9e6bb | ||
|
|
da7efa3f4e | ||
|
|
4de8882ef5 | ||
|
|
c00a90c9ca | ||
|
|
c4c50ea70d | ||
|
|
c578c8e954 | ||
|
|
e85719f2d2 | ||
|
|
4dca007003 | ||
|
|
d7d1bd4556 | ||
|
|
dc26daeebe | ||
|
|
f727d54d75 | ||
|
|
6f8371a7bf | ||
|
|
fff689312d | ||
|
|
b701f60a99 | ||
|
|
6ba6a595b8 | ||
|
|
6cd9c4a7d8 | ||
|
|
816ce2e1f8 | ||
|
|
19570ad4bb | ||
|
|
5212a4d913 | ||
|
|
46f0643cf5 | ||
|
|
656feab2a4 | ||
|
|
0611e00330 | ||
|
|
128d5e0a82 | ||
|
|
c6187b7c23 | ||
|
|
afd6669877 | ||
|
|
7bf007bb58 | ||
|
|
92a74e4b7d | ||
|
|
0880e6a01c | ||
|
|
4a889991bd | ||
|
|
89bb4eb46b | ||
|
|
f3c7555195 | ||
|
|
79f3895923 | ||
|
|
837cd91501 | ||
|
|
5112ce896b | ||
|
|
7715d6b23b | ||
|
|
373032e330 | ||
|
|
6a69fb760a | ||
|
|
4cc7573b27 | ||
|
|
1d7fd6aab3 | ||
|
|
c04a18d387 | ||
|
|
abf485b9ef | ||
|
|
0245c4e455 | ||
|
|
fa00f74af5 | ||
|
|
2f9ed7adca | ||
|
|
4f2e1c3687 | ||
|
|
2d2ca156d8 | ||
|
|
f8c3dbedf2 | ||
|
|
17354de8fe | ||
|
|
7066a6fd46 | ||
|
|
20595a70b4 | ||
|
|
568f7adf52 | ||
|
|
74e34fb07a | ||
|
|
e6d765d233 | ||
|
|
4250a31ff9 | ||
|
|
ad19271c6c | ||
|
|
b774b68ed4 | ||
|
|
8eaf7b00c3 | ||
|
|
59eecd956d | ||
|
|
e2f9388071 | ||
|
|
6c095e5ac6 | ||
|
|
274acfe6f5 | ||
|
|
f1eda629a8 | ||
|
|
5602534ba9 | ||
|
|
bc9b9952cd | ||
|
|
7f5a73d97d | ||
|
|
02a4ac0629 | ||
|
|
ab78f5c909 | ||
|
|
c9c552a1bd | ||
|
|
c24b055cf3 | ||
|
|
72052fe186 | ||
|
|
0f14378363 | ||
|
|
551220eccc | ||
|
|
287f8d71dd | ||
|
|
390e89aefb | ||
|
|
18e21661b2 | ||
|
|
8af19c79f4 | ||
|
|
b7cda2b2fe | ||
|
|
c86b8659e5 | ||
|
|
de3b41b70d | ||
|
|
5aa0aead4d | ||
|
|
0dae907dad | ||
|
|
59e3de62db | ||
|
|
6c2ab54f65 | ||
|
|
be47311883 | ||
|
|
1e9659c7a2 | ||
|
|
ca73d02804 | ||
|
|
5f827b6e19 | ||
|
|
7d9c40d79d | ||
|
|
33da08bce5 | ||
|
|
f2b8681611 | ||
|
|
fc609171ca | ||
|
|
2399da1f8d | ||
|
|
d699b9afba | ||
|
|
7a03e003a1 | ||
|
|
340223de2e | ||
|
|
54697c6e17 | ||
|
|
18eed1fb96 | ||
|
|
55c201e7c1 | ||
|
|
54a78175b4 | ||
|
|
cae19ca42e | ||
|
|
d4558c15d3 | ||
|
|
75c1dbf83c | ||
|
|
536155752c | ||
|
|
958561d255 | ||
|
|
7cd62232ef | ||
|
|
32b73c3a28 | ||
|
|
b0137d6181 | ||
|
|
a776de8b8f | ||
|
|
b577b02eb6 | ||
|
|
b006b1c943 | ||
|
|
4241dbf817 | ||
|
|
0ccd1793e3 | ||
|
|
29aad11bed | ||
|
|
6e33004ef2 | ||
|
|
afca2c164f | ||
|
|
c7e2160582 | ||
|
|
849e24757d | ||
|
|
e143362479 | ||
|
|
4146600579 | ||
|
|
a04afe8d4e | ||
|
|
550bb60691 | ||
|
|
df54db239d | ||
|
|
de532ca299 | ||
|
|
d7fc4e1fe9 | ||
|
|
e8a60c4abd | ||
|
|
1f8a9964c1 | ||
|
|
aabe8f7a80 | ||
|
|
fe9bdefc62 | ||
|
|
205d0ec976 | ||
|
|
e9ecc84064 | ||
|
|
3b7193c207 | ||
|
|
84cb0eb3fd | ||
|
|
d9fda2338f | ||
|
|
64acc0e97a | ||
|
|
8d2307d12d | ||
|
|
8c128592bd | ||
|
|
39430d78ae | ||
|
|
9c9aefd296 | ||
|
|
e63489829e | ||
|
|
87bc53c278 | ||
|
|
5bdf68594d | ||
|
|
f6988916d8 | ||
|
|
aaccbcf984 | ||
|
|
f9e3c4eaa4 | ||
|
|
97195bf2ac | ||
|
|
c787db7e07 | ||
|
|
12b5022a4f | ||
|
|
8c98f20f0e | ||
|
|
9e334c3627 | ||
|
|
66f06a1878 | ||
|
|
6d7f341de5 | ||
|
|
7973feceb0 | ||
|
|
8ccac46fc9 | ||
|
|
b70e791fed | ||
|
|
1a57aa7216 | ||
|
|
102355aba5 | ||
|
|
9a08048744 | ||
|
|
793569f6e1 | ||
|
|
ffafc3a989 | ||
|
|
951acb8088 | ||
|
|
afc0c0319b | ||
|
|
522dfa5703 | ||
|
|
332e444397 | ||
|
|
959e1e0520 | ||
|
|
d8572e17e6 | ||
|
|
b2f720cc2b | ||
|
|
c7fc55a0ef | ||
|
|
e84dd0f7e2 | ||
|
|
1624353b2b | ||
|
|
5e7b51710c | ||
|
|
97466ad27d | ||
|
|
90c5f5075a | ||
|
|
4e97975862 | ||
|
|
64e398112f | ||
|
|
2a5b50346c | ||
|
|
6ff09f92a5 | ||
|
|
07c8bf310d | ||
|
|
dc6c4826bc | ||
|
|
d915a24f4d | ||
|
|
267528efba | ||
|
|
ad827e34bb | ||
|
|
69b8c482c1 | ||
|
|
aac77950f2 | ||
|
|
614ab1e6fa | ||
|
|
2e6c493487 | ||
|
|
2ca7c9b2b9 | ||
|
|
b395eec893 | ||
|
|
5675284b08 | ||
|
|
cbe998b598 | ||
|
|
fc0dd41092 | ||
|
|
2f8d375692 | ||
|
|
8ed814cbf7 | ||
|
|
852dd4f6c7 | ||
|
|
88514a444b | ||
|
|
e33adbb12f | ||
|
|
ae178f1be0 | ||
|
|
d1b7a21b9b | ||
|
|
bf4fde5f7d | ||
|
|
6194a51ed0 | ||
|
|
4847fb0b77 | ||
|
|
fd241a59cc | ||
|
|
0f0f048380 | ||
|
|
974c93498a | ||
|
|
92bc0f692f | ||
|
|
7b2af3348d | ||
|
|
89cbbfc871 | ||
|
|
e955c45ba8 | ||
|
|
1ed8d4f543 | ||
|
|
19e5dcd9d0 | ||
|
|
caafdb266f | ||
|
|
412d73e7e1 | ||
|
|
76c0e4dd1b | ||
|
|
b8b223c87c | ||
|
|
9d3ea208ef | ||
|
|
5a55196572 | ||
|
|
35e9d5d64e | ||
|
|
b47f768076 | ||
|
|
6630b0c9bf | ||
|
|
1b2a8eec7c | ||
|
|
31da6dc7c2 | ||
|
|
d873cb5476 | ||
|
|
5179bc81b7 | ||
|
|
26e3d2bff2 | ||
|
|
61ee5fd3a7 | ||
|
|
0eecc95aac | ||
|
|
3bb8f73c6a | ||
|
|
890361468d | ||
|
|
889856aa81 | ||
|
|
63adbc71ef | ||
|
|
d876c150eb | ||
|
|
3202386eaa | ||
|
|
eade816ee0 | ||
|
|
f9861d3ea5 | ||
|
|
580108dd7f | ||
|
|
30105666e2 | ||
|
|
8d0d707d3e | ||
|
|
c94a943854 | ||
|
|
12685e264d | ||
|
|
1e56219bbe | ||
|
|
ab43c4e337 | ||
|
|
02d4e162b8 | ||
|
|
cc4f20ce30 | ||
|
|
10e1207242 | ||
|
|
24c3f7e857 | ||
|
|
a76c54d1ac | ||
|
|
9fea68815e | ||
|
|
9ff62f2cc4 | ||
|
|
3f0fd7409d | ||
|
|
bb8f716abd | ||
|
|
4201512912 | ||
|
|
409b5e6e54 | ||
|
|
490532643e | ||
|
|
b6f4481038 | ||
|
|
227a991388 | ||
|
|
18bb7b7dcb | ||
|
|
d40ba948e9 | ||
|
|
7f5fbe4135 | ||
|
|
86d4066084 | ||
|
|
912f5e99ff | ||
|
|
1d4278c5d2 | ||
|
|
3871b820d9 | ||
|
|
18d36b00bc | ||
|
|
5e62f8311f | ||
|
|
8e0614436b | ||
|
|
68b8e5d00a | ||
|
|
a202c280d8 | ||
|
|
ff5cab992b | ||
|
|
46f3c881ec | ||
|
|
a54fec0b43 | ||
|
|
f2a1aedbc2 | ||
|
|
fbe0742ef6 | ||
|
|
a0524c0cf3 | ||
|
|
bc7f4390b1 | ||
|
|
e5520ae4e5 | ||
|
|
06014f4a39 | ||
|
|
addd9b8f14 | ||
|
|
0d78e26e8d | ||
|
|
bc291255e8 | ||
|
|
5aba9b8707 | ||
|
|
6c555adb79 | ||
|
|
3eca2ef5df | ||
|
|
491c1fa683 | ||
|
|
4fe217ef0e | ||
|
|
872958127a | ||
|
|
32735a2ab1 | ||
|
|
f300b96251 | ||
|
|
b1d38bb7b7 | ||
|
|
0af9ac496e | ||
|
|
fd30a24079 | ||
|
|
0749f45054 | ||
|
|
168ddde0dd | ||
|
|
0d6d5e7dd3 | ||
|
|
27c70d8e24 | ||
|
|
0275e9e75f | ||
|
|
c618b30013 | ||
|
|
cbb2e823da | ||
|
|
113da1cd4b | ||
|
|
a9ae4ab3f1 | ||
|
|
3be983c650 | ||
|
|
7b680f8ac6 | ||
|
|
b6057a0a11 | ||
|
|
3bebdb2af7 | ||
|
|
dd80fcb337 | ||
|
|
2b523fe7e0 | ||
|
|
39e33e75a3 | ||
|
|
991b40047a | ||
|
|
39e44e9da9 | ||
|
|
499898a4fc | ||
|
|
de7571f91e | ||
|
|
fd8d2c1941 | ||
|
|
e953fc8891 | ||
|
|
b9d28418e8 | ||
|
|
3f46d2ec33 | ||
|
|
81f1be388e | ||
|
|
4b921227c5 | ||
|
|
c0bd7bb6a3 | ||
|
|
0cec2ec16d | ||
|
|
7120cf52a2 | ||
|
|
cc9151425f | ||
|
|
c744928e07 | ||
|
|
6529613496 | ||
|
|
010c8b28dd | ||
|
|
198702010f | ||
|
|
ffffaa9fe6 | ||
|
|
90b7d28627 | ||
|
|
d8b4e04861 | ||
|
|
8c1756d312 | ||
|
|
5989f0b45f | ||
|
|
846626fabf | ||
|
|
7768fa808d | ||
|
|
39c3c47ea2 | ||
|
|
f5770fdc6e | ||
|
|
b4595bf8bb | ||
|
|
8e3711b73c | ||
|
|
55deeaa88c | ||
|
|
f10199f0b6 | ||
|
|
eb6aaca1f5 | ||
|
|
9167c861d6 | ||
|
|
2d1bbb6e6a | ||
|
|
d82e316f9b | ||
|
|
33f5290015 | ||
|
|
aa1e2ca660 | ||
|
|
86600c3884 | ||
|
|
c6c7a44c5b | ||
|
|
0652ded616 | ||
|
|
2d3b6d0d87 | ||
|
|
b25263308b | ||
|
|
1410fbc565 | ||
|
|
c72c443090 | ||
|
|
6f29790b76 | ||
|
|
d936609188 | ||
|
|
8aa59bdb51 | ||
|
|
f0eee80ab7 | ||
|
|
7f9486fff1 | ||
|
|
e9f45eeb8b | ||
|
|
127e5e70a0 | ||
|
|
334787c140 | ||
|
|
2cdf3b2c85 | ||
|
|
bf14695eab | ||
|
|
a4da914994 | ||
|
|
fefbe19011 | ||
|
|
a2ade2ee42 | ||
|
|
2e7158a760 | ||
|
|
1cd0ed22f5 | ||
|
|
db982f2d93 | ||
|
|
44a10943c3 | ||
|
|
055e0250bd | ||
|
|
48dc39a3d5 | ||
|
|
f45ea9e0aa | ||
|
|
ab16bc673d | ||
|
|
7b504f9ed6 | ||
|
|
9d7287c647 | ||
|
|
c80d4750a8 | ||
|
|
e579b908f3 | ||
|
|
01acb97f96 | ||
|
|
7986ccb3f7 | ||
|
|
e452451926 | ||
|
|
9b7e7fc221 | ||
|
|
42ba637935 | ||
|
|
6aced84146 | ||
|
|
05987f04e2 | ||
|
|
32642af4a9 | ||
|
|
62ee8a0381 | ||
|
|
30216dd367 | ||
|
|
cbc4cf309d | ||
|
|
4217a50874 | ||
|
|
a8a27eb4a4 | ||
|
|
8410271fdb | ||
|
|
fe97e92dd2 | ||
|
|
9ab0121af0 | ||
|
|
6132c12835 | ||
|
|
cb48a27d16 | ||
|
|
3953a3a06c | ||
|
|
139338cf34 | ||
|
|
41cd938748 | ||
|
|
3229de9b3b | ||
|
|
dcc201e7bb |
No files matched your search
@@ -1,89 +0,0 @@
|
||||
# Dolt database (managed by Dolt, not git)
|
||||
dolt/
|
||||
embeddeddolt/
|
||||
proxieddb/
|
||||
|
||||
# Runtime files
|
||||
bd.sock
|
||||
bd.sock.startlock
|
||||
sync-state.json
|
||||
last-touched
|
||||
.exclusive-lock
|
||||
|
||||
# Daemon runtime (lock, log, pid)
|
||||
daemon.*
|
||||
|
||||
# Push state (runtime, per-machine)
|
||||
push-state.json
|
||||
|
||||
# Lock files (various runtime locks)
|
||||
*.lock
|
||||
|
||||
# Credential key (encryption key for federation peer auth — never commit)
|
||||
.beads-credential-key
|
||||
|
||||
# Local version tracking (prevents upgrade notification spam after git ops)
|
||||
.local_version
|
||||
|
||||
proxied_server_client_info.json
|
||||
|
||||
# Worktree redirect file (contains relative path to main repo's .beads/)
|
||||
# Must not be committed as paths would be wrong in other clones
|
||||
redirect
|
||||
|
||||
# Sync state (local-only, per-machine)
|
||||
# These files are machine-specific and should not be shared across clones
|
||||
.sync.lock
|
||||
|
||||
# Workspace operation gate (internal/workspacegate): physical-root gate
|
||||
# files live beside the guarded root inside .beads (e.g. dolt.gate.lock)
|
||||
*.gate.lock*
|
||||
export-state/
|
||||
export-state.json
|
||||
last_pull
|
||||
|
||||
# Ephemeral store (SQLite - wisps/molecules, intentionally not versioned)
|
||||
ephemeral.sqlite3
|
||||
ephemeral.sqlite3-journal
|
||||
ephemeral.sqlite3-wal
|
||||
ephemeral.sqlite3-shm
|
||||
|
||||
# Dolt server management (auto-started by bd)
|
||||
dolt-server.pid
|
||||
dolt-server.log
|
||||
dolt-server.lock
|
||||
dolt-server.port
|
||||
dolt-server.activity
|
||||
|
||||
# Debug-mode pprof artifacts (written when dolt.debug: true in config.yaml)
|
||||
dolt-pprof/
|
||||
|
||||
# Corrupt backup directories (created by bd doctor --fix recovery)
|
||||
*.corrupt.backup/
|
||||
|
||||
# issues.jsonl is deliberately TRACKED (see export.git-add in config.yaml).
|
||||
# Dolt remains the authoritative store and GitHub the external issue surface;
|
||||
# the tracked export exists so issue state is readable and recoverable from a
|
||||
# plain git clone, without a Dolt server. Removing it from this file is what
|
||||
# tracks it -- do NOT add a "!issues.jsonl" negation, which would override the
|
||||
# fork protection in .git/info/exclude (see the note at the end of this file).
|
||||
#
|
||||
# Backups stay local: they are point-in-time copies of the same data.
|
||||
backup/
|
||||
|
||||
# Per-project environment file (Dolt connection config, GH#2520)
|
||||
.env
|
||||
|
||||
# Legacy files (from pre-Dolt versions)
|
||||
*.db
|
||||
*.db?*
|
||||
*.db-journal
|
||||
*.db-wal
|
||||
*.db-shm
|
||||
db.sqlite
|
||||
bd.db
|
||||
# NOTE: Do NOT add negation patterns here.
|
||||
# They would override fork protection in .git/info/exclude.
|
||||
# Config files (metadata.json, config.yaml) are tracked by git by default
|
||||
# since no pattern above ignores them.
|
||||
# config.yaml
|
||||
@@ -1,85 +0,0 @@
|
||||
# Beads - AI-Native Issue Tracking
|
||||
|
||||
Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
|
||||
|
||||
## What is Beads?
|
||||
|
||||
Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
|
||||
|
||||
**Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Essential Commands
|
||||
|
||||
```bash
|
||||
# Create new issues
|
||||
bd create "Add user authentication"
|
||||
|
||||
# View all issues
|
||||
bd list
|
||||
|
||||
# View issue details
|
||||
bd show <issue-id>
|
||||
|
||||
# Update issue status
|
||||
bd update <issue-id> --claim
|
||||
bd update <issue-id> --status done
|
||||
|
||||
# Sync with Dolt remote
|
||||
bd dolt push
|
||||
```
|
||||
|
||||
### Working with Issues
|
||||
|
||||
Issues in Beads are:
|
||||
|
||||
- **Git-native**: Stored in Dolt database with version control and branching
|
||||
- **AI-friendly**: CLI-first design works perfectly with AI coding agents
|
||||
- **Branch-aware**: Issues can follow your branch workflow
|
||||
- **Sync-ready**: Uses Dolt remotes for backup and team sharing
|
||||
|
||||
## Why Beads?
|
||||
|
||||
✨ **AI-Native Design**
|
||||
|
||||
- Built specifically for AI-assisted development workflows
|
||||
- CLI-first interface works seamlessly with AI coding agents
|
||||
- No context switching to web UIs
|
||||
|
||||
🚀 **Developer Focused**
|
||||
|
||||
- Issues live in your repo, right next to your code
|
||||
- Works offline, syncs when you push
|
||||
- Fast, lightweight, and stays out of your way
|
||||
|
||||
🔧 **Git Integration**
|
||||
|
||||
- Dolt-native sync via bd dolt push / bd dolt pull
|
||||
- Branch-aware issue tracking
|
||||
- Dolt-native three-way merge resolution
|
||||
|
||||
## Get Started with Beads
|
||||
|
||||
Try Beads in your own projects:
|
||||
|
||||
```bash
|
||||
# Install Beads
|
||||
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
||||
|
||||
# Initialize in your repo
|
||||
bd init
|
||||
|
||||
# Create your first issue
|
||||
bd create "Try out Beads"
|
||||
```
|
||||
|
||||
## Learn More
|
||||
|
||||
- **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
|
||||
- **Quick Start Guide**: Run `bd quickstart`
|
||||
- **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
|
||||
|
||||
---
|
||||
|
||||
_Beads: Issue tracking that moves at the speed of thought_ ⚡
|
||||
@@ -1,82 +0,0 @@
|
||||
# Beads Configuration File
|
||||
# This file configures default behavior for all bd commands in this repository
|
||||
# All settings can also be set via environment variables (BD_* prefix)
|
||||
# or overridden with command-line flags
|
||||
|
||||
# Issue prefix for this repository (used by bd init)
|
||||
# If not set, bd init will auto-detect from directory name
|
||||
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
|
||||
# issue-prefix: ""
|
||||
|
||||
# Use no-db mode: JSONL-only, no Dolt database
|
||||
# When true, .beads/issues.jsonl is the only local store
|
||||
# no-db: false
|
||||
|
||||
# Enable JSON output by default
|
||||
# json: false
|
||||
|
||||
# Feedback title formatting for mutating commands (create/update/close/dep/edit)
|
||||
# 0 = hide titles, N > 0 = truncate to N characters
|
||||
# output:
|
||||
# title-length: 255
|
||||
|
||||
# Default actor for audit trails (overridden by BEADS_ACTOR or --actor)
|
||||
# actor: ""
|
||||
|
||||
# Optional JSONL sidecar for explicit agent/tool interaction audit records.
|
||||
# Issue history is always recorded in the database and is visible with
|
||||
# bd history <id> --events; this only controls .beads/interactions.jsonl.
|
||||
# audit:
|
||||
# enabled: false
|
||||
|
||||
# Export events (audit trail) to .beads/events.jsonl on each flush/sync
|
||||
# When enabled, new events are appended incrementally using a high-water mark.
|
||||
# Use 'bd export --events' to trigger manually regardless of this setting.
|
||||
# events-export: false
|
||||
|
||||
# Multi-repo configuration (experimental - bd-307)
|
||||
# Allows hydrating from multiple repositories and routing writes to the correct database
|
||||
# repos:
|
||||
# primary: "." # Primary repo (where this database lives)
|
||||
# additional: # Additional repos to hydrate from (read-only)
|
||||
# - ~/beads-planning # Personal planning repo
|
||||
# - ~/work-planning # Work planning repo
|
||||
|
||||
# Dolt-native backup (periodic backup for off-machine recovery)
|
||||
# This is full database backup only. Cross-machine sync uses Dolt remotes.
|
||||
# backup:
|
||||
# enabled: false # Disable auto-backup entirely
|
||||
# interval: 15m # Minimum time between auto-backups
|
||||
# git-push: false # Disable git push (backup locally only)
|
||||
# git-repo: "" # Separate git repo for backups (default: project repo)
|
||||
|
||||
# Optional JSONL auto-export for viewers, interchange, and issue-level migration.
|
||||
# Disabled by default; enable only when an integration needs fresh .beads/issues.jsonl.
|
||||
# Use relative paths under .beads/ for JSONL import/export filenames.
|
||||
export:
|
||||
auto: false
|
||||
path: issues.jsonl
|
||||
interval: 60s
|
||||
# issues.jsonl/interactions.jsonl are .gitignore'd local-only files --
|
||||
# Dolt (synced via sync.remote) is the source of truth. Leave auto off
|
||||
# and git-add off; do not re-track these in git.
|
||||
git-add: false
|
||||
import:
|
||||
path: issues.jsonl
|
||||
# Integration settings (access with 'bd config get/set')
|
||||
# Non-secret keys (stored in the database):
|
||||
# - jira.url, jira.project
|
||||
# - linear.team_id
|
||||
# - github.org, github.repo
|
||||
#
|
||||
# Secret keys (stored in this file but prefer env vars to avoid git exposure):
|
||||
# - linear.api_key → use LINEAR_API_KEY env var instead
|
||||
# - github.token → use GITHUB_TOKEN env var instead
|
||||
sync.remote: "git+https://github.com/samcharles93/archie-core.git"
|
||||
dolt:
|
||||
shared-server: false
|
||||
auto-commit: "on"
|
||||
audit:
|
||||
enabled: true
|
||||
agent:
|
||||
profile: team-maintainer
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'post-checkout' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'post-checkout'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'post-merge' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'post-merge'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'pre-commit' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'pre-push' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'pre-push'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'prepare-commit-msg' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'prepare-commit-msg'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"database": "dolt",
|
||||
"backend": "dolt",
|
||||
"dolt_mode": "embedded",
|
||||
"dolt_database": "archie_core",
|
||||
"project_id": "e8a66150-1f5f-42d2-8653-dcf8463cef74",
|
||||
"last_bd_version": "1.2.2"
|
||||
}
|
||||
+6
-1
@@ -10,7 +10,12 @@
|
||||
bin/
|
||||
dist/
|
||||
docs/
|
||||
node_modules/
|
||||
tmp/
|
||||
.playwright-mcp/
|
||||
# A trailing-slash pattern matches only the context root, so this is written to
|
||||
# match a node_modules at any depth: ui/node_modules alone is 200MB and the
|
||||
# agent image compiles Go, which needs none of it.
|
||||
**/node_modules/
|
||||
|
||||
# Stray host-built binaries committed at the repo root.
|
||||
/archied
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# Every 15 minutes, checks how the release installed on the canary host is
|
||||
# running, judged over the window counted from its install (-window, default
|
||||
# 24h; CANARY_WINDOW overrides it). If a hard check fails, the canary goes
|
||||
# back to the stable release straight away. If the release stays healthy for
|
||||
# the window, it's promoted to stable. A rollback fails the run, so it shows
|
||||
# up red.
|
||||
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:
|
||||
# Full history with tags: a rollback compares the migrations between
|
||||
# the stable and failed release tags.
|
||||
- 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
|
||||
# The self-hosted runner keeps the Go caches on disk between jobs, and
|
||||
# archiving them for the Actions cache takes minutes.
|
||||
cache: false
|
||||
|
||||
- name: Build archied
|
||||
# The check never serves the dashboard, so the build leaves it out.
|
||||
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
|
||||
|
||||
# Promotion retags stable and the images' latest in the registry.
|
||||
- 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
|
||||
+137
-140
@@ -1,12 +1,13 @@
|
||||
# Builds and pushes the archied and archie-agent images to GHCR on every
|
||||
# merge to main. Mirrors .gitea/workflows/deploy.yml, which remains the
|
||||
# production build path against git.catlow.cloud until that's cut over.
|
||||
# Builds and pushes the archied and archie-agent images to the Gitea
|
||||
# registry on every merge to main, and publishes the distribution zip as a
|
||||
# release on this repository. Gitea Actions reads this .github/workflows/
|
||||
# directory.
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["archied/v*", "archie/v*", "v*"]
|
||||
tags: ["v*"]
|
||||
|
||||
# Rapid successive pushes to main (a release commit right after its
|
||||
# preceding fix, say) previously queued a full gate+build for each one,
|
||||
@@ -46,7 +47,7 @@ jobs:
|
||||
- name: Resolve archied tag at HEAD
|
||||
id: release_tag
|
||||
run: |
|
||||
version="$(git tag --points-at HEAD --list 'archied/v*' --list 'v*' | sed -e 's|^archied/v||' -e 's|^v||' | sort -V | tail -1)"
|
||||
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"
|
||||
@@ -58,6 +59,13 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
# The self-hosted runner keeps the Go caches on disk between jobs, and
|
||||
# archiving them for the Actions cache takes minutes.
|
||||
cache: false
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
@@ -79,17 +87,11 @@ jobs:
|
||||
git branch main origin/main
|
||||
fi
|
||||
|
||||
- name: Install ripgrep
|
||||
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends ripgrep
|
||||
|
||||
# Extensions run in an unprivileged user and network namespace, which
|
||||
# Ubuntu 24.04 runners forbid through AppArmor by default.
|
||||
- name: Allow unprivileged user namespaces
|
||||
run: |
|
||||
if [ -e /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then
|
||||
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
||||
fi
|
||||
unshare --user --map-root-user --net true
|
||||
# ripgrep and the unprivileged-userns sysctl are provisioned on the host.
|
||||
# A self-hosted runner should not need sudo, and installing a package on
|
||||
# every run is not the gate's job.
|
||||
- name: Verify unprivileged user namespaces
|
||||
run: unshare --user --map-root-user --net true
|
||||
|
||||
# The gate's uncached `go test ./...` runs the Docker-backed tests that
|
||||
# -short skips, and those start a container from alpine:3. A fresh runner
|
||||
@@ -97,35 +99,20 @@ jobs:
|
||||
- name: Pull test container images
|
||||
run: docker pull alpine:3
|
||||
|
||||
# One definition of the gate, in the Taskfile. TEST_FLAGS is the one
|
||||
# difference: the release runs the whole suite, uncached and including
|
||||
# the Docker-backed tests -short skips. The diff after it asserts
|
||||
# `task fmt` changed nothing.
|
||||
- name: Quality gate
|
||||
run: |
|
||||
# The formatter sequence has one owner: task fmt, which drives go fix
|
||||
# to a fixpoint and then the configured lint formatters. This step
|
||||
# used to inline its own single `go fix ./...`, which leaves the
|
||||
# redundant loop-variable copy that copyloopvar rejects -- the hazard
|
||||
# of archie-core-wwho, surfacing here as a spurious git-diff failure
|
||||
# (archie-core-6kda).
|
||||
task fmt
|
||||
task check TEST_FLAGS=-count=1
|
||||
git diff --exit-code
|
||||
bash tools/proto.sh lint
|
||||
bash tools/proto.sh check
|
||||
go vet ./...
|
||||
golangci-lint run ./...
|
||||
go build ./...
|
||||
go test ./... -count=1
|
||||
|
||||
- name: Vulnerability scan
|
||||
run: |
|
||||
go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
govulncheck ./...
|
||||
|
||||
# The dashboard suite runs in CI too, or it only ever runs when
|
||||
# someone remembers to; the Go steps above never touch it.
|
||||
- name: Dashboard tests
|
||||
run: |
|
||||
npm ci --prefix ui || npm install --prefix ui
|
||||
npm test --prefix ui
|
||||
|
||||
- name: Release tags must match changelogs
|
||||
run: |
|
||||
set -e
|
||||
@@ -140,28 +127,16 @@ jobs:
|
||||
fail=1
|
||||
}
|
||||
;;
|
||||
archied/v* | archie/v*)
|
||||
# Legacy per-component tags. History is not re-tagged, and the
|
||||
# merged CHANGELOG.md carries every component's versions, so the
|
||||
# section is found there rather than in a component file.
|
||||
ver="${tag#*/v}"
|
||||
echo " legacy 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. Run: task release:prepare VERSION=<ver>"
|
||||
echo "edit the generated notes, then: task release VERSION=<ver>"
|
||||
echo "describe that version. Cut releases with the release workflow."
|
||||
exit 1
|
||||
fi
|
||||
if ! git tag --points-at HEAD | grep -qE '^(v[0-9]|archied/v|archie/v)' ; then
|
||||
echo "This commit is not a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest release."
|
||||
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
|
||||
|
||||
archied-image:
|
||||
@@ -174,11 +149,8 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
# Deliberately NOT `github.sha`. On a tag push that is the ref's OBJECT id,
|
||||
# and every release tag in this repo is annotated — measured, 80 of 80
|
||||
# `archied/v*` and `archie/v*` tags are tag objects — so it names something
|
||||
# that cannot be checked out. `archied/v1.36.0` is an instance: it points at
|
||||
# 6720bc42 (a tag object) and dereferences to commit c25f8d39. The producer
|
||||
# is right to create annotated tags; the consumer stops guessing.
|
||||
# and every release tag in this repo is annotated, so it names a tag object
|
||||
# that cannot be checked out. Dereference it to the commit.
|
||||
- name: Resolve the commit this ref points at
|
||||
id: commit
|
||||
run: |
|
||||
@@ -189,22 +161,16 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
|
||||
- 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: |
|
||||
GATEWAY_TAG="$(git tag --points-at HEAD --list 'archied/v*' | sort -V | tail -1)"
|
||||
RUNTIME_TAG="$(git tag --points-at HEAD --list 'archie/v*' | sort -V | tail -1)"
|
||||
# One release stream: a `v*` tag covers the whole release, so it names
|
||||
# both components' versions. Legacy per-component tags still win where
|
||||
# they exist, because history is not re-tagged.
|
||||
# One release stream: a `v*` tag names both components' versions.
|
||||
RELEASE_TAG="$(git tag --points-at HEAD --list 'v*' | sort -V | tail -1)"
|
||||
GATEWAY_VERSION="${GATEWAY_TAG#archied/}"
|
||||
RUNTIME_VERSION="${RUNTIME_TAG#archie/}"
|
||||
[ -n "$GATEWAY_VERSION" ] || GATEWAY_VERSION="${RELEASE_TAG#v}"
|
||||
[ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION="${RELEASE_TAG#v}"
|
||||
GATEWAY_VERSION="${RELEASE_TAG#v}"
|
||||
RUNTIME_VERSION="${RELEASE_TAG#v}"
|
||||
# `dev+<sha>` is what a build that is NOT a release reports, and it is
|
||||
# honest now that such a build no longer publishes :latest: the version
|
||||
# names the commit it came from, and the sha-<sha> tag makes it
|
||||
@@ -214,32 +180,24 @@ jobs:
|
||||
# the tag case is handled by the dereference above.)
|
||||
[ -n "$GATEWAY_VERSION" ] || GATEWAY_VERSION="dev+${GITHUB_SHA:0:12}"
|
||||
[ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION="dev+${GITHUB_SHA:0:12}"
|
||||
# Keep the raw tag presence separate from the version fallback: a
|
||||
# LEGACY gateway-only release (archied/v* and no archie/v*) must not
|
||||
# rebuild the runtime image as dev. A one-stream `v*` release is not
|
||||
# gateway-only -- one version covers the runtime too -- so it does
|
||||
# rebuild it, and release_tag is what tells the two apart.
|
||||
echo "gateway_tag=$GATEWAY_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "runtime_tag=$RUNTIME_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "gateway=$GATEWAY_VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT"
|
||||
# :latest names the newest RELEASE, so only a commit that IS one
|
||||
# publishes it. A push to main publishes :edge (mutable, newest main)
|
||||
# and sha-<sha> (immutable) instead. That is what stops a release's
|
||||
# :latest stamping from being overwritten minutes later by the next
|
||||
# ordinary commit, which left a host reporting dev and made the update
|
||||
# path unable to tell current from stale (archie-core-i5nb).
|
||||
# :latest names the newest PROMOTED release, so a release publishes
|
||||
# :v<version> and canary promotion moves :latest to it. A push to
|
||||
# main publishes :edge (mutable, newest main) and sha-<sha>
|
||||
# (immutable), so an ordinary commit never overwrites a release's
|
||||
# stamping.
|
||||
#
|
||||
# `if` blocks rather than `[ -n "$X" ] && echo`: the latter returns
|
||||
# non-zero when the test fails, and these steps run under `set -e`.
|
||||
{
|
||||
echo "archied_tags<<EOF"
|
||||
if [ -n "$RELEASE_TAG" ]; then
|
||||
echo "ghcr.io/samcharles93/archied:latest"
|
||||
echo "git.catlow.cloud/sam/archied:$RELEASE_TAG"
|
||||
fi
|
||||
echo "ghcr.io/samcharles93/archied:edge"
|
||||
echo "ghcr.io/samcharles93/archied:sha-${{ steps.commit.outputs.sha }}"
|
||||
echo "git.catlow.cloud/sam/archied:edge"
|
||||
echo "git.catlow.cloud/sam/archied:sha-${{ steps.commit.outputs.sha }}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
@@ -279,31 +237,28 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
|
||||
- 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: |
|
||||
RUNTIME_TAG="$(git tag --points-at HEAD --list 'archie/v*' | sort -V | tail -1)"
|
||||
RELEASE_TAG="$(git tag --points-at HEAD --list 'v*' | sort -V | tail -1)"
|
||||
RUNTIME_VERSION="${RUNTIME_TAG#archie/}"
|
||||
[ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION="${RELEASE_TAG#v}"
|
||||
echo "runtime_tag=$RUNTIME_TAG" >> "$GITHUB_OUTPUT"
|
||||
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.runtime_tag != '' || steps.versions.outputs.release_tag != ''
|
||||
if: steps.versions.outputs.release_tag != ''
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/samcharles93/archie-agent:latest
|
||||
ghcr.io/samcharles93/archie-agent:sha-${{ steps.commit.outputs.sha }}
|
||||
git.catlow.cloud/sam/archie-agent:${{ steps.versions.outputs.release_tag }}
|
||||
git.catlow.cloud/sam/archie-agent:sha-${{ steps.commit.outputs.sha }}
|
||||
build-args: |
|
||||
RUNTIME_VERSION=${{ steps.versions.outputs.runtime }}
|
||||
cache-from: type=gha,scope=archie-agent
|
||||
@@ -312,8 +267,10 @@ jobs:
|
||||
# Packages every host-run binary (archied, archie-gateway,
|
||||
# archie-state-store, archie-ui, archie-messaging) as a
|
||||
# linux/amd64 zip for a
|
||||
# non-Docker install. It waits only for the agent image, whose digest
|
||||
# release.json pins; archie-agent itself never ships as a host binary.
|
||||
# non-Docker install, plus archie-agent: it has no unit, but a Kit run
|
||||
# mounts it from archied's directory, so a host without it parks them.
|
||||
# It waits only for the agent image, whose digest
|
||||
# release.json pins.
|
||||
dist-zip:
|
||||
needs: [gate, agent-image]
|
||||
# Not gated on github.ref. A release is pushed as main plus both tags at
|
||||
@@ -325,10 +282,6 @@ jobs:
|
||||
# archied tag at HEAD.
|
||||
if: needs.gate.outputs.archied_version != ''
|
||||
runs-on: self-hosted
|
||||
# Least privilege: the workflow default is contents:read, and only this
|
||||
# job needs to write, to create the Release and attach the zip to it.
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -337,6 +290,25 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
# The self-hosted runner keeps the Go caches on disk between jobs, and
|
||||
# archiving them for the Actions cache takes minutes.
|
||||
cache: false
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
# archied and archie-ui embed the dashboard.
|
||||
- name: Build the dashboard
|
||||
working-directory: ui
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
|
||||
- name: Resolve archied version
|
||||
id: version
|
||||
@@ -360,9 +332,12 @@ jobs:
|
||||
# ran on with a dead Telegram bot and no error anywhere
|
||||
# (archie-core-1c01). TestDistZipShipsEveryHostCommand fails if this
|
||||
# list and the copy list below stop matching the commands in cmd/.
|
||||
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 }}"
|
||||
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[]' release.json); do
|
||||
# Units first, then the binaries that run beside them without one.
|
||||
# The agentworker stamp only lands in archie-agent; the linker
|
||||
# ignores -X for a symbol a binary does not import.
|
||||
for cmd in $(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json); do
|
||||
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
|
||||
done
|
||||
|
||||
@@ -372,56 +347,56 @@ jobs:
|
||||
set -e
|
||||
name="archie-core-archied-v${{ steps.version.outputs.version }}-linux-amd64"
|
||||
mkdir -p "$name"
|
||||
for cmd in $(jq -r '.required_topology.units[]' release.json); do
|
||||
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/"
|
||||
digest='${{ needs.agent-image.outputs.agent_digest }}'
|
||||
test -n "$digest"
|
||||
jq --arg image "ghcr.io/samcharles93/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
|
||||
jq --arg image "git.catlow.cloud/sam/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
|
||||
# README.md doesn't exist yet in this repo; include it once it does
|
||||
# rather than fail the release on its absence.
|
||||
[ -f README.md ] && cp README.md "$name/"
|
||||
zip -r "$name.zip" "$name"
|
||||
sha256sum "$name.zip" > SHA256SUMS
|
||||
echo "name=$name" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload distribution zip
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.zip.outputs.name }}
|
||||
path: |
|
||||
${{ steps.zip.outputs.name }}.zip
|
||||
SHA256SUMS
|
||||
path: ${{ steps.zip.outputs.name }}.zip
|
||||
retention-days: 90
|
||||
|
||||
# A Release is what an operator can actually download from; the
|
||||
# artifact above is reachable only from the run's page, behind an
|
||||
# Actions login, and expires after 90 days. Until this step existed the
|
||||
# zip was produced and then stranded -- the only Release on this repo
|
||||
# (archied/v1.22.0) was created by hand and carries no asset at all.
|
||||
#
|
||||
# Attached to the release's v* tag, or the archied tag for a release
|
||||
# cut before the single release stream.
|
||||
# --generate-notes is deliberately not used: the changelog section is
|
||||
# the release's own reviewed prose, and the tag/changelog gate above
|
||||
# already guarantees it describes this version.
|
||||
- name: Publish GitHub Release with the distribution zip
|
||||
# Installs and updates take a release from the signed artifact in the
|
||||
# registry, so this is what publishes it: the statement signed with
|
||||
# RELEASE_SIGNING_KEY and the zip, tagged v<version> and next. stable
|
||||
# moves only when canary.yml promotes it.
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Publish the signed release
|
||||
env:
|
||||
# GITHUB_TOKEN cannot write to another repository.
|
||||
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }}
|
||||
ARCHIE_RELEASE_SEED: ${{ secrets.RELEASE_SIGNING_KEY }}
|
||||
run: |
|
||||
set -e
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
prerelease=false
|
||||
case "$version" in *-*) prerelease=true ;; esac
|
||||
./dist/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
-version "$version" -prerelease="$prerelease" \
|
||||
-zip "${{ steps.zip.outputs.name }}.zip" \
|
||||
-agent-image "git.catlow.cloud/sam/archie-agent@${{ needs.agent-image.outputs.agent_digest }}" \
|
||||
-changelog "https://git.catlow.cloud/sam/archie/releases/tag/v$version"
|
||||
|
||||
# The release page carries this version's changelog section, the
|
||||
# release's own reviewed prose; the signed statement links to it.
|
||||
- name: Publish the Gitea release notes
|
||||
env:
|
||||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
tag="v${{ steps.version.outputs.version }}"
|
||||
if ! git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null; then
|
||||
tag="archied/v${{ steps.version.outputs.version }}"
|
||||
fi
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
# The release body is this version's changelog section, not the whole
|
||||
# file: from its "## [x.y.z]" heading to the next "## [" heading.
|
||||
# Extracting rather than inlining keeps the changelog the single
|
||||
# source of truth, and the tag/changelog gate above has already
|
||||
# proven that section exists.
|
||||
notes="$(mktemp)"
|
||||
awk -v hdr="## [$version]" '
|
||||
index($0, hdr) == 1 { printing = 1 }
|
||||
@@ -432,15 +407,37 @@ jobs:
|
||||
echo "no [$version] section extracted from CHANGELOG.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Idempotent: --clobber replaces the asset and leaves the notes
|
||||
# alone, so a re-run of this job (a retried or superseded deploy)
|
||||
# cannot fail on an existing Release or duplicate the zip.
|
||||
if gh release view "$tag" -R samcharles93/archie-releases >/dev/null 2>&1; then
|
||||
gh release upload "$tag" -R samcharles93/archie-releases "${{ steps.zip.outputs.name }}.zip" SHA256SUMS install.sh --clobber
|
||||
else
|
||||
gh release create "$tag" -R samcharles93/archie-releases \
|
||||
--title "archied v$version" \
|
||||
--notes-file "$notes" \
|
||||
"${{ steps.zip.outputs.name }}.zip" SHA256SUMS install.sh
|
||||
fi
|
||||
echo "published $tag with ${{ steps.zip.outputs.name }}.zip"
|
||||
api="https://git.catlow.cloud/api/v1"
|
||||
repo="sam/archie"
|
||||
auth="Authorization: token $DEPLOY_TOKEN"
|
||||
# Idempotent: a re-run replaces the release on the tag.
|
||||
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}')" \
|
||||
"$api/repos/$repo/releases" >/dev/null
|
||||
echo "published release notes for $tag"
|
||||
|
||||
# The canary host follows the `next` channel. canary.yml then judges the
|
||||
# release installed on the canary and decides whether it is promoted to
|
||||
# stable or the canary is rolled back. The start is queue-safe: a release
|
||||
# published while the canary still judges a newer one is queued behind
|
||||
# it and picked up by the next check, so the running window isn't
|
||||
# restarted under a different release.
|
||||
- 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 }}"
|
||||
|
||||
# A Gitea package belongs to its owner, not a repository, so the ones this
|
||||
# workflow publishes are linked here. Linking is per package and a no-op
|
||||
# once done, so an already linked package is not an error.
|
||||
- name: Link the packages to this repository
|
||||
env:
|
||||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||
run: |
|
||||
for name in archied archie-agent archie; do
|
||||
curl -sS -o /dev/null -X POST -H "Authorization: token $DEPLOY_TOKEN" \
|
||||
"https://git.catlow.cloud/api/v1/packages/sam/container/$name/-/link/archie" || true
|
||||
done
|
||||
@@ -0,0 +1,55 @@
|
||||
# Promotes the release the canary is running right now, without waiting out
|
||||
# the judging window: the canary's signals must show no hard failure and no
|
||||
# relative breach, otherwise the run refuses and fails. Dispatch it with the
|
||||
# version the canary runs (`archied release canary status` shows it).
|
||||
name: promote
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "release the canary is expected to run; must match what it runs"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: promote
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
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
|
||||
# The self-hosted runner keeps the Go caches on disk between jobs, and
|
||||
# archiving them for the Actions cache takes minutes.
|
||||
cache: false
|
||||
|
||||
- name: Build archied
|
||||
# The promote never serves the dashboard, so the build leaves it out.
|
||||
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
|
||||
|
||||
# Promotion retags stable and the images' latest in the registry.
|
||||
- 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
|
||||
env:
|
||||
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
|
||||
run: |
|
||||
"$RUNNER_TEMP/archied" release canary promote -dashboard "${{ vars.CANARY_URL }}" \
|
||||
-version "${{ inputs.version }}" \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
@@ -14,7 +14,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: self-hosted
|
||||
runs-on: archie-quality
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -31,11 +31,13 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
cache: npm
|
||||
cache-dependency-path: ui/package-lock.json
|
||||
|
||||
- name: Install quality tools
|
||||
run: |
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# Cuts a release from main: [Unreleased] in CHANGELOG.md becomes the version's
|
||||
# section, then the commit and its tag are pushed together. The tag push starts
|
||||
# deploy.yml, which publishes the release to `next` for the canary.
|
||||
name: release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release:
|
||||
description: "major, minor, patch, or an exact version such as 1.57.0"
|
||||
required: true
|
||||
default: minor
|
||||
|
||||
concurrency:
|
||||
group: release
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
cut:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
# DEPLOY_TOKEN rather than the job token: a push made with the job token
|
||||
# doesn't start workflows, and the tag push must start deploy.yml.
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.DEPLOY_TOKEN }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
# The self-hosted runner keeps the Go caches on disk between jobs, and
|
||||
# archiving them for the Actions cache takes minutes.
|
||||
cache: false
|
||||
|
||||
- name: Install Task
|
||||
run: go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
|
||||
- name: Cut the release
|
||||
env:
|
||||
RELEASE: ${{ inputs.release }}
|
||||
run: |
|
||||
git config user.name "Sam Catlow"
|
||||
git config user.email "sam@catlow.tech"
|
||||
task release RELEASE="$RELEASE"
|
||||
|
||||
# Atomic: a commit without its tag would build images stamped dev.
|
||||
- name: Push the release
|
||||
run: git push --atomic origin main "$(git describe --exact-match --match 'v*' HEAD)"
|
||||
+1
-6
@@ -25,19 +25,14 @@ config.production.toml
|
||||
/ui/node_modules/
|
||||
/ui/.vite/
|
||||
/ui/*.tsbuildinfo
|
||||
# ui/dist IS committed: the Go build must not need a Node toolchain.
|
||||
/ui/dist/
|
||||
|
||||
# air live-reload
|
||||
/.air/
|
||||
/tmp/
|
||||
|
||||
# Beads / Dolt files (added by bd init)
|
||||
.dolt/
|
||||
.beads-credential-key
|
||||
.beads/proxieddb/
|
||||
*.gate.lock*
|
||||
.beads/issues.jsonl
|
||||
.beads/interactions.jsonl
|
||||
.mcp.json
|
||||
|
||||
# gh CLI state (~/.local/state/gh) mistakenly created inside the tree
|
||||
|
||||
@@ -120,6 +120,7 @@ linters:
|
||||
sloglint:
|
||||
no-mixed-args: true
|
||||
key-naming-case: snake
|
||||
context: scope
|
||||
|
||||
exclusions:
|
||||
generated: lax
|
||||
|
||||
@@ -5,6 +5,63 @@ release's per-component sections are labelled beneath its heading.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.60.0] - 2026-11-02
|
||||
|
||||
### archied
|
||||
|
||||
- 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.
|
||||
|
||||
## [1.59.0] - 2026-11-02
|
||||
|
||||
### archied
|
||||
|
||||
- Forge extensions can open issues: the forge surface gains `CreateIssue` alongside list, comment and close, and the bundled Gitea and GitHub extensions implement it.
|
||||
|
||||
## [1.58.1] - 2026-11-01
|
||||
|
||||
### archied
|
||||
|
||||
- The systemd watchdog now also watches the task intake loop, and its warning names the loop that stalled.
|
||||
- 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.
|
||||
|
||||
## [1.58.0] - 2026-11-01
|
||||
|
||||
### archied
|
||||
|
||||
- Running `install.sh` over an install whose services are already running now restarts them, so they run the new binaries.
|
||||
|
||||
## [1.57.0] - 2026-10-31
|
||||
|
||||
### archied
|
||||
|
||||
- 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.
|
||||
|
||||
## [1.56.0] - 2026-10-31
|
||||
|
||||
### archied
|
||||
|
||||
- **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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- Instructions replace SOUL: instance, organisation, workflow and repository instructions are layered into every agent stage.
|
||||
- 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.
|
||||
- Run more than one instance side by side: `ARCHIE_INSTANCE` names an instance, and the installer installs and updates a named one.
|
||||
- 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.
|
||||
- A workflow installs a repository's declared tooling before its gate, and tasks clone from a shared per-repository mirror.
|
||||
- Traces: services, model and tool calls and task containers export OpenTelemetry spans, and log lines carry the trace id.
|
||||
- Telegram runs as an archipelago channel extension, enabled from the Extensions page.
|
||||
- The Extensions page groups the marketplace by surface, is searchable, shows install state, and offers an update only when the catalogue has one.
|
||||
- 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.
|
||||
|
||||
### archie-agent
|
||||
|
||||
- Released with archied 1.56.0; task containers export trace spans and install a repository's declared tooling before its gate.
|
||||
|
||||
## [1.55.0] - 2026-10-16
|
||||
|
||||
### archied
|
||||
|
||||
@@ -9,12 +9,34 @@ here changes a decision. If a rule stops changing decisions, delete it.
|
||||
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.
|
||||
of the product. A forge is one of many inputs or outputs; core code never
|
||||
assumes one.
|
||||
|
||||
<temporary - this statement must be removed on 2026-10-20"> The product is
|
||||
unfinished. Many features are half-built, and the codebase carries far more
|
||||
code, binaries, docs and tooling than it delivers. The job right now is to
|
||||
finish features and shrink the codebase, not to extend it. </temporary>
|
||||
<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>
|
||||
|
||||
## Services and layout
|
||||
|
||||
Each service is a gRPC contract in `proto/<service>/v1`, generated into
|
||||
`internal/contracts/<service>/v1`, and one binary in `cmd/` that parses flags
|
||||
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-agent` | The worker inside each task container | NATS |
|
||||
|
||||
`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.
|
||||
|
||||
## Authority
|
||||
|
||||
@@ -23,7 +45,7 @@ When sources disagree, the higher one wins:
|
||||
1. The maintainer's instruction in this session.
|
||||
2. This file.
|
||||
3. The code as it is in the tree.
|
||||
4. Beads issues (`bd show <id>`): the plan for a piece of work.
|
||||
4. Gitea issues (`tea issues view <n>`): the plan for a piece of work.
|
||||
5. Everything else (memories, comments, old docs) is a hint. Verify it against
|
||||
the code before acting on it.
|
||||
|
||||
@@ -78,10 +100,12 @@ When sources disagree, the higher one wins:
|
||||
`infrastructure` implements `domain` interfaces, `domain` imports neither.
|
||||
`cmd/` parses flags and calls `app`, nothing else.
|
||||
- Fix invalid state where it is produced, not with checks where it is consumed.
|
||||
- Log through the service's injected `*slog.Logger` with the `...Context`
|
||||
methods, so lines carry the OpenTelemetry trace id. Never the global `slog`.
|
||||
- If a fix fails twice, throw the block away and rewrite it simply.
|
||||
- Comments say why, briefly. No migration history, phase names or issue
|
||||
narration in code.
|
||||
- Generated files (`ui/dist/`, protobuf, sqlc) are regenerated and committed
|
||||
- Generated files (protobuf, sqlc) are regenerated and committed
|
||||
with the change that caused them, never hand-edited.
|
||||
|
||||
## Tests
|
||||
@@ -127,9 +151,18 @@ task build # binaries into bin/
|
||||
task test # go test -short ./...
|
||||
task ui # dashboard into ui/dist
|
||||
task check # the gate
|
||||
|
||||
go test -short ./internal/domain/workflow -run TestName # one test
|
||||
task dev # every service + Vite at http://localhost:5173, from deployments/dev.toml
|
||||
task e2e:up # seeded local stack; task e2e:check -- all runs the browser checks
|
||||
```
|
||||
|
||||
Requires Go 1.27, Task, golangci-lint, Node/npm and Docker. Adopt `task fmt` and
|
||||
`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.
|
||||
|
||||
Requires Go 1.27, Task, golangci-lint, Node, pnpm and Docker. Adopt `task fmt` and
|
||||
`go fix` output as-is.
|
||||
|
||||
- `task check` gates the commit: `task check && git commit ...`. Never claim a
|
||||
@@ -144,21 +177,32 @@ Requires Go 1.27, Task, golangci-lint, Node/npm and Docker. Adopt `task fmt` and
|
||||
Nothing in the working tree is read at runtime. Systemd is optional.
|
||||
- Releases: `RELEASING.md`.
|
||||
|
||||
## Issues (beads)
|
||||
## Issues (Gitea)
|
||||
|
||||
Work is tracked in `bd`, never in Markdown TODO files.
|
||||
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
|
||||
bd ready | bd show <id> | bd update <id> --claim | bd close <id>
|
||||
tea issues list -r sam/archie --state open --labels priority::critical
|
||||
tea issues list -r sam/archie --labels epic/<slug> --state open
|
||||
tea issues view 497
|
||||
tea issues edit 497 --add-labels status::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.
|
||||
- Bead state syncs through Dolt (`bd dolt push/pull`, only when told), not git.
|
||||
Never commit `.beads/` exports.
|
||||
- No host names, IPs, paths, PIDs or credentials in any bead: they are
|
||||
published.
|
||||
- File follow-up work you find as a bead. Do not fix it in passing.
|
||||
- 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.
|
||||
- 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.
|
||||
- The API caps `limit` at 50 regardless of what you pass.
|
||||
- No host names, IPs, paths, PIDs or credentials in an issue: the text outlives
|
||||
the change that wrote it.
|
||||
- File follow-up work you find as an issue. Do not fix it in passing.
|
||||
|
||||
## Changing this file
|
||||
|
||||
|
||||
+3
-2
@@ -2,7 +2,8 @@
|
||||
# Pre-installs system tools agents can't install themselves (no apt, no sudo).
|
||||
# Language packages are installed at runtime via uv/npm/go.
|
||||
#
|
||||
# Build: docker build -t archie-agent:latest .
|
||||
# Build: task image:agent (or docker build --build-arg RUNTIME_VERSION=<ver>)
|
||||
# A build that names no version stamps none, and the agent reports dev.
|
||||
|
||||
# ── builder ──
|
||||
FROM golang:1.27-trixie AS builder
|
||||
@@ -54,7 +55,7 @@ ENV GOPATH="/go"
|
||||
# /go/bin must be on PATH or anything `go install` puts there is unreachable.
|
||||
ENV PATH="/usr/local/go/bin:/go/bin:${PATH}"
|
||||
|
||||
ARG GOLANGCI_LINT_VERSION=2.13.2
|
||||
ARG GOLANGCI_LINT_VERSION=2.14.0
|
||||
ARG GOFUMPT_VERSION=0.11.0
|
||||
ARG BUF_VERSION=1.72.0
|
||||
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
# archied — the archie daemon
|
||||
# Run via docker compose alongside NATS.
|
||||
|
||||
FROM node:24-trixie-slim AS dashboard
|
||||
WORKDIR /src/ui
|
||||
RUN corepack enable
|
||||
COPY ui/package.json ui/pnpm-lock.yaml ui/pnpm-workspace.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY ui/ ./
|
||||
RUN pnpm run build
|
||||
|
||||
FROM golang:1.27-trixie AS builder
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN 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 \
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
[](https://github.com/samcharles93/archie-core/actions/workflows/quality.yml)
|
||||
|
||||
# Archie
|
||||
|
||||
**Event-driven Agentic Automation**
|
||||
@@ -103,7 +101,7 @@ or a hosted provider API key.
|
||||
1. **Install.**
|
||||
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/samcharles93/archie-core/main/install.sh | bash
|
||||
curl -fsSL https://offloaded.dev/install.sh | bash
|
||||
```
|
||||
|
||||
It downloads the latest release, verifies its checksum, installs the five
|
||||
|
||||
+215
-108
@@ -1,136 +1,243 @@
|
||||
# Releasing
|
||||
|
||||
One release stream. `CHANGELOG.md` carries every release section, one generated
|
||||
page per version describes it, and one tag names the release. A release is one
|
||||
version covering whatever changed; the components' entries are labelled sections
|
||||
inside it (`### archied`, `### archie-agent`), not separate numbers or separate
|
||||
pages.
|
||||
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`).
|
||||
|
||||
The host bundle ships five processes (`archied`, `archie-gateway`,
|
||||
`archie-state-store`, `archie-ui`, `archie-messaging`), and
|
||||
one version covers all of them. `archie-agent`, the per-task sandboxed runtime,
|
||||
ships as a container image and its changes are the `## [version]` release's
|
||||
`### archie-agent` section.
|
||||
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.
|
||||
|
||||
`tools/release.sh` decides which commits a release carries from the package
|
||||
closure of **every shipped binary**, not from commit-message guessing: a change
|
||||
to a package only the messaging service, state store, playbook runner or UI
|
||||
links still lands in the changelog. Read its header comment for how it
|
||||
partitions commits and enforces `main`-only, clean-tree releases.
|
||||
## Notes are written with the change
|
||||
|
||||
## What justifies a version
|
||||
|
||||
`task release:preview VERSION=X.Y.Z` shows exactly what would land, before
|
||||
anything is written. A commit set that justifies no version produces no version:
|
||||
`release.sh` exits **3** with "nothing to release" rather than inventing one, so
|
||||
a pipeline can finish green without tagging.
|
||||
|
||||
Most sessions touch the gateway side (daemon, gateway, web UI, chat, messaging)
|
||||
and leave the agent runtime alone. That is no longer a per-component `skip`
|
||||
decision — one version covers the release — but a runtime code change being
|
||||
merged to `main` is still not the same as it being in production: the
|
||||
`archie-agent` image is rebuilt by the release, and a host that runs the agent
|
||||
must pull the new image (`docker compose pull agent`) to get it.
|
||||
|
||||
## What the notes are for
|
||||
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 — is not the reader's experience
|
||||
either — out.
|
||||
- A capability that **shipped but is not yet wired** _is_ the reader's
|
||||
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.
|
||||
Do not apply this mechanically: deleting a caveat a reader needs misleads them,
|
||||
which is the failure this rule exists to prevent.
|
||||
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.
|
||||
|
||||
## Cutting a release
|
||||
|
||||
```bash
|
||||
task release:preview VERSION=1.3.0 # preview what would land
|
||||
task release:prepare VERSION=1.3.0 # write the section into CHANGELOG.md, uncommitted
|
||||
# edit CHANGELOG.md -- generated notes are a starting point, not the release
|
||||
task release VERSION=1.3.0 # commit + annotated tag
|
||||
git push --atomic origin main v1.3.0 # both refs or neither
|
||||
task release:publish VERSION=1.3.0 # images to GHCR, zip to archie-releases
|
||||
```
|
||||
Dispatch the **release** workflow (`.github/workflows/release.yml`) with
|
||||
`major`, `minor`, `patch` or an exact version. It runs `task release` on `main`:
|
||||
|
||||
The source repository is private, so releases are published to the public
|
||||
`samcharles93/archie-releases` repository, where `install.sh` and the
|
||||
updater find them. `release:publish` builds from a clean worktree of the tag
|
||||
and needs `gh` and `docker` logged in with write access to that repository
|
||||
and to GHCR.
|
||||
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`;
|
||||
|
||||
`release:prepare` emits bare commit subjects; they are a starting point. Rewrite
|
||||
them to say what a reader gets, per "What the notes are for" above.
|
||||
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.
|
||||
|
||||
Pushing is a separate, explicit step — never push without confirming first (see
|
||||
the repo's general "check before doing anything hard to reverse" rule). The
|
||||
deploy workflow reads tags pointing at `HEAD`; pushing the commit without its
|
||||
tag gets images stamped `dev`, which is why the push names the tag and is
|
||||
`--atomic`.
|
||||
|
||||
### After a release, `main` and the working branch have diverged
|
||||
|
||||
The release commit lands on `main` — `tools/release.sh` refuses to run anywhere
|
||||
else — while the working branch keeps advancing. So after every release, `main`
|
||||
is ahead by exactly that commit and the branch is ahead by however far it has
|
||||
moved: **neither tip is an ancestor of the other**, and `--ff-only` fails in
|
||||
both directions. That refusal reads as "the tree is not ready" when in fact the
|
||||
tree is fine.
|
||||
|
||||
Merge the release commit into the branch first, so any conflict is resolved on
|
||||
the branch, where it is reversible and nobody is reading the tip:
|
||||
|
||||
```bash
|
||||
git merge main # on the branch
|
||||
git merge --ff-only <branch> # then, in whichever worktree holds main
|
||||
```
|
||||
|
||||
Confirm which worktree holds `main` with `git worktree list` before the
|
||||
`--ff-only`. A detached worktree sitting at the same commit will accept it and
|
||||
move nothing, which looks like success.
|
||||
After a release, pull `main` before committing on it again: CI has added the
|
||||
release commit.
|
||||
|
||||
## What a release publishes
|
||||
|
||||
Tagging one version produces, from a single `deploy` run:
|
||||
The tag push runs `deploy.yml`:
|
||||
|
||||
- **Container images** — `ghcr.io/samcharles93/archied:latest` and
|
||||
`ghcr.io/samcharles93/archie-agent:latest`. The runtime image is rebuilt by
|
||||
the release, so runtime commits merged to `main` do not reach a running
|
||||
sandbox until the host pulls the new image.
|
||||
- **`:latest` names the newest release, not the newest commit.** A push to
|
||||
`main` that is not a release publishes `archied:edge` (mutable, tracking
|
||||
`main`) and `archied:sha-<commit>` (immutable) instead, so a release's
|
||||
`:latest` stamping is not overwritten minutes later by the next ordinary
|
||||
commit. A host that runs releases follows `:latest`; a host that tracks `main`
|
||||
follows `:edge`.
|
||||
- **A GitHub Release with a distribution zip** — `dist-zip` builds every process
|
||||
the reference deployment runs (`archied`, `archie-gateway`,
|
||||
`archie-state-store`, `archie-ui`, `archie-messaging`) for
|
||||
linux/amd64, packs them with `deployments/INSTRUCTIONS.md` and `CHANGELOG.md`,
|
||||
and attaches the zip to the Release. The Release body is that version's
|
||||
`## [version]` section of `CHANGELOG.md`.
|
||||
- **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.
|
||||
- **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 zip is also uploaded as an Actions artifact, but that is a backup copy:
|
||||
artifacts expire after 90 days and need an Actions login to download. The
|
||||
Release asset is the durable, operator-reachable one.
|
||||
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.
|
||||
|
||||
## Gate
|
||||
## The canary
|
||||
|
||||
CI (`deploy.yml`) runs `task check` before building images, then verifies any
|
||||
release tag at `HEAD` has a matching `[version]` section in `CHANGELOG.md`. A
|
||||
tag with no changelog entry is a hard failure. No tags at `HEAD` is a warning,
|
||||
not a failure — images get stamped `dev`.
|
||||
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:
|
||||
|
||||
One consequence worth knowing when a release commit needs amending: GitHub
|
||||
Actions runs the workflow **from the commit that triggered it**, so a fix to
|
||||
`deploy.yml` only takes effect for a release if it is an ancestor of the tagged
|
||||
commit. Delete and re-cut the tag (`git tag -d`, `task release`) rather than
|
||||
committing the fix on top of an already-tagged release.
|
||||
| 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:
|
||||
|
||||
```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 \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
```
|
||||
+98
-159
@@ -2,42 +2,13 @@ version: "3"
|
||||
|
||||
vars:
|
||||
BIN_DIR: "bin"
|
||||
# The version a build reports: the nearest tag with the distance and commit,
|
||||
# or a bare commit when the checkout has no tags (a shallow clone). A build
|
||||
# should not answer "dev" only because the caller did not name a version.
|
||||
VERSION:
|
||||
sh: git describe --tags --always --dirty 2>/dev/null | sed 's/^v//' || echo dev
|
||||
|
||||
tasks:
|
||||
default:
|
||||
desc: List available tasks
|
||||
cmds:
|
||||
- task --list
|
||||
|
||||
setup:
|
||||
desc: Install the pinned tooling and dependencies a checkout needs
|
||||
cmds:
|
||||
# Report what this task cannot install for you, so a missing Go, Node or
|
||||
# Docker fails here by name rather than somewhere inside the gate.
|
||||
- |
|
||||
set -eu
|
||||
missing=
|
||||
for tool in go task node npm docker; do
|
||||
command -v "$tool" >/dev/null 2>&1 || missing="$missing $tool"
|
||||
done
|
||||
if [ -n "$missing" ]; then
|
||||
echo "warning: not installed (AGENTS.md, Build and gate):$missing" >&2
|
||||
fi
|
||||
# The pin is one file, read here and by .github/workflows, so the linter
|
||||
# running locally and the one running the gate cannot drift apart.
|
||||
- |
|
||||
set -eu
|
||||
want=$(cat {{.ROOT_DIR}}/.golangci-version)
|
||||
have=$(golangci-lint --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)
|
||||
if [ "$have" = "${want#v}" ]; then
|
||||
echo "golangci-lint $want already installed"
|
||||
else
|
||||
echo "installing golangci-lint $want (have: ${have:-none})"
|
||||
GOBIN="$(go env GOPATH)/bin" go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$want"
|
||||
fi
|
||||
- task: proto:install
|
||||
- task: ui:deps
|
||||
|
||||
fmt:
|
||||
desc: Fix and format Go source with the gate's configured formatters
|
||||
cmds:
|
||||
@@ -117,23 +88,7 @@ tasks:
|
||||
desc: Run golangci-lint
|
||||
cmds:
|
||||
- golangci-lint run ./...
|
||||
- task: lint:tools
|
||||
|
||||
lint:tools:
|
||||
desc: Run golangci-lint over the tools module
|
||||
dir: tools
|
||||
cmds:
|
||||
- golangci-lint run ./...
|
||||
|
||||
vuln:
|
||||
desc: Scan for known vulnerabilities (requires network access)
|
||||
cmds:
|
||||
- govulncheck ./...
|
||||
|
||||
deadcode:
|
||||
desc: Report unreachable production functions (advisory)
|
||||
cmds:
|
||||
- go run golang.org/x/tools/cmd/deadcode@latest -test=false ./cmd/...
|
||||
- cd tools && golangci-lint run ./...
|
||||
|
||||
ui:deps:
|
||||
desc: Install dashboard dependencies
|
||||
@@ -142,33 +97,22 @@ tasks:
|
||||
run: once
|
||||
dir: ui
|
||||
cmds:
|
||||
- npm ci --no-audit --no-fund
|
||||
- pnpm install --frozen-lockfile
|
||||
|
||||
ui:
|
||||
desc: Build the dashboard into ui/dist (committed; the Go build embeds it)
|
||||
desc: Build the dashboard into ui/dist, which the Go build embeds
|
||||
dir: ui
|
||||
deps: [ui:deps]
|
||||
cmds:
|
||||
- npm run build
|
||||
|
||||
ui:check:
|
||||
desc: Rebuild the dashboard into a temporary directory and reject a stale ui/dist
|
||||
deps: [ui:deps]
|
||||
cmds:
|
||||
- bash tools/uidist.sh check
|
||||
- pnpm run build
|
||||
|
||||
test:ui:
|
||||
desc: Test and type-check the dashboard
|
||||
dir: ui
|
||||
deps: [ui:deps]
|
||||
cmds:
|
||||
- npm test
|
||||
- npm run typecheck
|
||||
|
||||
webhook:send:
|
||||
desc: Send a test event to the dashboard's capture intake (--help for kinds)
|
||||
cmds:
|
||||
- bash tools/webhook-send.sh {{.CLI_ARGS}}
|
||||
- pnpm test
|
||||
- pnpm run typecheck
|
||||
|
||||
bench:prreview:
|
||||
desc: Run the PR review benchmark on the configured models and write docs/benchmarks/pr-review-*.md (-- -model ALIAS -judge-model REF; --help for flags)
|
||||
@@ -179,6 +123,25 @@ tasks:
|
||||
desc: Run development services and Vite at http://localhost:5173
|
||||
deps: [dev:daemon, dev:gateway, dev:messaging, dev:state-store, dev:dashboard, dev:ui]
|
||||
|
||||
dev:tls:
|
||||
desc: Issue the development CA and service certificates deployments/dev.toml names
|
||||
status:
|
||||
- test -f tmp/dev-tls/archie-ui.pem
|
||||
cmds:
|
||||
- |
|
||||
# Task containers reach the State Store over the Docker bridge, which
|
||||
# services may only do over TLS.
|
||||
set -eu
|
||||
d=tmp/dev-tls
|
||||
mkdir -p "$d"
|
||||
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -days 3650 \
|
||||
-subj /CN=archie-dev-ca -keyout "$d/ca-key.pem" -out "$d/ca.pem" 2>/dev/null
|
||||
for s in archied archie-gateway archie-messaging archie-state-store archie-ui; do
|
||||
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -days 3650 \
|
||||
-subj "/CN=$s" -addext "subjectAltName=DNS:$s" -addext extendedKeyUsage=serverAuth,clientAuth \
|
||||
-CA "$d/ca.pem" -CAkey "$d/ca-key.pem" -keyout "$d/$s-key.pem" -out "$d/$s.pem" 2>/dev/null
|
||||
done
|
||||
|
||||
dev:postgres:
|
||||
desc: Start PostgreSQL and wait for readiness
|
||||
cmds:
|
||||
@@ -195,17 +158,21 @@ tasks:
|
||||
echo "postgres did not become healthy within 60s" >&2
|
||||
exit 1
|
||||
|
||||
dev:daemon:
|
||||
desc: Run archied with live reload
|
||||
dev:wait-state:
|
||||
internal: true
|
||||
cmds:
|
||||
- |
|
||||
# The daemon and Gateway read their settings from the State Store at
|
||||
# boot and exit if it is not up yet; it starts only once PostgreSQL
|
||||
# is healthy, so wait for its port ([services.state] in
|
||||
# deployments/dev.toml) first.
|
||||
# Services read their settings from the State Store at boot and exit
|
||||
# if it is not up yet, so wait for its port ([services.state] in
|
||||
# deployments/dev.toml).
|
||||
for _ in $(seq 1 120); do nc -z 127.0.0.1 9091 && exit 0; sleep 1; done
|
||||
echo "state store did not come up on 127.0.0.1:9091 within 120s" >&2
|
||||
exit 1
|
||||
|
||||
dev:daemon:
|
||||
desc: Run archied with live reload
|
||||
cmds:
|
||||
- task: dev:wait-state
|
||||
- air -build.args_bin="-config-overlay,deployments/dev.toml"
|
||||
|
||||
dev:dashboard:
|
||||
@@ -215,35 +182,28 @@ tasks:
|
||||
|
||||
dev:state-store:
|
||||
desc: Run the State Store with development PostgreSQL
|
||||
deps: [dev:postgres]
|
||||
deps: [dev:postgres, dev:tls]
|
||||
cmds:
|
||||
- go run ./cmd/archie-state-store -config-overlay deployments/dev.toml
|
||||
|
||||
dev:gateway:
|
||||
desc: Run the development Gateway
|
||||
cmds:
|
||||
- |
|
||||
# The daemon and Gateway read their settings from the State Store at
|
||||
# boot and exit if it is not up yet; it starts only once PostgreSQL
|
||||
# is healthy, so wait for its port ([services.state] in
|
||||
# deployments/dev.toml) first.
|
||||
for _ in $(seq 1 120); do nc -z 127.0.0.1 9091 && exit 0; sleep 1; done
|
||||
echo "state store did not come up on 127.0.0.1:9091 within 120s" >&2
|
||||
exit 1
|
||||
- task: dev:wait-state
|
||||
- go run ./cmd/archie-gateway -config-overlay deployments/dev.toml
|
||||
|
||||
dev:messaging:
|
||||
desc: Run the development Messaging Service
|
||||
cmds:
|
||||
- for _ in $(seq 1 120); do nc -z 127.0.0.1 9091 && exit 0; sleep 1; done; echo "state store did not come up on 127.0.0.1:9091 within 120s" >&2; exit 1
|
||||
- task: dev:wait-state
|
||||
- go run ./cmd/archie-messaging -config-overlay deployments/dev.toml
|
||||
|
||||
dev:ui:
|
||||
desc: Run Vite (requires the dashboard backend)
|
||||
dir: ui
|
||||
cmds:
|
||||
- npm install --no-audit --no-fund
|
||||
- npm run dev
|
||||
- pnpm install
|
||||
- pnpm run dev
|
||||
|
||||
e2e:up:
|
||||
desc: Start the local stack without Docker (PostgreSQL 18, services, Vite) and seed it
|
||||
@@ -257,33 +217,23 @@ tasks:
|
||||
- bash e2e/stack.sh stop
|
||||
|
||||
e2e:check:
|
||||
desc: Run the browser checks against the running e2e stack (-- --record VERSION for release evidence)
|
||||
desc: List browser checks; use -- all or -- CHECK to run, add --headed to watch
|
||||
cmds:
|
||||
- node e2e/run.cjs {{.CLI_ARGS}}
|
||||
|
||||
dev:mobile:
|
||||
desc: Serve the dashboard on your LAN (token-protected) for phone viewing
|
||||
deps:
|
||||
- ui
|
||||
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:
|
||||
- cmd: |
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
TOKEN_FILE="${XDG_DATA_HOME:-$HOME/.local/share}/archie/web-token"
|
||||
go run ./cmd/archie-ui -listen 0.0.0.0:8484 -token-file "$TOKEN_FILE" &
|
||||
UI_PID=$!
|
||||
sleep 2
|
||||
TOKEN=$(cat "$TOKEN_FILE" 2>/dev/null)
|
||||
URL="http://$IP:8484/?t=$TOKEN"
|
||||
echo "Phone URL: $URL"
|
||||
echo "$URL" | qrencode -t ANSIUTF8
|
||||
trap "kill $UI_PID 2>/dev/null" EXIT
|
||||
wait $UI_PID
|
||||
- sh tools/canary-rehearse.sh
|
||||
|
||||
build:
|
||||
desc: Build archie services and agent binaries
|
||||
deps: [ui]
|
||||
vars:
|
||||
GATEWAY_VERSION: '{{.GATEWAY_VERSION | default "dev"}}'
|
||||
RUNTIME_VERSION: '{{.RUNTIME_VERSION | default "dev"}}'
|
||||
GATEWAY_VERSION: '{{.GATEWAY_VERSION | default .VERSION}}'
|
||||
RUNTIME_VERSION: '{{.RUNTIME_VERSION | default .VERSION}}'
|
||||
SERVICE_LDFLAGS: >-
|
||||
-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary
|
||||
-X github.com/samcharles93/archie-core/internal/buildinfo.Version={{.GATEWAY_VERSION}}
|
||||
@@ -291,6 +241,12 @@ tasks:
|
||||
sources:
|
||||
- Taskfile.yml
|
||||
- "**/*.go"
|
||||
# Files the binaries embed.
|
||||
- "internal/**/*.sql"
|
||||
- "internal/**/*.yaml"
|
||||
- "internal/**/*.json"
|
||||
- "internal/**/*.tpl"
|
||||
- "internal/**/*.md"
|
||||
- go.mod
|
||||
- go.sum
|
||||
- "ui/dist/**"
|
||||
@@ -309,19 +265,26 @@ tasks:
|
||||
- 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
|
||||
|
||||
test:
|
||||
desc: Run short Go tests with caching
|
||||
desc: Run Go tests; the release gate passes TEST_FLAGS=-count=1
|
||||
cmds:
|
||||
- go test -short ./...
|
||||
- go test {{.TEST_FLAGS | default "-short"}} ./...
|
||||
|
||||
test:full:
|
||||
desc: Run the whole Go test suite uncached, including the wall-clock-bound tests
|
||||
image:agent:
|
||||
desc: Build the agent image stamped with this checkout's version
|
||||
# Compose owns the image build; this only supplies the version, which a
|
||||
# plain `docker build` has no way to learn from a context that excludes .git.
|
||||
cmds:
|
||||
- go test ./... -count=1
|
||||
- RUNTIME_VERSION={{.VERSION}} docker compose build agent
|
||||
|
||||
check:
|
||||
desc: Run the full quality gate
|
||||
# Finish mutations before starting parallel checks.
|
||||
cmds:
|
||||
# Node packages land under ui/, which `go test ./...` walks: installing
|
||||
# them while the parallel checks scan the tree makes a lockfile update
|
||||
# delete Go sources mid-walk. Install first, then fan out. Every Go step
|
||||
# embeds ui/dist, so the dashboard is built before any of them.
|
||||
- task: ui
|
||||
- task: fmt
|
||||
- task: proto:check
|
||||
- task: db:check
|
||||
@@ -337,57 +300,33 @@ tasks:
|
||||
- task: build
|
||||
- task: test
|
||||
- task: test:ui
|
||||
- task: ui:check
|
||||
|
||||
release:preview:
|
||||
desc: "Show the release notes that would be generated (VERSION=1.2.0)"
|
||||
cmds:
|
||||
- tools/release.sh --version {{.VERSION}} --dry-run
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
release:prepare:
|
||||
desc: Prepare changelog notes for editing (VERSION=1.2.0)
|
||||
cmds:
|
||||
- tools/release.sh --version {{.VERSION}} --prepare
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
release:
|
||||
desc: Commit and tag the prepared release (VERSION=1.2.0)
|
||||
cmds:
|
||||
- tools/release.sh --version {{.VERSION}} --tag
|
||||
desc: "Turn [Unreleased] into a release, then commit and tag it (RELEASE=major|minor|patch|1.2.3)"
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
release:publish:
|
||||
desc: Push the images and publish the pushed tag to the public releases repository (VERSION=1.2.0)
|
||||
vars: [RELEASE]
|
||||
cmds:
|
||||
- tools/publish.sh {{.VERSION}}
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
clean:
|
||||
desc: Remove build artifacts
|
||||
cmds:
|
||||
- rm -rf {{.BIN_DIR}}
|
||||
|
||||
docker-build:
|
||||
desc: Build the archie-agent sandbox image
|
||||
cmds:
|
||||
- docker compose build agent
|
||||
|
||||
docker-up:
|
||||
desc: Start the optional external NATS service via docker compose
|
||||
cmds:
|
||||
- docker compose up -d nats
|
||||
|
||||
docker-down:
|
||||
desc: Stop the docker compose stack
|
||||
cmds:
|
||||
- docker compose down
|
||||
|
||||
docker-logs:
|
||||
desc: Follow the NATS container logs
|
||||
cmds:
|
||||
- docker compose logs -f nats
|
||||
- |
|
||||
set -euo pipefail
|
||||
die() { echo "release: $*" >&2; exit 1; }
|
||||
[ "$(git rev-parse --abbrev-ref HEAD)" = main ] || die "releases are cut from main"
|
||||
[ -z "$(git status --porcelain)" ] || die "the working tree is dirty"
|
||||
last="$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1 || true)"
|
||||
IFS=. read -r major minor patch <<<"${last#v}"
|
||||
case "{{.RELEASE}}" in
|
||||
major) version="$((major + 1)).0.0" ;;
|
||||
minor) version="$major.$((minor + 1)).0" ;;
|
||||
patch) version="$major.$minor.$((patch + 1))" ;;
|
||||
*) version="$(echo "{{.RELEASE}}" | sed 's/^v//')" ;;
|
||||
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"
|
||||
+40
-12
@@ -71,7 +71,7 @@ Any string setting may contain `{{ path }}`, replaced when the step runs:
|
||||
| `task.repository` | `owner/name`. |
|
||||
| `task.kind` | What the task came from, as prose: `GitHub issue` or `chat-originated task`. |
|
||||
| `task.issue`, `task.pr` | Issue and pull request numbers. |
|
||||
| `task.plan` | The plan a `human.approve` step handed over (an approved PRD). |
|
||||
| `task.plan` | The plan a `workflow.approve` step handed over (an approved PRD). |
|
||||
| `task.review` | The review comments a remediation round addresses. |
|
||||
| `inputs.<name>` | A declared input; an undeclared one is refused at save. |
|
||||
| `steps.<id>.summary` | What an earlier step reported, e.g. an agent's finish summary or a gate's output. |
|
||||
@@ -108,7 +108,7 @@ it. Parallel steps do not nest, and need at least two branches.
|
||||
### How a run ends
|
||||
|
||||
A run ends at the first step that sets an outcome: `workflow.finish`,
|
||||
`workflow.handoff`, `human.approve`, `repo.open-pr`, `repo.commit` with
|
||||
`workflow.handoff`, `workflow.approve`, `repo.open-pr`, `repo.commit` with
|
||||
`if_empty: complete`, or `review.reply`. A run that reaches the end of its steps
|
||||
completes, with the last step's summary as its detail. A step that fails parks
|
||||
the run unless it continues on failure.
|
||||
@@ -173,6 +173,18 @@ _needs a repository._
|
||||
|---|---|---|
|
||||
| `branch` | `fresh` \| `task` | fresh starts a new branch from the base; task resumes the branch this task pushed. |
|
||||
|
||||
### `repo.tooling`
|
||||
|
||||
_needs a repository._
|
||||
|
||||
No settings. It runs the repository policy's `tooling` commands, in order, in
|
||||
the task worktree — the installs a gate needs and the container does not ship
|
||||
(protoc plugins, linters, generators). A repository that declares none installs
|
||||
nothing and the step succeeds. Place it after `repo.prepare` and before any
|
||||
`gate.*` step: a failing install fails the step with the command and its output
|
||||
and says the gate did not run, so a missing toolchain is not read as a red
|
||||
repository.
|
||||
|
||||
### `gate.diff-rules`
|
||||
|
||||
_needs a repository._
|
||||
@@ -181,12 +193,6 @@ _needs a repository._
|
||||
|---|---|---|
|
||||
| `rules` | list of mapping | Patterns the change must not match. |
|
||||
|
||||
### `gate.diff-size`
|
||||
|
||||
_needs a repository._
|
||||
|
||||
No settings.
|
||||
|
||||
### `gate.repository`
|
||||
|
||||
_needs a repository._
|
||||
@@ -211,13 +217,30 @@ _runs without a repository._
|
||||
| `body` | text | The comment text. |
|
||||
| `on` | `issue` \| `pr` | Comment on the issue or the pull request. Empty means issue. |
|
||||
|
||||
### `human.approve`
|
||||
### `message.send`
|
||||
|
||||
_runs without a repository._
|
||||
|
||||
Sends text to one chat on a messaging channel the workflow's organisation owns,
|
||||
and a package's workflow may not send. A test run records the message instead
|
||||
of sending it.
|
||||
|
||||
| Setting | Type | Meaning |
|
||||
|---|---|---|
|
||||
| `channel` | text | The messaging channel to send through. |
|
||||
| `chat_id` | text | The channel's identifier for the chat. |
|
||||
| `text` | text | The message. References are filled in. |
|
||||
|
||||
A scheduled message is a schedule bound to a workflow whose only step is
|
||||
`message.send`.
|
||||
|
||||
### `workflow.approve`
|
||||
|
||||
_runs without a repository._
|
||||
|
||||
| Setting | Type | Meaning |
|
||||
|---|---|---|
|
||||
| `plan` | text | What the human decides on; the next workflow reads it as task.plan. |
|
||||
| `plan` | text | What the operator decides on; the next workflow reads it as task.plan. |
|
||||
| `then` | text | The workflow the task runs once approved. |
|
||||
|
||||
### `review.pr`
|
||||
@@ -262,7 +285,7 @@ _runs without a repository._
|
||||
| Setting | Type | Meaning |
|
||||
|---|---|---|
|
||||
| `detail` | text | What the operator reads about the outcome. |
|
||||
| `status` | `completed` \| `parked` \| `waiting_human` \| `declined` | How the run ends. Empty means completed. |
|
||||
| `status` | `completed` \| `parked` \| `waiting_approval` \| `declined` | How the run ends. Empty means completed. |
|
||||
|
||||
### `workflow.handoff`
|
||||
|
||||
@@ -287,10 +310,15 @@ expressions that limit which files the rule applies to.
|
||||
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
|
||||
a `Schedule fired` event (`schedule_id`, `name`, `scheduled_for`,
|
||||
`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
|
||||
workflows.
|
||||
- **Other workflows**: `workflow.call` (a child run), `workflow.handoff` (the
|
||||
same task, requeued), `human.approve` (once approved).
|
||||
same task, requeued), `workflow.approve` (once approved).
|
||||
- **By hand**: the New task form, or Run on the Workflows page.
|
||||
|
||||
The canvas Start node lists the triggers of each workflow.
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/agentworker"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
|
||||
"github.com/samcharles93/archie-core/internal/logging"
|
||||
)
|
||||
|
||||
type workerRunner func(context.Context, agentworker.Settings, *slog.Logger) error
|
||||
@@ -54,12 +55,19 @@ func runCommand(args []string, getenv func(string) string, stderr io.Writer, run
|
||||
natsURLFlag := flags.String("nats-url", "", "NATS server URL (defaults to NATS_URL)")
|
||||
stateStoreURLFlag := flags.String("state-store-url", "", "State Store gRPC target (defaults to STATE_STORE_URL; required -- the legacy NATS storerpc path is deleted)")
|
||||
stateStoreTokenFlag := flags.String("state-store-token", "", "State Store bearer token (defaults to STATE_STORE_TOKEN)")
|
||||
showVersion := flags.Bool("version", false, "print the version and exit")
|
||||
if err := flags.Parse(args); err != nil {
|
||||
if errors.Is(err, flag.ErrHelp) {
|
||||
return 0
|
||||
}
|
||||
return 2
|
||||
}
|
||||
// The release and its updater read this line to prove a shipped
|
||||
// archie-agent belongs to the release being installed.
|
||||
if *showVersion {
|
||||
fmt.Printf("archie-agent %s\n", agentworker.Version())
|
||||
return 0
|
||||
}
|
||||
|
||||
natsURL, natsToken := natsConnectionSettings(*natsURLFlag, getenv)
|
||||
if natsURL == "" {
|
||||
@@ -68,7 +76,7 @@ func runCommand(args []string, getenv func(string) string, stderr io.Writer, run
|
||||
return 1
|
||||
}
|
||||
|
||||
log := slog.New(slog.NewJSONHandler(stderr, nil))
|
||||
log := slog.New(logging.WithTrace(slog.NewJSONHandler(stderr, nil)))
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// The Messaging Service reaches the State Store and the workflow engine only
|
||||
// through their contracts. Go imports are atomic, so one reference relinks a
|
||||
// runtime, and the boundary holds only while something re-measures it.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestMessagingDoesNotLinkStoreOrWorkflowRuntime(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
out, err := exec.CommandContext(ctx, "go", "list", "-deps", ".").Output()
|
||||
if err != nil {
|
||||
t.Fatalf("go list -deps .: %v", err)
|
||||
}
|
||||
linked := map[string]bool{}
|
||||
for line := range strings.SplitSeq(strings.TrimSpace(string(out)), "\n") {
|
||||
linked[line] = true
|
||||
}
|
||||
for _, pkg := range []string{
|
||||
"github.com/jackc/pgx/v5/pgxpool",
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/postgres",
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore",
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow",
|
||||
"github.com/samcharles93/archie-core/internal/agentexec",
|
||||
} {
|
||||
t.Run(pkg, func(t *testing.T) {
|
||||
if linked[pkg] {
|
||||
t.Errorf("cmd/archie-messaging links %s: services reach each other only through contracts", pkg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ func run() int {
|
||||
flag.StringVar(&options.OidcRedirectURL, "oidc-redirect-url", "", "callback URL registered at the provider (path must be /oauth2/callback)")
|
||||
flag.StringVar(&options.Gateway.Target, "gateway-target", "", "archie-gateway gRPC address (defaults to [services.gateway].target)")
|
||||
flag.StringVar(&options.State.Target, "state-target", "", "archie-state-store gRPC address (defaults to [services.state].target)")
|
||||
flag.StringVar(&options.Harness.Target, "harness-target", "", "archied harness session gRPC address (defaults to [services.harness].target); empty leaves the setup terminal unwired")
|
||||
flag.DurationVar(&options.DependencyTimeout, "dependency-timeout", 0, "per-dependency readiness probe timeout (default 5s)")
|
||||
flag.DurationVar(&options.EventPollInterval, "event-poll-interval", 0, "how often the activity feed polls the State Store for new events (default 1s)")
|
||||
// BoolFunc rather than BoolVar so an unset flag stays distinguishable
|
||||
|
||||
+31
-14
@@ -2,32 +2,49 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/archied"
|
||||
"github.com/samcharles93/archie-core/internal/app/archieplaybooks"
|
||||
"github.com/samcharles93/archie-core/internal/app/prbench"
|
||||
)
|
||||
|
||||
const commandUsage = "usage: archied [flags] # run the daemon; archied -h lists the flags\n" +
|
||||
"subcommands: setup, update, release, status, prbench, playbooks"
|
||||
|
||||
func main() {
|
||||
args := os.Args[1:]
|
||||
os.Exit(run(os.Args[1:]))
|
||||
}
|
||||
|
||||
func run(args []string) int {
|
||||
// The setup generator is dispatched before the daemon's flags are
|
||||
// parsed: it writes a first-run config.toml and must not touch the
|
||||
// store, NATS, or the running daemon's configuration.
|
||||
if archied.IsSetupArgs(args) {
|
||||
os.Exit(archied.RunSetup(args[1:], os.Stdin, os.Stdout, os.Stderr))
|
||||
return archied.RunSetup(args[1:], os.Stdin, os.Stdout, os.Stderr)
|
||||
}
|
||||
if len(args) > 0 && args[0] == "update" {
|
||||
os.Exit(archied.RunUpdate(args[1:], os.Stdout, os.Stderr))
|
||||
if len(args) > 0 {
|
||||
switch args[0] {
|
||||
case "update":
|
||||
return archied.RunUpdate(args[1:], os.Stdout, os.Stderr)
|
||||
case "release":
|
||||
return archied.RunRelease(args[1:], os.Stdout, os.Stderr)
|
||||
case "status":
|
||||
return archied.RunStatus(args[1:], os.Stdout, os.Stderr)
|
||||
case "prbench":
|
||||
return prbench.Main(args[1:], os.Stdout, os.Stderr)
|
||||
case "playbooks":
|
||||
return archieplaybooks.Run(args[1:], os.Stderr)
|
||||
}
|
||||
// A word that is not a subcommand is refused rather than ignored: a
|
||||
// stale `archied update-topology` would otherwise start a second
|
||||
// daemon under the running one's feet.
|
||||
if !strings.HasPrefix(args[0], "-") {
|
||||
fmt.Fprintf(os.Stderr, "archied: unknown command %q\n%s\n", args[0], commandUsage)
|
||||
return 2
|
||||
}
|
||||
}
|
||||
if len(args) > 0 && args[0] == "status" {
|
||||
os.Exit(archied.RunStatus(args[1:], os.Stdout, os.Stderr))
|
||||
}
|
||||
if len(args) > 0 && args[0] == "prbench" {
|
||||
os.Exit(prbench.Main(args[1:], os.Stdout, os.Stderr))
|
||||
}
|
||||
if len(args) > 0 && args[0] == "playbooks" {
|
||||
os.Exit(archieplaybooks.Run(args[1:], os.Stderr))
|
||||
}
|
||||
os.Exit(archied.Run())
|
||||
return archied.Run()
|
||||
}
|
||||
+74
-466
@@ -1,505 +1,113 @@
|
||||
# archie configuration
|
||||
#
|
||||
# archied configuration
|
||||
# This file starts the services. Everything else (forge connections, models,
|
||||
# providers, chat, tools, containers, repositories, policies) is edited in the
|
||||
# dashboard, and a saved value there overrides the same setting here.
|
||||
#
|
||||
# Secrets are NOT stored here: each one is a {engine, key}
|
||||
# reference resolved through a secrets engine at startup.
|
||||
# The built-in "env" engine reads key as an environment variable name.
|
||||
# Every other engine (bws, sops, vault, age) is an extension installed from
|
||||
# the archipelago marketplace and enabled through the control plane.
|
||||
# Secrets are never written here: each is a {engine, key} reference. The
|
||||
# built-in "env" engine reads key as an environment variable.
|
||||
|
||||
# work_dir = "~/.local/share/archie/work" # default
|
||||
# state_dir = "~/.local/share/archie" # default; embedded NATS store, task logs, disk probe
|
||||
|
||||
# The PostgreSQL connection archie-state-store, archied and archie-gateway
|
||||
# serve from. Required: each fails closed without it.
|
||||
# `docker compose up -d postgres` starts a matching local postgres:18 with this
|
||||
# default URL.
|
||||
# database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
|
||||
|
||||
# skills_dir = "~/.local/share/archie/skills" # SKILL.md search path; defaults under work_dir when unset
|
||||
# database_url = "postgres://archie:archie@localhost:5432/archie?sslmode=disable"
|
||||
# work_dir = "~/.local/share/archie/work"
|
||||
# state_dir = "~/.local/share/archie"
|
||||
|
||||
poll_interval = "60s"
|
||||
label = "archie"
|
||||
bot_user = "vectis-labs-archie"
|
||||
# 0 switches the cap off; omit the key to take the built-in default (400).
|
||||
diff_cap_lines = 400
|
||||
# org = "acme" # empty means the default org (a single-operator install's one identity)
|
||||
# granted_credentials = ["openai"] # credential@1 services the root identity may resolve (see [containers.credentials])
|
||||
|
||||
# how many operator-triggered retries a parked task gets
|
||||
# before it moves to dead (global default; set per-repo to
|
||||
# override). Enforced by the dashboard's retry action.
|
||||
# max_retries = 3
|
||||
|
||||
[forge]
|
||||
# The name of an installed, enabled forge package (archipelago: forge/github, forge/gitea), or "none".
|
||||
# Install and enable it from the Extensions page, then restart archied.
|
||||
type = "github"
|
||||
host = "https://github.com"
|
||||
token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" }
|
||||
# How forge issues become work:
|
||||
# "poll" – re-discover issues each poll_interval (default)
|
||||
# "webhook" – react to GitHub webhook events the moment they arrive
|
||||
# "both" – webhook plus the poll as a backstop
|
||||
# intake = "poll"
|
||||
# Required when intake is "webhook" or "both": the shared secret configured
|
||||
# on the GitHub webhook, and the host:port the receiver listens on. On
|
||||
# GitHub, set the webhook's Content type to application/json (the UI
|
||||
# default) -- the alternate form-encoded delivery is not supported.
|
||||
# Webhook intake is single-identity, and that is enforced: with [[identities]]
|
||||
# configured this combination is REJECTED at startup rather than silently
|
||||
# downgraded to polling. The receiver binds one secret and one dispatch
|
||||
# predicate, so it could only judge another identity's events by the wrong
|
||||
# rules. Either drop the [[identities]] blocks, or keep intake = "poll" and
|
||||
# let each identity poll.
|
||||
# intake = "poll" # "poll", "webhook" or "both"
|
||||
# webhook_secret = { engine = "env", key = "ARCHIE_WEBHOOK_SECRET" }
|
||||
# webhook_addr = "0.0.0.0:8645"
|
||||
# intake, webhook_secret and webhook_addr exist only here. Set on a
|
||||
# [identities.forge] entry they are REJECTED for the same reason: nothing
|
||||
# reads them, so the identity would silently keep polling. Serving webhook
|
||||
# intake per identity is a pending migration, not a setting.
|
||||
|
||||
# [[identities]] runs more than one bot identity from a single daemon, each
|
||||
# with its own forge account and repository membership. Runtime settings
|
||||
# are shared and edited through the control plane. Intake
|
||||
# settings are rejected per identity, and [forge].intake = "webhook"/"both"
|
||||
# is rejected alongside [[identities]]. Minimal shape:
|
||||
# [[identities]]
|
||||
# name = "personal" # required; namespaces logs/events/NATS subjects
|
||||
# bot_user = "your-bot" # required
|
||||
# forge = { type = "github", host = "https://github.com", token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN_PERSONAL" } }
|
||||
# org = "acme" # empty inherits the shared org (empty = default)
|
||||
# granted_credentials = ["openai"] # credential@1 services this identity may resolve (see [containers.credentials])
|
||||
|
||||
[dispatch]
|
||||
# Can be of "assignee", "label", or "either"
|
||||
# this sets the method archie uses to pick up tasks.
|
||||
trigger = "assignee"
|
||||
trigger = "assignee" # "assignee", "label" or "either"
|
||||
ack_reaction = "eyes" # "off" for none
|
||||
|
||||
# Optionally set a reaction to show that archie has picked up a task.
|
||||
# setting this to "off" disables the pickup reactions.
|
||||
ack_reaction = "eyes"
|
||||
|
||||
[models] # role -> ai-sdk runtime ref (used by agent workflows)
|
||||
[models]
|
||||
triage = "openai/gpt-5.4"
|
||||
planner = "openai/gpt-5.4"
|
||||
builder = "openai/gpt-5.4"
|
||||
# `reviewer` runs the adversarial self-review stage and operator-triggered PR
|
||||
# reviews. Omitted, it falls back to `builder`.
|
||||
# reviewer = "openai/gpt-5.4"
|
||||
# `embedding` is optional: it powers in-process embedding consumers
|
||||
# (curators first). Unset, or a credential that fails to resolve, degrades
|
||||
# to the capability reporting unavailable -- archied still starts.
|
||||
# embedding = "openai/text-embedding-3-small"
|
||||
# `transcription` is optional: it turns Telegram voice notes into text before
|
||||
# the turn is dispatched, behind a "[voice transcription]" marker. Read by
|
||||
# archie-messaging. Unset, or a provider that does not resolve, leaves the
|
||||
# voice note as its media placeholder -- the turn still runs.
|
||||
# transcription = "openai/whisper-1"
|
||||
|
||||
# [providers.openai]
|
||||
# class = "openai"
|
||||
# api_key = { engine = "env", key = "OPENAI_API_KEY" }
|
||||
|
||||
[providers.ollama]
|
||||
class = "ollama"
|
||||
|
||||
# [chat]
|
||||
# `operator` is the display name of user. It is
|
||||
# passed to the chat agent as runtime metadata, which means it is sent to the
|
||||
# configured model provider on every turn -- leave it unset to tell the agent
|
||||
# nothing about who is running it.
|
||||
# operator = "John Smith"
|
||||
|
||||
# `workspace` roots the chat agent's file and shell tools (read, write, edit,
|
||||
# shell, grep, find). If unser, the tools aren't registered.
|
||||
# Set it to let the agent read, modify and execute inside that directory
|
||||
# choose it deliberately
|
||||
# workspace = "~/.local/share/archie/workspace"
|
||||
|
||||
# `max_steps` caps the model/tool round-trips in a single chat turn
|
||||
# (default 100). This is a task budget, not a safety limit.
|
||||
# max_steps = 100
|
||||
|
||||
# Let read/write/edit/find/grep tools reach absolute paths outside the
|
||||
# workspace jail. Relative paths still resolve against workspace.
|
||||
# The shell tool is never confined, so a jail only pushes the agent into
|
||||
# using shell for everything, losing truncation, line numbering, and
|
||||
# read-before-write protection. Enable when the agent needs to work
|
||||
# cross-filesystem (disk ops, system edits, etc.). Grant deliberately.
|
||||
# unrestricted_filesystem = true
|
||||
|
||||
# Render each completed tool call inline in the reply, naming the tool and one
|
||||
# line of its result, before the answer built from them. Off by default: it is
|
||||
# there to make a wrong tool choice visible from the chat, at the cost of
|
||||
# narrating every internal step. Applies to every chat channel -- Telegram
|
||||
# and the web dashboard both read this one setting.
|
||||
# show_tool_calls = true
|
||||
|
||||
# Optional interactive-chat catalog. /provider groups these references by
|
||||
# their first path segment, and /model shows only the selected provider's
|
||||
# entries. When omitted, Archie uses the distinct refs in [models].
|
||||
# models = [
|
||||
# "openai/gpt-5.6-sol",
|
||||
# "openrouter/openai/gpt-5.6-sol",
|
||||
# ]
|
||||
|
||||
# [chat.telegram]
|
||||
# The bot token from @BotFather, resolved through a configured secret engine.
|
||||
# token = { engine = "bws", key = "TELEGRAM_BOT_TOKEN" }
|
||||
|
||||
# Email and the generic inbound webhook are archipelago channel extensions
|
||||
# (channels/email, channels/webhook): install, accept and enable them from the
|
||||
# Extensions page, with their settings there.
|
||||
|
||||
# Per-(channel, sender) inbound rate limiting, shared by every chat channel:
|
||||
# Telegram keys by numeric user ID, email by SMTP from address, webhook by
|
||||
# its configured route path -- a source, not a person, so it reaches the
|
||||
# limiter as a transport-only budget key rather than as an identity. Off by
|
||||
# default -- both fields must be set to a positive value.
|
||||
#
|
||||
# This section is the seed for the Channel settings resource. The Web UI owns
|
||||
# the value a running deployment limits with (restart-required), so edit it
|
||||
# there rather than here; a stored value is not overwritten by this file.
|
||||
# [chat.rate_limit]
|
||||
# window = "1m"
|
||||
# max_requests = 20
|
||||
|
||||
# External MCP tools are launched and managed by Archie's MCP client. A
|
||||
# command of "npx" gets a persistent package cache under work_dir
|
||||
# (top of this file) automatically, so a daemon restart reuses it instead
|
||||
# of re-resolving and re-downloading the package from the npm registry
|
||||
# every time. This does not cover a package's own separate downloads (e.g.
|
||||
# a Playwright/Puppeteer-based server fetching a browser binary from a CDN
|
||||
# via its postinstall script) -- consult that package's own env vars for
|
||||
# those.
|
||||
# Most MCP servers are single-threaded and get one tools/call at a time.
|
||||
# parallel_tool_calls = true (default false) drops that serialization for
|
||||
# this server only, for a server whose own implementation handles
|
||||
# concurrent requests. It never affects another configured server.
|
||||
# [[tools.mcp_servers]]
|
||||
# name = "desktop-commander"
|
||||
# transport = "stdio"
|
||||
# command = "npx"
|
||||
# args = ["-y", "@wonderwhy-er/desktop-commander@0.2.46", "--no-onboarding"]
|
||||
# work_dir = "/path/to/workspace"
|
||||
# parallel_tool_calls = false
|
||||
|
||||
# archied's own liveness surface, always on. GET /healthz and /health answer
|
||||
# 200 once the daemon is serving (503 while it is still booting), and
|
||||
# /health/detailed reports the readiness probes. This is what the update
|
||||
# watchdog polls after restarting archied to decide whether the release came
|
||||
# up or has to be rolled back, so it stays separate from the dashboard's
|
||||
# /healthz: the dashboard can be switched off, and it runs as its own process
|
||||
# in the extracted UI topology.
|
||||
[health]
|
||||
listen = "127.0.0.1:8485"
|
||||
# Bounds one readiness probe's call into a service the daemon depends on but
|
||||
# does not own (the Gateway), so a hung dependency degrades that probe instead
|
||||
# of stalling the whole report. Omit for the default; a negative value leaves
|
||||
# only the caller's own deadline in force.
|
||||
# dependency_timeout = "5s"
|
||||
|
||||
# Web dashboard and API: task board, activity stream, chat, config,
|
||||
# memory, SSE events. Served as an embedded SPA with a full REST
|
||||
# and streaming API. Auth is token-based for non-loopback addresses;
|
||||
# loopback binds (127.0.0.1, ::1, localhost) skip auth automatically.
|
||||
#
|
||||
# The dashboard is served by the
|
||||
# standalone archie-ui process, not by archied: this listen address is what
|
||||
# archie-ui binds, and archied runs no dashboard listener at all. Run
|
||||
# `archie-ui -config <same config.toml>` alongside the other services.
|
||||
[web]
|
||||
listen = "127.0.0.1:8484"
|
||||
# Trust X-Forwarded-Proto and X-Forwarded-Host headers when validating Origin
|
||||
# on mutating requests (CSRF protection).
|
||||
#
|
||||
# Off by default. When false, the expected Origin scheme is derived directly
|
||||
# from the daemon's own network connection (http unless TLS is terminated by
|
||||
# archied directly). Setting this to true causes archied to respect the
|
||||
# X-Forwarded-Proto header sent by a reverse proxy (e.g. Traefik, Caddy, Nginx).
|
||||
#
|
||||
# SECURITY WARNING: Enable ONLY when archied is deployed behind a trusted
|
||||
# reverse proxy that strips or overwrites any client-supplied X-Forwarded-*
|
||||
# headers. Enabling this on a directly exposed daemon allows untrusted
|
||||
# clients to spoof the Origin scheme and bypass CSRF protection.
|
||||
# trust_forwarded_headers = false
|
||||
|
||||
# Where archied writes its logs. Without file set, output goes only to
|
||||
# stderr -- which under systemd means journald holds the sole copy, and
|
||||
# running by hand leaves no record at all. Setting file gives a durable
|
||||
# copy independent of the supervisor, and is what lets the dashboard show
|
||||
# history from before it connected. Both stderr and the file get output
|
||||
# unless quiet is set.
|
||||
# [log]
|
||||
# file = "~/.local/share/archie/logs/archied.log"
|
||||
# max_size_mb = 20 # rotate once the file exceeds this; 0 uses the default (20)
|
||||
# keep = 5 # rotated files to retain; 0 uses the default (5)
|
||||
# level = "info" # "debug" | "info" | "warn" | "error"
|
||||
# quiet = false # true suppresses stderr once a file is configured
|
||||
|
||||
# The built-in file-backed memory engine (internal/domain/memory +
|
||||
# internal/infrastructure/memory) is always on -- nothing here is required
|
||||
# to get memory at all. engine selects among the domain/memory engine
|
||||
# family; "builtin" (the default, same as leaving it unset) is the only
|
||||
# one implemented so far.
|
||||
# [memory]
|
||||
# engine = "builtin" # "builtin" is the only engine implemented so far
|
||||
|
||||
# Operator alerts (parked tasks, failed runs, unhealthy services, missing
|
||||
# credentials) are listed in the dashboard. Archie also POSTs each raised and
|
||||
# resolved alert as JSON to the webhook: wire it to n8n, email, Slack, or any
|
||||
# HTTP endpoint. Failed deliveries are retried and recorded on the alert.
|
||||
[notify]
|
||||
# webhook = "https://n8n.example.com/webhook/archie"
|
||||
# min_severity = "warning" # info, warning or action: the lowest severity delivered
|
||||
# secret = {engine = "env", key = "ARCHIE_NOTIFY_SECRET"} # signs X-Archie-Signature (HMAC-SHA256)
|
||||
|
||||
[budgets]
|
||||
max_steps = 60
|
||||
wall_clock = "30m" # one agent call
|
||||
wall_clock = "30m" # one agent call
|
||||
gate_max_failures = 5
|
||||
task_wall_clock = "4h" # a whole task run; keep containers.max_uptime at or above it
|
||||
task_wall_clock = "4h" # a whole task run
|
||||
|
||||
[health]
|
||||
listen = "127.0.0.1:8485"
|
||||
# dependency_timeout = "5s"
|
||||
|
||||
# Trace export. Without an endpoint nothing is exported.
|
||||
# [telemetry]
|
||||
# endpoint = "127.0.0.1:4317" # OTLP/gRPC collector
|
||||
# insecure = false # plaintext to the collector
|
||||
# ca_file = "" # PEM bundle verifying the collector
|
||||
# sample_ratio = 1.0 # share of new traces recorded
|
||||
# headers = { authorization = "Bearer ..." }
|
||||
|
||||
[web]
|
||||
listen = "127.0.0.1:8484" # "off" disables the dashboard
|
||||
# trust_forwarded_headers = false # only behind a proxy you control
|
||||
|
||||
[services.gateway]
|
||||
target = "127.0.0.1:8585"
|
||||
# listen = "127.0.0.1:8585"
|
||||
|
||||
[services.state]
|
||||
target = "127.0.0.1:9090"
|
||||
# listen = "127.0.0.1:9090"
|
||||
|
||||
# TLS: every gRPC hop between services uses certificates from your own CA
|
||||
# (step-ca, cert-manager, Vault, openssl). Each process loads
|
||||
# cert_dir/<service>.pem and cert_dir/<service>-key.pem, whose DNS SAN is its
|
||||
# service name: archied, archie-gateway, archie-messaging, archie-state-store,
|
||||
# archie-ui. Every peer must chain to ca_file. Certificates are reloaded when
|
||||
# they change. Without [tls], services may only listen on and dial loopback
|
||||
# addresses, task containers cannot reach the State Store, and the harness
|
||||
# setup terminal is off.
|
||||
# [tls]
|
||||
# ca_file = "/etc/archie/tls/ca.pem"
|
||||
# cert_dir = "/etc/archie/tls"
|
||||
|
||||
# Services selects contract adapters at composition time.
|
||||
[services.gateway]
|
||||
target = "127.0.0.1:8585" # archie-gateway's gRPC address (always remote once set)
|
||||
# listen = "127.0.0.1:8585" # The address archie-gateway BINDS. Read only by the
|
||||
# # archie-gateway process; every client ignores it. Defaults
|
||||
# # to the target above, so a default deployment's client and
|
||||
# # server cannot drift onto different ports. Set it when the
|
||||
# # host already owns that port.
|
||||
|
||||
[services.state]
|
||||
target = "127.0.0.1:9090" # REQUIRED. The State Store gRPC address archied and
|
||||
# # archie-gateway dial. They own no task data
|
||||
# # in-process: the standalone archie-state-store process
|
||||
# # owns it in PostgreSQL. An empty target is a startup error.
|
||||
# listen = "127.0.0.1:9090" # The address archie-state-store BINDS. Read only by that
|
||||
# # process; every client ignores it. Defaults to the target
|
||||
# # above, so a default deployment's client and server cannot
|
||||
# # drift onto different ports. Move it when a port is already
|
||||
# # taken on the host.
|
||||
|
||||
# The daemon's harness session contract: the dashboard's setup terminal opens
|
||||
# a PTY into an ephemeral Kit container over it. Both ends are optional and
|
||||
# the dashboard's setup terminal degrades to 503 without them: the daemon
|
||||
# serves the contract only when [tls] is configured, and archie-ui dials it
|
||||
# only when a target is set.
|
||||
# [services.harness]
|
||||
# target = "127.0.0.1:8587" # The address archie-ui dials. Empty leaves the
|
||||
# # setup terminal unwired.
|
||||
|
||||
# NATS is the sole autonomous workflow handoff. mode changes only where the
|
||||
# broker runs; every workflow still runs in a managed task container:
|
||||
# "embedded" – in-process nats-server (the default; no external server)
|
||||
# "external" – connect to url
|
||||
# Leave the section absent to run embedded.
|
||||
# [nats]
|
||||
# mode = "embedded" # "embedded" | "external"
|
||||
# url = "nats://localhost:4222" # required when mode = "external"
|
||||
# token_env = "NATS_TOKEN" # optional external-server credential; embedded generates one per start
|
||||
# mode = "embedded" # or "external" with url
|
||||
# url = "nats://localhost:4222"
|
||||
# token_env = "NATS_TOKEN"
|
||||
|
||||
# Unbound webhook capture: POST /webhooks/capture/{source} accepts and
|
||||
# stores any inbound payload archie doesn't yet have a binding for, so it can
|
||||
# be inspected and mapped later.
|
||||
# Stored in the same PostgreSQL database as tasks, not NATS -- capture has one
|
||||
# writer and one (human, dashboard) reader, so it doesn't need JetStream's
|
||||
# fan-out/replay machinery. All fields default when the section is absent;
|
||||
# capture is on by default.
|
||||
#
|
||||
# The receiver is mounted by the
|
||||
# archie-ui process, which projects these same values from this file; the
|
||||
# daemon's binding-dispatch loop consumes captures from the shared State
|
||||
# Store. Leave this section here even if you do not edit it: both processes
|
||||
# read it.
|
||||
# [capture]
|
||||
# retention = "168h" # 7 days; prune-on-write deletes anything older
|
||||
# max_events = 5000 # row cap, pruned on every insert regardless of age
|
||||
# max_body_bytes = 262144 # 256 KiB; larger POSTs are rejected with 413
|
||||
# rate_per_second = 1.0 # per-remote-address token bucket
|
||||
# rate_burst = 5
|
||||
# [log]
|
||||
# file = "~/.local/share/archie/logs/archied.log"
|
||||
# level = "info"
|
||||
|
||||
# The cron/scheduling ticker engine: how often scheduled jobs are checked,
|
||||
# how many may run at once, and how long one may run. The engine polls a job
|
||||
# store for what is due and dispatches each due job to the delivery it names
|
||||
# -- so nothing here schedules anything by itself, it only tunes the timing.
|
||||
# Absent is valid: every field defaults independently, and a section naming
|
||||
# only one of them still gets the defaults for the other two.
|
||||
#
|
||||
# Zero (or absent) takes the default named below. A NEGATIVE value is a
|
||||
# startup error, not a clamp: running something other than what was written
|
||||
# is how a misconfiguration stays invisible. Zero cannot mean "off" here for
|
||||
# the same reason it cannot in [tools.tool_policy] -- it is indistinguishable
|
||||
# from an unset key.
|
||||
# [scheduling]
|
||||
# interval = "60s" # tick cadence: how often due jobs are checked.
|
||||
# # Absent/zero means 1m. The finest granularity a
|
||||
# # cron-style schedule needs, and polling a local
|
||||
# # job store that often costs nothing.
|
||||
# max_parallel = 4 # caps simultaneous parallel-pool runs, so a store
|
||||
# # reporting many jobs due at once (the first tick
|
||||
# # after long downtime, typically) cannot launch an
|
||||
# # unbounded fan-out. Absent/zero means 4. It does
|
||||
# # not bound the sequential pool, which is one by
|
||||
# # definition.
|
||||
# job_timeout = "1h" # bounds one run. Absent/zero means 1h. A job that
|
||||
# # has not finished in an hour is stuck, and leaving
|
||||
# # it in flight would suppress every later run of the
|
||||
# # same job forever.
|
||||
# events_sink = "none" # "bus" publishes each run and failure on the event
|
||||
# # stream, which is what the dashboard timeline reads;
|
||||
# # "none" (the default, same as leaving it unset)
|
||||
# # leaves the engine unobservable -- a scheduled run
|
||||
# # has no task or chat turn behind it, so with no
|
||||
# # sink nothing anywhere records that it fired.
|
||||
# # Any other value is a startup error, so a typo
|
||||
# # cannot silently turn observability off.
|
||||
|
||||
# Playbook-binding at-rest encryption: [bindings].encryption_key resolves a
|
||||
# 32-byte high-entropy key through the secret registry (engine + key) and seals
|
||||
# each binding's HMAC secret in the bindings.secret column with AES-256-
|
||||
# GCM. When the key is absent,
|
||||
# binding secrets are stored as plaintext (the pre-t2db.7 behaviour) -- enabling
|
||||
# encryption does not retroactively encrypt existing rows, which stay plaintext
|
||||
# until they are edited. Rotation: after changing encryption_key, retain the
|
||||
# previous material in previous_encryption_keys so rows sealed under the old
|
||||
# key still decrypt, then drop it once no row references it. A reload that
|
||||
# changes these keys requires a daemon restart.
|
||||
# [bindings]
|
||||
# encryption_key = { engine = "env", key = "ARCHIE_BINDING_KEY" }
|
||||
# previous_encryption_keys = [ { engine = "env", key = "ARCHIE_BINDING_KEY_OLD" } ]
|
||||
# encryption_key = { engine = "env", key = "ARCHIE_BINDING_KEY" }
|
||||
|
||||
# Docker sandbox execution of archie-agent is mandatory for autonomous
|
||||
# workflows. Omit this section to use the default image, lifetimes, and pull
|
||||
# policy; the options below show the available overrides. If Docker or
|
||||
# the image is unavailable, chat and the dashboard still start while tasks
|
||||
# park explicitly; archied never falls back to a host agent loop.
|
||||
# [containers]
|
||||
# image = "ghcr.io/samcharles93/archie-agent:latest"
|
||||
# max_concurrency = 4 # optional cap; 0/absent means no global cap
|
||||
# max_uptime = "60m" # container lifetime cap
|
||||
# volume_ttl = "72h" # max age for persistent repo volumes and Git clone caches
|
||||
# pull_policy = "missing" # "missing" or "always"
|
||||
#
|
||||
# A private registry needs a credential the daemon sends on pull (an
|
||||
# anonymous pull always answers 401 there, whatever the policy). The value is
|
||||
# a Docker registry.AuthConfig JSON document -- {"username":"bot","password":"..."}
|
||||
# ("identitytoken"/"registrytoken" are alternatives; "serveraddress" is
|
||||
# optional and defaults to the image's registry). Unset means anonymous pulls,
|
||||
# exactly as before this key existed; a reference that cannot be resolved
|
||||
# warns and pulls anonymously rather than failing the daemon.
|
||||
# registry_auth = { engine = "env", key = "ARCHIE_REGISTRY_AUTH" }
|
||||
#
|
||||
# Agent profiles a workflow selects with `profile: <name>`. A workflow that
|
||||
# names none runs under [containers].image with every tool.
|
||||
# Once the State Store holds container policies, edit profiles in the
|
||||
# dashboard (Settings, Advanced); a stored set replaces the file's.
|
||||
# [containers.profiles.network-investigator]
|
||||
# image = "archie-agent-net:local" # docker compose build agent-net; empty uses [containers].image
|
||||
# tools = [] # allowlist over MCP, script and plugin tools; empty allows all
|
||||
# A Kit profile runs every agent stage on an external CLI packaged as a Kit v3
|
||||
# image: one workload Kit or published Kit set (which merges a workload with
|
||||
# its mixins), pinned by digest.
|
||||
# [containers.profiles.claude]
|
||||
# kit = "docker/claude-code-kit@sha256:<digest>"
|
||||
# adapter = "claude-code" # claude-code, codex, pi, omp or copilot; empty runs without capture tools or usage
|
||||
#
|
||||
# Credential bindings map a Kit's credential@1 service name to a secret. A
|
||||
# binding alone grants nothing -- an identity resolves it only when its own
|
||||
# org matches and the service is in its granted_credentials
|
||||
# ([[identities]] above). Once the State Store holds it, edit bindings in the
|
||||
# dashboard (Settings, Advanced); a stored set replaces the file's.
|
||||
# [[containers.credentials]]
|
||||
# service = "openai"
|
||||
# org = "acme" # empty means the default org
|
||||
# secret = {engine = "env", key = "OPENAI_API_KEY"}
|
||||
# Access records: how long a recorded access denial is kept before the State
|
||||
# Store's sweep deletes it. Zero means 90 days.
|
||||
# [access]
|
||||
# denial_retention = "2160h"
|
||||
|
||||
# At least one [[repos]] entry is required before archied will poll
|
||||
# anything -- it is deliberately left commented rather than shipped active:
|
||||
# an active example here validates as a normal, working repo (owner/name are
|
||||
# only checked for non-empty), so archied would silently start polling a
|
||||
# repository that doesn't exist. archied setup does not write this section
|
||||
# ([[repos]] is an array of tables, which the text-patching setup uses
|
||||
# cannot target) -- add at least one entry by hand.
|
||||
#
|
||||
# [[repos]]
|
||||
# owner = "your-github-username"
|
||||
# name = "todo"
|
||||
# base = "main"
|
||||
# ecosystem = "go" # "go", "python", "node", "rust", or "custom"
|
||||
# # Override the ecosystem defaults when needed:
|
||||
# # preflight = [["go", "version"]]
|
||||
# # test_glob = "*_test.go"
|
||||
# protect = ["_templ.go"]
|
||||
# gate = [
|
||||
# ["templ", "generate", "./components/"],
|
||||
# ["go", "vet", "./..."],
|
||||
# ["go", "build", "./..."],
|
||||
# ["golangci-lint", "run"],
|
||||
# ["go", "test", "./...", "-count=1"],
|
||||
# ]
|
||||
# # allow_concurrent = true # let the daemon run multiple tasks for this repo at once instead of
|
||||
# # FIFO-serializing them; only safe when concurrent worktrees won't collide
|
||||
# # (e.g. different base branches or packages per task). Still bounded by
|
||||
# # [containers].max_concurrency globally.
|
||||
# # persistent_storage = true # reuse a per-repo Docker volume and Git object cache until volume_ttl
|
||||
# # max_retries = 5 # per-repo override of the global max_retries above
|
||||
# Where releases and the extension catalogue come from on a new instance: an
|
||||
# OCI repository and the base64 ed25519 key it signs with. Blank is the
|
||||
# official source. Once stored, change them in the dashboard settings.
|
||||
# [distribution]
|
||||
# releases = "registry.example/owner/archie"
|
||||
# releases_key = "base64 public key"
|
||||
# catalogue = "registry.example/owner/archipelago/catalogue"
|
||||
# catalogue_key = "base64 public key"
|
||||
|
||||
# ── Tools ───────────────────────────────────────────────────────────────────
|
||||
# Limits on what a tool may return. These bound how much of the context window
|
||||
# one tool call can spend: the workspace file tools truncate themselves, but
|
||||
# skill bodies and MCP server results otherwise arrive whole.
|
||||
#
|
||||
# Zero (or absent) takes the default. A NEGATIVE value disables the limit --
|
||||
# zero cannot mean "off" because it is indistinguishable from an unset key.
|
||||
# [tools.tool_policy]
|
||||
# max_result_chars = 50000 # cap on one tool result; -1 for no cap
|
||||
# spill_dir = "" # unset by default, which truncates oversized results
|
||||
# # inline. When set, a result over the cap is written
|
||||
# # here in full and the model is handed the path.
|
||||
# # It MUST be inside chat.workspace: the read tool
|
||||
# # refuses paths outside it, so a spill anywhere else
|
||||
# # is a reference the model cannot open -- worse than
|
||||
# # truncating. Startup warns if it is outside.
|
||||
# # Task agents work in their own worktree and cannot
|
||||
# # read it at all; they always truncate.
|
||||
|
||||
# The web_fetch tool: retrieve a URL and return readable text.
|
||||
# [tools.web_fetch]
|
||||
# enabled = true # set false to withdraw the tool entirely
|
||||
# timeout = "30s"
|
||||
# max_bytes = 2000000
|
||||
# allow_private_networks = false
|
||||
# # Off by default, and worth leaving off. archied's own dashboard, NATS and
|
||||
# # the Docker API answer on loopback and private addresses, and the URL to
|
||||
# # fetch arrives through chat -- an untrusted path, since a forge issue body
|
||||
# # or an inbound email can be quoted into a turn. The address is checked at
|
||||
# # dial time rather than on the URL string, so a public name that resolves to
|
||||
# # a private address is refused too. Turn this on only for a homelab endpoint
|
||||
# # you intend Archie to reach.
|
||||
|
||||
# The generate_video tool: text-to-video via MiniMax's API. Off by default,
|
||||
# unlike web_fetch -- this spends real API credits per call, so it needs an
|
||||
# explicit opt-in and a working key before it is registered at all.
|
||||
# [tools.minimax]
|
||||
# enabled = true
|
||||
# api_key = { engine = "env", key = "MINIMAX_API_KEY" }
|
||||
# base_url = "" # override the API host; leave unset in normal operation
|
||||
# # Generation is synchronous from the model's point of view: the tool call
|
||||
# # blocks until MiniMax reports the video ready or failed, which can take
|
||||
# # several minutes. The result is a hosted URL delivered through whatever
|
||||
# # channel supports gateway.MediaSender (Telegram today); channels without
|
||||
# # that support get the URL as a plain link in the reply text instead.
|
||||
# Long-running agent loops that maintain memory, skills and — in dry run —
|
||||
# file follow-up issues from recent runs. Definitions are data: the server
|
||||
# validates them and the gateway applies them live.
|
||||
# [[curators]]
|
||||
# name = "self-intake"
|
||||
# interval = "1h"
|
||||
# tools = ["run_list", "run_events", "issue_list"]
|
||||
# instructions = """
|
||||
# You are archie's self-intake curator, in dry run. Each pass: list recent
|
||||
# task runs with run_list, inspect anything parked or failed with run_events,
|
||||
# check issue_list for each repo so nothing already open is repeated, then
|
||||
# report candidate follow-up issues, each tied to the run that produced it.
|
||||
# Do not create issues.
|
||||
# """
|
||||
# To let it file: add "issue_create" to tools and tell it to file each
|
||||
# candidate (citing the run) instead of only reporting it.
|
||||
+16
-11
@@ -19,18 +19,22 @@ daemon, and `archied playbooks serve` is its language server for editors.
|
||||
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) is **not** in this archive —
|
||||
it only ever runs inside the Docker container `archied` spawns per task, never
|
||||
as a host binary. Pull it from GHCR: `ghcr.io/samcharles93/archie-agent`.
|
||||
`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
|
||||
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`
|
||||
pins the digest the release published. Set `[containers].registry_auth` when
|
||||
that reference is on a registry that needs a login -- see
|
||||
`deployments/systemd-user-service.md#6-pinning-the-archie-agent-image`.
|
||||
|
||||
## Quickstart
|
||||
|
||||
1. Pick a starting configuration. The full set of annotated templates lives
|
||||
in this repository's `deployments/` directory on GitHub
|
||||
(<https://github.com/samcharles93/archie-core/tree/main/deployments>) —
|
||||
(<https://offloaded.dev>) —
|
||||
`standalone.toml` (no forge, the simplest start),
|
||||
`single-forge-github.toml`, `multi-forge-github-gitea.toml` and
|
||||
`docker-nats-stack.toml` cover the common cases. Every one needs
|
||||
`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:
|
||||
|
||||
```bash
|
||||
@@ -61,7 +65,7 @@ as a host binary. Pull it from GHCR: `ghcr.io/samcharles93/archie-agent`.
|
||||
|
||||
4. For a persistent, 24/7 deployment instead of a foreground run, follow the
|
||||
systemd user-unit runbook:
|
||||
<https://github.com/samcharles93/archie-core/blob/main/deployments/systemd-user-service.md>.
|
||||
<https://offloaded.dev>.
|
||||
|
||||
## Verifying an install
|
||||
|
||||
@@ -85,10 +89,11 @@ an install (or an upgrade across v1.30.0) needs its unit as well -- see
|
||||
|
||||
### Native self-update
|
||||
|
||||
Install on Settings → Status runs `archied update install -version X`, which
|
||||
downloads the release's Linux/amd64 zip and verifies it against `SHA256SUMS`
|
||||
before unpacking it. Every host binary in the zip must report `X`. It then pulls
|
||||
the agent image `release.json` pins by digest, backs up the database to
|
||||
Install on Settings → Status runs `archied update install -version X` against
|
||||
the release source in the update settings. It fetches release `vX`, refuses it
|
||||
unless the source's key signed its statement, and downloads the Linux/amd64 zip
|
||||
only if it hashes to the digest that statement names. Every host binary in the
|
||||
zip must report `X`. It then pulls the agent image the statement pins by digest, backs up the database to
|
||||
`db.pre-update.dump` in the state directory, stages the new binaries beside the
|
||||
live ones and hands the transaction to `archied update watchdog` in a process of
|
||||
its own (a transient systemd user unit). Nothing that runs changes until the
|
||||
|
||||
@@ -7,9 +7,6 @@ This directory contains configuration templates and guides for different deploym
|
||||
- **[`single-forge-github.toml`](./single-forge-github.toml)**:
|
||||
Standard single-forge deployment managing multiple GitHub repositories under a single bot account and GitHub token.
|
||||
|
||||
- **[`multi-forge-github-gitea.toml`](./multi-forge-github-gitea.toml)**:
|
||||
Multi-identity deployment running GitHub and a self-hosted Gitea instance simultaneously with distinct bot accounts, tokens, and repository sets.
|
||||
|
||||
- **[`standalone.toml`](./standalone.toml)**: start here. Event-driven
|
||||
automation with no forge or repositories, local Ollama models, loopback
|
||||
services and no tokens.
|
||||
|
||||
+24
-3
@@ -25,13 +25,34 @@ listen = "127.0.0.1:8484"
|
||||
# when a port is already taken on the host -- before the
|
||||
# listen key existed the collision could only be worked around by hand-writing
|
||||
# a matching target and passing -listen, and it read as a code fault.
|
||||
#
|
||||
# Task containers dial the target over the Docker bridge gateway, so the store
|
||||
# listens on every interface and [tls] (issued by `task dev:tls`) is required.
|
||||
[services.state]
|
||||
target = "127.0.0.1:9091"
|
||||
listen = "127.0.0.1:9091"
|
||||
target = "172.17.0.1:9091"
|
||||
listen = "0.0.0.0:9091"
|
||||
|
||||
[tls]
|
||||
ca_file = "tmp/dev-tls/ca.pem"
|
||||
cert_dir = "tmp/dev-tls"
|
||||
|
||||
# `task dev` runs archie-gateway via dev:gateway, which also passes no -listen:
|
||||
# the listen below is what it binds. Stated explicitly so the value archie-ui
|
||||
# dials is visible next to the State Store one.
|
||||
[services.gateway]
|
||||
target = "127.0.0.1:8585"
|
||||
listen = "127.0.0.1:8585"
|
||||
listen = "127.0.0.1:8585"
|
||||
[services.daemon]
|
||||
target = "127.0.0.1:8587"
|
||||
listen = "127.0.0.1:8587"
|
||||
|
||||
# Dry-run self-intake curator (#1770): surveys recent runs and reports
|
||||
# candidate follow-up issues as pass summaries; declares no issue-creating
|
||||
# tool, so it cannot file. Needs a chat model configured to run at all.
|
||||
[[curators]]
|
||||
name = "self-intake"
|
||||
interval = "1h"
|
||||
tools = ["run_list", "run_events", "issue_list"]
|
||||
instructions = """
|
||||
You are archie's self-intake curator, in dry run. Each pass: list recent task runs with run_list, inspect anything parked or failed with run_events, check issue_list for each repo so nothing already open is repeated, then report candidate follow-up issues — concrete, each tied to the run that produced it. Do not create issues; this pass reports only (no issue-creating tool is declared, so it cannot). End your reply with the report.
|
||||
"""
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
poll_interval = "60s"
|
||||
bot_user = "archie"
|
||||
diff_cap_lines = 0
|
||||
work_dir = "~/.local/share/archie/work"
|
||||
state_dir = "~/.local/share/archie" # NATS store, task logs
|
||||
# The State Store's PostgreSQL connection (PostgreSQL 18, required).
|
||||
@@ -62,11 +61,13 @@ url = "nats://172.19.0.1:4222"
|
||||
network = "archie-core_default"
|
||||
# Pin your own registry's tag/digest -- never deploy against a bare
|
||||
# ":latest" reference, which can change under a running deployment with no
|
||||
# warning. See deployments/systemd-user-service.md#pinning-the-archie-agent-image
|
||||
# for the pinning convention this repo follows for its own GHCR image.
|
||||
# warning. See deployments/systemd-user-service.md#6-pinning-the-archie-agent-image
|
||||
# for the pinning convention this repo follows for its own agent image.
|
||||
image = "git.example.com/you/archie-agent:v1.21.0" # or "@sha256:..." for a production digest pin
|
||||
max_concurrency = 4
|
||||
max_uptime = "60m"
|
||||
# Must outlast the whole-task limit (default 4h), or the reaper ends a run the
|
||||
# task budget would have parked.
|
||||
max_uptime = "5h"
|
||||
# "missing": pull only when the image is absent locally. "always" against a
|
||||
# private registry answers 401 because the daemon sends no credentials, so
|
||||
# refresh the agent by hand: docker compose pull agent
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
# ==============================================================================
|
||||
# Multi-Forge (GitHub + Gitea) Deployment Example
|
||||
#
|
||||
# Runs GitHub and a self-hosted Gitea instance simultaneously.
|
||||
# Each [[identities]] entry defines its own forge, token, and repository list.
|
||||
# Each identity runs in an isolated background goroutine and worktree directory.
|
||||
# ==============================================================================
|
||||
|
||||
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"
|
||||
|
||||
[services.gateway]
|
||||
target = "127.0.0.1:8585"
|
||||
|
||||
# The State Store gRPC service owns the PostgreSQL task data; archied and
|
||||
# archie-gateway dial it and never open those tables themselves.
|
||||
# This deployment runs the agent in containers, so the target is the Docker
|
||||
# bridge gateway (172.17.0.1) the container can reach. A non-loopback address
|
||||
# needs [tls]; see config.example.toml.
|
||||
[services.state]
|
||||
target = "172.17.0.1:9090"
|
||||
|
||||
[models]
|
||||
triage = "openai/gpt-6-luna"
|
||||
planner = "openai/gpt-6-luna"
|
||||
builder = "openai/gpt-6-luna"
|
||||
|
||||
[providers.openai]
|
||||
class = "openai"
|
||||
api_key_env = "OPENAI_API_KEY"
|
||||
|
||||
[nats]
|
||||
mode = "embedded"
|
||||
|
||||
[containers]
|
||||
# Pinned to a verified digest -- archie-agent has no published semver tag
|
||||
# yet (CI only pushes :latest). See
|
||||
# deployments/systemd-user-service.md#pinning-the-archie-agent-image.
|
||||
image = "ghcr.io/samcharles93/archie-agent@sha256:870f1b1357979cfea23fccacb24166ebeb9ab321708ef2c2b218a763ed99b090"
|
||||
pull_policy = "missing"
|
||||
|
||||
[budgets]
|
||||
max_steps = 60
|
||||
wall_clock = "30m"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Identity 1: GitHub Bot
|
||||
# ------------------------------------------------------------------------------
|
||||
[[identities]]
|
||||
name = "github-bot"
|
||||
bot_user = "archie-github"
|
||||
bot_email = "archie-github@users.noreply.github.com"
|
||||
|
||||
[identities.forge]
|
||||
type = "github"
|
||||
host = "https://github.com"
|
||||
token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" }
|
||||
|
||||
[identities.dispatch]
|
||||
trigger = "assignee"
|
||||
ack_reaction = "eyes"
|
||||
|
||||
[[identities.repos]]
|
||||
owner = "my-org"
|
||||
name = "github-repo-one"
|
||||
ecosystem = "go"
|
||||
|
||||
[[identities.repos]]
|
||||
owner = "my-org"
|
||||
name = "github-repo-two"
|
||||
ecosystem = "node"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Identity 2: Self-Hosted Gitea Bot
|
||||
# ------------------------------------------------------------------------------
|
||||
[[identities]]
|
||||
name = "gitea-bot"
|
||||
bot_user = "archie-gitea"
|
||||
bot_email = "archie-gitea@example.com"
|
||||
|
||||
[identities.forge]
|
||||
type = "gitea"
|
||||
host = "https://gitea.example.com"
|
||||
token = { engine = "env", key = "ARCHIE_GITEA_TOKEN" }
|
||||
|
||||
[identities.dispatch]
|
||||
trigger = "label"
|
||||
ack_reaction = "eyes"
|
||||
|
||||
[[identities.repos]]
|
||||
owner = "internal-team"
|
||||
name = "gitea-repo-alpha"
|
||||
ecosystem = "go"
|
||||
|
||||
[[identities.repos]]
|
||||
owner = "internal-team"
|
||||
name = "gitea-repo-beta"
|
||||
ecosystem = "python"
|
||||
@@ -15,7 +15,6 @@ poll_interval = "60s"
|
||||
label = "archie"
|
||||
bot_user = "archie-bot"
|
||||
bot_email = "archie-bot@users.noreply.github.com"
|
||||
diff_cap_lines = 400
|
||||
|
||||
# The Gateway Service owns conversational state and serves ChatContract over
|
||||
# gRPC. Run archie-gateway alongside archied and archie-ui (the dashboard
|
||||
@@ -54,9 +53,9 @@ mode = "embedded"
|
||||
|
||||
[containers]
|
||||
# Pinned to a verified digest -- archie-agent has no published semver tag
|
||||
# yet (CI only pushes :latest). See
|
||||
# deployments/systemd-user-service.md#pinning-the-archie-agent-image.
|
||||
image = "ghcr.io/samcharles93/archie-agent@sha256:870f1b1357979cfea23fccacb24166ebeb9ab321708ef2c2b218a763ed99b090"
|
||||
# yet (a release publishes :latest and :sha-<commit>). See
|
||||
# deployments/systemd-user-service.md#6-pinning-the-archie-agent-image.
|
||||
image = "git.catlow.cloud/sam/archie-agent@sha256:<digest>"
|
||||
pull_policy = "missing"
|
||||
|
||||
[budgets]
|
||||
|
||||
@@ -134,9 +134,10 @@ Compose service or host `archie-agent` binary is required.
|
||||
|
||||
Docker must be installed and reachable by the service user. With no explicit
|
||||
broker or container settings, Archie defaults `containers.image` to
|
||||
`ghcr.io/samcharles93/archie-agent:latest`. Every profile shipped in
|
||||
`deployments/` overrides that default with a pinned reference -- see
|
||||
[Pinning the archie-agent image](#pinning-the-archie-agent-image) below. An
|
||||
`git.catlow.cloud/sam/archie-agent:latest`. `single-forge-github.toml` and
|
||||
`docker-nats-stack.toml` override that default with a pinned reference
|
||||
(`standalone.toml` and `dev.toml` leave it) -- see
|
||||
[Pinning the archie-agent image](#6-pinning-the-archie-agent-image) below. An
|
||||
explicit equivalent, pinned the same way, is:
|
||||
|
||||
```toml
|
||||
@@ -144,7 +145,7 @@ explicit equivalent, pinned the same way, is:
|
||||
mode = "embedded"
|
||||
|
||||
[containers]
|
||||
image = "ghcr.io/samcharles93/archie-agent@sha256:870f1b1357979cfea23fccacb24166ebeb9ab321708ef2c2b218a763ed99b090"
|
||||
image = "git.catlow.cloud/sam/archie-agent@sha256:<digest>"
|
||||
pull_policy = "missing"
|
||||
```
|
||||
|
||||
@@ -168,37 +169,66 @@ fall back to a host model loop.
|
||||
|
||||
## 6. Pinning the archie-agent Image
|
||||
|
||||
`ghcr.io/samcharles93/archie-agent:latest` is a moving target: every push to
|
||||
`main` that touches the runtime's package closure re-publishes it
|
||||
(`.github/workflows/deploy.yml`), so `latest` can change under a running
|
||||
deployment with no warning and no way to reproduce a prior build.
|
||||
`archie-agent:latest` is a moving target: every release re-publishes it, so it
|
||||
can change under a running deployment with no warning and no way to reproduce a
|
||||
prior build. Two paths publish it, to different references:
|
||||
|
||||
As of this writing, `archie-agent` has **no published semantic-version tag**
|
||||
-- CI only pushes `:latest` to GHCR (`archied` is versioned independently per
|
||||
`RELEASING.md`, but that versioning is not yet reflected as a registry tag for
|
||||
the agent image). Until CI publishes one, the only reproducible reference is
|
||||
a content digest, resolved once and pinned explicitly:
|
||||
- `.github/workflows/deploy.yml` publishes `git.catlow.cloud/sam/archie-agent`
|
||||
as `:latest` and `:sha-<commit>` when the commit carries a release tag; an
|
||||
ordinary push to `main` publishes nothing for the agent image.
|
||||
- `tools/publish.sh`, run by hand for a release, publishes
|
||||
`git.catlow.cloud/sam/archie-agent` as `:latest` and `:sha-<commit>`, which is
|
||||
the registry the shipped default above names.
|
||||
|
||||
A distribution zip pins whichever one its own release published, by digest, in
|
||||
`release.json`; `archied update install` then pulls exactly that.
|
||||
|
||||
As of this writing, `archie-agent` has **no published semantic-version tag** --
|
||||
both paths publish only `:latest` and an immutable `:sha-<commit>` (`archied`
|
||||
is versioned independently per `RELEASING.md`, but that versioning is not yet
|
||||
reflected as a registry tag for the agent image). Until one publishes it, the
|
||||
only reproducible reference is a content digest, resolved once and pinned
|
||||
explicitly:
|
||||
|
||||
```toml
|
||||
[containers]
|
||||
image = "ghcr.io/samcharles93/archie-agent@sha256:870f1b1357979cfea23fccacb24166ebeb9ab321708ef2c2b218a763ed99b090"
|
||||
image = "git.catlow.cloud/sam/archie-agent@sha256:<digest>"
|
||||
```
|
||||
|
||||
This is the digest `latest` resolved to on 2026-09-05. Digest pinning is the
|
||||
strongest option for production: it is immutable and independently
|
||||
verifiable (`docker manifest inspect ghcr.io/samcharles93/archie-agent@sha256:...`),
|
||||
verifiable (`docker manifest inspect git.catlow.cloud/sam/archie-agent@sha256:...`),
|
||||
at the cost of being opaque in a config file a human is meant to edit --
|
||||
resolve a fresh digest deliberately (`docker pull ...:latest` followed by
|
||||
`docker inspect --format '{{index .RepoDigests 0}}'`) rather than editing this
|
||||
one in place expecting it to track new releases.
|
||||
|
||||
If/when CI starts publishing a semantic-version tag for `archie-agent`
|
||||
(e.g. `ghcr.io/samcharles93/archie-agent:v1.21.0`), prefer that tag for
|
||||
(e.g. `git.catlow.cloud/sam/archie-agent:v1.21.0`), prefer that tag for
|
||||
day-to-day config readability, and reserve digest pinning for deployments
|
||||
that need byte-for-byte reproducibility guarantees a tag alone cannot give
|
||||
(tags are mutable pointers; a compromised or accidentally-overwritten tag
|
||||
still resolves, a digest cannot).
|
||||
|
||||
A reference on a registry that needs a login needs the credential in
|
||||
`[containers].registry_auth` -- the release's own
|
||||
`git.catlow.cloud/sam/archie-agent` digest is one, since an anonymous pull
|
||||
cannot reach it:
|
||||
|
||||
```toml
|
||||
[containers]
|
||||
registry_auth = {engine = "env", key = "ARCHIE_REGISTRY_AUTH"}
|
||||
```
|
||||
|
||||
The secret resolves to a Docker `AuthConfig` JSON document: the object
|
||||
`docker login` stores under `auths`, without the surrounding map, and with a
|
||||
personal access token that can read the package as the password --
|
||||
`{"username":"<user>","password":"<token>"}`. Put it in
|
||||
`~/.config/archie/env` as `ARCHIE_REGISTRY_AUTH` so it stays out of
|
||||
`config.toml`. The field is file-owned and settled at boot, so a change takes
|
||||
effect on restart; a value that cannot be read logs a warning and pulls
|
||||
anonymously, which is the failure the task reports as a capability error.
|
||||
|
||||
The bundled update adapter snapshots the configured `[containers].image` before
|
||||
rebuilding it and restores that image if the restarted daemon fails its health
|
||||
check. A custom image reference is therefore supported directly in
|
||||
|
||||
+12
-6
@@ -8,7 +8,7 @@
|
||||
# Embedded NATS is the normal deployment and needs no Compose service.
|
||||
# State Store DB: docker compose up -d postgres
|
||||
# External broker: docker compose up -d nats
|
||||
# Build worker: docker compose build agent
|
||||
# Build worker: task image:agent (stamps this checkout's version)
|
||||
# Profile image: docker compose build agent-net
|
||||
# Stop external: docker compose down
|
||||
# Logs: journalctl --user -u archied -f (the daemon)
|
||||
@@ -75,7 +75,7 @@ services:
|
||||
# "Started", which reads like a crash loop. Naming the service explicitly
|
||||
# still works without activating the profile:
|
||||
#
|
||||
# docker compose build agent (also: task docker-build)
|
||||
# docker compose build agent
|
||||
# docker compose pull agent -- plain `pull` skips profiled services
|
||||
#
|
||||
# Routine freshness is handled by the daemon, which pulls this image per
|
||||
@@ -86,10 +86,16 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
# Pinned to a verified digest -- archie-agent has no published semver
|
||||
# tag yet (CI only pushes :latest). See
|
||||
# deployments/systemd-user-service.md#pinning-the-archie-agent-image.
|
||||
image: ghcr.io/samcharles93/archie-agent@sha256:870f1b1357979cfea23fccacb24166ebeb9ab321708ef2c2b218a763ed99b090
|
||||
# Stamped into the agent so the version it reports is the one the rest of
|
||||
# the install reports. `task image:agent` passes this checkout's version;
|
||||
# a bare `docker build` passes nothing and the agent answers dev.
|
||||
args:
|
||||
RUNTIME_VERSION: ${RUNTIME_VERSION:-dev}
|
||||
# A tag, not the digest: Compose refuses to build an image it is told to
|
||||
# name by digest. The digest a task container actually runs is pinned in
|
||||
# the daemon's own [containers] image, so nothing here decides it. See
|
||||
# deployments/systemd-user-service.md#6-pinning-the-archie-agent-image.
|
||||
image: git.catlow.cloud/sam/archie-agent:latest
|
||||
|
||||
# ── example agent profile image ─────────────────────────────────────
|
||||
# The agent image plus network lookup tools, for a workflow that names
|
||||
|
||||
+19
-9
@@ -1,8 +1,12 @@
|
||||
# Generating a GitHub Token for Archie Core
|
||||
|
||||
This guide walks you through creating a GitHub Personal Access Token (PAT) for Archie Core.
|
||||
This guide walks you through creating a GitHub Personal Access Token (PAT) for
|
||||
Archie Core.
|
||||
|
||||
> **Important**: Archie Core requires a **Classic Personal Access Token** (starts with `ghp_...`). Fine-grained PATs currently lack necessary scope permissions for Git HTTP push operations, repository invitation acceptance, and cross-repository operations needed by the orchestrator.
|
||||
> **Important**: Archie Core requires a **Classic Personal Access Token**
|
||||
> (starts with `ghp_...`). Fine-grained PATs currently lack necessary scope
|
||||
> permissions for Git HTTP push operations, repository invitation acceptance,
|
||||
> and cross-repository operations needed by the orchestrator.
|
||||
|
||||
---
|
||||
|
||||
@@ -11,23 +15,29 @@ This guide walks you through creating a GitHub Personal Access Token (PAT) for A
|
||||
Archie Core uses the GitHub API to:
|
||||
|
||||
1. Poll assigned or labelled issues (`archie:queued`).
|
||||
2. Update issue labels as tasks transition (`archie:working`, `archie:pr`, `archie:parked`).
|
||||
2. Update issue labels as tasks transition (`archie:working`, `archie:pr`,
|
||||
`archie:parked`).
|
||||
3. Post status comments and emoji reactions.
|
||||
4. Create branches, commit code changes, and open Pull Requests for human review.
|
||||
4. Create branches, commit code changes, and open Pull Requests for review.
|
||||
|
||||
---
|
||||
|
||||
## Step-by-Step Instructions: Creating a Classic Token
|
||||
|
||||
1. Navigate to [GitHub Settings → Developer Settings → Tokens (classic)](https://github.com/settings/tokens).
|
||||
1. Navigate to
|
||||
[GitHub Settings → Developer Settings → Tokens (classic)](https://github.com/settings/tokens).
|
||||
2. Click **Generate new token** → **Generate new token (classic)**.
|
||||
3. Set the **Note**: `Archie Core` (or your bot's name).
|
||||
4. Choose an **Expiration** (e.g. 90 days, 1 year, or No expiration for dedicated bot accounts).
|
||||
4. Choose an **Expiration** (e.g. 90 days, 1 year, or No expiration for
|
||||
dedicated bot accounts).
|
||||
5. Select the required scope:
|
||||
- **`repo`** (Full control of private repositories — required for polling, commenting, pushing branches, and opening PRs).
|
||||
- **`workflow`** (Optional — required if Archie needs to update GitHub Actions workflows).
|
||||
- **`repo`** (Full control of private repositories — required for polling,
|
||||
commenting, pushing branches, and opening PRs).
|
||||
- **`workflow`** (Optional — required if Archie needs to update GitHub
|
||||
Actions workflows).
|
||||
6. Scroll to the bottom and click **Generate token**.
|
||||
7. **Copy your token immediately** (starts with `ghp_...`). You won't be able to see it again!
|
||||
7. **Copy your token immediately** (starts with `ghp_...`). You won't be able to
|
||||
see it again!
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
# Building your first playbook binding
|
||||
|
||||
This walks through the whole no-code path the event-capture epic promises:
|
||||
point an external app's webhook at archie, see the real payload it sends,
|
||||
map the fields you care about, bind them to a workflow, and watch the next
|
||||
matching event turn into a task -- no code, no redeploy, no restart.
|
||||
This walks through the whole no-code path the event-capture epic promises: point
|
||||
an external app's webhook at archie, see the real payload it sends, map the
|
||||
fields you care about, bind them to a workflow, and watch the next matching
|
||||
event turn into a task -- no code, no redeploy, no restart.
|
||||
|
||||
## 1. Create a source and send a test event
|
||||
|
||||
Open **Events → Inspector** and click **New source**. Archie shows the
|
||||
source's URL and signing secret once; copy both. Point the external app's
|
||||
webhook at that URL. Send one real
|
||||
event however is easiest for a first test, e.g.:
|
||||
Open **Events → Inspector** and click **New source**. Archie shows the source's
|
||||
URL and signing secret once; copy both. Point the external app's webhook at that
|
||||
URL. Send one real event however is easiest for a first test, e.g.:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8484/webhooks/capture/sentry \
|
||||
@@ -18,25 +17,25 @@ curl -X POST http://localhost:8484/webhooks/capture/sentry \
|
||||
-d '{"issue": {"title": "NullPointerException in checkout"}, "level": "error"}'
|
||||
```
|
||||
|
||||
This event isn't signed yet, so it's captured but marked **unauthenticated**
|
||||
-- visible for you to design against, but incapable of triggering anything: an unauthenticated event can never match a binding.
|
||||
This event isn't signed yet, so it's captured but marked **unauthenticated** --
|
||||
visible for you to design against, but incapable of triggering anything: an
|
||||
unauthenticated event can never match a binding.
|
||||
|
||||
## 2. Inspect the captured payload
|
||||
|
||||
Open the dashboard's **Event inspector** (`/captures`). Your test event
|
||||
appears there with its real body -- this is schema-by-example: you're
|
||||
looking at an actual payload from the actual sender, not guessing at a
|
||||
schema in advance.
|
||||
Open the dashboard's **Event inspector** (`/captures`). Your test event appears
|
||||
there with its real body -- this is schema-by-example: you're looking at an
|
||||
actual payload from the actual sender, not guessing at a schema in advance.
|
||||
|
||||
## 3. Map the fields you care about
|
||||
|
||||
Open **Field mappings** (`/mappings`) → **New mapping**. Pick your captured
|
||||
event from the dropdown, then click through its payload tree on the right --
|
||||
every key and value is clickable. Clicking a value binds it as a field
|
||||
(name, JSON path, and an inferred type you can change). Add whichever fields
|
||||
your workflow needs (e.g. the issue title), mark the ones that must be
|
||||
present as **Required**, hit **Preview** to confirm they resolve correctly
|
||||
against the real payload, then **Save**.
|
||||
every key and value is clickable. Clicking a value binds it as a field (name,
|
||||
JSON path, and an inferred type you can change). Add whichever fields your
|
||||
workflow needs (e.g. the issue title), mark the ones that must be present as
|
||||
**Required**, hit **Preview** to confirm they resolve correctly against the real
|
||||
payload, then **Save**.
|
||||
|
||||
## 4. Create the binding
|
||||
|
||||
@@ -46,20 +45,20 @@ Open **Playbook bindings** (`/bindings`) → **New binding**:
|
||||
- **Source** -- the same `<source>` segment from step 1 (e.g. `sentry`).
|
||||
- **Field mapping** -- the one you just saved.
|
||||
- **Workflow** -- which registered workflow should run on a match.
|
||||
- **Repo pin** (optional) -- leave both blank to use the single configured
|
||||
repo; set owner/repo explicitly if you run a multi-repo deployment.
|
||||
- **Shared secret** -- a real secret (16+ bytes), never `test1234`. The
|
||||
sender signs every request body with this via HMAC-SHA256 so archie can
|
||||
tell a genuine event from anyone who finds the URL.
|
||||
- **Repo pin** (optional) -- leave both blank to use the single configured repo;
|
||||
set owner/repo explicitly if you run a multi-repo deployment.
|
||||
- **Shared secret** -- a real secret (16+ bytes), never `test1234`. The sender
|
||||
signs every request body with this via HMAC-SHA256 so archie can tell a
|
||||
genuine event from anyone who finds the URL.
|
||||
|
||||
Save. The binding starts in **draft** -- nothing fires yet.
|
||||
|
||||
## 5. Approve it
|
||||
|
||||
A **draft** or freshly-**edited** binding needs an explicit human 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
|
||||
|
||||
@@ -77,16 +76,14 @@ curl -X POST http://localhost:8484/webhooks/capture/sentry \
|
||||
-d "$BODY"
|
||||
```
|
||||
|
||||
This event is captured as **authenticated**, matched against your armed
|
||||
binding, and dispatched into a new task through the exact same
|
||||
gate/worktree/sandbox pipeline every other task goes through. Check
|
||||
the **Tasks** page; a new task should appear, its body built from the fields
|
||||
your mapping resolved.
|
||||
This event is captured as **authenticated**, matched against your armed binding,
|
||||
and dispatched into a new task through the exact same gate/worktree/sandbox
|
||||
pipeline every other task goes through. Check the **Tasks** page; a new task
|
||||
should appear, its body built from the fields your mapping resolved.
|
||||
|
||||
## Editing a live binding
|
||||
|
||||
Any edit to an armed binding -- even a typo fix -- drops it back to
|
||||
**pending_approval** automatically. This can't be bypassed by editing; it
|
||||
has to be re-approved. When editing, leave the **Shared secret** field blank
|
||||
to keep the existing secret; only fill it in if you're deliberately
|
||||
rotating it.
|
||||
**pending_approval** automatically. This can't be bypassed by editing; it has to
|
||||
be re-approved. When editing, leave the **Shared secret** field blank to keep
|
||||
the existing secret; only fill it in if you're deliberately rotating it.
|
||||
@@ -4,9 +4,9 @@
|
||||
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
|
||||
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.
|
||||
|
||||
@@ -14,8 +14,8 @@ precision, models, archie version). Commit that file with the run.
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -84,7 +84,13 @@
|
||||
"/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.7.0/": "/news/1.7.0/",
|
||||
"/news/archie/1.8.0/": "/news/1.8.0/",
|
||||
"/news/archie/1.9.0/": "/news/1.9.0/",
|
||||
@@ -184,7 +190,13 @@
|
||||
"/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.7.0/": "/news/1.7.0/",
|
||||
"/news/archied/1.8.0/": "/news/1.8.0/",
|
||||
"/news/archied/1.9.0/": "/news/1.9.0/",
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
[
|
||||
{
|
||||
"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",
|
||||
|
||||
+238
-218
@@ -1,18 +1,17 @@
|
||||
# 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`,
|
||||
**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.
|
||||
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:
|
||||
|
||||
@@ -28,101 +27,99 @@ Two boundaries hold regardless of what the harness does:
|
||||
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.
|
||||
`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` | The operator's skills store (`skills_dir`), mounted read-only whatever the Kit asks. |
|
||||
| `agent-context@1` | The workload's profile file beside the workspace, indexing each Kit's guidance. |
|
||||
| `resources@1` | Container CPU and memory limits. |
|
||||
| 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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
`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.
|
||||
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.
|
||||
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.
|
||||
`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
|
||||
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.
|
||||
`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.
|
||||
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 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.
|
||||
- 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:
|
||||
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
|
||||
@@ -131,26 +128,26 @@ one of:
|
||||
|
||||
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.
|
||||
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`.
|
||||
`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.
|
||||
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 |
|
||||
| | 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
|
||||
@@ -160,39 +157,37 @@ established egress phase differ.
|
||||
`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 a human; 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.
|
||||
(`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".
|
||||
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
|
||||
@@ -200,118 +195,136 @@ established egress phase differ.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
- **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
|
||||
bead.** It needs the dangerous-command authority (`archie-core-sod1`) to
|
||||
gate it, and that authority is not wired for it: the harness listener has
|
||||
no approval step; `ToolSetOptions.Approval` in `internal/agentexec/modelloop`
|
||||
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 a human only on the chat paths (dashboard ask, Telegram,
|
||||
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.
|
||||
- **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.
|
||||
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.
|
||||
- **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 token, 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.
|
||||
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.
|
||||
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.
|
||||
- **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.
|
||||
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.
|
||||
- **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, which are how a stage returns structured results, are served
|
||||
by `archie-agent mcp`, a stdio MCP server registered through the Kit's MCP
|
||||
configuration or the adapter's flags. It serves the stage's `CaptureTools`
|
||||
and the central tools the agent profile's `AllowTools` permits, never the
|
||||
`workspace` toolset. The runner's `ToolLimits` bound its results; the
|
||||
harness's own built-in tools are outside archie's limits.
|
||||
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 |
|
||||
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 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. |
|
||||
| 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.
|
||||
@@ -319,38 +332,34 @@ 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.
|
||||
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.
|
||||
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.
|
||||
- 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.
|
||||
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.
|
||||
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.
|
||||
@@ -360,8 +369,19 @@ of them.
|
||||
|
||||
## Verification
|
||||
|
||||
- The same workflow definition completes on `builtin` and on the Claude Code
|
||||
Kit with the same `Result` shape and captures.
|
||||
- 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.
|
||||
@@ -373,8 +393,8 @@ of them.
|
||||
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 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,
|
||||
@@ -382,11 +402,11 @@ of them.
|
||||
- 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 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 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.
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
# Self-development loop: archie develops its own codebase
|
||||
|
||||
**Status:** Decided, not yet built (2026-11-03, sam) **Scope:** how archie
|
||||
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.
|
||||
|
||||
## Built today
|
||||
|
||||
The machinery the loop will reuse exists: shipped triage/implement/pr-review
|
||||
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.
|
||||
|
||||
## Decision
|
||||
|
||||
Archie improves its own codebase through a closed loop, built in stages:
|
||||
|
||||
1. **Self-intake** (#1770): a curator pass reads run outcomes, step transcripts,
|
||||
gate failures and alerts, dedupes against open issues, and files new issues.
|
||||
Archie files its own work; the maintainer approves priority.
|
||||
2. **Approved-issue loop** (#1771): an approved issue runs the shipped
|
||||
triage/implement workflows end to end — read-only plan, gated build,
|
||||
adversarial self-review, daemon commits and opens a green PR. The maintainer
|
||||
still merges at this stage.
|
||||
3. **Implementation judge** (#1772): the prbench judge pattern scores diffs,
|
||||
calibrated against the maintainer's merge decisions; auto-merge applies only
|
||||
when the gate is green, the review stage is clean, and the judge is above the
|
||||
calibrated bar.
|
||||
4. **Outcome distillation** (#1773): a curator turns merged-run postmortems into
|
||||
proposals for the repo's agent instructions, each added only because it
|
||||
changes a decision; rules that stop changing decisions are removed.
|
||||
5. **Canary** (#1774): self-directed changes ship through the canary release
|
||||
window and are judged on the installed release before promotion. Rollback is
|
||||
a plain revert, because every self-directed change is one gated commit.
|
||||
|
||||
## Boundary
|
||||
|
||||
Enforcement lives in the harness, never in the prompt (#1775). Changes to the
|
||||
commit gate, the invariants in `AGENTS.md`, access control and grant scoping,
|
||||
the daemon-only git path, and webhook HMAC verification may be proposed by
|
||||
archie but are never merged by archie — they require a maintainer merge.
|
||||
Everything else (workflows, curators, memory, docs, the dashboard) is fair game
|
||||
for the loop.
|
||||
|
||||
## Why
|
||||
|
||||
Self-improvement degrades when it relies on the model choosing to follow rules.
|
||||
Gates, scoped grants and the daemon's monopoly on git cannot be argued with; a
|
||||
prompt can. Keeping quality measurable — a judge bar and a canary verdict as
|
||||
numbers, tests guarding the protected seams — is what lets the loop widen
|
||||
without turning the codebase to garbage.
|
||||
|
||||
## Consequences
|
||||
|
||||
- One issue → one small PR applies doubly to self-directed work: past about 100
|
||||
lines or any new mechanism, the change stops and reassesses.
|
||||
- Every self-directed commit cites the issue that authorized it.
|
||||
- Rule proposals from the distillation curator must name the run that triggered
|
||||
them, and `AGENTS.md` stays short enough to read in full every session.
|
||||
+171
-162
@@ -1,18 +1,20 @@
|
||||
# User authorization boundaries
|
||||
|
||||
Archie separates authentication (which person or service is calling) from
|
||||
permission to act on a resource. This inventory follows the [OWASP
|
||||
Authentication Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html)
|
||||
and [Authorization Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html),
|
||||
permission to act on a resource. This inventory follows the
|
||||
[OWASP Authentication Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html)
|
||||
and
|
||||
[Authorization Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html),
|
||||
including its guidance on attributes and relationships. It describes concrete
|
||||
enforcement points and their regression tests; it is not a compliance certification.
|
||||
enforcement points and their regression tests; it is not a compliance
|
||||
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 State Store opens the task/control-plane/account database; Gateway
|
||||
owns conversation storage. Browser HTTP handlers never open either database.
|
||||
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
|
||||
State Store opens the task/control-plane/account database; Gateway owns
|
||||
conversation storage. Browser HTTP handlers never open either database.
|
||||
|
||||
Instance service credentials are administrative authority. They are not user
|
||||
sessions and must never reach a browser, model, or agent container. A service
|
||||
@@ -23,21 +25,25 @@ boundary evaluates Cedar before invoking them. Task credentials have a separate,
|
||||
explicit RPC allowlist and cannot call account or identity administration.
|
||||
|
||||
Local service listeners are trusted process boundaries. Loopback is not a
|
||||
substitute for authentication on a remotely reachable listener. OIDC credentials,
|
||||
local browser sessions, personal API tokens, service credentials, and task grants
|
||||
must remain distinct.
|
||||
substitute for authentication on a remotely reachable listener. OIDC
|
||||
credentials, local browser sessions, personal API tokens, service credentials,
|
||||
and task grants must remain distinct.
|
||||
|
||||
## Policy and relationship model
|
||||
|
||||
`internal/domain/access` defines actions, resources, principals and memberships.
|
||||
`internal/infrastructure/access` assembles Cedar entities and evaluates the
|
||||
instance → organization → workspace → object chain. A forbid wins; each applicable
|
||||
level must permit the operation. Missing or invalid policy chains fail closed.
|
||||
instance → organization → workspace → object chain. A forbid wins; each
|
||||
applicable level must permit the operation. Missing or invalid policy chains
|
||||
fail closed.
|
||||
|
||||
The default policies grant actions through scoped roles. Policies can also
|
||||
restrict a named identity, workspace environment, owner, state, source address,
|
||||
signature, run or step. HTTP task decisions now include the stored initiating identity and task state; binding decisions include the stored binding state. The HTTP source address is the actual connection peer, not an unverified forwarded header. Membership and resource attributes must come from stored
|
||||
records or authenticated context, never a request's assertion about itself.
|
||||
signature, run or step. HTTP task decisions now include the stored initiating
|
||||
identity and task state; binding decisions include the stored binding state. The
|
||||
HTTP source address is the actual connection peer, not an unverified forwarded
|
||||
header. Membership and resource attributes must come from stored records or
|
||||
authenticated context, never a request's assertion about itself.
|
||||
|
||||
Cedar permission is not ownership of another person's private data. Conversation
|
||||
history, passkeys, recovery codes and personal tokens are bound to the person.
|
||||
@@ -48,34 +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: `forge/webhook`, `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. | Webhook/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` |
|
||||
| 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 human attribution. | Existing dispatch, grant, memory and org-scope tests |
|
||||
| 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: `forge/webhook`, `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. | Webhook/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` |
|
||||
| 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 |
|
||||
|
||||
The policy HTTP matrix enumerates each registered protected route. It checks
|
||||
both anonymous refusal and refusal by an explicit Cedar forbid, using the real
|
||||
@@ -93,8 +100,9 @@ they do not contain user data. `/health/detailed` remains protected.
|
||||
|
||||
Personal routes under `/api/account/` require an active signed-in person and
|
||||
server-derived ownership: password change, recovery-secret generation, passkey
|
||||
begin/finish/list/delete. They do not require an organization administrator role.
|
||||
`POST /api/accounts` and `/api/authentication` are administrative policy routes.
|
||||
begin/finish/list/delete. They do not require an organization administrator
|
||||
role. `POST /api/accounts` and `/api/authentication` are administrative policy
|
||||
routes.
|
||||
|
||||
## HTTP route inventory
|
||||
|
||||
@@ -102,120 +110,121 @@ The following routes are covered by `TestHTTPPolicyCannotBeBypassed` in
|
||||
`internal/webui/authorization_surfaces_test.go`. `authorize.go` maps each to its
|
||||
action/resource; the handler may impose a stricter record or instance boundary.
|
||||
|
||||
| Method | Route example |
|
||||
| --- | --- |
|
||||
| DELETE | `/api/access/policies` |
|
||||
| DELETE | `/api/bindings/7` |
|
||||
| DELETE | `/api/event-types/7` |
|
||||
| DELETE | `/api/extensions/sample` |
|
||||
| DELETE | `/api/mappings/7` |
|
||||
| DELETE | `/api/orgs/7/members/sample` |
|
||||
| DELETE | `/api/sources/sample` |
|
||||
| DELETE | `/api/tokens/7` |
|
||||
| GET | `/api/access/policies` |
|
||||
| GET | `/api/alerts` |
|
||||
| GET | `/api/authentication` |
|
||||
| GET | `/api/bindings` |
|
||||
| GET | `/api/bindings/7` |
|
||||
| GET | `/api/bindings/7/dispatches` |
|
||||
| GET | `/api/capabilities` |
|
||||
| GET | `/api/captures` |
|
||||
| GET | `/api/captures/7/dispatches` |
|
||||
| GET | `/api/channels` |
|
||||
| GET | `/api/chat/file/sample` |
|
||||
| GET | `/api/chat/sessions` |
|
||||
| GET | `/api/chat/sessions/7/messages` |
|
||||
| GET | `/api/chat/sessions/7/turns` |
|
||||
| GET | `/api/chat/update` |
|
||||
| GET | `/api/config` |
|
||||
| GET | `/api/control-plane/apply-status` |
|
||||
| GET | `/api/control-plane/audit` |
|
||||
| GET | `/api/control-plane/catalog` |
|
||||
| GET | `/api/control-plane/resources/sample` |
|
||||
| GET | `/api/control-plane/resources/sample/history` |
|
||||
| GET | `/api/curators` |
|
||||
| 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` |
|
||||
| GET | `/api/mappings/7` |
|
||||
| GET | `/api/orgs` |
|
||||
| GET | `/api/orgs/7` |
|
||||
| GET | `/api/orgs/7/members` |
|
||||
| GET | `/api/orgs/7/workspaces` |
|
||||
| GET | `/api/secret-engines` |
|
||||
| GET | `/api/services` |
|
||||
| GET | `/api/setup` |
|
||||
| GET | `/api/skills` |
|
||||
| GET | `/api/sources` |
|
||||
| GET | `/api/stream` |
|
||||
| GET | `/api/summary` |
|
||||
| GET | `/api/task-meta` |
|
||||
| GET | `/api/tasks` |
|
||||
| GET | `/api/tasks/7` |
|
||||
| GET | `/api/tasks/7/attempts` |
|
||||
| GET | `/api/tasks/7/changes` |
|
||||
| GET | `/api/tasks/7/debug` |
|
||||
| GET | `/api/tasks/7/dispatches` |
|
||||
| GET | `/api/tasks/7/logs` |
|
||||
| GET | `/api/tasks/7/logs/download` |
|
||||
| GET | `/api/tasks/7/sandbox` |
|
||||
| GET | `/api/tokens` |
|
||||
| GET | `/api/version` |
|
||||
| GET | `/api/workflows` |
|
||||
| PATCH | `/api/bindings/7` |
|
||||
| PATCH | `/api/mappings/7` |
|
||||
| POST | `/api/accounts` |
|
||||
| POST | `/api/alerts/7/dismiss` |
|
||||
| POST | `/api/bindings` |
|
||||
| POST | `/api/bindings/7/approve` |
|
||||
| POST | `/api/bindings/7/pause` |
|
||||
| POST | `/api/bindings/7/resume` |
|
||||
| POST | `/api/channels/7/reload` |
|
||||
| POST | `/api/chat/answer` |
|
||||
| POST | `/api/chat/cancel` |
|
||||
| POST | `/api/chat/message` |
|
||||
| POST | `/api/chat/persona` |
|
||||
| POST | `/api/chat/stream` |
|
||||
| POST | `/api/chat/update/defer` |
|
||||
| POST | `/api/chat/update/install` |
|
||||
| POST | `/api/control-plane/resources/sample/commands/sample` |
|
||||
| POST | `/api/event-types` |
|
||||
| POST | `/api/extensions` |
|
||||
| POST | `/api/extensions/catalogue/sample/install` |
|
||||
| POST | `/api/extensions/sample/accept` |
|
||||
| POST | `/api/extensions/sample/approve-update` |
|
||||
| POST | `/api/extensions/sample/rollback` |
|
||||
| POST | `/api/extensions/sample/update` |
|
||||
| POST | `/api/identities` |
|
||||
| POST | `/api/identities/7/sample` |
|
||||
| POST | `/api/mappings` |
|
||||
| POST | `/api/mappings/preview` |
|
||||
| POST | `/api/orgs` |
|
||||
| POST | `/api/orgs/7/members` |
|
||||
| POST | `/api/orgs/7/workspaces` |
|
||||
| POST | `/api/secret-references/check` |
|
||||
| POST | `/api/sources` |
|
||||
| POST | `/api/sources/sample/approve-unsigned` |
|
||||
| POST | `/api/sources/sample/secret` |
|
||||
| POST | `/api/sources/sample/signing` |
|
||||
| POST | `/api/tasks/7/action` |
|
||||
| POST | `/api/tokens` |
|
||||
| POST | `/api/work-requests` |
|
||||
| PUT | `/api/access/policies` |
|
||||
| PUT | `/api/authentication` |
|
||||
| PUT | `/api/event-types/7` |
|
||||
| PUT | `/api/extensions/sample/enabled` |
|
||||
| PUT | `/api/extensions/sample/update-policy` |
|
||||
| PUT | `/api/orgs/7/agents/sample` |
|
||||
| PUT | `/api/orgs/7/members/sample` |
|
||||
| PUT | `/api/sources/sample/delivery-header` |
|
||||
| PUT | `/api/sources/sample/name` |
|
||||
| PUT | `/api/workflows/7/enabled` |
|
||||
| Method | Route example |
|
||||
| ------ | ----------------------------------------------------- |
|
||||
| DELETE | `/api/access/policies` |
|
||||
| DELETE | `/api/bindings/7` |
|
||||
| DELETE | `/api/event-types/7` |
|
||||
| DELETE | `/api/extensions/sample` |
|
||||
| DELETE | `/api/mappings/7` |
|
||||
| DELETE | `/api/orgs/7/members/sample` |
|
||||
| DELETE | `/api/sources/sample` |
|
||||
| DELETE | `/api/tokens/7` |
|
||||
| GET | `/api/access/policies` |
|
||||
| GET | `/api/alerts` |
|
||||
| GET | `/api/audit` |
|
||||
| GET | `/api/audit/export` |
|
||||
| GET | `/api/authentication` |
|
||||
| GET | `/api/bindings` |
|
||||
| GET | `/api/bindings/7` |
|
||||
| GET | `/api/bindings/7/dispatches` |
|
||||
| GET | `/api/capabilities` |
|
||||
| GET | `/api/captures` |
|
||||
| GET | `/api/captures/7/dispatches` |
|
||||
| GET | `/api/channels` |
|
||||
| GET | `/api/chat/file/sample` |
|
||||
| GET | `/api/chat/sessions` |
|
||||
| GET | `/api/chat/sessions/7/messages` |
|
||||
| GET | `/api/chat/sessions/7/turns` |
|
||||
| GET | `/api/chat/update` |
|
||||
| GET | `/api/config` |
|
||||
| GET | `/api/control-plane/apply-status` |
|
||||
| GET | `/api/control-plane/catalog` |
|
||||
| GET | `/api/control-plane/resources/sample` |
|
||||
| GET | `/api/control-plane/resources/sample/history` |
|
||||
| GET | `/api/curators` |
|
||||
| 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` |
|
||||
| GET | `/api/mappings/7` |
|
||||
| GET | `/api/orgs` |
|
||||
| GET | `/api/orgs/7` |
|
||||
| GET | `/api/orgs/7/members` |
|
||||
| GET | `/api/orgs/7/workspaces` |
|
||||
| GET | `/api/secret-engines` |
|
||||
| GET | `/api/services` |
|
||||
| GET | `/api/setup` |
|
||||
| GET | `/api/skills` |
|
||||
| GET | `/api/sources` |
|
||||
| GET | `/api/stream` |
|
||||
| GET | `/api/summary` |
|
||||
| GET | `/api/task-meta` |
|
||||
| GET | `/api/tasks` |
|
||||
| GET | `/api/tasks/7` |
|
||||
| GET | `/api/tasks/7/attempts` |
|
||||
| GET | `/api/tasks/7/changes` |
|
||||
| GET | `/api/tasks/7/debug` |
|
||||
| GET | `/api/tasks/7/dispatches` |
|
||||
| GET | `/api/tasks/7/logs` |
|
||||
| GET | `/api/tasks/7/logs/download` |
|
||||
| GET | `/api/tasks/7/sandbox` |
|
||||
| GET | `/api/tokens` |
|
||||
| GET | `/api/version` |
|
||||
| GET | `/api/workflows` |
|
||||
| PATCH | `/api/bindings/7` |
|
||||
| PATCH | `/api/mappings/7` |
|
||||
| POST | `/api/accounts` |
|
||||
| POST | `/api/alerts/7/dismiss` |
|
||||
| POST | `/api/bindings` |
|
||||
| POST | `/api/bindings/7/approve` |
|
||||
| POST | `/api/bindings/7/pause` |
|
||||
| POST | `/api/bindings/7/resume` |
|
||||
| POST | `/api/channels/7/reload` |
|
||||
| POST | `/api/chat/answer` |
|
||||
| POST | `/api/chat/cancel` |
|
||||
| POST | `/api/chat/message` |
|
||||
| POST | `/api/chat/persona` |
|
||||
| POST | `/api/chat/stream` |
|
||||
| POST | `/api/chat/update/defer` |
|
||||
| POST | `/api/chat/update/install` |
|
||||
| POST | `/api/control-plane/resources/sample/commands/sample` |
|
||||
| POST | `/api/event-types` |
|
||||
| POST | `/api/extensions` |
|
||||
| POST | `/api/extensions/catalogue/sample/install` |
|
||||
| POST | `/api/extensions/sample/accept` |
|
||||
| POST | `/api/extensions/sample/approve-update` |
|
||||
| POST | `/api/extensions/sample/rollback` |
|
||||
| POST | `/api/extensions/sample/update` |
|
||||
| POST | `/api/identities` |
|
||||
| POST | `/api/identities/7/sample` |
|
||||
| POST | `/api/mappings` |
|
||||
| POST | `/api/mappings/preview` |
|
||||
| POST | `/api/orgs` |
|
||||
| POST | `/api/orgs/7/members` |
|
||||
| POST | `/api/orgs/7/workspaces` |
|
||||
| POST | `/api/secret-references/check` |
|
||||
| POST | `/api/sources` |
|
||||
| POST | `/api/sources/sample/approve-unsigned` |
|
||||
| POST | `/api/sources/sample/secret` |
|
||||
| POST | `/api/sources/sample/signing` |
|
||||
| POST | `/api/tasks/7/action` |
|
||||
| POST | `/api/tokens` |
|
||||
| POST | `/api/work-requests` |
|
||||
| PUT | `/api/access/policies` |
|
||||
| PUT | `/api/authentication` |
|
||||
| PUT | `/api/event-types/7` |
|
||||
| PUT | `/api/extensions/sample/enabled` |
|
||||
| PUT | `/api/extensions/sample/update-policy` |
|
||||
| PUT | `/api/orgs/7/agents/sample` |
|
||||
| PUT | `/api/orgs/7/members/sample` |
|
||||
| PUT | `/api/sources/sample/delivery-header` |
|
||||
| PUT | `/api/sources/sample/name` |
|
||||
| PUT | `/api/workflows/7/enabled` |
|
||||
|
||||
## Verification limits
|
||||
|
||||
@@ -224,9 +233,9 @@ security key or every operating system. An OIDC unit test is not acceptance
|
||||
against a deployed provider. Disposable PostgreSQL smoke checks verify real SQL
|
||||
without putting database-dependent tests in the fast unit suite.
|
||||
|
||||
Existing anonymous conversations are retained but are not silently assigned to
|
||||
a new person. Existing service credentials remain privileged; this inventory
|
||||
does not claim that all internal gRPC methods have independent Cedar gates.
|
||||
Existing anonymous conversations are retained but are not silently assigned to a
|
||||
new person. Existing service credentials remain privileged; this inventory does
|
||||
not claim that all internal gRPC methods have independent Cedar gates.
|
||||
|
||||
When changing a user-facing operation, update its inventory entry and its
|
||||
allow/deny behavior cases. Include another user in the same organization, a
|
||||
|
||||
+69
-15
@@ -9,7 +9,7 @@ park, which is useful data for the dashboard.
|
||||
| --- | --- |
|
||||
| `stack.sh` | Starts PostgreSQL 18 (port 55432) and the five services as local processes, then Vite on 5173 |
|
||||
| `seed.sh` | Seeds the stack through the dashboard API; safe to rerun |
|
||||
| `run.cjs` | Runs `checks/*.cjs` in headless Chromium; screenshots to `out/` |
|
||||
| `run.cjs` | Runs `checks/*.cjs` in Chromium; screenshots, manifest and `report.html` to `out/<stamp>/` |
|
||||
| `checks/` | One module per behaviour |
|
||||
| `results/` | One committed report per release |
|
||||
|
||||
@@ -17,45 +17,99 @@ park, which is useful data for the dashboard.
|
||||
|
||||
```bash
|
||||
task e2e:up # build, start everything, seed
|
||||
task e2e:check # all checks; or: node e2e/run.cjs routes
|
||||
task e2e:check # list available checks (no stack needed)
|
||||
task e2e:check -- list # explicitly list checks
|
||||
task e2e:check -- audit-redirect # one check
|
||||
task e2e:check -- all # all checks
|
||||
task e2e:check -- --headed accessibility # watch a check in Chromium
|
||||
task e2e:check -- --headed all # watch every check
|
||||
task e2e:down # stop; e2e/stack.sh reset also deletes the data
|
||||
```
|
||||
|
||||
Headless is the default. `--headed` opens visible Chromium and slows browser
|
||||
actions to 150ms so you can follow them; assertions and saved evidence are the
|
||||
same in both modes. The terminal prints each check before it starts. Headed mode
|
||||
requires a graphical desktop.
|
||||
|
||||
Nothing reads the installed config: `stack.sh` points the XDG directories at
|
||||
`${ARCHIE_DEV_DIR:-~/.local/state/archie-dev}` and writes its overlay from
|
||||
`deployments/dev.toml`. Logs are in its `logs/`. `e2e/stack.sh restart archied`
|
||||
restarts one service.
|
||||
restarts one service. Run `task e2e:down` before starting again: startup refuses
|
||||
occupied service ports and checks that each launched process stays alive.
|
||||
|
||||
The first run needs `npm ci --prefix e2e` and `npx --prefix e2e playwright
|
||||
The seed creates a local test administrator: `operator@example.test`, password
|
||||
`archie-local-e2e-password`. Use it at `http://localhost:5173`; the browser
|
||||
checks sign in with the same account. These are test fixtures for this
|
||||
loopback-only stack. To use an existing test account, set `ARCHIE_E2E_EMAIL`
|
||||
and `ARCHIE_E2E_PASSWORD` for both seeding and browser checks. Seeding never
|
||||
resets an existing account or deletes test data.
|
||||
|
||||
The first run needs `pnpm install --dir e2e` and `pnpm --dir e2e exec playwright
|
||||
install chromium`. In the cloud environment, Chromium and Playwright are
|
||||
preinstalled; run with `NODE_PATH=$(npm root -g)`.
|
||||
preinstalled; run with `NODE_PATH=$(pnpm root -g)`.
|
||||
|
||||
## Release evidence
|
||||
|
||||
```bash
|
||||
node e2e/run.cjs --record v1.54.0
|
||||
node e2e/run.cjs --record v1.54.0 all
|
||||
```
|
||||
|
||||
writes `results/v1.54.0.md`, the pass or fail of every check for that
|
||||
release. Commit it with the release. Screenshots stay in `out/`.
|
||||
writes `results/v1.54.0.md`, the pass, fail or skip of every check for
|
||||
that release. Commit it with the release. Screenshots stay in `out/`.
|
||||
|
||||
## Writing a check
|
||||
|
||||
A module in `checks/` exports `async ({ page, go, shot, fail })`. `go(path)`
|
||||
loads a dashboard route, `shot(label)` saves a screenshot, `fail(msg)` records
|
||||
a problem without stopping. A throw, a `fail`, or any console or page error
|
||||
fails the check. Wait for elements, never for `networkidle`: the event stream
|
||||
never goes idle.
|
||||
A module in `checks/` exports `async ({ page, go, shot, fail, skip, settled, attach, tolerate })`.
|
||||
|
||||
- `go(path)` loads a dashboard route: `waitUntil: 'load'` plus 1200ms.
|
||||
Wait for elements, never for `networkidle`: the event stream never goes idle.
|
||||
- `shot(label)` saves `<check>-<kebab>[-<w>x<h>].png` after a short settle,
|
||||
and records `{file, w, h, check}` in the manifest. The label is slugified,
|
||||
so `shot('/')` becomes `routes-home.png`; a viewport other than the
|
||||
1440x900 default adds a suffix (`-390x844`). Repeated labels get `-2`,
|
||||
`-3`, so every capture is kept.
|
||||
- `fail(msg)` records a problem without stopping.
|
||||
- `skip(reason)` stops the check and records a skip: a missing
|
||||
precondition, never a failure.
|
||||
- `tolerate(re)` ignores console errors matching `re`, for a response the page is designed to survive.
|
||||
- `attach(name, data)` saves a non-image artifact as `<check>-<name>`.
|
||||
- `settled(sel?)` waits for a selector or URL, then settles briefly.
|
||||
It is the harness-owned wait; checks need no capture wrapper or
|
||||
ad-hoc sleeps around screenshots.
|
||||
|
||||
Each check gets a fresh page at 1440x900 with the login `storageState`;
|
||||
a check that needs a phone viewport resizes it itself to 390x844.
|
||||
Those are the only two viewports in use. A throw, a `fail`, or any
|
||||
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.
|
||||
|
||||
`routes` loads every static route and flags text with stray leading,
|
||||
trailing or doubled spaces. `seeded` checks the seed is visible.
|
||||
`/logs` is visited but skipped by the whitespace lint: log lines are
|
||||
data, not copy.
|
||||
|
||||
## Output
|
||||
|
||||
Every run writes `out/<stamp>/` with the screenshots,
|
||||
`results.json` (the manifest: `{check, ok, ms, problems, artifacts[]}`,
|
||||
plus `skipped`/`skipReason` for skips) and `report.html`: a self-contained
|
||||
test record with the commit, totals and one row per check (status, time,
|
||||
message and that check's artifacts, screenshots inline). `attach(name, data)`
|
||||
adds a non-image artifact to the current check; a failed check also gets a
|
||||
`failure` screenshot.
|
||||
|
||||
Exits: 0 when every check passes or skips, 1 when any check fails,
|
||||
2 when the harness itself errors. `ARCHIE_E2E_URL` points the run at
|
||||
a dashboard other than `http://localhost:5173`.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
| Symptom | Cause | Fix |
|
||||
| --- | --- | --- |
|
||||
| State Store exits: server is older than PostgreSQL 18 | another server answered | `stack.sh` uses port 55432; set `ARCHIE_DEV_PGPORT` if that is taken |
|
||||
| Work request: repository is not configured | archied reads repository policies only at boot | `seed.sh` restarts it; do the same after changing policies |
|
||||
| Startup says a port is in use | a stack or another process already owns it | Run `task e2e:down`, then `task e2e:up`; inspect any remaining listener with `ss -ltnp` |
|
||||
| Your own shell is killed (exit 144) | `pkill -f` matched its own command line | `stack.sh stop` or `restart`, which kill by PID |
|
||||
| `npx shadcn-vue add` cannot fetch the registry | Node's fetch ignores the cloud agent proxy | `curl` the registry JSON and copy the files |
|
||||
| Postgres aborts in the cloud | `/tmp/claude-0` is reset to mode 700 | `stack.sh` keeps the root cluster in `/var/lib/archie-dev` |
|
||||
@@ -0,0 +1,53 @@
|
||||
// Keyboard and phone access: the task dialog fits and tabs in order, pages
|
||||
// title correctly, the skip link and palette focus main content, and
|
||||
// query-only tab switches keep focus where it is.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
module.exports = async ({ page, go, shot, settled }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
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');
|
||||
await dialog.waitFor();
|
||||
await settled();
|
||||
const bounds = await dialog.boundingBox();
|
||||
assert.ok(bounds.y >= 0 && bounds.y + bounds.height <= 844, 'New task dialog extends outside viewport');
|
||||
await shot('phone-task-dialog-top');
|
||||
const start = dialog.getByRole('button', { name: 'Start task', exact: true });
|
||||
await start.scrollIntoViewIfNeeded();
|
||||
const button = await start.boundingBox();
|
||||
assert.ok(button.y >= 0 && button.y + button.height <= 844, 'Start task cannot be reached by scrolling');
|
||||
await shot('phone-task-dialog');
|
||||
const close = dialog.getByRole('button', { name: 'Close', exact: true });
|
||||
await dialog.getByRole('button', { name: 'Cancel', exact: true }).focus();
|
||||
await page.keyboard.press('Tab');
|
||||
assert.ok(await close.evaluate(el => el === document.activeElement), 'Close is missing from keyboard tab order');
|
||||
const closeBounds = await close.boundingBox();
|
||||
assert.ok(closeBounds.y >= 0 && closeBounds.y + closeBounds.height <= 844, 'Close cannot be reached by keyboard');
|
||||
await page.keyboard.press('Escape');
|
||||
for (const [path, title] of [['/tasks', 'Tasks'], ['/events', 'Events'], ['/account', 'Your account'], ['/settings/models', 'Models | Instance'], ['/org/models', 'Models | Organisation']]) {
|
||||
await go(path);
|
||||
assert.equal(await page.title(), `${title} | Archie`);
|
||||
}
|
||||
await page.keyboard.press('Tab');
|
||||
const skip = page.getByRole('link', { name: 'Skip to main content', exact: true });
|
||||
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('list', { name: 'Sections', exact: true }).getByRole('link', { 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();
|
||||
await page.getByRole('option', { name: 'Events', 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', 'palette navigation did not focus main');
|
||||
// The conversation panel is only open on some entries to this page; the
|
||||
// focus check below needs it closed either way.
|
||||
const hide = page.getByRole('button', { name: 'Hide conversation', exact: true });
|
||||
if (await hide.count()) await hide.click();
|
||||
const tab = page.getByRole('tab', { name: /^Map/ });
|
||||
await tab.click();
|
||||
assert.ok(await tab.evaluate(el => el === document.activeElement), 'query-only navigation stole focus');
|
||||
};
|
||||
@@ -0,0 +1,113 @@
|
||||
// Audit filters are server-evaluated through the URL contract: search,
|
||||
// category, time range, back/forward restore, denied, and the actor filter.
|
||||
const assert = require('node:assert/strict');
|
||||
const { trackAudit } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, fail }) => {
|
||||
const { requestMatching, waitForUrl } = trackAudit(page);
|
||||
|
||||
await go('/org/audit');
|
||||
const status = await page.evaluate(async () => (await fetch('/api/auth/status')).json());
|
||||
const actor = status?.user?.id;
|
||||
assert.ok(actor, 'signed-in identity has no id');
|
||||
|
||||
const search = page.getByLabel('Search events', { exact: true });
|
||||
let request = await requestMatching(
|
||||
() => search.fill('repository'),
|
||||
(u) => u.searchParams.get('q') === 'repository',
|
||||
);
|
||||
assert.ok(request, 'search issued no matching /api/audit request');
|
||||
await waitForUrl((u) => u.searchParams.get('q') === 'repository');
|
||||
assert.equal((await search.inputValue()), 'repository');
|
||||
|
||||
await go('/org/audit');
|
||||
request = await requestMatching(
|
||||
() => page.getByRole('button', { name: 'Runtime', exact: true }).click(),
|
||||
(u) => u.searchParams.get('categories') === 'runtime',
|
||||
);
|
||||
assert.ok(request, 'category filter issued no matching /api/audit request');
|
||||
await waitForUrl((u) => u.searchParams.get('categories') === 'runtime');
|
||||
assert.equal(
|
||||
await page.getByRole('button', { name: 'Runtime', exact: true }).getAttribute('aria-pressed'),
|
||||
'true',
|
||||
);
|
||||
|
||||
// Time: Any time drops the window from the request rather than guessing one.
|
||||
await page.getByRole('combobox', { name: 'Time range', exact: true }).click();
|
||||
request = await requestMatching(
|
||||
() => page.getByRole('option', { name: 'Any time', exact: true }).click(),
|
||||
(u) => u.searchParams.get('from') === null && u.searchParams.get('categories') === 'runtime',
|
||||
);
|
||||
assert.ok(request, 'Any time issued no matching /api/audit request');
|
||||
await waitForUrl((u) => u.searchParams.get('since') === 'any');
|
||||
assert.equal(await page.getByRole('combobox', { name: 'Time range', exact: true }).innerText(), 'Any time');
|
||||
|
||||
// Back/forward restore the controls the URL describes.
|
||||
const backRequest = page.waitForRequest(
|
||||
(r) => {
|
||||
const u = new URL(r.url());
|
||||
return u.pathname === '/api/audit' && u.searchParams.get('categories') === 'runtime' && !!u.searchParams.get('from');
|
||||
},
|
||||
{ timeout: 8000 },
|
||||
);
|
||||
await page.goBack();
|
||||
await backRequest;
|
||||
await waitForUrl((u) => u.searchParams.get('categories') === 'runtime' && u.searchParams.get('since') === null);
|
||||
assert.equal(await page.getByRole('combobox', { name: 'Time range', exact: true }).innerText(), 'Last 30 days');
|
||||
assert.equal(
|
||||
await page.getByRole('button', { name: 'Runtime', exact: true }).getAttribute('aria-pressed'),
|
||||
'true',
|
||||
'back did not restore the category toggle',
|
||||
);
|
||||
const forwardRequest = page.waitForRequest(
|
||||
(r) => {
|
||||
const u = new URL(r.url());
|
||||
return u.pathname === '/api/audit' && u.searchParams.get('categories') === 'runtime' && u.searchParams.get('from') === null;
|
||||
},
|
||||
{ timeout: 8000 },
|
||||
);
|
||||
await page.goForward();
|
||||
await forwardRequest;
|
||||
await waitForUrl((u) => u.searchParams.get('since') === 'any');
|
||||
assert.equal(await page.getByRole('combobox', { name: 'Time range', exact: true }).innerText(), 'Any time');
|
||||
|
||||
// Denied reaches the server through the same URL contract as the other
|
||||
// filters. It must both update the URL and issue a request.
|
||||
await go('/org/audit');
|
||||
const denied = page.getByRole('button', { name: 'Denied', exact: true });
|
||||
request = await requestMatching(
|
||||
() => denied.click(),
|
||||
(u) => u.searchParams.get('outcome') === 'denied',
|
||||
3000,
|
||||
);
|
||||
const deniedUrl = new URL(page.url());
|
||||
if (!request || deniedUrl.searchParams.get('outcome') !== 'denied') {
|
||||
await shot('denied');
|
||||
fail(
|
||||
`Denied filter did not reach the server: URL ${page.url()} has outcome=${deniedUrl.searchParams.get('outcome') ?? 'absent'}, ` +
|
||||
`aria-pressed=${await denied.getAttribute('aria-pressed')}, no /api/audit request with outcome=denied`,
|
||||
);
|
||||
} else {
|
||||
assert.equal(await denied.getAttribute('aria-pressed'), 'true');
|
||||
}
|
||||
|
||||
// Advanced actor filter: server-evaluated, in the URL, shown as a chip.
|
||||
await go('/org/audit');
|
||||
await page.getByRole('button', { name: 'Filters', exact: true }).click();
|
||||
const actorInput = page.getByLabel('Actor', { exact: true });
|
||||
request = await requestMatching(
|
||||
async () => {
|
||||
await actorInput.fill(actor);
|
||||
await actorInput.press('Enter');
|
||||
},
|
||||
(u) => u.searchParams.get('actor') === actor,
|
||||
);
|
||||
assert.ok(request, 'advanced actor filter issued no matching /api/audit request');
|
||||
await waitForUrl((u) => u.searchParams.get('actor') === actor);
|
||||
assert.match(
|
||||
await page.locator('ul[aria-label="Active filters"] li', { hasText: 'Actor:' }).first().innerText(),
|
||||
new RegExp(actor),
|
||||
);
|
||||
await shot('filters');
|
||||
await page.keyboard.press('Escape');
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
// The audit page at phone width: secondary columns collapse, and the list,
|
||||
// an expanded row and the filters dialog fit without horizontal overflow.
|
||||
const assert = require('node:assert/strict');
|
||||
const { trackAudit } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, fail, settled }) => {
|
||||
trackAudit(page);
|
||||
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await go('/org/audit');
|
||||
const assertNoOverflow = async (label) => {
|
||||
const { scrollWidth, innerWidth } = await page.evaluate(() => ({
|
||||
scrollWidth: document.documentElement.scrollWidth,
|
||||
innerWidth,
|
||||
}));
|
||||
if (scrollWidth > innerWidth) {
|
||||
fail(`${label} overflows 390px: documentElement.scrollWidth=${scrollWidth} > innerWidth=${innerWidth}`);
|
||||
}
|
||||
};
|
||||
await page.locator('[data-row-key]').first().waitFor();
|
||||
await assertNoOverflow('audit list');
|
||||
assert.equal(
|
||||
await page.locator('thead th', { hasText: 'Target' }).first().evaluate((el) => getComputedStyle(el).display),
|
||||
'none',
|
||||
'secondary columns are still rendered on the phone',
|
||||
);
|
||||
await shot('list');
|
||||
|
||||
const phoneRow = page.locator('[data-row-key]').first();
|
||||
await phoneRow.focus();
|
||||
await page.keyboard.press('Enter');
|
||||
await settled();
|
||||
assert.equal(await phoneRow.getAttribute('aria-expanded'), 'true', 'phone row did not expand');
|
||||
await assertNoOverflow('expanded change set');
|
||||
await shot('expanded');
|
||||
|
||||
await page.getByRole('button', { name: 'Filters', exact: true }).click();
|
||||
await page.getByRole('dialog').first().waitFor();
|
||||
await settled();
|
||||
await assertNoOverflow('advanced filters');
|
||||
await shot('filters');
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
// A deep link to the old history route redirects to the audit page keeping
|
||||
// section, actor, since and the hash, and the feed loads with filter chips.
|
||||
const assert = require('node:assert/strict');
|
||||
const { trackAudit } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, fail }) => {
|
||||
const { lastRequest } = trackAudit(page);
|
||||
|
||||
await go('/org/audit');
|
||||
const status = await page.evaluate(async () => (await fetch('/api/auth/status')).json());
|
||||
const actor = status?.user?.id;
|
||||
assert.ok(actor, 'signed-in identity has no id');
|
||||
|
||||
const deepLink = `/settings/history?section=container-runtime-policies&actor=${encodeURIComponent(actor)}&since=30d#deep`;
|
||||
await go(deepLink);
|
||||
assert.match(page.url(), /\/org\/audit\?/, 'history did not redirect to the audit route');
|
||||
assert.match(page.url(), /section=container-runtime-policies/, 'redirect dropped section');
|
||||
assert.match(page.url(), new RegExp(`actor=${encodeURIComponent(actor)}`), 'redirect dropped actor');
|
||||
assert.match(page.url(), /since=30d/, 'redirect dropped since');
|
||||
assert.match(page.url(), /#deep$/, 'redirect dropped the hash');
|
||||
const redirected = lastRequest();
|
||||
assert.ok(redirected, 'the redirect issued no /api/audit request');
|
||||
assert.equal(redirected.searchParams.get('kind'), 'container-runtime-policies');
|
||||
assert.equal(redirected.searchParams.get('actor'), actor);
|
||||
|
||||
// The feed must be readable before anything below can mean anything. A 500
|
||||
// here is the whole page: say what the server answered instead of timing out.
|
||||
const probe = await page.evaluate(async () => {
|
||||
const response = await fetch('/api/audit?limit=1');
|
||||
return { status: response.status, body: await response.text() };
|
||||
});
|
||||
if (probe.status !== 200) {
|
||||
await shot('unavailable');
|
||||
fail(`GET /api/audit returned ${probe.status}: ${probe.body.slice(0, 200)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const kindChip = page.locator('ul[aria-label="Active filters"] li', { hasText: 'Kind:' });
|
||||
await kindChip.first().waitFor({ timeout: 8000 });
|
||||
assert.match(await kindChip.first().innerText(), /Container runtime policies/, 'kind chip missing its catalog title');
|
||||
assert.match(
|
||||
await page.locator('ul[aria-label="Active filters"] li', { hasText: 'Actor:' }).first().innerText(),
|
||||
new RegExp(actor),
|
||||
'actor chip missing',
|
||||
);
|
||||
await shot('redirect');
|
||||
await go('/org/audit');
|
||||
await page.locator('[data-row-key]').first().waitFor();
|
||||
await shot('desktop');
|
||||
};
|
||||
@@ -0,0 +1,148 @@
|
||||
// Audit retention reads the stored resource, the live tail prepends new rows
|
||||
// without a reload and holds them behind a button while scrolled away, and a
|
||||
// retention save persists. The save stays last: it must not stop the rest.
|
||||
const assert = require('node:assert/strict');
|
||||
const { trackAudit } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, fail, settled }) => {
|
||||
const { loadCount } = trackAudit(page);
|
||||
|
||||
await go('/org/audit');
|
||||
const resourceResponse = await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`);
|
||||
assert.equal(resourceResponse.status(), 200, 'audit-retention resource is unreadable');
|
||||
const retentionResource = await resourceResponse.json();
|
||||
const retentionHours = (value) => {
|
||||
const match = String(value || '').match(/^(\d+)h$/);
|
||||
return match ? Number(match[1]) : 0;
|
||||
};
|
||||
const originalHours = retentionHours(retentionResource.resource.value.runtime_event_retention);
|
||||
|
||||
const openRetention = async () => {
|
||||
await page.getByRole('button', { name: 'Audit actions', exact: true }).click();
|
||||
await page.getByRole('menuitem', { name: 'Retention', exact: true }).click();
|
||||
const dialog = page.getByRole('dialog');
|
||||
await dialog.waitFor();
|
||||
await dialog.getByLabel('Runtime event retention (hours)', { exact: true }).waitFor();
|
||||
return dialog;
|
||||
};
|
||||
|
||||
let retentionDialog = await openRetention();
|
||||
assert.match(await retentionDialog.innerText(), /Audit retention/);
|
||||
assert.equal(
|
||||
await retentionDialog.getByLabel('Runtime event retention (hours)', { exact: true }).inputValue(),
|
||||
String(originalHours),
|
||||
'retention dialog did not read the stored resource',
|
||||
);
|
||||
await retentionDialog.getByRole('button', { name: 'Cancel', exact: true }).click();
|
||||
await retentionDialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
|
||||
assert.ok(!(await retentionDialog.isVisible().catch(() => false)), 'Cancel left the retention dialog open');
|
||||
|
||||
// ---- live tail -----------------------------------------------------------
|
||||
await go('/org/audit');
|
||||
await page.evaluate(() => window.scrollTo(0, 0));
|
||||
await settled();
|
||||
const topKey = await page.locator('[data-row-key]').first().getAttribute('data-row-key');
|
||||
const loadsBeforeWrite = loadCount();
|
||||
let resource = await (await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`)).json();
|
||||
const toggleRetention = async () => {
|
||||
const current = retentionHours(resource.resource.value.runtime_event_retention);
|
||||
const next = current === 2160 ? 2161 : 2160;
|
||||
const written = await page.request.post(
|
||||
`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention/commands/replace`,
|
||||
{
|
||||
headers: { 'X-Archie-CSRF': '1', Origin: new URL(page.url()).origin },
|
||||
data: { value: { runtime_event_retention: `${next}h` }, expected_version: resource.resource.version },
|
||||
},
|
||||
);
|
||||
const body = await written.text();
|
||||
assert.equal(written.status(), 200, `retention write answered ${written.status()}: ${body.slice(0, 200)}`);
|
||||
resource = JSON.parse(body);
|
||||
};
|
||||
|
||||
await toggleRetention();
|
||||
let liveKey = null;
|
||||
for (let attempt = 0; attempt < 40; attempt += 1) {
|
||||
const key = await page.locator('[data-row-key]').first().getAttribute('data-row-key');
|
||||
if (key !== topKey) {
|
||||
liveKey = key;
|
||||
break;
|
||||
}
|
||||
await page.waitForTimeout(300);
|
||||
}
|
||||
if (!liveKey) {
|
||||
fail('live tail did not show a new row within 12s of a write');
|
||||
await shot('live');
|
||||
} else {
|
||||
assert.equal(loadCount(), loadsBeforeWrite, 'the live row required a page reload');
|
||||
assert.match(
|
||||
await page.locator(`[data-row-key="${liveKey}"]`).innerText(),
|
||||
/audit-retention/i,
|
||||
'the live row is not the write that caused it',
|
||||
);
|
||||
await shot('live');
|
||||
}
|
||||
|
||||
// Scrolled away, a new event is held behind a button instead of jumping the
|
||||
// list under the operator.
|
||||
await page.evaluate(() => window.scrollTo(0, 900));
|
||||
await settled();
|
||||
const scrolledTo = await page.evaluate(() => window.scrollY);
|
||||
assert.ok(scrolledTo > 80, 'the feed is too short to test held new events');
|
||||
const heldTop = await page.locator('[data-row-key]').first().getAttribute('data-row-key');
|
||||
await toggleRetention();
|
||||
const heldButton = page.getByRole('button', { name: /^\d+ new events?$/ }).first();
|
||||
let held = false;
|
||||
for (let attempt = 0; attempt < 40; attempt += 1) {
|
||||
if ((await heldButton.count()) && (await heldButton.isVisible().catch(() => false))) {
|
||||
held = true;
|
||||
break;
|
||||
}
|
||||
await page.waitForTimeout(300);
|
||||
}
|
||||
if (!held) {
|
||||
fail('held new events did not appear while scrolled away');
|
||||
await shot('held');
|
||||
} else {
|
||||
assert.equal(
|
||||
await page.locator('[data-row-key]').first().getAttribute('data-row-key'),
|
||||
heldTop,
|
||||
'a new row was prepended while the operator was scrolled away',
|
||||
);
|
||||
await shot('held');
|
||||
await heldButton.click();
|
||||
await page.waitForFunction(
|
||||
(top) => document.querySelector('[data-row-key]')?.getAttribute('data-row-key') !== top,
|
||||
heldTop,
|
||||
{ timeout: 8000 },
|
||||
).catch(() => {});
|
||||
await settled();
|
||||
assert.notEqual(
|
||||
await page.locator('[data-row-key]').first().getAttribute('data-row-key'),
|
||||
heldTop,
|
||||
'showing held events did not prepend the new row',
|
||||
);
|
||||
assert.ok((await page.evaluate(() => window.scrollY)) < 10, 'showing held events did not return to the top');
|
||||
}
|
||||
|
||||
// ---- retention: save -----------------------------------------------------
|
||||
// Kept last: the page error this currently raises must not stop the rest.
|
||||
await go('/org/audit');
|
||||
retentionDialog = await openRetention();
|
||||
const hoursField = retentionDialog.getByLabel('Runtime event retention (hours)', { exact: true });
|
||||
const beforeSave = await (await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`)).json();
|
||||
const beforeHours = retentionHours(beforeSave.resource.value.runtime_event_retention);
|
||||
const wanted = beforeHours === 2160 ? 2161 : 2160;
|
||||
await hoursField.fill(String(wanted));
|
||||
await retentionDialog.getByRole('button', { name: 'Save', exact: true }).click();
|
||||
await retentionDialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
|
||||
const stillOpen = await retentionDialog.isVisible().catch(() => false);
|
||||
const afterSave = await (await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`)).json();
|
||||
const afterHours = retentionHours(afterSave.resource.value.runtime_event_retention);
|
||||
if (stillOpen || afterHours !== wanted) {
|
||||
await shot('retention-save');
|
||||
fail(
|
||||
`retention save did not complete: dialog ${stillOpen ? 'stayed open' : 'closed'}, ` +
|
||||
`stored retention is ${afterHours}h (wanted ${wanted}h), URL ${page.url()}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
// A revertable change set expands to its Before/After diff, offers one Revert
|
||||
// action whose dialog cancels cleanly, and toggles from the keyboard.
|
||||
const assert = require('node:assert/strict');
|
||||
const { DEFAULT_WINDOW_MS, trackAudit } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, fail, settled }) => {
|
||||
trackAudit(page);
|
||||
|
||||
await go('/org/audit');
|
||||
await page.locator('[data-row-key]').first().waitFor();
|
||||
const from = new Date(Date.now() - DEFAULT_WINDOW_MS).toISOString();
|
||||
// The feed page size is 100: only rows in this response are rendered.
|
||||
const feed = await page.evaluate(
|
||||
async (iso) => (await fetch(`/api/audit?limit=100&from=${encodeURIComponent(iso)}`)).json(),
|
||||
from,
|
||||
);
|
||||
const records = feed.records || [];
|
||||
assert.ok(records.length, 'the seeded feed is empty');
|
||||
|
||||
const changeSet = records.find(
|
||||
(row) =>
|
||||
row.target?.kind === 'resource' &&
|
||||
(row.detail?.fields || []).length > 0 &&
|
||||
(row.detail?.version ?? 0) > 1,
|
||||
);
|
||||
if (!changeSet) {
|
||||
fail('no revertable settings change set in the feed; cannot exercise the diff or Revert');
|
||||
return;
|
||||
}
|
||||
|
||||
const row = page.locator(`[data-row-key="${changeSet.id}"]`);
|
||||
await row.waitFor();
|
||||
await row.scrollIntoViewIfNeeded();
|
||||
await row.locator('td').first().click();
|
||||
assert.equal(await row.getAttribute('aria-expanded'), 'true', 'click did not expand the change set');
|
||||
const detail = row.locator('xpath=following-sibling::tr[1]');
|
||||
await detail.getByText('Before:', { exact: false }).first().waitFor();
|
||||
assert.match(await detail.innerText(), /After:/, 'expanded change set has no after value');
|
||||
assert.equal(
|
||||
await detail.getByRole('button', { name: /^Revert \S/ }).count(),
|
||||
0,
|
||||
'the audit diff offers a per-field revert',
|
||||
);
|
||||
const revertAll = page.getByRole('button', { name: 'Revert', exact: true });
|
||||
assert.ok((await revertAll.count()) > 0, 'no Revert action on a revertable change set');
|
||||
await shot('change-set');
|
||||
|
||||
await revertAll.first().click();
|
||||
const dialog = page.getByRole('alertdialog');
|
||||
await dialog.waitFor();
|
||||
assert.match(await dialog.innerText(), /Revert this change\?/);
|
||||
assert.match(await dialog.innerText(), /previous version opens for review/i);
|
||||
await dialog.getByRole('button', { name: 'Cancel', exact: true }).click();
|
||||
await dialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
|
||||
assert.ok(!(await dialog.isVisible().catch(() => false)), 'Cancel left the revert dialog open');
|
||||
assert.equal(
|
||||
await page.getByRole('region', { name: 'Unsaved changes' }).count(),
|
||||
0,
|
||||
'Cancel touched the save bar',
|
||||
);
|
||||
|
||||
// Enter is the keyboard equivalent of clicking the row.
|
||||
await row.click();
|
||||
assert.equal(await row.getAttribute('aria-expanded'), 'false', 'the row did not collapse');
|
||||
await row.focus();
|
||||
await page.keyboard.press('Enter');
|
||||
await settled();
|
||||
assert.equal(await row.getAttribute('aria-expanded'), 'true', 'Enter did not expand the change set');
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
// A runtime event with a task target expands to its metadata and links to
|
||||
// the task. The seed's work requests park and record the event; the feed is
|
||||
// filtered to it so settings noise cannot push it off the page. Without it
|
||||
// there is nothing to exercise, so the check skips instead of failing.
|
||||
const assert = require('node:assert/strict');
|
||||
const { DEFAULT_WINDOW_MS, trackAudit } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, skip }) => {
|
||||
trackAudit(page);
|
||||
|
||||
await go('/org/audit?kind=parked');
|
||||
await page.locator('[data-row-key]').first().waitFor();
|
||||
const from = new Date(Date.now() - DEFAULT_WINDOW_MS).toISOString();
|
||||
// The feed page size is 100: only rows in this response are rendered.
|
||||
const feed = await page.evaluate(
|
||||
async (iso) => (await fetch(`/api/audit?limit=100&kind=parked&from=${encodeURIComponent(iso)}`)).json(),
|
||||
from,
|
||||
);
|
||||
const records = feed.records || [];
|
||||
const runtime = records.find((row) => row.category === 'runtime' && row.target?.kind === 'task' && row.target?.id);
|
||||
if (!runtime) {
|
||||
skip('no runtime event with a task target in the feed');
|
||||
}
|
||||
|
||||
const row = page.locator(`[data-row-key="${runtime.id}"]`);
|
||||
await row.waitFor();
|
||||
await row.scrollIntoViewIfNeeded();
|
||||
await row.locator('td').first().click();
|
||||
assert.equal(await row.getAttribute('aria-expanded'), 'true', 'runtime row did not expand');
|
||||
const detail = row.locator('xpath=following-sibling::tr[1]');
|
||||
await detail.locator('dl dt', { hasText: 'Target' }).first().waitFor();
|
||||
assert.match(await detail.innerText(), /Table/, 'runtime metadata has no table row');
|
||||
const link = detail.getByRole('link', { name: runtime.target.label || runtime.target.id, exact: true });
|
||||
assert.equal(await link.count(), 1, 'runtime target is not a link');
|
||||
assert.equal(await link.getAttribute('href'), `/tasks/${runtime.target.id}`);
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
// Audit saved views round-trip through the URL, and CSV/JSON exports carry
|
||||
// the resolved window and arrive as attachments.
|
||||
const assert = require('node:assert/strict');
|
||||
const { trackAudit, exportOnce } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, fail, settled }) => {
|
||||
const { waitForUrl } = trackAudit(page);
|
||||
|
||||
await go('/org/audit');
|
||||
await page.getByRole('button', { name: 'Runtime', exact: true }).click();
|
||||
await waitForUrl((u) => u.searchParams.get('categories') === 'runtime');
|
||||
|
||||
const viewName = `e2e-view-${Date.now()}`;
|
||||
await page.getByRole('button', { name: 'Audit actions', exact: true }).click();
|
||||
await page.getByRole('menuitem', { name: 'Save view…', exact: true }).click();
|
||||
const saveDialog = page.getByRole('dialog');
|
||||
await saveDialog.waitFor();
|
||||
await saveDialog.getByLabel('Name', { exact: true }).fill(viewName);
|
||||
await saveDialog.getByRole('button', { name: 'Save', exact: true }).click();
|
||||
await settled();
|
||||
await saveDialog.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {});
|
||||
|
||||
const savedView = page.getByRole('combobox', { name: 'Saved view', exact: true });
|
||||
await savedView.waitFor();
|
||||
assert.equal((await savedView.innerText()).trim(), viewName);
|
||||
await shot('saved-view');
|
||||
|
||||
await page.getByRole('button', { name: 'Runtime', exact: true }).click();
|
||||
await waitForUrl((u) => u.searchParams.get('categories') === null);
|
||||
await savedView.click();
|
||||
await page.getByRole('option', { name: viewName, exact: true }).click();
|
||||
await waitForUrl((u) => u.searchParams.get('categories') === 'runtime');
|
||||
assert.equal((await savedView.innerText()).trim(), viewName, 'applying the saved view did not restore it');
|
||||
|
||||
await page.getByRole('button', { name: 'Audit actions', exact: true }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete view', exact: true }).click();
|
||||
await savedView.waitFor({ state: 'detached', timeout: 5000 }).catch(() => {});
|
||||
assert.equal(await savedView.count(), 0, 'deleting the saved view left it in the picker');
|
||||
|
||||
await go('/org/audit');
|
||||
await page.getByRole('button', { name: 'Export', exact: true }).click();
|
||||
await page.getByRole('menuitem', { name: 'CSV', exact: true }).waitFor();
|
||||
await shot('export');
|
||||
await page.keyboard.press('Escape');
|
||||
|
||||
const csvBody = await exportOnce(page, fail, 'CSV', 'csv');
|
||||
if (csvBody !== null) assert.ok(csvBody.split('\n')[0].trim().length > 0, 'CSV export is empty');
|
||||
const jsonBody = await exportOnce(page, fail, 'JSON', 'json');
|
||||
if (jsonBody !== null) assert.ok(jsonBody.trimStart().startsWith('['), 'JSON export is not an array');
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
// The chat composer: IME confirmation never submits the draft, Shift+Enter
|
||||
// inserts a newline, and ordinary Enter submits and clears.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await go('/events');
|
||||
const composer = page.getByRole('textbox', { name: 'Message Archie', exact: true });
|
||||
await composer.waitFor();
|
||||
await composer.fill('Composition in progress');
|
||||
const sent = [];
|
||||
await page.route('**/api/chat/stream', async route => {
|
||||
sent.push(route.request().postDataJSON().text);
|
||||
await route.fulfill({ contentType: 'text/event-stream', body: 'data: {"type":"done","text":"Test response"}\n\n' });
|
||||
});
|
||||
for (const event of [{ isComposing: true }, { keyCode: 229 }]) {
|
||||
await composer.dispatchEvent('keydown', { key: 'Enter', bubbles: true, cancelable: true, ...event });
|
||||
assert.equal(await composer.inputValue(), 'Composition in progress', 'IME confirmation submitted the draft');
|
||||
}
|
||||
assert.equal(sent.length, 0);
|
||||
await composer.press('Shift+Enter');
|
||||
assert.ok((await composer.inputValue()).includes('\n'), 'Shift+Enter no longer inserts a newline');
|
||||
await composer.fill('Ordinary Enter submits');
|
||||
const request = page.waitForRequest('**/api/chat/stream');
|
||||
await composer.press('Enter');
|
||||
assert.equal((await request).postDataJSON().text, 'Ordinary Enter submits');
|
||||
assert.equal(await composer.inputValue(), '');
|
||||
await shot('chat-composition');
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
// Real local API records; workflow edits stay unsaved and the test agent retires.
|
||||
const assert = require('node:assert/strict');
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
const base = process.env.ARCHIE_E2E_URL || 'http://localhost:5173';
|
||||
const headers = { 'X-Archie-CSRF': '1', Origin: base };
|
||||
let agent;
|
||||
const command = async (name, display_name = '') => {
|
||||
const response = await page.request.post(`${base}/api/identities/${agent.id}/${name}`, {
|
||||
headers, data: { expected_version: agent.version, display_name },
|
||||
});
|
||||
assert.equal(response.ok(), true, await response.text());
|
||||
agent = await response.json();
|
||||
};
|
||||
const openSettings = async () => {
|
||||
await go('/workflows');
|
||||
await page.getByRole('button', { name: /^implement/ }).click();
|
||||
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();
|
||||
return page.getByRole('combobox', { name: 'Execution identity', exact: true });
|
||||
};
|
||||
try {
|
||||
const created = await page.request.post(`${base}/api/identities`, {
|
||||
headers, data: { display_name: `E2E execution agent ${Date.now()}`, kind: 'bot' },
|
||||
});
|
||||
assert.equal(created.ok(), true, await created.text());
|
||||
agent = await created.json();
|
||||
const trigger = await openSettings();
|
||||
await page.waitForFunction(() => !document.querySelector('[aria-label="Execution identity"]')?.hasAttribute('disabled'));
|
||||
await trigger.click();
|
||||
await page.getByRole('option', { name: agent.display_name, exact: true }).click();
|
||||
assert.match(await trigger.innerText(), new RegExp(agent.display_name));
|
||||
await shot('named-execution-identity');
|
||||
await command('rename', agent.display_name + ' renamed');
|
||||
await page.reload();
|
||||
const renamed = await openSettings();
|
||||
await page.waitForFunction(() => !document.querySelector('[aria-label="Execution identity"]')?.hasAttribute('disabled'));
|
||||
await renamed.click();
|
||||
await page.getByRole('option', { name: agent.display_name, exact: true }).waitFor();
|
||||
await page.keyboard.press('Escape');
|
||||
await command('suspend');
|
||||
await page.reload();
|
||||
const suspended = await openSettings();
|
||||
await page.waitForFunction(() => !document.querySelector('[aria-label="Execution identity"]')?.hasAttribute('disabled'));
|
||||
await suspended.click();
|
||||
assert.equal(await page.getByRole('option', { name: agent.display_name, exact: true }).and(page.locator(':not([data-disabled])')).count(), 0);
|
||||
} finally {
|
||||
if (agent && agent.lifecycle !== 'retired') await command('retire');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,103 @@
|
||||
// Shared setup for the audit-* checks: feed request tracking, URL waits,
|
||||
// and the export download-or-popup accept. One behaviour per check module;
|
||||
// this file holds only what several of them need.
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const DEFAULT_WINDOW_MS = 30 * 24 * 60 * 60 * 1000;
|
||||
|
||||
function isAudit(u) {
|
||||
return u.pathname === '/api/audit';
|
||||
}
|
||||
|
||||
// Installs request tracking on a fresh check page. Returns the helpers the
|
||||
// audit checks share; a check destructures only what it uses.
|
||||
function trackAudit(page) {
|
||||
page.setDefaultTimeout(10000);
|
||||
const auditRequests = [];
|
||||
page.on('request', (request) => {
|
||||
try {
|
||||
const url = new URL(request.url());
|
||||
if (isAudit(url) || url.pathname === '/api/audit/export') auditRequests.push(url);
|
||||
} catch {
|
||||
// A non-URL request cannot be an audit call.
|
||||
}
|
||||
});
|
||||
let loads = 0;
|
||||
page.on('load', () => (loads += 1));
|
||||
|
||||
const requestMatching = async (action, predicate, timeout = 6000) => {
|
||||
const waiter = page
|
||||
.waitForRequest(
|
||||
(request) => {
|
||||
try {
|
||||
const url = new URL(request.url());
|
||||
return (isAudit(url) || url.pathname === '/api/audit/export') && predicate(url);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{ timeout },
|
||||
)
|
||||
.catch(() => null);
|
||||
await action();
|
||||
return waiter;
|
||||
};
|
||||
|
||||
const waitForUrl = (predicate, timeout = 8000) =>
|
||||
page.waitForURL((url) => predicate(new URL(url)), { timeout });
|
||||
|
||||
const lastRequest = () => auditRequests[auditRequests.length - 1] || null;
|
||||
const loadCount = () => loads;
|
||||
|
||||
return { requestMatching, waitForUrl, lastRequest, loadCount };
|
||||
}
|
||||
|
||||
// Export resolves its window at click time and opens a tab. A successful
|
||||
// export arrives as an attachment download; a failed one stays visible in
|
||||
// that tab, so the check accepts either and reads the response from it.
|
||||
async function exportOnce(page, fail, label, extension) {
|
||||
await page.getByRole('button', { name: 'Export', exact: true }).click();
|
||||
const item = page.getByRole('menuitem', { name: label, exact: true });
|
||||
await item.waitFor();
|
||||
const downloadP = page.waitForEvent('download', { timeout: 15000 }).then((download) => ({ download })).catch(() => null);
|
||||
const popupP = page.waitForEvent('popup', { timeout: 15000 }).then((popup) => ({ popup })).catch(() => null);
|
||||
await item.click();
|
||||
const settled = await Promise.race([downloadP, popupP]);
|
||||
if (!settled) {
|
||||
fail(`${label} export neither downloaded nor opened a tab`);
|
||||
return null;
|
||||
}
|
||||
if (settled.popup) {
|
||||
await settled.popup.waitForLoadState('load').catch(() => {});
|
||||
const url = new URL(settled.popup.url());
|
||||
assert.equal(url.pathname, '/api/audit/export', `${label} opened ${url.href}`);
|
||||
assert.equal(url.searchParams.get('format'), extension);
|
||||
assert.ok(url.searchParams.get('from'), `${label} export has no explicit start`);
|
||||
assert.ok(url.searchParams.get('to'), `${label} export has no explicit end`);
|
||||
const response = await page.request.get(url.href);
|
||||
const body = await response.text();
|
||||
if (response.status() !== 200) {
|
||||
fail(`${label} export failed (${response.status()}): ${body.slice(0, 200)}`);
|
||||
return null;
|
||||
}
|
||||
if (!new RegExp(`attachment;.*\\.${extension}`).test(response.headers()['content-disposition'] || '')) {
|
||||
fail(`${label} export opened a tab without an attachment filename`);
|
||||
return null;
|
||||
}
|
||||
return body;
|
||||
}
|
||||
if (!new RegExp(`\\.${extension}$`).test(settled.download.suggestedFilename())) {
|
||||
fail(`${label} export did not download a .${extension} file`);
|
||||
return null;
|
||||
}
|
||||
const failure = await settled.download.failure();
|
||||
if (failure) {
|
||||
fail(`${label} download failed: ${failure}`);
|
||||
return null;
|
||||
}
|
||||
const saved = await settled.download.path();
|
||||
return saved ? fs.readFileSync(saved, 'utf8') : '';
|
||||
}
|
||||
|
||||
module.exports = { DEFAULT_WINDOW_MS, isAudit, trackAudit, exportOnce };
|
||||
@@ -0,0 +1,18 @@
|
||||
// Shared by the org-* and setup checks: acting in a seeded org and the 404s a
|
||||
// fresh org's pages are built to survive.
|
||||
const ORG = { home: 'org-sys', beta: 'org-beta', outsider: 'org-gamma' };
|
||||
|
||||
// A new org has written no documents, and the instance-only reads answer
|
||||
// not found outside the system org.
|
||||
const ABSENT = /status of 404.*\/api\/(control-plane|schedules|identities)/;
|
||||
|
||||
// Selects an org the way the topbar does, over the page's own session.
|
||||
async function selectOrg(page, id) {
|
||||
const origin = new URL(page.url() === 'about:blank' ? 'http://localhost:5173' : page.url()).origin;
|
||||
return page.request.put(`${origin}/api/orgs/current`, {
|
||||
headers: { 'X-Archie-CSRF': '1', Origin: origin },
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { ORG, ABSENT, selectOrg };
|
||||
@@ -0,0 +1,19 @@
|
||||
const assert=require('node:assert/strict');
|
||||
module.exports=async({page,go,shot})=>{
|
||||
await page.route('**/api/access/policies',async route=>{await new Promise(r=>setTimeout(r,2200));await route.continue()});
|
||||
await go('/access/policies');
|
||||
assert.equal(await page.getByText('No policies yet.',{exact:true}).count(),0);
|
||||
await page.getByText('Loading policies…',{exact:true}).waitFor({state:'hidden'});
|
||||
await page.route('**/api/tasks?**',async route=>{
|
||||
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 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);
|
||||
await page.unroute('**/api/tasks?**');
|
||||
await page.getByRole('button',{name:'Retry runs',exact:true}).click();
|
||||
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor({state:'hidden'});
|
||||
await shot('recovered');
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
// The save response is mocked; this checks the page's save path without changing models.
|
||||
const assert=require('node:assert/strict');
|
||||
module.exports=async({page,go,shot})=>{
|
||||
let submitted;
|
||||
await page.route('**/api/control-plane/resources/model-aliases/commands/replace',async route=>{
|
||||
submitted=route.request().postDataJSON();
|
||||
await route.fulfill({json:{resource:{kind:'model-aliases',version:submitted.expected_version+1,value:submitted.value}}});
|
||||
});
|
||||
await go('/access/models');
|
||||
await page.getByLabel('New alias',{exact:true}).fill('e2e-test');
|
||||
await page.getByRole('button',{name:'Add alias',exact:true}).click();
|
||||
await page.getByLabel('e2e-test',{exact:true}).fill('test/model');
|
||||
await page.getByRole('button',{name:'Review and save',exact:true}).click();
|
||||
await page.getByRole('button',{name:'Save',exact:true}).click();
|
||||
await page.getByRole('heading',{name:/^Review \d/}).waitFor({state:'hidden'});
|
||||
assert.equal(submitted?.value['e2e-test'],'test/model');
|
||||
await shot('saved');
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
// The organisation pages: each loads its form in the selected org, and the old
|
||||
// settings audit route lands on the organisation's audit page.
|
||||
const assert = require('node:assert/strict');
|
||||
const { trackAudit } = require('./helpers/audit-helpers.cjs');
|
||||
|
||||
const PAGES = [
|
||||
{ path: '/org/channels', heading: 'Channels', text: 'Chat session defaults' },
|
||||
{ path: '/org/scheduling-policy', heading: 'Scheduling policy', text: 'Retries and polling' },
|
||||
{ path: '/org/alerts', heading: 'Alert webhook', text: 'Webhook severity' },
|
||||
];
|
||||
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
for (const { path, heading, text } of PAGES) {
|
||||
await go(path);
|
||||
await page.getByRole('heading', { name: heading, exact: true }).waitFor();
|
||||
await page.getByText(text, { exact: true }).first().waitFor();
|
||||
assert.equal(new URL(page.url()).pathname, path);
|
||||
await shot(path);
|
||||
}
|
||||
|
||||
trackAudit(page);
|
||||
await go('/org/audit');
|
||||
await page.getByRole('heading', { name: 'Audit', exact: true }).first().waitFor();
|
||||
await page.locator('[data-row-key]').first().waitFor();
|
||||
await shot('/org/audit');
|
||||
await go('/settings/audit?since=7d');
|
||||
assert.equal(new URL(page.url()).pathname, '/org/audit', '/settings/audit did not redirect');
|
||||
assert.equal(new URL(page.url()).searchParams.get('since'), '7d', 'redirect dropped the query');
|
||||
await page.locator('[data-row-key]').first().waitFor();
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
// A non-system org can arm a schedule trigger: the schedule source's built-in
|
||||
// mapping is readable there, so a binding on it is accepted. The editor's own
|
||||
// schedule list is instance-only, so the binding is written over the API.
|
||||
const assert = require('node:assert/strict');
|
||||
const { ORG, ABSENT, selectOrg } = require('./helpers/org-helpers.cjs');
|
||||
|
||||
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');
|
||||
const origin = new URL(page.url()).origin;
|
||||
const headers = { 'X-Archie-CSRF': '1', Origin: origin };
|
||||
const created = await page.request.post(`${origin}/api/bindings`, {
|
||||
headers,
|
||||
data: {
|
||||
name: 'e2e schedule trigger', matcher: { source: 'schedule' }, mapping_id: 'schedule-fired',
|
||||
filter: 'schedule_id == "issue-discovery"', workflow: 'feasibility', repo_param: '', owner: '', repo: '', inputs: {},
|
||||
},
|
||||
});
|
||||
try {
|
||||
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 page.getByText('Starts when').first().waitFor();
|
||||
await shot('beta-trigger');
|
||||
} finally {
|
||||
if (created.ok()) await page.request.delete(`${origin}/api/bindings/${(await created.json()).id}`, { headers });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
// The sidebar org switcher: choosing a member org reloads the dashboard into it,
|
||||
// Tasks and Workflows then show only that org's work, and the API refuses an
|
||||
// org the caller is not a member of.
|
||||
const assert = require('node:assert/strict');
|
||||
const { ORG, ABSENT, selectOrg } = require('./helpers/org-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, settled, tolerate }) => {
|
||||
tolerate(ABSENT);
|
||||
await go('/tasks');
|
||||
await page.getByText('Fix flaky login test').first().waitFor();
|
||||
const picker = page.getByRole('button', { name: /^Organisation: / });
|
||||
await picker.waitFor();
|
||||
const offered = await (async () => {
|
||||
await picker.click();
|
||||
await page.getByRole('menuitem').first().waitFor();
|
||||
const names = (await page.getByRole('menuitem').allInnerTexts()).map(t => t.trim().split('\n').pop().trim());
|
||||
await page.keyboard.press('Escape');
|
||||
return names;
|
||||
})();
|
||||
assert.deepEqual(offered.sort(), ['Beta', 'E2E'], 'selector must offer exactly the orgs the caller belongs to');
|
||||
await go('/workflows');
|
||||
await page.getByText('Parked', { exact: true }).first().waitFor();
|
||||
await shot('home-org-workflows');
|
||||
|
||||
await picker.click();
|
||||
await Promise.all([page.waitForEvent('load'), page.getByRole('menuitem', { name: 'Beta' }).click()]);
|
||||
await settled('/workflows');
|
||||
await page.getByRole('button', { name: /^Organisation: / }).waitFor();
|
||||
assert.equal(await page.getByText('Parked', { exact: true }).count(), 0, 'workflow run counts leaked across orgs');
|
||||
await shot('beta-workflows');
|
||||
await go('/tasks');
|
||||
await page.getByText('No tasks yet').waitFor();
|
||||
assert.equal(await page.getByText('Fix flaky login test').count(), 0, 'tasks leaked across orgs');
|
||||
await shot('beta-tasks');
|
||||
|
||||
// The selector never writes an org the caller is outside of; the server decides.
|
||||
const refused = await selectOrg(page, ORG.outsider);
|
||||
assert.equal(refused.status(), 403, 'selecting a non-member org must be forbidden');
|
||||
await go('/tasks');
|
||||
await page.getByText('No tasks yet').waitFor();
|
||||
assert.equal((await selectOrg(page, ORG.home)).status(), 204);
|
||||
await go('/tasks');
|
||||
await page.getByText('Fix flaky login test').first().waitFor();
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
// Repositories and connections say what stops them serving work: the seeded
|
||||
// repository has no connection, and the seeded connection's forge is not enabled.
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await go('/org/repositories');
|
||||
await page.getByText('acme/widgets', { exact: true }).first().waitFor();
|
||||
await page.getByText('No connection', { exact: true }).waitFor();
|
||||
await shot('repositories');
|
||||
|
||||
await go('/org/connections');
|
||||
await page.getByText('github.com', { exact: true }).first().waitFor();
|
||||
await page.getByText('Forge not enabled', { exact: true }).waitFor();
|
||||
await shot('connections');
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
// Draft edits only: no saved configuration is changed.
|
||||
const assert = require('node:assert/strict');
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await go('/settings/channels');
|
||||
const workspace = page.getByLabel('Workspace', { exact: true });
|
||||
assert.equal(await page.getByRole('region', { name: 'Unsaved changes' }).count(), 0, 'unsaved bar before any edit');
|
||||
await workspace.fill('/srv/e2e-workspace');
|
||||
await page.getByRole('link', { name: 'Models', exact: true }).click();
|
||||
await page.getByRole('heading', { name: 'Models' }).waitFor();
|
||||
await page.getByRole('link', { name: 'Channels', exact: true }).click();
|
||||
assert.equal(await page.getByLabel('Workspace', { exact: true }).inputValue(), '/srv/e2e-workspace', 'edit lost on navigation');
|
||||
const form = await page.getByText('Chat session defaults', { exact: true }).evaluate(el => el.closest('[data-slot="card"]').getBoundingClientRect().width);
|
||||
assert.ok(form <= 850, `settings form stretched to ${form}px`);
|
||||
const review = page.getByRole('button', { name: 'Review and save', exact: true });
|
||||
await review.scrollIntoViewIfNeeded();
|
||||
const unobscured = await review.evaluate(el => { const r=el.getBoundingClientRect(); const hit=document.elementFromPoint(r.x+r.width/2,r.y+r.height/2); return hit && el.contains(hit); });
|
||||
assert.ok(unobscured, 'Review and save is covered');
|
||||
await review.click();
|
||||
await page.getByRole('heading', { name: /^Review \d/ }).waitFor();
|
||||
await page.getByText('/srv/e2e-workspace', { exact: false }).last().waitFor();
|
||||
await shot('review');
|
||||
await page.getByRole('button', { name: 'Discard all', exact: true }).click();
|
||||
assert.equal(await page.getByRole('region', { name: 'Unsaved changes' }).count(), 0);
|
||||
assert.equal(await page.getByLabel('Workspace', { exact: true }).inputValue(), '', 'discard kept the edit');
|
||||
await page.setViewportSize({width:390,height:844});
|
||||
await page.getByLabel('Workspace', { exact: true }).fill('/srv/e2e-workspace');
|
||||
const mobileReview=page.getByRole('button',{name:'Review and save',exact:true});
|
||||
await mobileReview.scrollIntoViewIfNeeded();
|
||||
assert.ok(await mobileReview.evaluate(el=>{const r=el.getBoundingClientRect();return el.contains(document.elementFromPoint(r.x+r.width/2,r.y+r.height/2))}), 'mobile save action covered');
|
||||
await shot('mobile');
|
||||
await page.getByRole('button',{name:'Discard',exact:true}).click();
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
// The setup checklist reads the selected org: an org with no model to run gets a
|
||||
// Model step that leads to the page that fixes it.
|
||||
const assert = require('node:assert/strict');
|
||||
const { ORG, ABSENT, selectOrg } = require('./helpers/org-helpers.cjs');
|
||||
|
||||
module.exports = async ({ page, go, shot, settled, tolerate }) => {
|
||||
tolerate(ABSENT);
|
||||
await go('/');
|
||||
await page.getByPlaceholder('Describe a task').waitFor();
|
||||
assert.equal(await page.getByRole('link', { name: 'Model', exact: true }).count(), 0, 'an org with a model got a Model step');
|
||||
assert.equal((await selectOrg(page, ORG.beta)).status(), 204);
|
||||
await go('/');
|
||||
await page.getByText('Setup', { exact: true }).waitFor();
|
||||
const model = page.getByRole('link', { name: 'Model', exact: true });
|
||||
await model.waitFor();
|
||||
assert.equal(await model.getAttribute('href'), '/org/models');
|
||||
await shot('beta-dashboard');
|
||||
await model.click();
|
||||
await settled('/org/models');
|
||||
await shot('model-page');
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
const assert=require('node:assert/strict');
|
||||
module.exports=async({page,go,shot})=>{
|
||||
await go('/tasks');
|
||||
const base=new URL(page.url()).origin;
|
||||
const tasks=await (await page.request.get(base+'/api/tasks')).json();
|
||||
const task=tasks.find(t=>t.status==='parked' && t.attempt>0);
|
||||
assert.ok(task,'seeded stack has no parked attempt to inspect');
|
||||
const state=await (await page.request.get(`${base}/api/tasks/${task.id}/attempts`)).json();
|
||||
assert.ok(state.attempts.some(a=>a.attempt===state.current_attempt),'claimed current attempt missing');
|
||||
await go(`/tasks/${task.id}`);
|
||||
assert.equal(await page.getByText(`Attempt ${state.current_attempt} is not recorded`,{exact:true}).count(),0);
|
||||
const logs=await (await page.request.get(`${base}/api/tasks/${task.id}/logs?attempt=${state.current_attempt}&level=ERROR&limit=1`)).json();
|
||||
await page.getByRole('button',{name:'Jump to log line',exact:true}).click();
|
||||
if(logs.entries?.[0]?.id){
|
||||
await page.locator(`[data-row-key="${logs.entries[0].id}"]`).waitFor();
|
||||
await page.waitForFunction(id=>document.activeElement?.getAttribute('data-row-key')===String(id),logs.entries[0].id);
|
||||
}else{
|
||||
await page.getByText('No error log line was recorded for this attempt.',{exact:true}).waitFor();
|
||||
}
|
||||
await shot('attempt');
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
// A parked task whose blocker has a fix links to the page that supplies it, from
|
||||
// Needs attention on the dashboard and from the Stage Rail on the task page.
|
||||
// The seed's work requests park for want of a repository connection.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
module.exports = async ({ page, go, shot, settled, skip }) => {
|
||||
await go('/');
|
||||
const tasks = await page.evaluate(async () => (await fetch('/api/tasks?limit=100')).json());
|
||||
if (!tasks.some((task) => task.status === 'parked')) skip('no parked task');
|
||||
const parked = tasks.find((task) => task.status === 'parked' && task.recovery);
|
||||
assert.ok(parked, 'no parked task in the list carries a recovery link');
|
||||
const { label, link } = parked.recovery;
|
||||
|
||||
const row = page.getByRole('link', { name: parked.title, exact: true }).locator('xpath=ancestor::*[.//a[normalize-space()="' + label + '"]][1]');
|
||||
const fromDashboard = row.getByRole('link', { name: label, exact: true });
|
||||
await fromDashboard.waitFor();
|
||||
assert.equal(await fromDashboard.getAttribute('href'), link);
|
||||
await shot('needs-attention');
|
||||
await fromDashboard.click();
|
||||
await settled(link);
|
||||
|
||||
await go(`/tasks/${parked.id}`);
|
||||
const fromRail = page.getByRole('complementary', { name: 'Task details' }).getByRole('link', { name: label, exact: true });
|
||||
await fromRail.waitFor();
|
||||
assert.equal(await fromRail.getAttribute('href'), link);
|
||||
await shot('stage-rail');
|
||||
await fromRail.click();
|
||||
await settled(link);
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
const assert = require('node:assert/strict');
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await page.route('**/api/control-plane/resources/workflow-definitions', async route => {
|
||||
await new Promise(resolve => setTimeout(resolve, 2200));
|
||||
await route.continue();
|
||||
});
|
||||
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();
|
||||
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');
|
||||
};
|
||||
@@ -0,0 +1,118 @@
|
||||
// Workflow definition behaviour at desktop width: legacy title IDs migrate
|
||||
// to slugs, invalid expressions flag the node and toolbar alike, a pinned
|
||||
// historical run keeps its original step IDs inspectable, and handoff
|
||||
// targets round-trip between the step form and YAML.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
module.exports = async ({ page, go, shot, settled }) => {
|
||||
await page.route('**/api/control-plane/resources/workflow-drafts', async route => {
|
||||
const response = await route.fetch();
|
||||
const data = await response.json();
|
||||
data.resource.value = { drafts: [] };
|
||||
await route.fulfill({ json: data });
|
||||
});
|
||||
const panTo = async node => {
|
||||
const flow = page.locator('.vue-flow');
|
||||
await flow.hover();
|
||||
for (let adjustment = 0; adjustment < 3; adjustment++) {
|
||||
const target = await node.boundingBox(), viewport = await flow.boundingBox();
|
||||
const delta = target.y + target.height / 2 - viewport.y - viewport.height / 2;
|
||||
if (Math.abs(delta) < 30) break;
|
||||
await page.mouse.wheel(0, delta * 2);
|
||||
await settled();
|
||||
}
|
||||
};
|
||||
// Reproduce a previously stored title ID without changing the test server.
|
||||
await go('/workflows');
|
||||
const response = await page.request.get(new URL('/api/control-plane/resources/workflow-definitions', page.url()).href);
|
||||
const resource = await response.json();
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
await shot('legacy-reference');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.getByRole('tab', { name: 'YAML', 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();
|
||||
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') });
|
||||
assert.equal(await problem.evaluate(el => getComputedStyle(el).color), await toolbarProblem.evaluate(el => getComputedStyle(el).color));
|
||||
const invalidPage = await page.evaluate(() => ({
|
||||
scrollWidth: document.documentElement.scrollWidth, width: innerWidth,
|
||||
}));
|
||||
assert.equal(invalidPage.scrollWidth, invalidPage.width, 'invalid toolbar overflows');
|
||||
await shot('validation');
|
||||
// A pinned historical run keeps its original step IDs and remains inspectable.
|
||||
const snapshot = definition.yaml;
|
||||
await page.route('**/api/tasks?*', route => {
|
||||
const workflow = new URL(route.request().url()).searchParams.get('workflow');
|
||||
return workflow === 'feasibility'
|
||||
? route.fulfill({ json: [{ id: 999999, workflow, title: 'Historical run', status: 'failed', workflow_definition_yaml: snapshot }] })
|
||||
: route.continue();
|
||||
});
|
||||
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');
|
||||
const picker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
await picker.waitFor();
|
||||
assert.match(await picker.innerText(), /Run #999999/);
|
||||
const root = await page.locator('.vue-flow__node[data-id="workflow"]').boundingBox();
|
||||
const pinnedCanvas = await page.locator('.workflow-canvas').boundingBox();
|
||||
assert.ok(root.y >= pinnedCanvas.y, 'historical workflow header clipped above canvas');
|
||||
await shot('run-picker');
|
||||
await page.locator('.vue-flow').hover();
|
||||
await page.mouse.wheel(0, 550);
|
||||
await settled();
|
||||
const historicalStep = page.locator('.vue-flow__node').filter({ hasText: 'Write a Product Requirement Document' }).first();
|
||||
await panTo(historicalStep);
|
||||
await historicalStep.click();
|
||||
await page.getByText('Historical failure', { exact: true }).first().waitFor();
|
||||
await shot('historical-run');
|
||||
await page.keyboard.press('Escape');
|
||||
await picker.click();
|
||||
await page.getByRole('option', { name: 'Definition', exact: true }).click();
|
||||
assert.equal(await picker.innerText(), 'Definition');
|
||||
await shot('definition-picker');
|
||||
await go('/workflows?workflow=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();
|
||||
await page.mouse.wheel(0, 650);
|
||||
await settled();
|
||||
const handoff = page.locator('.vue-flow__node').filter({ hasText: 'Hand off' }).first();
|
||||
await panTo(handoff);
|
||||
await handoff.click();
|
||||
const target = handoff.getByLabel('Workflow', { exact: true });
|
||||
await target.waitFor();
|
||||
assert.equal(await target.inputValue(), '{{ steps.classify.result.workflow }}');
|
||||
await target.fill('{{ steps.classify.result.alternative }}');
|
||||
await target.press('Home');
|
||||
await shot('dynamic-handoff');
|
||||
await page.keyboard.press('Escape');
|
||||
await page.getByRole('tab', { name: 'YAML', 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 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();
|
||||
assert.ok((await page.getByLabel('Workflow YAML', { exact: true }).inputValue()).includes('workflow: implement'));
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
// The workflow canvas at phone width: no page scroll, a clean topbar, lanes
|
||||
// inside the canvas, zoom controls below the graph, step and run dialogs
|
||||
// that fit, YAML without page scroll, and a pinned run header that stays
|
||||
// visible.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
module.exports = async ({ page, go, shot, settled }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
for (const workflow of ['implement', 'feasibility']) {
|
||||
await go(`/workflows?workflow=${workflow}`);
|
||||
const canvas = page.locator('.workflow-canvas');
|
||||
await canvas.waitFor();
|
||||
const dimensions = await page.evaluate(() => ({
|
||||
height: innerHeight, width: innerWidth,
|
||||
scrollHeight: document.documentElement.scrollHeight,
|
||||
scrollWidth: document.documentElement.scrollWidth,
|
||||
}));
|
||||
assert.equal(dimensions.scrollHeight, dimensions.height, 'workflow page scrolls vertically');
|
||||
assert.equal(dimensions.scrollWidth, dimensions.width, 'workflow page scrolls horizontally');
|
||||
const topbar = page.locator('header').first();
|
||||
const bar = await topbar.boundingBox();
|
||||
assert.equal(bar.y, 0, 'blank band above topbar');
|
||||
assert.equal(await topbar.evaluate(el => getComputedStyle(el).backdropFilter), 'none');
|
||||
assert.ok(!await canvas.getByText('Works on a repository', { exact: true }).count());
|
||||
const run = page.getByRole('button', { name: new RegExp(`^(Run|Test) ${workflow}$`) });
|
||||
assert.ok(await run.isVisible(), 'Run hidden on phone');
|
||||
const box = await canvas.boundingBox();
|
||||
const start = await page.locator('.vue-flow__node[data-id="start"]').boundingBox();
|
||||
assert.ok(start.y >= box.y && start.y < box.y + box.height, 'start is outside initial viewport');
|
||||
const nodes = await page.locator('.vue-flow__node').evaluateAll(elements => elements.map(el => ({
|
||||
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');
|
||||
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');
|
||||
await step.click();
|
||||
const dialog = page.getByRole('dialog');
|
||||
await dialog.waitFor();
|
||||
const dialogBox = await dialog.boundingBox();
|
||||
assert.ok(dialogBox.x >= 0 && dialogBox.x + dialogBox.width <= 390, 'step editor exceeds phone width');
|
||||
const input = dialog.getByRole('textbox').first();
|
||||
if (await input.count()) assert.ok(await input.evaluate(el => el.getBoundingClientRect().height) >= 24, 'step form scaled down');
|
||||
await shot(`${workflow}-step`);
|
||||
await page.keyboard.press('Escape');
|
||||
await run.click();
|
||||
await page.getByRole('dialog').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 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();
|
||||
// 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();
|
||||
const snapshot = resource.resource.value.definitions.find(entry => entry.id === 'feasibility').yaml;
|
||||
await page.route('**/api/tasks?*', route => {
|
||||
const workflow = new URL(route.request().url()).searchParams.get('workflow');
|
||||
return workflow === 'feasibility'
|
||||
? route.fulfill({ json: [{ id: 999999, workflow, title: 'Historical run', status: 'failed', workflow_definition_yaml: snapshot }] })
|
||||
: route.continue();
|
||||
});
|
||||
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');
|
||||
const picker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
|
||||
await picker.waitFor();
|
||||
assert.match(await picker.innerText(), /Run #999999/);
|
||||
const root = await page.locator('.vue-flow__node[data-id="workflow"]').boundingBox();
|
||||
const pinnedCanvas = await page.locator('.workflow-canvas').boundingBox();
|
||||
assert.ok(root.y >= pinnedCanvas.y, 'historical workflow header clipped above canvas');
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
const assert = require('node:assert/strict');
|
||||
module.exports = async ({ page, go, shot }) => {
|
||||
await go('/workflows');
|
||||
await page.getByRole('button', {name:/^implement/}).click();
|
||||
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 condition=page.getByLabel('Run only when', {exact:true});
|
||||
await condition.fill('what');
|
||||
await page.getByRole('alert').filter({hasText:'when must name'}).first().waitFor();
|
||||
await condition.fill('task.title');
|
||||
await page.getByRole('alert').filter({hasText:'when must name'}).first().waitFor({state:'hidden'});
|
||||
const backoff=page.getByLabel('Retry backoff',{exact:true});
|
||||
await backoff.fill('yes');
|
||||
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor();
|
||||
await backoff.fill('0.5');
|
||||
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();
|
||||
assert.match(await page.getByLabel('Workflow YAML',{exact:true}).inputValue(), /backoff: 30s/);
|
||||
await shot('validated');
|
||||
};
|
||||
Generated
-42
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "archie-e2e",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "archie-e2e",
|
||||
"devDependencies": {
|
||||
"playwright": "1.64.0"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright": {
|
||||
"version": "1.64.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.0.tgz",
|
||||
"integrity": "sha512-kVzTnYFYEyQ9RGzBjNCd2+yEqWmVbxl3AHPynv3qQ6JTjv4a+kwRcnqQwIpuP3NnrnIrE/Q6wWAIAvMfIE2/Yg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright-core": "1.64.0"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.64.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.0.tgz",
|
||||
"integrity": "sha512-T9r+MZkTECl2+oUcZ26YgZzTrYidTsIhYYkJix+6iDOymOb1FB2RLLSOxRGnZGv5DStt+aduIVbt+E8WygXYpg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"playwright-core": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,5 +7,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"playwright": "1.64.0"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@12.10.1"
|
||||
}
|
||||
Generated
+191
@@ -0,0 +1,191 @@
|
||||
---
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
configDependencies: {}
|
||||
packageManagerDependencies:
|
||||
pnpm:
|
||||
specifier: 12.10.1
|
||||
version: 12.10.1
|
||||
|
||||
packages:
|
||||
|
||||
'@pnpm/exe.android-arm64@12.10.1':
|
||||
resolution: {integrity: sha512-CVTlHPwNvadQCJD9bGSMzWIhFX8QpjtqC2c27dhdnn/9iKzEjZ3qL62o3gHpKbIuo6qn4WxTKRoaokgNdReBig==}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@pnpm/exe.android-x64@12.10.1':
|
||||
resolution: {integrity: sha512-NFiYLIaodY7da0XIebwcU3JoP7IK/lzF7zgKSSP+9H+QcFnQ1GDfBkuBKCYJzZ+Xu0WH54neIPLBBCaOjaaauA==}
|
||||
cpu: [x64]
|
||||
os: [android]
|
||||
|
||||
'@pnpm/exe.darwin-arm64@12.10.1':
|
||||
resolution: {integrity: sha512-0O8tdQ8ijlPJudXspLMTcitMkdBEz6uUflazL5uQE0WMs85oQIp0U+5hfEktMFB64QqEhjqlvvujTwbzdr9oMg==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@pnpm/exe.darwin-x64@12.10.1':
|
||||
resolution: {integrity: sha512-ud+1/uZOKEo8P/AsPynOJc/LNwfI0j6WwCElibj71rU9l4nIBnsSn+wWTIPZPkZ4BBSH5+82azSnAARMyJ1lNA==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@pnpm/exe.freebsd-x64@12.10.1':
|
||||
resolution: {integrity: sha512-mj9PE5rf8uAfQQ2K66HSATMSut+lNiB4eSqFd5+azFVCMnxNSy/32xpZQJT21PhnN3Y4qbK+iKHe5nWAxSuRhw==}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@pnpm/exe.linux-arm64-musl@12.10.1':
|
||||
resolution: {integrity: sha512-xba+00wZJ8Um6rBJJjWl88uJj0tydB8dtomvjlCLvi0uL32vpa9CRP8Vv26FIXvbiZ1bo2RCzYt/eChxJVV52w==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@pnpm/exe.linux-arm64@12.10.1':
|
||||
resolution: {integrity: sha512-oBdMp69ScC9UnniG4qZAQVr2fBDSXjm4yk/72vkEVyrlwS23yMxcRQl7Qdo3sgXPAygY6TWnPRKm4rXzjoyW7w==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-ppc64@12.10.1':
|
||||
resolution: {integrity: sha512-Yyb3wu09h3c7mLme270uHFiVaAIUHC411Ru9LIU2BKUIstrGlXa9OqqVWoXaRgYRdFdOFknkwG7GNn6ygwLbnw==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-riscv64@12.10.1':
|
||||
resolution: {integrity: sha512-PdkeUFFkybknnGkWP0H22eMpIiS4OZXL5BcQzF4lh+vmrW3IaC2HOkbANKgot/PKO0Kl77pzA/6PKFxgbgfXIQ==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-s390x@12.10.1':
|
||||
resolution: {integrity: sha512-1okKuHKJwJPAbofDxfhZWAUxEWtee4ZSf7Pah8kcvocaJkf2WxFJ5KVTiNIvDml5GLidDQsgf7Pcf/WHbCak7Q==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-x64-musl@12.10.1':
|
||||
resolution: {integrity: sha512-e6IqzVNkPa7srFKJKnY23uWJ+qz0LaRWiTUo/sHfFXRRMRzB5uNOr6qWWip/jqhdGwU91n9J7LrEYZ6e0tRczw==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@pnpm/exe.linux-x64@12.10.1':
|
||||
resolution: {integrity: sha512-ZByV0DRgWzGaDSjT5ddRBASdwz+r/qPMYh7o6RGmPQjtRGNFbSl94xY2DcAM8mqCOZJUUDtAXQ+wpBXcdpKlkg==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.win32-arm64@12.10.1':
|
||||
resolution: {integrity: sha512-I7QZHcjioG7orFeCRUFUHByJ1G0zFPnAlaGGyrUvb6MGkv5oeNwNPl7t+Gp+7zHfnMcgLGJ1a+Wfim0IDw3lOw==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@pnpm/exe.win32-x64@12.10.1':
|
||||
resolution: {integrity: sha512-4WJFdp58EKlCj0zLobrXU0vpszSZIr4X/3y/uNbAQqGW0zE+VdruZB0gFc3L2kzsUzVwTYbaCn+XEhnCYSAlTg==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
pnpm@12.10.1:
|
||||
resolution: {integrity: sha512-ukCjfrGjcNYP6oxM8dNkwTvMzvUY6YrSvO6VT1OdONo3RY5YJho/pV4GUjRQ6g//+fSXsTW+QfLBXBZCusrObA==}
|
||||
engines: {node: '>=18.*'}
|
||||
hasBin: true
|
||||
|
||||
snapshots:
|
||||
|
||||
'@pnpm/exe.android-arm64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.android-x64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.darwin-arm64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.darwin-x64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.freebsd-x64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-arm64-musl@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-arm64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-ppc64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-riscv64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-s390x@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-x64-musl@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-x64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.win32-arm64@12.10.1':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.win32-x64@12.10.1':
|
||||
optional: true
|
||||
|
||||
pnpm@12.10.1:
|
||||
optionalDependencies:
|
||||
'@pnpm/exe.android-arm64': 12.10.1
|
||||
'@pnpm/exe.android-x64': 12.10.1
|
||||
'@pnpm/exe.darwin-arm64': 12.10.1
|
||||
'@pnpm/exe.darwin-x64': 12.10.1
|
||||
'@pnpm/exe.freebsd-x64': 12.10.1
|
||||
'@pnpm/exe.linux-arm64': 12.10.1
|
||||
'@pnpm/exe.linux-arm64-musl': 12.10.1
|
||||
'@pnpm/exe.linux-ppc64': 12.10.1
|
||||
'@pnpm/exe.linux-riscv64': 12.10.1
|
||||
'@pnpm/exe.linux-s390x': 12.10.1
|
||||
'@pnpm/exe.linux-x64': 12.10.1
|
||||
'@pnpm/exe.linux-x64-musl': 12.10.1
|
||||
'@pnpm/exe.win32-arm64': 12.10.1
|
||||
'@pnpm/exe.win32-x64': 12.10.1
|
||||
|
||||
---
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
devDependencies:
|
||||
playwright:
|
||||
specifier: 1.64.0
|
||||
version: 1.64.0
|
||||
|
||||
packages:
|
||||
|
||||
playwright-core@1.64.0:
|
||||
resolution: {integrity: sha512-T9r+MZkTECl2+oUcZ26YgZzTrYidTsIhYYkJix+6iDOymOb1FB2RLLSOxRGnZGv5DStt+aduIVbt+E8WygXYpg==}
|
||||
engines: {node: '>=20'}
|
||||
hasBin: true
|
||||
|
||||
playwright@1.64.0:
|
||||
resolution: {integrity: sha512-kVzTnYFYEyQ9RGzBjNCd2+yEqWmVbxl3AHPynv3qQ6JTjv4a+kwRcnqQwIpuP3NnrnIrE/Q6wWAIAvMfIE2/Yg==}
|
||||
engines: {node: '>=20'}
|
||||
hasBin: true
|
||||
|
||||
snapshots:
|
||||
|
||||
playwright-core@1.64.0: {}
|
||||
|
||||
playwright@1.64.0:
|
||||
dependencies:
|
||||
playwright-core: 1.64.0
|
||||
+142
-18
@@ -1,58 +1,182 @@
|
||||
// Drive the dashboard of a running local stack (e2e/stack.sh) in headless
|
||||
// Chromium. Each module in checks/ exports async ({ page, go, shot, fail }).
|
||||
// A check fails on a thrown error or any console or page error.
|
||||
// Drive the dashboard of a running local stack (e2e/stack.sh) in Chromium. Each module in checks/ exports async ({ page, go, shot, fail, skip, settled }).
|
||||
// A check fails on a thrown error or any console or page error. skip(reason)
|
||||
// records a skip for a missing precondition and never fails.
|
||||
//
|
||||
// node e2e/run.cjs [--record VERSION] [check ...]
|
||||
// node e2e/run.cjs [--headed] [--record VERSION] [list | all | check ...]
|
||||
//
|
||||
// Screenshots and results.json go to e2e/out/<stamp>/. --record also writes
|
||||
// e2e/results/VERSION.md, the committed evidence for a release.
|
||||
// Screenshots, results.json (the manifest) and report.html (the run report) go to
|
||||
// e2e/out/<stamp>/. --record also writes e2e/results/VERSION.md, the committed
|
||||
// evidence for a release.
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
const DESKTOP = { width: 1440, height: 900 };
|
||||
|
||||
// Stable label naming: kebab-case, so a route like /org/members becomes
|
||||
// org-members and / becomes home.
|
||||
function slug(label) {
|
||||
return String(label).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'home';
|
||||
}
|
||||
|
||||
class SkipCheck extends Error {}
|
||||
|
||||
const base = process.env.ARCHIE_E2E_URL || 'http://localhost:5173';
|
||||
const args = process.argv.slice(2);
|
||||
const headed = args.includes('--headed');
|
||||
if (headed) args.splice(args.indexOf('--headed'), 1);
|
||||
let record = '';
|
||||
if (args[0] === '--record') { record = args[1]; args.splice(0, 2); }
|
||||
const names = args.length ? args : fs.readdirSync(path.join(__dirname, 'checks')).filter((f) => f.endsWith('.cjs')).map((f) => f.slice(0, -4)).sort();
|
||||
if (args[0] === '--record') {
|
||||
record = args[1];
|
||||
if (!record || record.startsWith('-')) {
|
||||
console.error('Usage: --record VERSION all|check ...');
|
||||
process.exit(1);
|
||||
}
|
||||
args.splice(0, 2);
|
||||
}
|
||||
const available = fs.readdirSync(path.join(__dirname, 'checks')).filter((f) => f.endsWith('.cjs')).map((f) => f.slice(0, -4)).sort();
|
||||
if (!args.length || (args.length === 1 && args[0] === 'list')) {
|
||||
console.log(`Available browser checks:\n${available.map(name => ` ${name}`).join('\n')}\n\nRun: task e2e:check -- <check ...>\nAll: task e2e:check -- all\nWatch: task e2e:check -- --headed <check ...>`);
|
||||
process.exit(0);
|
||||
}
|
||||
const names = args.length === 1 && args[0] === 'all' ? available : args;
|
||||
const unknown = names.filter(name => !available.includes(name));
|
||||
if (unknown.length) {
|
||||
console.error(`Unknown checks: ${unknown.join(', ')}. Run task e2e:check to list available checks.`);
|
||||
process.exit(1);
|
||||
}
|
||||
const { chromium } = require('playwright');
|
||||
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
||||
const out = path.join(__dirname, 'out', stamp);
|
||||
fs.mkdirSync(out, { recursive: true });
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch();
|
||||
const browser = await chromium.launch({ headless: !headed, slowMo: headed ? 150 : 0 });
|
||||
const context = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
||||
const login = await context.request.post(base + '/api/auth/login', {
|
||||
headers: { 'X-Archie-CSRF': '1', Origin: base },
|
||||
data: { email: process.env.ARCHIE_E2E_EMAIL || 'operator@example.test', password: process.env.ARCHIE_E2E_PASSWORD || 'archie-local-e2e-password' },
|
||||
});
|
||||
if (!login.ok()) {
|
||||
const error = `Test account sign-in failed (${login.status()}): ${await login.text()}`;
|
||||
await browser.close();
|
||||
throw new Error(error);
|
||||
}
|
||||
const storageState = await context.storageState();
|
||||
await context.close();
|
||||
const results = [];
|
||||
for (const name of names) {
|
||||
console.log(`run ${name}`);
|
||||
const check = require(path.join(__dirname, 'checks', name + '.cjs'));
|
||||
// A fresh page per check: open event streams pile up across navigations.
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 900 }, storageState });
|
||||
const errors = [];
|
||||
const notes = [];
|
||||
page.on('pageerror', (e) => errors.push(String(e)));
|
||||
page.on('console', (m) => m.type() === 'error' && errors.push(m.text()));
|
||||
page.on('console', (m) => {
|
||||
if (m.type() !== 'error') return;
|
||||
const url = m.location().url;
|
||||
errors.push(url ? `${m.text()} (${url})` : m.text());
|
||||
});
|
||||
// Wait for load, never networkidle: the event stream never goes idle.
|
||||
const go = async (p) => { await page.goto(base + p, { waitUntil: 'load' }); await page.waitForTimeout(1200); };
|
||||
const shot = (label) => page.screenshot({ path: path.join(out, `${name}-${label.replace(/[^a-z0-9-]+/gi, '_') || 'root'}.png`) });
|
||||
// Harness-owned wait: wait for a selector or URL, then settle briefly.
|
||||
const settled = async (sel, timeout = 10000) => {
|
||||
if (sel) {
|
||||
if (/^https?:/.test(sel)) await page.waitForURL(sel, { timeout });
|
||||
else if (sel.startsWith('/')) await page.waitForURL('**' + sel, { timeout });
|
||||
else await page.locator(sel).first().waitFor({ timeout });
|
||||
}
|
||||
await page.waitForTimeout(150);
|
||||
};
|
||||
const artifacts = [];
|
||||
// <check>-<kebab>[-<w>x<h>].png; the viewport suffix marks non-desktop
|
||||
// shots. A short settle precedes every capture so checks need no capture
|
||||
// wrapper of their own. Every capture is kept: a repeated label gets -2, -3...
|
||||
const shot = async (label) => {
|
||||
await page.waitForTimeout(150);
|
||||
const vp = page.viewportSize() || DESKTOP;
|
||||
const suffix = (vp.width === DESKTOP.width && vp.height === DESKTOP.height) ? '' : `-${vp.width}x${vp.height}`;
|
||||
const stem = `${name}-${slug(label)}${suffix}`;
|
||||
let file = `${stem}.png`;
|
||||
for (let n = 2; fs.existsSync(path.join(out, file)); n++) file = `${stem}-${n}.png`;
|
||||
await page.screenshot({ path: path.join(out, file) });
|
||||
artifacts.push({ file });
|
||||
return file;
|
||||
};
|
||||
// Keep a non-image artifact for this case: written as <check>-<name>.
|
||||
const attach = (fileName, data) => {
|
||||
const file = `${name}-${fileName}`;
|
||||
fs.writeFileSync(path.join(out, file), data);
|
||||
artifacts.push({ file });
|
||||
};
|
||||
const fail = (msg) => notes.push(msg);
|
||||
// Drop console errors matching re: a response the page is designed to survive.
|
||||
const tolerated = [];
|
||||
const tolerate = (re) => tolerated.push(re);
|
||||
const skip = (reason) => { throw new SkipCheck(reason || 'precondition missing'); };
|
||||
const started = Date.now();
|
||||
let error = '';
|
||||
try { await check({ page, go, shot, fail }); } catch (e) { error = String(e && e.message || e); }
|
||||
let skipped = '';
|
||||
try { await check({ page, go, shot, fail, skip, settled, attach, tolerate }); } catch (e) {
|
||||
if (e instanceof SkipCheck) skipped = e.message;
|
||||
else error = String(e && e.message || e);
|
||||
}
|
||||
if (error || notes.length) await shot('failure').catch(() => {});
|
||||
await page.close();
|
||||
const problems = [error, ...notes, ...errors].filter(Boolean);
|
||||
results.push({ check: name, ok: problems.length === 0, ms: Date.now() - started, problems });
|
||||
console.log(`${problems.length ? 'FAIL' : 'ok '} ${name}${problems.length ? '\n ' + problems.join('\n ') : ''}`);
|
||||
const problems = skipped ? [] : [error, ...notes, ...errors.filter((e) => !tolerated.some((re) => re.test(e)))].filter(Boolean);
|
||||
const result = { check: name, ok: problems.length === 0, ms: Date.now() - started, problems, artifacts };
|
||||
if (skipped) { result.skipped = true; result.skipReason = skipped; }
|
||||
results.push(result);
|
||||
console.log(`${skipped ? 'SKIP' : problems.length ? 'FAIL' : 'ok '} ${name}${skipped ? ` (${skipped})` : problems.length ? '\n ' + problems.join('\n ') : ''}`);
|
||||
}
|
||||
await browser.close();
|
||||
fs.writeFileSync(path.join(out, 'results.json'), JSON.stringify(results, null, 2));
|
||||
const commit = require('child_process').execFileSync('git', ['rev-parse', '--short', 'HEAD'], { cwd: __dirname, encoding: 'utf8' }).trim();
|
||||
fs.writeFileSync(path.join(out, 'report.html'), report(results, { time: new Date().toISOString(), commit }));
|
||||
if (record) writeRecord(record, results);
|
||||
console.log(`evidence: ${out}`);
|
||||
process.exit(results.every((r) => r.ok) ? 0 : 1);
|
||||
})().catch((e) => { console.error(e); process.exit(2); });
|
||||
|
||||
function esc(s) {
|
||||
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
|
||||
// One self-contained page per run: a test plan and verification record. Each
|
||||
// case carries the artifacts its own run produced; images are inlined.
|
||||
function report(results, meta) {
|
||||
const status = (r) => (r.skipped ? 'SKIP' : r.ok ? 'ok' : 'FAIL');
|
||||
const count = (s) => results.filter((r) => status(r) === s).length;
|
||||
const artifact = (a) => {
|
||||
const data = fs.readFileSync(path.join(out, a.file));
|
||||
if (!a.file.endsWith('.png')) return `<a href="${esc(a.file)}">${esc(a.file)}</a>`;
|
||||
const src = `data:image/png;base64,${data.toString('base64')}`;
|
||||
return `<figure><img src="${src}" alt="${esc(a.file)}" title="${esc(a.file)}"></figure>`;
|
||||
};
|
||||
const rows = results.map((r) => {
|
||||
const s = status(r);
|
||||
const msg = r.skipped ? [r.skipReason] : r.problems;
|
||||
return `<tr class="${s}"><td>${esc(r.check)}</td><td class="st">${s}</td><td>${r.ms}ms</td>`
|
||||
+ `<td>${msg.map((m) => `<pre>${esc(m)}</pre>`).join('')}</td>`
|
||||
+ `<td class="art">${r.artifacts.map(artifact).join('')}</td></tr>`;
|
||||
}).join('\n');
|
||||
return `<!doctype html>
|
||||
<html><head><meta charset="utf-8"><title>e2e ${esc(meta.time)}</title>
|
||||
<style>body{font:14px system-ui,sans-serif;margin:1em}table{border-collapse:collapse;width:100%}td,th{border-top:1px solid #ccc;padding:.4em;vertical-align:top;text-align:left}pre{margin:0 0 .3em;white-space:pre-wrap;font-size:12px}.st{font-weight:600}.ok .st{color:#060}.FAIL .st{color:#a00}.SKIP .st{color:#668}.FAIL{background:#fff3f3}.art{display:flex;flex-wrap:wrap;gap:.5em;border:0}figure{margin:0}.art img{width:150px;border:1px solid #ccc;cursor:zoom-in}.art img.big{position:fixed;inset:2vh 2vw;width:96vw;height:96vh;object-fit:contain;background:#fff;z-index:9;cursor:zoom-out}</style>
|
||||
</head><body><h1>e2e ${esc(meta.time)}</h1>
|
||||
<p>commit ${esc(meta.commit)} against ${esc(base)}: ${results.length} cases, ${count('ok')} ok, ${count('FAIL')} FAIL, ${count('SKIP')} SKIP</p>
|
||||
<table><tr><th>Case</th><th>Status</th><th>Time</th><th>Message</th><th>Artifacts</th></tr>
|
||||
${rows}
|
||||
</table>
|
||||
<script>document.addEventListener('click',e=>{if(e.target.matches('.art img'))e.target.classList.toggle('big')})</script>
|
||||
</body></html>
|
||||
`;
|
||||
}
|
||||
|
||||
function writeRecord(version, results) {
|
||||
const dir = path.join(__dirname, 'results');
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
const rows = results.map((r) => `| ${r.check} | ${r.ok ? 'pass' : 'fail'} | ${r.problems.join('<br>').replace(/\|/g, '\\|') || ''} |`);
|
||||
const rows = results.map((r) => `| ${r.check} | ${r.skipped ? 'skip' : r.ok ? 'pass' : 'fail'} | ${r.problems.join('<br>').replace(/\|/g, '\\|') || ''} |`);
|
||||
const passed = results.filter((r) => r.ok).length;
|
||||
fs.writeFileSync(path.join(dir, `${version}.md`), [
|
||||
`# ${version}`, '',
|
||||
|
||||
+32
-5
@@ -6,13 +6,28 @@ set -euo pipefail
|
||||
|
||||
base=${ARCHIE_E2E_API:-http://localhost:8484}
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
H=(-H 'Content-Type: application/json' -H 'X-Archie-CSRF: 1' -H "Origin: $base")
|
||||
cookie=$(mktemp)
|
||||
trap 'rm -f "$cookie"' EXIT
|
||||
H=(-b "$cookie" -c "$cookie" -H 'Content-Type: application/json' -H 'X-Archie-CSRF: 1' -H "Origin: $base")
|
||||
|
||||
get() { curl -fsS "$base$1"; }
|
||||
get() { curl -fsS -b "$cookie" "$base$1"; }
|
||||
post() { curl -fsS -X POST "$base$1" "${H[@]}" -d "$2"; }
|
||||
# jq-free JSON reads: py EXPR, with the parsed body as d.
|
||||
py() { python3 -c "import sys, json; d = json.load(sys.stdin); print($1)"; }
|
||||
|
||||
# This account belongs only to the isolated local test stack.
|
||||
email=${ARCHIE_E2E_EMAIL:-operator@example.test}
|
||||
password=${ARCHIE_E2E_PASSWORD:-archie-local-e2e-password}
|
||||
account=$(python3 -c 'import json,sys; print(json.dumps(dict(email=sys.argv[1], password=sys.argv[2], display_name="E2E operator", organisation_name="E2E", workspace_name="Local test", public_url=sys.argv[3])))' "$email" "$password" "${ARCHIE_E2E_URL:-http://localhost:5173}")
|
||||
if [ "$(get /api/auth/status | py 'd["setup_required"]')" = "True" ]; then
|
||||
post /api/auth/setup "$account" >/dev/null
|
||||
else
|
||||
if ! post /api/auth/login "$account" >/dev/null; then
|
||||
echo "Test account sign-in failed. Set ARCHIE_E2E_EMAIL and ARCHIE_E2E_PASSWORD to this test stack's account credentials." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Repository policy. archied applies it live; the pause lets the watch publish it.
|
||||
if ! get /api/control-plane/resources/repository-policies | grep -q '"widgets"'; then
|
||||
version=$(get /api/control-plane/resources/repository-policies | py 'd["resource"]["version"]')
|
||||
@@ -24,9 +39,9 @@ fi
|
||||
# Work requests. Without Docker they park within a minute, which fills
|
||||
# Needs you, Quality gates and the task pages.
|
||||
tasks=$(get /api/tasks)
|
||||
for t in "Fix flaky login test" "Add retry to webhook sender" "Document the gate" "Speed up the CI cache"; do
|
||||
for t in "Fix flaky login test" "Add retry to webhook sender" "Document the gate" "Speed up the CI cache" "Recovery probe"; do
|
||||
grep -qF "\"$t\"" <<<"$tasks" && continue
|
||||
post /api/work-requests "{\"identity\":\"archie-dev\",\"repository\":\"acme/widgets\",\"workflow\":\"triage\",\"title\":\"$t\",\"instructions\":\"Do it.\"}" >/dev/null
|
||||
post /api/work-requests "{\"repository\":\"acme/widgets\",\"workflow\":\"triage\",\"title\":\"$t\",\"instructions\":\"Do it.\"}" >/dev/null
|
||||
done
|
||||
|
||||
# An unsigned capture source with one delivery, an event type, a mapping and
|
||||
@@ -36,7 +51,7 @@ if ! get /api/sources | grep -q "\"$src\""; then
|
||||
post /api/sources "{\"path\":\"$src\"}" >/dev/null
|
||||
post "/api/sources/$src/signing" '{"signed":false}' >/dev/null
|
||||
post "/api/sources/$src/approve-unsigned" '{}' >/dev/null
|
||||
bash "$here/../tools/webhook-send.sh" --url "$base" --source "$src" --kind github-issue >/dev/null
|
||||
bash "$here/../tools/webhook-send.sh" --url "$base" --source "$src" --kind github-issue --quiet >/dev/null
|
||||
fi
|
||||
et=$(get /api/event-types | py '"".join(t["id"] for t in (d.get("event_types", []) if isinstance(d, dict) else d) if t["name"] == "issue-opened")')
|
||||
if [ -z "$et" ]; then
|
||||
@@ -47,4 +62,16 @@ if ! get /api/bindings | grep -q '"e2e-binding"'; then
|
||||
post /api/bindings "{\"name\":\"e2e-binding\",\"matcher\":{\"source\":\"$src\"},\"mapping_id\":\"$mapping\",\"workflow\":\"feasibility\",\"owner\":\"acme\",\"repo\":\"widgets\"}" >/dev/null
|
||||
fi
|
||||
|
||||
# Two more orgs: the operator owns Beta, so the org selector offers it; Gamma
|
||||
# belongs to an identity the operator is not a member of, so selecting it is refused.
|
||||
orgs=$(get /api/orgs)
|
||||
if ! grep -q '"org-beta"' <<<"$orgs"; then
|
||||
operator=$(get /api/identities | py '"".join(i["id"] for i in d["identities"] if i["display_name"] == "E2E operator")')
|
||||
post /api/orgs "{\"id\":\"org-beta\",\"name\":\"Beta\",\"owner_identity\":\"$operator\"}" >/dev/null
|
||||
fi
|
||||
if ! grep -q '"org-gamma"' <<<"$orgs"; then
|
||||
outsider=$(post /api/identities '{"display_name":"E2E outsider","kind":"user"}' | py 'd["id"]')
|
||||
post /api/orgs "{\"id\":\"org-gamma\",\"name\":\"Gamma\",\"owner_identity\":\"$outsider\"}" >/dev/null
|
||||
fi
|
||||
|
||||
echo "seeded: $(get /api/tasks | py 'len(d.get("tasks", d) if isinstance(d, dict) else d)') tasks"
|
||||
+45
-9
@@ -4,7 +4,7 @@
|
||||
# the installed config: XDG paths point into the dev directory.
|
||||
#
|
||||
# e2e/stack.sh start | stop | restart <service> | status | reset
|
||||
set -euo pipefail
|
||||
set -Eeuo pipefail
|
||||
|
||||
repo=$(cd "$(dirname "$0")/.." && pwd)
|
||||
dir=${ARCHIE_DEV_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/archie-dev}
|
||||
@@ -34,8 +34,17 @@ pgbin() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_process() {
|
||||
local pid
|
||||
if [ ! -f "$dir/pids/$1" ] || ! pid=$(cat "$dir/pids/$1") || ! kill -0 "$pid" 2>/dev/null; then
|
||||
echo "$1 exited; see $dir/logs/$1.log" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
wait_port() {
|
||||
for _ in $(seq 1 "${3:-60}"); do
|
||||
check_process "$2" || return 1
|
||||
(echo >"/dev/tcp/127.0.0.1/$1") 2>/dev/null && return 0
|
||||
sleep 1
|
||||
done
|
||||
@@ -65,18 +74,27 @@ prepare() {
|
||||
[ -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\"#" \
|
||||
"$repo/deployments/dev.toml" >"$dir/dev.toml"
|
||||
local s
|
||||
for s in "${services[@]}"; do
|
||||
(cd "$repo" && go build -o "$dir/bin/$s" "./cmd/$s")
|
||||
done
|
||||
local version
|
||||
version=$(git -C "$repo" describe --tags --exact-match --match 'v[0-9]*' 2>/dev/null || true)
|
||||
version=${version#v}
|
||||
[ -n "$version" ] || version="dev+$(git -C "$repo" rev-parse --short=12 HEAD)"
|
||||
task --dir "$repo" dev:tls
|
||||
task --dir "$repo" --force build BIN_DIR="$dir/bin" GATEWAY_VERSION="$version" RUNTIME_VERSION="$version"
|
||||
}
|
||||
|
||||
# spawn NAME DIR CMD...: a detached session leader, so stop takes its children.
|
||||
spawn() {
|
||||
local name=$1 cwd=$2
|
||||
shift 2
|
||||
rm -f "$dir/pids/$name"
|
||||
setsid -f bash -c 'cd "$1" && echo $$ >"$2" && shift 2 && exec "$@"' _ "$cwd" "$dir/pids/$name" "$@" \
|
||||
</dev/null >"$dir/logs/$name.log" 2>&1
|
||||
</dev/null >"$dir/logs/$name.log" 2>&1 9>&-
|
||||
for _ in $(seq 1 50); do
|
||||
[ ! -f "$dir/pids/$name" ] || { check_process "$name"; return; }
|
||||
sleep 0.1
|
||||
done
|
||||
echo "$name did not start; see $dir/logs/$name.log" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
start_service() {
|
||||
@@ -95,16 +113,29 @@ stop_pid() {
|
||||
}
|
||||
|
||||
start() {
|
||||
local port
|
||||
for port in 9091 8585 8586 8587 8485 8484 5173; do
|
||||
if (echo >"/dev/tcp/127.0.0.1/$port") 2>/dev/null; then
|
||||
echo "Port $port is already in use. Run task e2e:down before task e2e:up; if it stays occupied, inspect its owner with ss -ltnp." >&2
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
trap 'trap - ERR; stop' ERR
|
||||
prepare
|
||||
start_pg
|
||||
start_pg 9>&-
|
||||
start_service archie-state-store
|
||||
wait_port 9091 archie-state-store 90
|
||||
local s
|
||||
for s in archie-gateway archied archie-messaging archie-ui; do start_service "$s"; done
|
||||
wait_port 8585 archie-gateway
|
||||
wait_port 8586 archie-messaging
|
||||
wait_port 8485 archied
|
||||
wait_port 8484 archie-ui
|
||||
[ -d "$repo/ui/node_modules" ] || (cd "$repo/ui" && npm ci --no-audit --no-fund >/dev/null)
|
||||
spawn vite "$repo/ui" npx vite --host 127.0.0.1 --port 5173 --strictPort
|
||||
[ -d "$repo/ui/node_modules" ] || (cd "$repo/ui" && pnpm install --frozen-lockfile >/dev/null)
|
||||
spawn vite "$repo/ui" pnpm exec vite --host 127.0.0.1 --port 5173 --strictPort
|
||||
wait_port 5173 vite
|
||||
for s in "${services[@]}" vite; do check_process "$s"; done
|
||||
trap - ERR
|
||||
echo "dashboard: http://localhost:5173 logs: $dir/logs"
|
||||
}
|
||||
|
||||
@@ -116,6 +147,11 @@ stop() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Keep concurrent invocations from replacing each other's process records.
|
||||
mkdir -p "$dir"
|
||||
exec 9>"$dir/stack.lock"
|
||||
flock -n 9 || { echo "Another e2e stack command is running" >&2; exit 1; }
|
||||
|
||||
case ${1:-} in
|
||||
start) start ;;
|
||||
stop) stop ;;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# the network-investigator profile package (archipelago: profiles/network-investigator).
|
||||
#
|
||||
# Build: docker compose build agent-net
|
||||
ARG AGENT_IMAGE=ghcr.io/samcharles93/archie-agent:latest
|
||||
ARG AGENT_IMAGE=git.catlow.cloud/sam/archie-agent:latest
|
||||
FROM ${AGENT_IMAGE}
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/samcharles93/archie-core
|
||||
|
||||
go 1.27.2
|
||||
go 1.27.3
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.25.3 // indirect
|
||||
@@ -8,6 +8,7 @@ require (
|
||||
github.com/ProtonMail/go-crypto v1.5.2 // indirect
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.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
|
||||
@@ -19,7 +20,7 @@ require (
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/fatih/color v1.19.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.1.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.4 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.6 // 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-logr/logr v1.4.4 // indirect
|
||||
@@ -28,6 +29,7 @@ require (
|
||||
github.com/go-webauthn/x v0.3.1 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/go-tpm v0.9.8 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.32.0 // indirect
|
||||
github.com/hashicorp/yamux v0.1.2 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
@@ -43,7 +45,7 @@ require (
|
||||
github.com/nats-io/nkeys v0.4.16 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/oklog/run v1.2.0 // indirect
|
||||
github.com/philhofer/fwd v1.2.0 // indirect
|
||||
github.com/philhofer/fwd v1.2.1 // indirect
|
||||
github.com/pjbgf/sha1cd v0.7.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
github.com/segmentio/asm v1.2.1 // indirect
|
||||
@@ -51,23 +53,20 @@ require (
|
||||
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.4 // 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
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 // indirect
|
||||
go.opentelemetry.io/otel v1.47.0 // indirect
|
||||
go.opentelemetry.io/otel/log v1.47.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.47.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.47.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.5 // indirect
|
||||
golang.org/x/exp v0.0.0-20261013213113-2ab7f3cbc5fb // indirect
|
||||
golang.org/x/exp v0.0.0-20261014143641-f0251eb4aa3e // indirect
|
||||
golang.org/x/sync v0.24.0 // indirect
|
||||
golang.org/x/text v0.43.0 // indirect
|
||||
golang.org/x/time v0.16.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261019180522-ce908d29299b // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -79,7 +78,7 @@ require (
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.8
|
||||
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.5
|
||||
github.com/go-jose/go-jose/v4 v4.1.6
|
||||
github.com/go-telegram/bot v1.27.0
|
||||
github.com/go-webauthn/webauthn v0.18.2
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1
|
||||
@@ -92,22 +91,30 @@ require (
|
||||
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.1
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
github.com/nats-io/nats.go v1.55.0
|
||||
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.3.1
|
||||
github.com/samcharles93/ai-sdk v0.6.0
|
||||
go.lsp.dev/jsonrpc2 v1.0.1
|
||||
go.lsp.dev/protocol v1.0.1
|
||||
go.lsp.dev/uri v1.0.1
|
||||
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
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0
|
||||
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.0
|
||||
golang.org/x/mod v0.42.0
|
||||
golang.org/x/net v0.61.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
|
||||
google.golang.org/grpc v1.86.0-dev
|
||||
google.golang.org/protobuf v1.36.12
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
oras.land/oras-go/v2 v2.6.3
|
||||
oras.land/oras-go/v2 v2.7.0
|
||||
)
|
||||
@@ -20,6 +20,8 @@ github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/
|
||||
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/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=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cloudflare/circl v1.6.5 h1:O64F26HEqNhznd/hrC5KZXVKYuKM2rx4deZDTc4ihQA=
|
||||
@@ -53,8 +55,8 @@ 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.4 h1:xwjVlxEMR3S605oUlgBjKLTTeGFciYPGYCtF/35LKGo=
|
||||
github.com/fxamacker/cbor/v2 v2.9.4/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
|
||||
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/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
|
||||
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
|
||||
github.com/go-git/gcfg/v2 v2.0.2 h1:MY5SIIfTGGEMhdA7d7JePuVVxtKL7Hp+ApGDJAJ7dpo=
|
||||
@@ -65,8 +67,8 @@ 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.5 h1:RjgjO2LOtWOJKUC5wpwY9LR3B3vwVAz6JS2YHfYU6eA=
|
||||
github.com/go-jose/go-jose/v4 v4.1.5/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
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-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-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
@@ -96,6 +98,8 @@ 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/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
|
||||
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs=
|
||||
@@ -147,8 +151,8 @@ 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/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.go v1.54.0 h1:vsXoOxjHp/GmPUN+EcI7uOf/uB+iAP+kEsAFNQN0yzA=
|
||||
github.com/nats-io/nats.go v1.54.0/go.mod h1:y+DZoD1oBOYfZTU681eTUiUjI0vbqYGixNVFHcjHJ0k=
|
||||
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/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
@@ -161,8 +165,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
|
||||
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
|
||||
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
|
||||
github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
|
||||
github.com/philhofer/fwd v1.2.1 h1:UtpS73q8bFgy/yH3gCq8LSNvj5gv/FowNOiWZa7uKwQ=
|
||||
github.com/philhofer/fwd v1.2.1/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
|
||||
github.com/pjbgf/sha1cd v0.7.0 h1:ZRNPKHj+gfkLBf0KJv/p1Hmz+7bqCT5o311YX0nq+DA=
|
||||
github.com/pjbgf/sha1cd v0.7.0/go.mod h1:pKR5Li+qTCo+ebqITZfwPlJGoCFCvSO00qxjbNtTUFQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
@@ -174,8 +178,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
|
||||
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.3.1 h1:fD/Byx1Vo6NeZZBsSurxTO9e2/tAdAlEUIW+J7Hc/DM=
|
||||
github.com/samcharles93/ai-sdk v0.3.1/go.mod h1:u4zrQ9/Q58L5mNEut4bNQ1ks+RCKq71LN5EDz2N/0Zk=
|
||||
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/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=
|
||||
@@ -193,8 +197,8 @@ 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/tinylib/msgp v1.6.4 h1:mOwYbyYDLPj35mkA2BjjYejgJk9BuHxDdvRnb6v2ZcQ=
|
||||
github.com/tinylib/msgp v1.6.4/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
|
||||
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=
|
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
|
||||
@@ -207,10 +211,16 @@ go.lsp.dev/uri v1.0.1 h1:ywxJN1UXoQ+v0I9lkoQNMmsm7lub5G9ZG7KXT8YTx30=
|
||||
go.lsp.dev/uri v1.0.1/go.mod h1:06a0ghafs4PuqkLsJGUmlgPHw6+kH79edRXjOT/rA8s=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0 h1:Tq+E65HaNbZTeqcLw6QUhsV+/EIWdkfUH2CQzcrlE5M=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0/go.mod h1:A+EVhDakAj1waJBPhmTszZaSr08ww8MRRKy1nB1rqck=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 h1:LxwW/9ctSCv+QkE/cLR7M91ZIkXNMqJtEMi1vCw9U8s=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0/go.mod h1:tOsftB4SslBwwErVEPaenU2RpThXWPIU8DoJHEC4dyw=
|
||||
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
|
||||
go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 h1:julhjPeUH/q/7hinbSdDdqt5h7Zw9YWmRlWRhI0jd54=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0/go.mod h1:Ao2mz688LH/tFf0yMAenidq6k2YNSx6SIY2q6jDACck=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0 h1:UFpxOpYPmMNUtOWhdb+nC1WELIgVf8z9higURrbzYU4=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0/go.mod h1:YBGjxe3lt0jtXoEXxGrGhv/jM7oUBUDVK7zhAvNyEjc=
|
||||
go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI=
|
||||
go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw=
|
||||
go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY=
|
||||
@@ -221,6 +231,10 @@ go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV
|
||||
go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw=
|
||||
go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM=
|
||||
go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0=
|
||||
go.opentelemetry.io/proto/otlp v1.11.1 h1:SCrPqH9NE5CmBrOqpjNCiT0X5mGwMyGERXdogfR7Yjw=
|
||||
go.opentelemetry.io/proto/otlp v1.11.1/go.mod h1:wq8W4aSf6bOy8RZyESOeQFr9Pu7wydWX/TY4sgvrTPg=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
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=
|
||||
@@ -229,12 +243,12 @@ 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=
|
||||
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/exp v0.0.0-20261013213113-2ab7f3cbc5fb h1:fMK59tNbIKghD6eTnk7DGfVtbK6JiHiFgpmBAWcPaco=
|
||||
golang.org/x/exp v0.0.0-20261013213113-2ab7f3cbc5fb/go.mod h1:DBoxwWhjaW8DJJw/YeM4zpeOKMC1FMXSblsYy+1mFSw=
|
||||
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/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg=
|
||||
golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs=
|
||||
golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
|
||||
golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
|
||||
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=
|
||||
@@ -258,10 +272,10 @@ golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs=
|
||||
golang.org/x/tools v0.52.0/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-20261012220534-4341edf3f941 h1:DS/w3N8rsfrwxwgGSj6WhMsPo7aNQGmDx74J81zd0NQ=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941/go.mod h1:AuGAdi9KnXss7xbLxIKhCvk+Ro/SxpET/iS45DNYN+M=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941 h1:QG6hS4zFplRZvOQedzei4t2pT/zkQc3VR1u+S9/rcAw=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
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/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/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=
|
||||
@@ -285,7 +299,7 @@ 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=
|
||||
oras.land/oras-go/v2 v2.6.3 h1:72z4K9YiDKVB5jieM8cuB1WSVnbZkkD2hd+NmO3HYVI=
|
||||
oras.land/oras-go/v2 v2.6.3/go.mod h1:imXEFiYkTZUVVYkfv/r5GVmWeiLkGtNQA8FU4F/sjKs=
|
||||
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=
|
||||
pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
|
||||
+185
-60
@@ -1,25 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# install.sh - installs Archie Core for the current user.
|
||||
#
|
||||
# curl -fsSL https://raw.githubusercontent.com/samcharles93/archie-core/main/install.sh | bash
|
||||
# curl -fsSL https://offloaded.dev/install.sh | bash
|
||||
#
|
||||
# Downloads the latest release, verifies it against SHA256SUMS, installs the
|
||||
# Downloads a release from its OCI registry, verifies the release key signed
|
||||
# it and that the zip is the one signed, installs the
|
||||
# five services to ${XDG_BIN_HOME:-~/.local/bin}, runs `archied setup`, starts
|
||||
# the bundled PostgreSQL and installs systemd user units.
|
||||
# Config: ${XDG_CONFIG_HOME:-~/.config}/archie Data: ${XDG_DATA_HOME:-~/.local/share}/archie
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO="samcharles93/archie-releases"
|
||||
MODULE="github.com/samcharles93/archie-core"
|
||||
SOURCE_GIT="https://git.catlow.cloud/sam/archie.git"
|
||||
# Where releases come from: an OCI repository and the base64 ed25519 key that
|
||||
# must have signed them. A self-hosted source sets both.
|
||||
DEFAULT_RELEASES="git.catlow.cloud/sam/archie"
|
||||
DEFAULT_RELEASE_KEY="gIBqoQMwy+8WXmGfiuHtnUa50W0IqfzkTR6iF5q3dSM="
|
||||
ARCHIE_RELEASES="${ARCHIE_RELEASES:-${DEFAULT_RELEASES}}"
|
||||
ARCHIE_RELEASE_KEY="${ARCHIE_RELEASE_KEY:-${DEFAULT_RELEASE_KEY}}"
|
||||
ARCHIE_CHANNEL="${ARCHIE_CHANNEL:-stable}"
|
||||
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}"
|
||||
XDG_DATA_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}"
|
||||
XDG_BIN_HOME="${XDG_BIN_HOME:-${HOME}/.local/bin}"
|
||||
|
||||
ARCHIE_CONFIG_DIR="${XDG_CONFIG_HOME}/archie"
|
||||
ARCHIE_DATA_DIR="${XDG_DATA_HOME}/archie"
|
||||
ARCHIE_BIN_DIR="${XDG_BIN_HOME}"
|
||||
ENV_FILE="${ARCHIE_CONFIG_DIR}/env"
|
||||
INSTANCE=archie
|
||||
PORT_BASE=""
|
||||
|
||||
INSTALL_SYSTEMD=true
|
||||
ENABLE_LINGER=true
|
||||
@@ -33,12 +41,21 @@ if (: </dev/tty) 2>/dev/null; then INTERACTIVE=true; fi
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: install.sh [options]
|
||||
or: curl -fsSL https://raw.githubusercontent.com/${REPO}/main/install.sh | bash -s -- [options]
|
||||
or: curl -fsSL https://offloaded.dev/install.sh | bash -s -- [options]
|
||||
|
||||
Environment:
|
||||
ARCHIE_RELEASES OCI repository to install from (default ${DEFAULT_RELEASES})
|
||||
ARCHIE_RELEASE_KEY base64 ed25519 key that source signs with
|
||||
ARCHIE_CHANNEL stable (default) or next
|
||||
|
||||
Options:
|
||||
--version X.Y.Z Install this release instead of the latest
|
||||
--from-source Build from a checkout (this one, or a fresh clone) instead
|
||||
of a release; needs Go, git and jq
|
||||
--instance NAME Install a named instance beside others: archie (default)
|
||||
or archie-X; its dirs are <xdg>/NAME and its units end in -X
|
||||
--port-base N Use ports N..N+6 for web, health, gateway, state store,
|
||||
state store readiness, messaging and daemon
|
||||
--no-systemd Skip systemd user units
|
||||
--no-linger Skip loginctl enable-linger
|
||||
--no-start Install the units but do not start them
|
||||
@@ -51,6 +68,8 @@ VERSION=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--version) VERSION="${2:?--version needs a value}"; shift ;;
|
||||
--instance) INSTANCE="${2:?--instance needs a value}"; shift ;;
|
||||
--port-base) PORT_BASE="${2:?--port-base needs a value}"; shift ;;
|
||||
--from-source) FROM_SOURCE=true ;;
|
||||
--no-systemd) INSTALL_SYSTEMD=false; AUTO_START=false ;;
|
||||
--no-linger) ENABLE_LINGER=false ;;
|
||||
@@ -62,12 +81,86 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ "${INSTANCE}" =~ ^archie(-[a-z0-9][a-z0-9-]{0,23})?$ ]]; then
|
||||
echo "Error: --instance '${INSTANCE}' must be archie or archie-<name>, e.g. archie-dev" >&2; exit 1
|
||||
fi
|
||||
if [ -n "${PORT_BASE}" ] && ! { [[ "${PORT_BASE}" =~ ^[0-9]+$ ]] && [ "${PORT_BASE}" -ge 1024 ] && [ "${PORT_BASE}" -le 65529 ]; }; then
|
||||
echo "Error: --port-base must be a number from 1024 to 65529" >&2; exit 1
|
||||
fi
|
||||
export ARCHIE_INSTANCE="${INSTANCE}"
|
||||
ARCHIE_CONFIG_DIR="${XDG_CONFIG_HOME}/${INSTANCE}"
|
||||
ARCHIE_DATA_DIR="${XDG_DATA_HOME}/${INSTANCE}"
|
||||
ENV_FILE="${ARCHIE_CONFIG_DIR}/env"
|
||||
|
||||
# unit maps a base unit name to this instance's: unchanged for the default
|
||||
# instance, suffixed with the name after archie- otherwise.
|
||||
unit() {
|
||||
if [ "${INSTANCE}" = archie ]; then echo "$1"; else echo "$1-${INSTANCE#archie-}"; fi
|
||||
}
|
||||
U_DAEMON="$(unit archied)"
|
||||
U_STATE="$(unit archie-state-store)"
|
||||
U_GATEWAY="$(unit archie-gateway)"
|
||||
U_UI="$(unit archie-ui)"
|
||||
U_MESSAGING="$(unit archie-messaging)"
|
||||
|
||||
# Ports in --port-base order; without it, today's defaults.
|
||||
if [ -n "${PORT_BASE}" ]; then
|
||||
P_WEB=${PORT_BASE}; P_HEALTH=$((PORT_BASE + 1)); P_GATEWAY=$((PORT_BASE + 2))
|
||||
P_STATE=$((PORT_BASE + 3)); P_READY=$((PORT_BASE + 4)); P_MESSAGING=$((PORT_BASE + 5)); P_DAEMON=$((PORT_BASE + 6))
|
||||
else
|
||||
P_WEB=8484; P_HEALTH=8485; P_GATEWAY=8585; P_STATE=9090; P_READY=9091; P_MESSAGING=8586; P_DAEMON=8587
|
||||
fi
|
||||
|
||||
need() {
|
||||
for cmd in "$@"; do
|
||||
command -v "$cmd" &>/dev/null || { echo "Error: '$cmd' is required but not installed." >&2; exit 1; }
|
||||
done
|
||||
}
|
||||
|
||||
# install_release fetches the release on ARCHIE_CHANNEL (or VERSION) from
|
||||
# ARCHIE_RELEASES and unpacks it into TMP: the statement must verify against
|
||||
# ARCHIE_RELEASE_KEY and the zip must hash to the digest the statement names.
|
||||
install_release() {
|
||||
local registry="${ARCHIE_RELEASES%%/*}" repo="${ARCHIE_RELEASES#*/}" scheme=https tag="${ARCHIE_CHANNEL}"
|
||||
case "${registry}" in localhost | localhost:* | 127.* | "[::1]"*) scheme=http ;; esac
|
||||
[ -n "${VERSION}" ] && tag="v${VERSION#v}"
|
||||
local base="${scheme}://${registry}/v2/${repo}" auth=()
|
||||
# Registries hand anonymous readers a pull token named by the challenge.
|
||||
local challenge
|
||||
challenge="$(curl -fsS -o /dev/null -D - "${base}/manifests/${tag}" 2>/dev/null | tr -d '\r' | sed -n 's/^[Ww][Ww][Ww]-[Aa]uthenticate: *Bearer *//p')" || true
|
||||
if [ -n "${challenge}" ]; then
|
||||
local realm service token
|
||||
realm="$(sed -n 's/.*realm="\([^"]*\)".*/\1/p' <<<"${challenge}")"
|
||||
service="$(sed -n 's/.*service="\([^"]*\)".*/\1/p' <<<"${challenge}")"
|
||||
token="$(curl -fsSL -G "${realm}" --data-urlencode "service=${service}" --data-urlencode "scope=repository:${repo}:pull" | jq -r '.token // .access_token')"
|
||||
auth=(-H "Authorization: Bearer ${token}")
|
||||
fi
|
||||
echo "==> Fetching ${ARCHIE_RELEASES}:${tag}..."
|
||||
curl -fsSL "${auth[@]}" -H "Accept: application/vnd.oci.image.manifest.v1+json" "${base}/manifests/${tag}" -o "${TMP}/manifest.json"
|
||||
blob() { curl -fsSL "${auth[@]}" "${base}/blobs/$1" -o "$2" && [ "sha256:$(sha256sum "$2" | cut -d' ' -f1)" = "$1" ]; }
|
||||
local statement_digest
|
||||
statement_digest="$(jq -er '.layers[0].digest' "${TMP}/manifest.json")"
|
||||
blob "${statement_digest}" "${TMP}/statement.json" || { echo "Error: the release statement does not match its digest." >&2; exit 1; }
|
||||
jq -er '.annotations["dev.archie.release.signature.v1"]' "${TMP}/manifest.json" | base64 -d >"${TMP}/statement.sig"
|
||||
# An ed25519 public key is its 32 bytes behind a fixed SubjectPublicKeyInfo header.
|
||||
{ printf '\x30\x2a\x30\x05\x06\x03\x2b\x65\x70\x03\x21\x00'; base64 -d <<<"${ARCHIE_RELEASE_KEY}"; } >"${TMP}/key.der"
|
||||
openssl pkeyutl -verify -pubin -inkey "${TMP}/key.der" -keyform DER -rawin \
|
||||
-in "${TMP}/statement.json" -sigfile "${TMP}/statement.sig" >/dev/null 2>&1 ||
|
||||
{ echo "Error: ${ARCHIE_RELEASES}:${tag} is not signed by the release key." >&2; exit 1; }
|
||||
local zip_name zip_digest
|
||||
VERSION="$(jq -er .version "${TMP}/statement.json")"
|
||||
[ "$(jq -r .platform "${TMP}/statement.json")" = linux-amd64 ] || { echo "Error: the release is not built for linux-amd64." >&2; exit 1; }
|
||||
[ -z "${VERSION}" ] || [ "${tag}" = "${ARCHIE_CHANNEL}" ] || [ "v${VERSION}" = "${tag}" ] ||
|
||||
{ echo "Error: ${tag} carries the statement for ${VERSION}." >&2; exit 1; }
|
||||
zip_name="$(jq -er .zip.name "${TMP}/statement.json")"
|
||||
zip_digest="$(jq -er .zip.digest "${TMP}/statement.json")"
|
||||
RELEASE_NAME="${zip_name%.zip}"
|
||||
case "${RELEASE_NAME}" in archie-core-archied-v*-linux-amd64) ;; *) echo "Error: unexpected release zip ${zip_name}." >&2; exit 1 ;; esac
|
||||
echo "==> Downloading Archie ${VERSION}..."
|
||||
blob "${zip_digest}" "${TMP}/${zip_name}" || { echo "Error: ${zip_name} does not match the signed digest." >&2; exit 1; }
|
||||
unzip -q "${TMP}/${zip_name}" -d "${TMP}"
|
||||
}
|
||||
|
||||
# 1. Prerequisites
|
||||
echo "==> Checking prerequisites..."
|
||||
# The installer depends on systemd user units and GNU tools.
|
||||
@@ -79,7 +172,7 @@ if [ "${FROM_SOURCE}" = true ]; then
|
||||
need git go jq
|
||||
else
|
||||
[ "$(uname -m)" = x86_64 ] || { echo "Error: releases are built for x86_64 only; use --from-source." >&2; exit 1; }
|
||||
need curl unzip sha256sum
|
||||
need curl unzip sha256sum openssl jq base64
|
||||
fi
|
||||
if command -v docker &>/dev/null; then
|
||||
echo " [OK] $(docker --version)"
|
||||
@@ -96,48 +189,44 @@ trap 'rm -rf "${TMP}"' EXIT
|
||||
|
||||
if [ "${FROM_SOURCE}" = true ]; then
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
||||
if [ -f "${SCRIPT_DIR}/go.mod" ] && grep -q "github.com/${REPO}" "${SCRIPT_DIR}/go.mod"; then
|
||||
if [ -f "${SCRIPT_DIR}/go.mod" ] && grep -q "${MODULE}" "${SCRIPT_DIR}/go.mod"; then
|
||||
SRC_DIR="${SCRIPT_DIR}"
|
||||
else
|
||||
SRC_DIR="${TMP}/src"
|
||||
git clone --quiet --depth=1 "https://github.com/${REPO}.git" "${SRC_DIR}"
|
||||
git clone --quiet --depth=1 "${SOURCE_GIT}" "${SRC_DIR}"
|
||||
fi
|
||||
echo "==> Building from ${SRC_DIR}..."
|
||||
# Selects (and under the default GOTOOLCHAIN=auto, downloads) the toolchain
|
||||
# go.mod requires, so a missing one fails here rather than mid-build.
|
||||
required="$(sed -n 's/^go //p' "${SRC_DIR}/go.mod")"
|
||||
if ! out="$(cd "${SRC_DIR}" && go list -m 2>&1)"; then
|
||||
echo "Error: Archie needs Go ${required}, which is not available: ${out}" >&2
|
||||
echo "Install Go ${required} from https://go.dev/dl, or allow the download with GOTOOLCHAIN=auto and network access to proxy.golang.org." >&2
|
||||
exit 1
|
||||
fi
|
||||
STAGE="${TMP}/stage"
|
||||
mkdir -p "${STAGE}"
|
||||
# A source build is not a release: it says `dev`, and buildType=binary lets
|
||||
# it self-update.
|
||||
LDFLAGS="-X github.com/${REPO}/internal/buildinfo.Version=dev -X github.com/${REPO}/internal/buildinfo.Runtime=dev -X github.com/${REPO}/internal/installtype.buildType=binary"
|
||||
for cmd in $(jq -er '.required_topology.units | join(" ")' "${SRC_DIR}/release.json"); do
|
||||
# it self-update. The agentworker stamp only lands in archie-agent.
|
||||
LDFLAGS="-X ${MODULE}/internal/buildinfo.Version=dev -X ${MODULE}/internal/buildinfo.Runtime=dev -X ${MODULE}/internal/installtype.buildType=binary -X ${MODULE}/internal/app/agentworker.version=dev"
|
||||
for cmd in $(jq -er '[.required_topology.units[], .required_topology.binaries[]?] | join(" ")' "${SRC_DIR}/release.json"); do
|
||||
(cd "${SRC_DIR}" && go build -ldflags "${LDFLAGS}" -o "${STAGE}/${cmd}" "./cmd/${cmd}")
|
||||
done
|
||||
cp "${SRC_DIR}/release.json" "${STAGE}/"
|
||||
else
|
||||
if [ -z "${VERSION}" ]; then
|
||||
tag="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p')"
|
||||
[ -n "${tag}" ] || { echo "Error: could not find the latest release." >&2; exit 1; }
|
||||
else
|
||||
tag="v${VERSION}"
|
||||
fi
|
||||
VERSION="${tag##*v}"
|
||||
name="archie-core-archied-v${VERSION}-linux-amd64"
|
||||
echo "==> Downloading Archie ${VERSION}..."
|
||||
base="https://github.com/${REPO}/releases/download/${tag}"
|
||||
curl -fsSL "${base}/${name}.zip" -o "${TMP}/${name}.zip"
|
||||
curl -fsSL "${base}/SHA256SUMS" -o "${TMP}/SHA256SUMS"
|
||||
expected="$(awk -v n="${name}.zip" '$2 == n {print $1}' "${TMP}/SHA256SUMS")"
|
||||
[[ "${expected}" =~ ^[a-f0-9]{64}$ ]] || { echo "Error: ${name}.zip is not in SHA256SUMS." >&2; exit 1; }
|
||||
printf '%s %s\n' "${expected}" "${TMP}/${name}.zip" | sha256sum --check --status ||
|
||||
{ echo "Error: checksum mismatch for ${name}.zip." >&2; exit 1; }
|
||||
unzip -q "${TMP}/${name}.zip" -d "${TMP}"
|
||||
STAGE="${TMP}/${name}"
|
||||
install_release
|
||||
STAGE="${TMP}/${RELEASE_NAME}"
|
||||
fi
|
||||
|
||||
TOPOLOGY_UNITS="$(tr -d '\n' <"${STAGE}/release.json" | sed -n 's/.*"units": *\[\([^]]*\)\].*/\1/p' | tr -d '" ' | tr , ' ')"
|
||||
for cmd in ${TOPOLOGY_UNITS}; do
|
||||
# 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.
|
||||
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}"
|
||||
done
|
||||
echo " Installed ${TOPOLOGY_UNITS} to ${ARCHIE_BIN_DIR}/"
|
||||
echo " Installed ${TOPOLOGY_UNITS} ${TOPOLOGY_BINARIES} to ${ARCHIE_BIN_DIR}/"
|
||||
|
||||
# 3. Configuration. archied setup asks every question and writes config.toml
|
||||
# plus any secrets to the env file beside it; this script asks nothing itself.
|
||||
@@ -155,7 +244,25 @@ if [ ! -f "${ARCHIE_CONFIG_DIR}/config.toml" ]; then
|
||||
echo "ERROR: archied setup could not generate ${ARCHIE_CONFIG_DIR}/config.toml" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ "${ARCHIE_RELEASES}" != "${DEFAULT_RELEASES}" ] || [ "${ARCHIE_RELEASE_KEY}" != "${DEFAULT_RELEASE_KEY}" ]; then
|
||||
# The instance keeps updating from the source it was installed from.
|
||||
printf '\n[distribution]\nreleases = "%s"\nreleases_key = "%s"\n' "${ARCHIE_RELEASES}" "${ARCHIE_RELEASE_KEY}" >>"${ARCHIE_CONFIG_DIR}/config.toml"
|
||||
fi
|
||||
if [ -n "${PORT_BASE}" ]; then
|
||||
# The generated config names the default addresses; move them to this
|
||||
# instance's ports and pin the services the template leaves commented.
|
||||
sed -i -e "s/127\.0\.0\.1:8484/127.0.0.1:${P_WEB}/g" -e "s/127\.0\.0\.1:8485/127.0.0.1:${P_HEALTH}/g" \
|
||||
-e "s/127\.0\.0\.1:8585/127.0.0.1:${P_GATEWAY}/g" -e "s/127\.0\.0\.1:9090/127.0.0.1:${P_STATE}/g" \
|
||||
-e "s/127\.0\.0\.1:8586/127.0.0.1:${P_MESSAGING}/g" -e "s/127\.0\.0\.1:8587/127.0.0.1:${P_DAEMON}/g" \
|
||||
"${ARCHIE_CONFIG_DIR}/config.toml"
|
||||
for section in messaging:${P_MESSAGING} daemon:${P_DAEMON}; do
|
||||
name="${section%%:*}" port="${section#*:}"
|
||||
grep -q "^\[services\.${name}\]" "${ARCHIE_CONFIG_DIR}/config.toml" ||
|
||||
printf '\n[services.%s]\ntarget = "127.0.0.1:%s"\nlisten = "127.0.0.1:%s"\n' "${name}" "${port}" "${port}" >>"${ARCHIE_CONFIG_DIR}/config.toml"
|
||||
done
|
||||
fi
|
||||
else
|
||||
[ -n "${PORT_BASE}" ] && echo " [WARN] --port-base only applies to a new config; ${ARCHIE_CONFIG_DIR}/config.toml keeps its addresses." >&2
|
||||
echo " [SKIP] ${ARCHIE_CONFIG_DIR}/config.toml already exists. Re-run 'archied setup' to change it."
|
||||
fi
|
||||
|
||||
@@ -197,9 +304,9 @@ services:
|
||||
volumes:
|
||||
pg_data:
|
||||
EOF
|
||||
if ! docker compose -p archie --env-file "${ENV_FILE}" -f "${PG_COMPOSE}" up -d --wait; then
|
||||
if ! docker compose -p "${INSTANCE}" --env-file "${ENV_FILE}" -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 archie -f ${PG_COMPOSE} logs" >&2
|
||||
echo " Check: docker compose -p "${INSTANCE}" -f ${PG_COMPOSE} logs" >&2
|
||||
AUTO_START=false
|
||||
fi
|
||||
fi
|
||||
@@ -233,7 +340,7 @@ if [ "${INSTALL_SYSTEMD}" = true ] && command -v systemctl &>/dev/null && [ -d "
|
||||
# description now, not the mechanism: a fresh install must not need four
|
||||
# hand-written units before its own updater will run, and
|
||||
# the contents must not live in two places to drift apart.
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/archied.service"
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/${U_DAEMON}.service"
|
||||
[Unit]
|
||||
Description=Archie Core Orchestrator Daemon
|
||||
After=network.target
|
||||
@@ -244,9 +351,13 @@ StartLimitIntervalSec=300
|
||||
StartLimitBurst=5
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
# Beats only while the run loop is polling, so a wedged loop is restarted.
|
||||
WatchdogSec=30s
|
||||
ExecStart=${ARCHIE_BIN_DIR}/archied -config ${ARCHIE_CONFIG_DIR}/config.toml
|
||||
EnvironmentFile=-${ENV_FILE}
|
||||
Environment=ARCHIE_INSTANCE=${INSTANCE}
|
||||
# archied reloads its configuration on SIGHUP. Without ExecReload,
|
||||
# 'systemctl --user reload archied' fails and the operator has to know
|
||||
# to run 'systemctl --user kill -s HUP' instead.
|
||||
@@ -260,15 +371,17 @@ EOF
|
||||
|
||||
# The State Store owns the task data and is the process everything else dials, so
|
||||
# its unit is the first dependency the others name.
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/archie-state-store.service"
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/${U_STATE}.service"
|
||||
[Unit]
|
||||
Description=Archie State Store Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=${ARCHIE_BIN_DIR}/archie-state-store -config ${ARCHIE_CONFIG_DIR}/config.toml -listen 127.0.0.1:9090 -ready-addr 127.0.0.1:9091
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
ExecStart=${ARCHIE_BIN_DIR}/archie-state-store -config ${ARCHIE_CONFIG_DIR}/config.toml -listen 127.0.0.1:${P_STATE} -ready-addr 127.0.0.1:${P_READY}
|
||||
EnvironmentFile=-${ENV_FILE}
|
||||
Environment=ARCHIE_INSTANCE=${INSTANCE}
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
@@ -276,15 +389,17 @@ RestartSec=5s
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/archie-gateway.service"
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/${U_GATEWAY}.service"
|
||||
[Unit]
|
||||
Description=Archie Gateway Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=${ARCHIE_BIN_DIR}/archie-gateway -config ${ARCHIE_CONFIG_DIR}/config.toml -listen 127.0.0.1:8585
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
ExecStart=${ARCHIE_BIN_DIR}/archie-gateway -config ${ARCHIE_CONFIG_DIR}/config.toml -listen 127.0.0.1:${P_GATEWAY}
|
||||
EnvironmentFile=-${ENV_FILE}
|
||||
Environment=ARCHIE_INSTANCE=${INSTANCE}
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
@@ -292,16 +407,17 @@ RestartSec=5s
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/archie-ui.service"
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/${U_UI}.service"
|
||||
[Unit]
|
||||
Description=Archie UI Service
|
||||
After=network.target archie-state-store.service
|
||||
Wants=archie-state-store.service
|
||||
After=network.target ${U_STATE}.service
|
||||
Wants=${U_STATE}.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=${ARCHIE_BIN_DIR}/archie-ui -config ${ARCHIE_CONFIG_DIR}/config.toml
|
||||
EnvironmentFile=-${ENV_FILE}
|
||||
Environment=ARCHIE_INSTANCE=${INSTANCE}
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
@@ -311,16 +427,18 @@ EOF
|
||||
|
||||
# The Telegram, email and webhook channels run here, not in archied: without
|
||||
# this unit a host looks healthy while its channels are dead.
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/archie-messaging.service"
|
||||
cat <<EOF > "${SYSTEMD_USER_DIR}/${U_MESSAGING}.service"
|
||||
[Unit]
|
||||
Description=Archie Messaging Service
|
||||
After=network.target archie-gateway.service archie-state-store.service
|
||||
Wants=archie-gateway.service archie-state-store.service
|
||||
After=network.target ${U_GATEWAY}.service ${U_STATE}.service
|
||||
Wants=${U_GATEWAY}.service ${U_STATE}.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
ExecStart=${ARCHIE_BIN_DIR}/archie-messaging -config ${ARCHIE_CONFIG_DIR}/config.toml
|
||||
EnvironmentFile=-${ENV_FILE}
|
||||
Environment=ARCHIE_INSTANCE=${INSTANCE}
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
@@ -328,9 +446,12 @@ RestartSec=5s
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
INSTANCE_UNITS=""
|
||||
for base in $TOPOLOGY_UNITS; do INSTANCE_UNITS="${INSTANCE_UNITS:+${INSTANCE_UNITS} }$(unit "${base}")"; done
|
||||
|
||||
systemctl --user daemon-reload || true
|
||||
SERVICE_INSTALLED=true
|
||||
for unit in $TOPOLOGY_UNITS; do
|
||||
for unit in $INSTANCE_UNITS; do
|
||||
test -f "${SYSTEMD_USER_DIR}/${unit}.service" || { echo "missing required unit: $unit" >&2; exit 1; }
|
||||
echo " Installed ${SYSTEMD_USER_DIR}/${unit}.service"
|
||||
done
|
||||
@@ -354,11 +475,13 @@ EOF
|
||||
fi
|
||||
|
||||
# Auto-enable and start the services, the store first so a fresh boot does
|
||||
# not race a dial it depends on.
|
||||
# not race a dial it depends on. Restart rather than start, because a
|
||||
# reinstall over running services would otherwise leave the old binaries
|
||||
# running.
|
||||
if [ "${AUTO_START}" = true ]; then
|
||||
echo "==> Enabling and starting Archie services..."
|
||||
systemctl --user enable --now $TOPOLOGY_UNITS ||
|
||||
echo " Notice: Could not start every service automatically. Check: systemctl --user status archied archie-state-store archie-gateway archie-ui archie-messaging"
|
||||
{ systemctl --user enable $INSTANCE_UNITS && systemctl --user restart $INSTANCE_UNITS; } ||
|
||||
echo " Notice: Could not start every service automatically. Check: systemctl --user status ${INSTANCE_UNITS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -385,13 +508,15 @@ fi
|
||||
|
||||
if [ "${SERVICE_INSTALLED}" = true ] && [ "${AUTO_START}" = true ]; then
|
||||
echo "Service Management:"
|
||||
echo " - Units installed : archied archie-state-store archie-gateway archie-ui archie-messaging"
|
||||
echo " - View live logs : journalctl --user -u archied -f"
|
||||
echo " - Service status : systemctl --user status archied archie-state-store archie-gateway archie-ui archie-messaging"
|
||||
echo " - Restart daemon : systemctl --user restart archied"
|
||||
echo " - Units installed : ${INSTANCE_UNITS}"
|
||||
echo " - View live logs : journalctl --user -u ${U_DAEMON} -f"
|
||||
echo " - Service status : systemctl --user status ${INSTANCE_UNITS}"
|
||||
echo " - Restart daemon : systemctl --user restart ${U_DAEMON}"
|
||||
else
|
||||
echo "Manual Startup: start the five services as in https://github.com/${REPO}/blob/main/deployments/README.md"
|
||||
echo "Manual Startup: start the five services as in https://offloaded.dev"
|
||||
fi
|
||||
echo ""
|
||||
echo "Dashboard: http://127.0.0.1:8484 Change the config: archied setup"
|
||||
SETUP_HINT="archied setup"
|
||||
[ "${INSTANCE}" = archie ] || SETUP_HINT="ARCHIE_INSTANCE=${INSTANCE} archied setup"
|
||||
echo "Dashboard: http://127.0.0.1:${P_WEB} Change the config: ${SETUP_HINT}"
|
||||
echo ""
|
||||
@@ -46,6 +46,17 @@ func AcceptCapture(spec agentrun.CaptureTool, accepted int, value json.RawMessag
|
||||
// its rejection, so the agent can correct it, and is not recorded.
|
||||
func ServeCaptureMCP(ctx context.Context, specs []agentrun.CaptureTool, sink io.Writer, t mcp.Transport) error {
|
||||
server := mcp.NewServer(&mcp.Implementation{Name: "archie", Version: "1"}, nil)
|
||||
return serveHarnessMCP(ctx, specs, sink, t, server, false)
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -121,8 +132,8 @@ func ServeCaptureFiles(ctx context.Context, specPath, capturesPath string, t mcp
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var specs []agentrun.CaptureTool
|
||||
if err := json.Unmarshal(raw, &specs); err != nil {
|
||||
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)
|
||||
@@ -130,5 +141,17 @@ func ServeCaptureFiles(ctx context.Context, specPath, capturesPath string, t mcp
|
||||
return err
|
||||
}
|
||||
defer sink.Close()
|
||||
return ServeCaptureMCP(ctx, specs, sink, t)
|
||||
server := mcp.NewServer(&mcp.Implementation{Name: "archie", Version: "1"}, nil)
|
||||
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") {
|
||||
if err := os.WriteFile(capturesPath+".ready", nil, 0o600); err != nil {
|
||||
return nil, fmt.Errorf("record MCP initialization: %w", err)
|
||||
}
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
})
|
||||
return serveHarnessMCP(ctx, spec.Captures, sink, t, server, spec.CentralTools)
|
||||
}
|
||||
@@ -29,12 +29,9 @@ var harnessAdapters = map[string]HarnessAdapter{
|
||||
NewOutput: func() HarnessOutput { return newClaudeCodeHarnessOutput() },
|
||||
MCPConfig: []string{"--mcp-config", mcpConfigPlaceholder},
|
||||
},
|
||||
// Codex takes MCP servers only as inline -c overrides, and Pi and OMP
|
||||
// read no MCP config file of this shape, so their stages serve no
|
||||
// capture tools.
|
||||
AdapterCodex: {NewOutput: func() HarnessOutput { return &codexHarnessOutput{} }},
|
||||
AdapterPi: {NewOutput: func() HarnessOutput { return &piHarnessOutput{} }},
|
||||
AdapterOMP: {NewOutput: func() HarnessOutput { return &piHarnessOutput{} }},
|
||||
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},
|
||||
@@ -55,7 +52,7 @@ type HarnessStages struct {
|
||||
Spec agentrun.HarnessSpec
|
||||
}
|
||||
|
||||
func (r HarnessStages) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
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"]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//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(nil).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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func newClaudeCodeHarnessOutput() *claudeCodeHarnessOutput {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
SessionID string `json:"session_id"`
|
||||
@@ -55,7 +55,7 @@ func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.ToolCallRepo
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage, _ agentrun.ToolCallReporter) {
|
||||
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage, _ agentrun.Reporter) {
|
||||
var message struct {
|
||||
ID string `json:"id"`
|
||||
Usage json.RawMessage `json:"usage"`
|
||||
@@ -79,7 +79,7 @@ func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage, _ agentrun.Tool
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) user(raw json.RawMessage, report agentrun.ToolCallReporter) {
|
||||
func (o *claudeCodeHarnessOutput) user(raw json.RawMessage, report agentrun.Reporter) {
|
||||
var message struct {
|
||||
Content []struct {
|
||||
Type string `json:"type"`
|
||||
@@ -100,12 +100,10 @@ func (o *claudeCodeHarnessOutput) user(raw json.RawMessage, report agentrun.Tool
|
||||
continue
|
||||
}
|
||||
delete(o.pending, block.ToolUseID)
|
||||
if report != nil {
|
||||
report(agentrun.ToolCallReport{
|
||||
Tool: tool, Detail: ClipToolCallDetail(claudeResultContent(block.Content)),
|
||||
Failed: block.IsError,
|
||||
})
|
||||
}
|
||||
report.ReportToolCall(agentrun.ToolCallReport{
|
||||
Tool: tool, Detail: ClipToolCallDetail(claudeResultContent(block.Content)),
|
||||
Failed: block.IsError,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type codexHarnessOutput struct {
|
||||
usage agentrun.Usage
|
||||
}
|
||||
|
||||
func (o *codexHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *codexHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
ThreadID string `json:"thread_id"`
|
||||
@@ -43,8 +43,8 @@ func (o *codexHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter)
|
||||
})
|
||||
}
|
||||
case "item.completed":
|
||||
if call, ok := event.Item.report(); ok && report != nil {
|
||||
report(call)
|
||||
if call, ok := event.Item.report(); ok {
|
||||
report.ReportToolCall(call)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func newCopilotHarnessOutput() *copilotHarnessOutput {
|
||||
return &copilotHarnessOutput{pending: make(map[string]string)}
|
||||
}
|
||||
|
||||
func (o *copilotHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *copilotHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
SessionID string `json:"sessionId"`
|
||||
@@ -52,9 +52,7 @@ func (o *copilotHarnessOutput) Line(line []byte, report agentrun.ToolCallReporte
|
||||
return
|
||||
}
|
||||
delete(o.pending, event.Data.ToolCallID)
|
||||
if report != nil {
|
||||
report(agentrun.ToolCallReport{Tool: tool, Detail: ClipToolCallDetail(event.Data.Result.Content), Failed: !event.Data.Success})
|
||||
}
|
||||
report.ReportToolCall(agentrun.ToolCallReport{Tool: tool, Detail: ClipToolCallDetail(event.Data.Result.Content), Failed: !event.Data.Success})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type piHarnessOutput struct {
|
||||
usage agentrun.Usage
|
||||
}
|
||||
|
||||
func (o *piHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *piHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
@@ -49,7 +49,7 @@ func (o *piHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
o.usage = addUsage(o.usage, usageFromFields(u.Input, u.Output, u.CacheRead, u.CacheWrite))
|
||||
}
|
||||
case "tool_execution_end":
|
||||
if event.ToolName == "" || report == nil {
|
||||
if event.ToolName == "" {
|
||||
return
|
||||
}
|
||||
texts := make([]string, 0, len(event.Result.Content))
|
||||
@@ -58,7 +58,7 @@ func (o *piHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
texts = append(texts, block.Text)
|
||||
}
|
||||
}
|
||||
report(agentrun.ToolCallReport{Tool: event.ToolName, Detail: ClipToolCallDetail(strings.Join(texts, "\n")), Failed: event.IsError})
|
||||
report.ReportToolCall(agentrun.ToolCallReport{Tool: event.ToolName, Detail: ClipToolCallDetail(strings.Join(texts, "\n")), Failed: event.IsError})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ const (
|
||||
// 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.ToolCallReporter)
|
||||
Line(line []byte, report agentrun.Reporter)
|
||||
SessionID() string
|
||||
Usage() agentrun.Usage
|
||||
}
|
||||
@@ -67,7 +67,7 @@ func NewHarnessRunner(newOutput func() HarnessOutput) *HarnessRunner {
|
||||
return &HarnessRunner{newOutput: newOutput}
|
||||
}
|
||||
|
||||
func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
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
|
||||
}
|
||||
@@ -81,6 +81,11 @@ func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.
|
||||
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))
|
||||
@@ -90,7 +95,7 @@ func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.Request, mcpConfig string, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
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 {
|
||||
@@ -195,8 +200,8 @@ func validateHarness(req agentrun.Request) error {
|
||||
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 && !slices.ContainsFunc(h.MCPConfig, func(s string) bool { return strings.Contains(s, mcpConfigPlaceholder) }) {
|
||||
return errors.New("stage has capture tools but the harness registers no MCP server; its results would be lost")
|
||||
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
|
||||
}
|
||||
@@ -239,7 +244,7 @@ func resumeVerb(h *agentrun.HarnessSpec, sessionID string) []string {
|
||||
// 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.ToolCallReporter) error {
|
||||
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
|
||||
@@ -462,9 +467,9 @@ func policyViolation(before, after repoState, changes []string, req agentrun.Req
|
||||
|
||||
type silentOutput struct{}
|
||||
|
||||
func (silentOutput) Line([]byte, agentrun.ToolCallReporter) {}
|
||||
func (silentOutput) SessionID() string { return "" }
|
||||
func (silentOutput) Usage() agentrun.Usage { return agentrun.Usage{} }
|
||||
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 }
|
||||
@@ -485,7 +490,7 @@ func (t *tailBuffer) String() string { return t.buf.String() }
|
||||
// writes into it.
|
||||
func (r *HarnessRunner) prepareCaptures(req agentrun.Request) (config, captures string, cleanup func(), err error) {
|
||||
cleanup = func() {}
|
||||
if len(req.CaptureTools) == 0 {
|
||||
if len(req.CaptureTools) == 0 && !req.Harness.CentralTools {
|
||||
return "", "", cleanup, nil
|
||||
}
|
||||
dir, err := os.MkdirTemp("", "archie-captures-")
|
||||
@@ -497,7 +502,7 @@ func (r *HarnessRunner) prepareCaptures(req agentrun.Request) (config, captures
|
||||
cleanup()
|
||||
return "", "", func() {}, err
|
||||
}
|
||||
spec, err := json.Marshal(req.CaptureTools)
|
||||
spec, err := json.Marshal(harnessMCPSpec{Captures: req.CaptureTools, CentralTools: req.Harness.CentralTools})
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
@@ -511,6 +516,7 @@ func (r *HarnessRunner) prepareCaptures(req agentrun.Request) (config, captures
|
||||
command = []string{self}
|
||||
}
|
||||
server := map[string]any{
|
||||
"env": harnessMCPEnvironment(req.Harness.Env),
|
||||
"command": command[0],
|
||||
"args": slices.Concat(command[1:], []string{"mcp", "-spec", specPath, "-captures", capturesPath}),
|
||||
}
|
||||
@@ -526,5 +532,9 @@ func (r *HarnessRunner) prepareCaptures(req agentrun.Request) (config, captures
|
||||
if err := ownForHarness(req.Harness.User, dir, specPath, configPath, capturesPath); err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
return configPath, capturesPath, cleanup, nil
|
||||
registration, err := harnessMCPRegistration(req.Harness.Adapter, dir, configPath, server)
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
return registration, capturesPath, cleanup, nil
|
||||
}
|
||||
@@ -18,7 +18,7 @@ func TestHarnessLiveOutput(t *testing.T) {
|
||||
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, nil)
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ func NewLoopRunner(
|
||||
// work on the chat workspace and bypass ReadOnly and ProtectPaths.
|
||||
const workspaceToolset = "workspace"
|
||||
|
||||
func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return agentrun.Result{}, err
|
||||
}
|
||||
@@ -67,21 +67,29 @@ func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Req
|
||||
notes := &memoryNotes{initial: req.Notes}
|
||||
captures := make(map[string][]json.RawMessage)
|
||||
toolOpts := r.Limits.Options(workspaceToolset)
|
||||
toolOpts.OnToolCall = report
|
||||
toolOpts.OnToolCall = report.ToolCall
|
||||
centralTools, err := BuildToolSet(r.tools, toolOpts)
|
||||
if err != nil {
|
||||
return agentrun.Result{}, fmt.Errorf("build central tool set: %w", err)
|
||||
}
|
||||
captureTools := captureToolSet(req.CaptureTools, captures)
|
||||
var modelHooks []core.ModelHook
|
||||
var toolHooks []core.ToolHook
|
||||
if report.Transcript != nil {
|
||||
recorder := newTranscript(report.Transcript)
|
||||
modelHooks, toolHooks = []core.ModelHook{recorder}, []core.ToolHook{recorder}
|
||||
}
|
||||
res, err := r.run(ctx, agentloop.Config{
|
||||
Runtime: r.runtime,
|
||||
ModelRef: req.Model,
|
||||
WorkDir: workspace,
|
||||
Mission: req.Mission,
|
||||
ExtraRules: agentexec.ProjectScopedRules(workspace, req.ExtraRules),
|
||||
Notes: notes,
|
||||
Gate: toAgentGate(req.Gate),
|
||||
Preflight: toAgentCommands(req.Preflight),
|
||||
Runtime: r.runtime,
|
||||
ModelRef: req.Model,
|
||||
WorkDir: workspace,
|
||||
|
||||
MaxParallelToolCalls: MaxParallelToolCalls,
|
||||
Mission: req.Mission,
|
||||
ExtraRules: agentexec.ProjectScopedRules(workspace, req.ExtraRules),
|
||||
Notes: notes,
|
||||
Gate: toAgentGate(req.Gate),
|
||||
Preflight: toAgentCommands(req.Preflight),
|
||||
Budget: agentloop.Budget{
|
||||
MaxSteps: req.Budget.MaxSteps,
|
||||
WallClock: req.Budget.WallClock,
|
||||
@@ -99,7 +107,9 @@ func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Req
|
||||
allowedTools(centralTools, r.AllowTools),
|
||||
captureTools,
|
||||
),
|
||||
Logger: r.logger(req),
|
||||
ModelHooks: modelHooks,
|
||||
ToolHooks: toolHooks,
|
||||
Logger: r.logger(req),
|
||||
})
|
||||
result := resultFromRun(req, res, notes.appended, captures)
|
||||
if cause := context.Cause(ctx); cause != nil {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package modelloop
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/runtime"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
@@ -14,6 +16,18 @@ import (
|
||||
// "provider/model"; its Reasoning flag tells the runtime which models need
|
||||
// max_completion_tokens instead of max_tokens.
|
||||
func NewRuntime(providers map[string]agentrun.Provider, limits map[string]config.ModelLimits) *runtime.Runtime {
|
||||
return NewRuntimeWithKeys(providers, limits, nil)
|
||||
}
|
||||
|
||||
// NewRuntimeWithKeys binds host-resolved credentials to one runtime without
|
||||
// exporting them into the process environment or the task protocol.
|
||||
func NewRuntimeWithKeys(providers map[string]agentrun.Provider, limits map[string]config.ModelLimits, keys map[string]string) *runtime.Runtime {
|
||||
return NewRuntimeOver(nil, providers, limits, keys)
|
||||
}
|
||||
|
||||
// NewRuntimeOver is NewRuntimeWithKeys with base carrying the provider
|
||||
// requests, traced; nil means http.DefaultTransport.
|
||||
func NewRuntimeOver(base http.RoundTripper, providers map[string]agentrun.Provider, limits map[string]config.ModelLimits, keys map[string]string) *runtime.Runtime {
|
||||
if len(providers) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -21,14 +35,16 @@ func NewRuntime(providers map[string]agentrun.Provider, limits map[string]config
|
||||
catalog := make(map[string]runtime.ProviderConfig, len(providers))
|
||||
for name, provider := range providers {
|
||||
cfg := runtime.ProviderConfig{ID: name, Class: provider.Class, BaseURL: provider.BaseURL, Models: reasoningModels(name, limits)}
|
||||
if provider.APIKeyEnv == "" {
|
||||
if key, ok := keys[name]; ok {
|
||||
cfg.Auth = runtime.AuthConfig{APIKey: key}
|
||||
} else if provider.APIKeyEnv == "" {
|
||||
cfg.Auth = runtime.AuthConfig{Type: runtime.AuthTypeNone}
|
||||
} else {
|
||||
cfg.Auth = runtime.AuthConfig{APIKeyEnv: provider.APIKeyEnv}
|
||||
}
|
||||
catalog[name] = cfg
|
||||
}
|
||||
return runtime.NewRuntime(runtime.Config{Providers: catalog})
|
||||
return runtime.NewRuntime(runtime.Config{Providers: catalog, HTTPTransport: otelhttp.NewTransport(base)})
|
||||
}
|
||||
|
||||
func reasoningModels(provider string, limits map[string]config.ModelLimits) []runtime.ModelConfig {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
|
||||
aicore "github.com/samcharles93/ai-sdk/core"
|
||||
@@ -65,7 +66,7 @@ type ToolSetOptions struct {
|
||||
// bypass the agent loop's read-only and protected-path enforcement.
|
||||
ExcludeToolsets []string
|
||||
|
||||
// Approval is the human-consent gate for tools marked RequiresApproval.
|
||||
// Approval is the operator-consent gate for tools marked RequiresApproval.
|
||||
// Nil means no approver is configured — such tools are omitted from the
|
||||
// built set rather than failing at call time.
|
||||
Approval tools.ApprovalRequester
|
||||
@@ -73,7 +74,7 @@ type ToolSetOptions struct {
|
||||
// OnToolCall, when non-nil, is notified once per completed tool call.
|
||||
// LoopRunner populates it so a workflow stage can surface tool activity on
|
||||
// the task timeline. Nil means no one is listening.
|
||||
OnToolCall agentrun.ToolCallReporter
|
||||
OnToolCall func(agentrun.ToolCallReport)
|
||||
}
|
||||
|
||||
// reportToolCallCompletion notifies opts.OnToolCall, if set, of one
|
||||
@@ -123,7 +124,7 @@ func BuildToolSetFrom(entries []tools.ToolEntry, opts ToolSetOptions) (aicore.To
|
||||
// A tool that requires approval must not appear in a set built without
|
||||
// an approver: the model would see a tool it can never invoke. With an
|
||||
// approver present the tool is built and the execute closure gates each
|
||||
// call on the human's decision.
|
||||
// call on the operator's decision.
|
||||
if entry.Classification.IsApprovalRequired() && opts.Approval == nil {
|
||||
continue
|
||||
}
|
||||
@@ -148,11 +149,45 @@ func BuildToolSetFrom(entries []tools.ToolEntry, opts ToolSetOptions) (aicore.To
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("tool %s schema: %w", entry.Name, err)
|
||||
}
|
||||
set[entry.Name] = aicore.NewTool(entry.Name, entry.Description, params, toolExecute(entry, opts))
|
||||
tool := aicore.NewTool(entry.Name, entry.Description, params, toolExecute(entry, opts))
|
||||
tool.Concurrency = concurrency(entry.Classification)
|
||||
set[entry.Name] = tool
|
||||
}
|
||||
return set, nil
|
||||
}
|
||||
|
||||
// MaxParallelToolCalls bounds how many of one model step's tool calls run at
|
||||
// once. Each tool's classification decides which calls may overlap.
|
||||
const MaxParallelToolCalls = 8
|
||||
|
||||
// concurrency maps a classification to how a call may overlap others.
|
||||
// Unclassified and approval-gated tools run alone: approvals are asked one
|
||||
// at a time, and an unknown tool is never assumed safe.
|
||||
func concurrency(class tools.ToolClassification) func(string) aicore.Concurrency {
|
||||
switch {
|
||||
case class.IsApprovalRequired():
|
||||
return nil
|
||||
case class.IsIdempotent():
|
||||
return func(input string) aicore.Concurrency { return pathKeyed(input, true) }
|
||||
case class.IsMutating():
|
||||
return func(input string) aicore.Concurrency { return pathKeyed(input, false) }
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// pathKeyed orders calls per path argument, so a read and a write of one
|
||||
// file keep the model's order. A call without a path runs in parallel when
|
||||
// pathless is set and alone otherwise.
|
||||
func pathKeyed(input string, pathless bool) aicore.Concurrency {
|
||||
var args struct {
|
||||
Path string `json:"path"`
|
||||
}
|
||||
if json.Unmarshal([]byte(input), &args) != nil || args.Path == "" {
|
||||
return aicore.Concurrency{Parallel: pathless}
|
||||
}
|
||||
return aicore.Concurrency{Parallel: true, Key: filepath.Clean(args.Path)}
|
||||
}
|
||||
|
||||
func safeToolAvailable(entry tools.ToolEntry) (available bool, err error) {
|
||||
defer func() {
|
||||
if recovered := recover(); recovered != nil {
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
package modelloop
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/chat"
|
||||
"github.com/samcharles93/ai-sdk/core"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
"github.com/samcharles93/archie-core/internal/webhookguard"
|
||||
)
|
||||
|
||||
// transcriptFieldLimit caps each recorded text field, in bytes.
|
||||
const transcriptFieldLimit = 32 << 10
|
||||
|
||||
// compactionPrefix starts the instruction agentloop sends to summarise the
|
||||
// history, which marks a model call as a compaction rather than a step.
|
||||
const compactionPrefix = "Compact the conversation history above"
|
||||
|
||||
// transcript records one agent run's conversation through agentloop's model
|
||||
// and tool hooks. Tool hooks run concurrently, so entries are numbered and
|
||||
// reported under one lock to keep their order.
|
||||
type transcript struct {
|
||||
report func(agentrun.TranscriptEntry)
|
||||
|
||||
mu sync.Mutex
|
||||
seq int
|
||||
prompted bool
|
||||
lastUser string
|
||||
started map[string]time.Time
|
||||
}
|
||||
|
||||
func newTranscript(report func(agentrun.TranscriptEntry)) *transcript {
|
||||
return &transcript{report: report, started: map[string]time.Time{}}
|
||||
}
|
||||
|
||||
func (t *transcript) add(entry agentrun.TranscriptEntry) {
|
||||
t.seq++
|
||||
entry.Seq = t.seq
|
||||
t.report(entry)
|
||||
}
|
||||
|
||||
func (t *transcript) ModelCallStarted(context.Context, chat.Request) {}
|
||||
|
||||
func (t *transcript) ModelCallFinished(_ context.Context, req chat.Request, resp *chat.Response, err error, latency time.Duration, usage *chat.Usage) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
entry := agentrun.TranscriptEntry{Kind: agentrun.TranscriptModel, LatencyMS: latency.Milliseconds(), Usage: transcriptUsage(usage)}
|
||||
if isCompaction(req) {
|
||||
entry.Kind = agentrun.TranscriptCompaction
|
||||
} else {
|
||||
t.recordInput(req.Messages)
|
||||
}
|
||||
if err != nil {
|
||||
entry.Error = clip(err.Error(), nil)
|
||||
}
|
||||
if resp != nil {
|
||||
entry.Text = clip(resp.Content, &entry.TextBytes)
|
||||
entry.Reasoning = clip(reasoning(resp.Parts), &entry.ReasoningBytes)
|
||||
entry.FinishReason = resp.FinishReason
|
||||
for _, call := range resp.ToolCalls {
|
||||
recorded := agentrun.TranscriptToolCall{ID: call.ID, Name: call.Name}
|
||||
recorded.Args = clipArgs(call.Arguments, &recorded.ArgsBytes)
|
||||
entry.ToolCalls = append(entry.ToolCalls, recorded)
|
||||
}
|
||||
}
|
||||
t.add(entry)
|
||||
}
|
||||
|
||||
// recordInput records the prompt on the first call, and after that each user
|
||||
// message the loop appended since the model last answered: gate feedback,
|
||||
// recovery nudges. Assistant and tool messages are recorded from the response
|
||||
// and the tool hooks instead.
|
||||
func (t *transcript) recordInput(messages []chat.Message) {
|
||||
if !t.prompted {
|
||||
t.prompted = true
|
||||
for _, message := range messages {
|
||||
t.recordMessage(message)
|
||||
}
|
||||
return
|
||||
}
|
||||
start := len(messages)
|
||||
for start > 0 && messages[start-1].Role == chat.RoleUser {
|
||||
start--
|
||||
}
|
||||
for _, message := range messages[start:] {
|
||||
if message.Content != t.lastUser {
|
||||
t.recordMessage(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t *transcript) recordMessage(message chat.Message) {
|
||||
kind := agentrun.TranscriptUser
|
||||
switch message.Role {
|
||||
case chat.RoleSystem:
|
||||
kind = agentrun.TranscriptSystem
|
||||
case chat.RoleUser:
|
||||
t.lastUser = message.Content
|
||||
default:
|
||||
return
|
||||
}
|
||||
entry := agentrun.TranscriptEntry{Kind: kind}
|
||||
entry.Text = clip(message.Content, &entry.TextBytes)
|
||||
t.add(entry)
|
||||
}
|
||||
|
||||
func (t *transcript) BeforeToolExecute(_ context.Context, call *core.ToolCall) (*core.Skip, error) {
|
||||
t.mu.Lock()
|
||||
t.started[call.ToolCallID] = time.Now()
|
||||
t.mu.Unlock()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (t *transcript) AfterToolExecute(_ context.Context, call core.ToolCall, result *core.ToolResult) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
entry := agentrun.TranscriptEntry{Kind: agentrun.TranscriptTool, CallID: call.ToolCallID, Tool: call.ToolName}
|
||||
if started, ok := t.started[call.ToolCallID]; ok {
|
||||
entry.LatencyMS = time.Since(started).Milliseconds()
|
||||
delete(t.started, call.ToolCallID)
|
||||
}
|
||||
entry.Args = clipArgs(call.Input, &entry.ArgsBytes)
|
||||
entry.Output = clip(result.Output, &entry.OutputBytes)
|
||||
entry.Error = clip(result.Error, nil)
|
||||
t.add(entry)
|
||||
}
|
||||
|
||||
func reasoning(parts chat.Parts) string {
|
||||
var texts []string
|
||||
for _, part := range parts {
|
||||
if thought, ok := part.(chat.ReasoningPart); ok && thought.Text != "" {
|
||||
texts = append(texts, thought.Text)
|
||||
}
|
||||
}
|
||||
return strings.Join(texts, "\n\n")
|
||||
}
|
||||
|
||||
func isCompaction(req chat.Request) bool {
|
||||
n := len(req.Messages)
|
||||
return n > 0 && req.Messages[n-1].Role == chat.RoleUser && strings.HasPrefix(req.Messages[n-1].Content, compactionPrefix)
|
||||
}
|
||||
|
||||
func transcriptUsage(usage *chat.Usage) *agentrun.Usage {
|
||||
if usage == nil {
|
||||
return nil
|
||||
}
|
||||
return &agentrun.Usage{
|
||||
PromptTokens: usage.PromptTokens,
|
||||
CompletionTokens: usage.CompletionTokens,
|
||||
TotalTokens: usage.TotalTokens,
|
||||
CachedTokens: usage.CachedTokens,
|
||||
CacheCreationTokens: usage.CacheCreationTokens,
|
||||
}
|
||||
}
|
||||
|
||||
// clipArgs redacts tool arguments by key when they are JSON, then clips them.
|
||||
func clipArgs(args string, full *int) string {
|
||||
if json.Valid([]byte(args)) {
|
||||
if redacted, err := webhookguard.RedactPayload([]byte(args)); err == nil {
|
||||
args = string(redacted)
|
||||
}
|
||||
}
|
||||
return clip(args, full)
|
||||
}
|
||||
|
||||
// clip redacts secret-shaped spans and cuts text to transcriptFieldLimit on a
|
||||
// rune boundary, storing the original size in full when it cuts.
|
||||
func clip(text string, full *int) string {
|
||||
text = webhookguard.RedactText(text)
|
||||
if len(text) <= transcriptFieldLimit {
|
||||
return text
|
||||
}
|
||||
if full != nil {
|
||||
*full = len(text)
|
||||
}
|
||||
cut := transcriptFieldLimit
|
||||
for cut > 0 && !utf8.RuneStart(text[cut]) {
|
||||
cut--
|
||||
}
|
||||
return text[:cut]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package modelloop
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/core"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
func TestTranscriptToolEntryRedactsAndClips(t *testing.T) {
|
||||
const jwt = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcmNoaWUifQ.c2lnbmF0dXJlc2lnbmF0dXJl"
|
||||
const pem = "-----BEGIN RSA PRIVATE KEY-----\nMIIEow\n-----END RSA PRIVATE KEY-----"
|
||||
long := strings.Repeat("x", transcriptFieldLimit+10)
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
output string
|
||||
wantArgs string
|
||||
wantOutput string
|
||||
wantBytes int
|
||||
}{
|
||||
{
|
||||
name: "secret key in arguments, token inside output",
|
||||
input: `{"path":"a.txt","api_key":"plain-value"}`,
|
||||
output: "curl -H 'Authorization: Bearer " + jwt + "' done",
|
||||
wantArgs: `{"api_key":"[redacted]","path":"a.txt"}`,
|
||||
wantOutput: "curl -H 'Authorization: Bearer [redacted]' done",
|
||||
},
|
||||
{
|
||||
name: "private key block inside output",
|
||||
input: `{}`,
|
||||
output: "before\n" + pem + "\nafter",
|
||||
wantArgs: `{}`,
|
||||
wantOutput: "before\n[redacted]\nafter",
|
||||
},
|
||||
{
|
||||
name: "oversized output keeps its full size",
|
||||
input: `{}`,
|
||||
output: long,
|
||||
wantArgs: `{}`,
|
||||
wantOutput: long[:transcriptFieldLimit],
|
||||
wantBytes: len(long),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
var got []agentrun.TranscriptEntry
|
||||
recorder := newTranscript(func(entry agentrun.TranscriptEntry) { got = append(got, entry) })
|
||||
call := core.ToolCall{ToolCallID: "c1", ToolName: "shell", Input: tt.input}
|
||||
if _, err := recorder.BeforeToolExecute(t.Context(), &call); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
recorder.AfterToolExecute(t.Context(), call, &core.ToolResult{Output: tt.output})
|
||||
if len(got) != 1 {
|
||||
t.Fatalf("entries = %d, want 1", len(got))
|
||||
}
|
||||
entry := got[0]
|
||||
if entry.Args != tt.wantArgs {
|
||||
t.Errorf("args = %q, want %q", entry.Args, tt.wantArgs)
|
||||
}
|
||||
if entry.Output != tt.wantOutput {
|
||||
t.Errorf("output = %q, want %q", entry.Output, tt.wantOutput)
|
||||
}
|
||||
if entry.OutputBytes != tt.wantBytes {
|
||||
t.Errorf("output bytes = %d, want %d", entry.OutputBytes, tt.wantBytes)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func readProjectMemory(path string) (string, error) {
|
||||
return "Project memory from earlier sessions:\n" + strings.Join(entries, "\n"), nil
|
||||
}
|
||||
|
||||
func (r persistentRunner) Run(ctx context.Context, workspace string, request agentrun.Request, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
func (r persistentRunner) Run(ctx context.Context, workspace string, request agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
if !r.enabled {
|
||||
return r.Runner.Run(ctx, workspace, request, report)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -20,6 +21,7 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
"github.com/samcharles93/archie-core/internal/events"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/prsource"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/taskmcp"
|
||||
"github.com/samcharles93/archie-core/internal/installtype"
|
||||
"github.com/samcharles93/archie-core/internal/storage"
|
||||
"github.com/samcharles93/archie-core/internal/taskrun"
|
||||
@@ -96,10 +98,6 @@ func (h *hybridTrees) Snapshot(ctx context.Context, dir, destDir string) error {
|
||||
return h.local.Snapshot(ctx, dir, destDir)
|
||||
}
|
||||
|
||||
func (h *hybridTrees) ChangedLines(ctx context.Context, dir, base string) (int, error) {
|
||||
return h.local.ChangedLines(ctx, dir, base)
|
||||
}
|
||||
|
||||
// ChangedFileStats forwards to the local worktree manager.
|
||||
func (h *hybridTrees) ChangedFileStats(ctx context.Context, dir, base string) (task.ChangeStats, error) {
|
||||
return h.local.ChangedFileStats(ctx, dir, base)
|
||||
@@ -137,11 +135,12 @@ func worktreeOwnerID(env string) int {
|
||||
}
|
||||
|
||||
type taskDependencies struct {
|
||||
forge workflow.Forger
|
||||
store workflow.Store
|
||||
calls task.Caller
|
||||
trees remoteTrees
|
||||
events agentexec.EventPublisher
|
||||
forge workflow.Forger
|
||||
messenger workflow.Messenger
|
||||
store workflow.Store
|
||||
calls task.Caller
|
||||
trees remoteTrees
|
||||
events agentexec.EventPublisher
|
||||
// steps is the workflow step vocabulary pinned definitions are compiled
|
||||
// against, registered at the composition root and injected: this is the
|
||||
// executing half of the contract whose validating half is the control
|
||||
@@ -152,12 +151,18 @@ type taskDependencies struct {
|
||||
// runs in archie-agent, so the daemon's engine cannot reach it) and set on
|
||||
// every TaskContext; nil means guardrails are disabled.
|
||||
guardrails *tools.GuardrailEngine
|
||||
// modelTransport carries model requests: the egress proxy transport, or
|
||||
// nil to go direct.
|
||||
modelTransport http.RoundTripper
|
||||
}
|
||||
|
||||
type runnerFactory func(map[string]agentrun.Provider, map[string]config.ModelLimits, *slog.Logger) agentrun.Runner
|
||||
|
||||
func newTaskRunner(providers map[string]agentrun.Provider, limits map[string]config.ModelLimits, log *slog.Logger) agentrun.Runner {
|
||||
return modelloop.NewLoopRunner(modelloop.NewRuntime(providers, limits), log)
|
||||
// newTaskRunner builds runners whose model requests go over base.
|
||||
func newTaskRunner(base http.RoundTripper) runnerFactory {
|
||||
return func(providers map[string]agentrun.Provider, limits map[string]config.ModelLimits, log *slog.Logger) agentrun.Runner {
|
||||
return modelloop.NewLoopRunner(modelloop.NewRuntimeOver(base, providers, limits, nil), log)
|
||||
}
|
||||
}
|
||||
|
||||
// applyToolLimits sets the task's tool policy and allowlist on a
|
||||
@@ -177,14 +182,14 @@ func applyToolLimits(agent agentrun.Runner, policy config.ToolPolicy, allow []st
|
||||
// stageRunners builds the runner every agent stage uses. llm is the task's
|
||||
// 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 *mcpProviderSet, newRunner runnerFactory, llm *runtime.Runtime, log *slog.Logger) (agentrun.Runner, error) {
|
||||
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(nil), Spec: *req.Harness}, nil
|
||||
}
|
||||
var agent agentrun.Runner
|
||||
if mcpSet != nil && mcpSet.registry != nil {
|
||||
agent = modelloop.NewLoopRunner(llm, log, mcpSet.registry)
|
||||
if mcpSet != nil && mcpSet.Registry != nil {
|
||||
agent = modelloop.NewLoopRunner(llm, log, mcpSet.Registry)
|
||||
} else {
|
||||
agent = newRunner(req.Providers, req.Cfg.ModelLimits, log)
|
||||
}
|
||||
@@ -224,19 +229,9 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
}
|
||||
defer restoreWorktreeOwnership(trees, workDir, log)()
|
||||
|
||||
// The MCP providers a task hosts share the same model runtime its agent
|
||||
// stages run on, so a server-initiated sampling request is answered from
|
||||
// the task's own model rather than a second provider client.
|
||||
var llm *runtime.Runtime
|
||||
if len(req.MCPServers) > 0 {
|
||||
llm = modelloop.NewRuntime(req.Providers, req.Cfg.ModelLimits)
|
||||
}
|
||||
mcpSet, mcpErr := startMCPProviders(ctx, req.MCPServers, taskSamplingHandler(llm, req.Cfg, samplingUsageRecorder(dependencies.store, req.Task, log)), log)
|
||||
llm, mcpSet := taskMCPProviders(ctx, req, dependencies, log)
|
||||
if mcpSet != nil {
|
||||
defer mcpSet.cleanup(ctx, log)
|
||||
}
|
||||
if mcpErr != nil {
|
||||
log.Warn("mcp providers had errors, continuing with available tools", "err", mcpErr)
|
||||
defer mcpSet.Close(ctx, log)
|
||||
}
|
||||
|
||||
agent, err := stageRunners(req, mcpSet, newRunner, llm, log)
|
||||
@@ -261,12 +256,14 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
Forge: dependencies.forge,
|
||||
Store: dependencies.store,
|
||||
Calls: dependencies.calls,
|
||||
Messenger: dependencies.messenger,
|
||||
Trees: trees,
|
||||
Agent: agent,
|
||||
Bus: bus,
|
||||
Log: log,
|
||||
Guardrails: dependencies.guardrails,
|
||||
}
|
||||
tc.Instructions = req.Instructions
|
||||
configureTaskContext(tc, workDir)
|
||||
|
||||
if req.Repo.PersistentStorage {
|
||||
@@ -290,11 +287,11 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
}
|
||||
|
||||
// configureTaskContext applies what the task's kind changes about its context:
|
||||
// a test run writes nothing to a forge, and pr-review reads the PR data the
|
||||
// daemon prefetched into workDir.
|
||||
// a test run records every outward delivery and performs none, and pr-review
|
||||
// reads the PR data the daemon prefetched into workDir.
|
||||
func configureTaskContext(tc *workflow.TaskContext, workDir string) {
|
||||
if tc.Task.IsTestRun() {
|
||||
workflow.SuppressForgeWrites(tc)
|
||||
workflow.RecordDeliveries(tc)
|
||||
}
|
||||
if tc.Task.Workflow == "pr-review" {
|
||||
tc.PRSource = prsource.NewFromMount(filepath.Join(workDir, prsource.PrefetchDirName))
|
||||
@@ -342,3 +339,15 @@ func CompilePinnedWorkflow(req *taskrun.Request, steps *workflow.Manager) (workf
|
||||
}
|
||||
return wf, nil
|
||||
}
|
||||
|
||||
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 {
|
||||
return nil, nil
|
||||
}
|
||||
llm := modelloop.NewRuntimeOver(deps.modelTransport, req.Providers, req.Cfg.ModelLimits, nil)
|
||||
set, err := taskmcp.Start(ctx, req.MCPServers, taskmcp.SamplingHandler(llm, req.Cfg, taskmcp.UsageRecorder(deps.store, req.Task, log)), log, storage.MCPNPMCacheMountDir)
|
||||
if err != nil {
|
||||
log.WarnContext(ctx, "mcp providers had errors, continuing with available tools", "err", err)
|
||||
}
|
||||
return llm, set
|
||||
}
|
||||
Loaded 100 of 1408 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user