Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdbdbbc72d | ||
|
|
2a04abb84e
|
||
|
|
98f5af3eef
|
||
|
|
d1b1bac4fb
|
||
|
|
45b368af2e
|
||
|
|
0f6448c048
|
||
|
|
b15858adc9
|
||
|
|
1ef576ca7b
|
||
|
|
50cb0b4276
|
||
|
|
472478cf83
|
||
|
|
90c7d137fb
|
||
|
|
2d51cf5106
|
||
|
|
1167f8a51e
|
||
|
|
17e6e66e72
|
||
|
|
fa76f4c994
|
||
|
|
21a523bd35
|
||
|
|
db377380a0
|
||
|
|
81fcea7a03
|
||
|
|
011d22c24c
|
||
|
|
83c8614418
|
||
|
|
ac98b68bda
|
||
|
|
ad63692781
|
||
|
|
090b220d25
|
||
|
|
514219b6a5
|
||
|
|
6a5ba67cf5
|
||
|
|
c09ece6064
|
||
|
|
43ba64684e
|
||
|
|
67fa57008e
|
||
|
|
074ebbd931
|
||
|
|
10d23e3e06
|
||
|
|
6a4e1964f6
|
||
|
|
5939ef6ff1
|
||
|
|
1d9eff6529
|
||
|
|
6ae7f319cb
|
||
|
|
260e9fc46e
|
||
|
|
52b5740c39
|
||
|
|
d11a0cd245
|
||
|
|
860b2c85e0
|
||
|
|
af7577625f
|
||
|
|
617a312ed5
|
||
|
|
a7d202fb04
|
||
|
|
2a52508a5d
|
||
|
|
98fb9dfddf
|
||
|
|
64bb195700
|
||
|
|
c8a46fd9e7
|
||
|
|
93db9a6395
|
||
|
|
89808d0719
|
||
|
|
ef99b7d74e
|
||
|
|
62ddbea0c1
|
||
|
|
b548cabcbf
|
||
|
|
8f37cc79cd
|
||
|
|
031521550a
|
||
|
|
3b67ef746f | ||
|
|
18838105f0
|
||
|
|
d70596f4bf | ||
|
|
a9878c329d | ||
|
|
558659bcf4 | ||
|
|
00e7603932 | ||
|
|
33f7323eb0 | ||
|
|
184038a918
|
No files matched your search
@@ -1,9 +1,3 @@
|
||||
# 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:
|
||||
@@ -23,8 +17,6 @@ jobs:
|
||||
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:
|
||||
@@ -35,15 +27,11 @@ 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
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
+27
-107
@@ -1,7 +1,3 @@
|
||||
# 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:
|
||||
@@ -9,20 +5,8 @@ on:
|
||||
branches: [main]
|
||||
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,
|
||||
# several minutes apiece, with no caching -- so a burst of pushes left
|
||||
# three deploys racing in parallel for the same runner capacity. Only the
|
||||
# last one's images matter (each job pushes its image tags), so cancel a
|
||||
# superseded run rather than let it fight for resources it can't use.
|
||||
#
|
||||
# Keyed on the commit, not github.ref: a release push lands main and its
|
||||
# tag in one go, both pointing at the same commit -- on.push matches
|
||||
# branches and tags both, so a single release push otherwise fires
|
||||
# redundant builds of identical content that a ref-keyed group can't see
|
||||
# as the same work.
|
||||
concurrency:
|
||||
group: deploy-${{ github.sha }}
|
||||
group: ${{ startsWith(github.ref, 'refs/tags/') && format('deploy-release-{0}', github.sha) || format('deploy-{0}', github.ref) }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
@@ -30,20 +14,17 @@ permissions:
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
gate:
|
||||
plan:
|
||||
runs-on: self-hosted
|
||||
outputs:
|
||||
archied_version: ${{ steps.release_tag.outputs.archied_version }}
|
||||
run: ${{ steps.release_tag.outputs.run }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Read the release from the commit, not from github.ref. One release
|
||||
# push carries main and both tags at the same SHA, and only one of
|
||||
# those refs survives the concurrency group, so a ref-derived version
|
||||
# is whatever won the race. The tag at HEAD is the same either way.
|
||||
- name: Resolve archied tag at HEAD
|
||||
id: release_tag
|
||||
run: |
|
||||
@@ -54,13 +35,32 @@ jobs:
|
||||
else
|
||||
echo "no release tag at HEAD; distribution zip will be skipped"
|
||||
fi
|
||||
run=true
|
||||
case "$GITHUB_REF" in
|
||||
refs/tags/*) ;;
|
||||
*)
|
||||
if [ -n "$version" ]; then
|
||||
run=false
|
||||
echo "the v$version tag push runs this commit; skipping the branch run"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
echo "run=$run" >> "$GITHUB_OUTPUT"
|
||||
|
||||
gate:
|
||||
needs: plan
|
||||
if: needs.plan.outputs.run == 'true'
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
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
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
@@ -87,22 +87,12 @@ jobs:
|
||||
git branch main origin/main
|
||||
fi
|
||||
|
||||
# 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
|
||||
# has no such image, so the suite failed on "No such image: alpine:3".
|
||||
- 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: |
|
||||
task check TEST_FLAGS=-count=1
|
||||
@@ -148,9 +138,6 @@ jobs:
|
||||
with:
|
||||
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, 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: |
|
||||
@@ -167,30 +154,14 @@ jobs:
|
||||
- name: Resolve component versions
|
||||
id: versions
|
||||
run: |
|
||||
# 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="${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
|
||||
# restorable. Before, this same string reached :latest minutes after a
|
||||
# release and made the release's own stamping read as dev
|
||||
# (archie-core-i5nb). (On an untagged push GITHUB_SHA IS the commit —
|
||||
# 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}"
|
||||
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "gateway=$GATEWAY_VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT"
|
||||
# :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
|
||||
@@ -214,7 +185,6 @@ jobs:
|
||||
cache-from: type=gha,scope=archied
|
||||
cache-to: type=gha,mode=max,scope=archied
|
||||
|
||||
|
||||
agent-image:
|
||||
outputs:
|
||||
agent_digest: ${{ steps.agent.outputs.digest }}
|
||||
@@ -226,7 +196,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Annotated tags: dereference to the commit, as archied-image does.
|
||||
- name: Resolve the commit this ref points at
|
||||
id: commit
|
||||
run: |
|
||||
@@ -264,23 +233,9 @@ jobs:
|
||||
cache-from: type=gha,scope=archie-agent
|
||||
cache-to: type=gha,mode=max,scope=archie-agent
|
||||
|
||||
# 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, 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
|
||||
# one SHA, the concurrency group below collapses those into a single run,
|
||||
# and the survivor is whichever ref happened to start last -- for
|
||||
# v1.23.0 that was refs/heads/main, so this job was skipped and no zip
|
||||
# was ever produced. Resolve the tag from the commit instead of trusting
|
||||
# the ref that won the race, and skip only when there is genuinely no
|
||||
# archied tag at HEAD.
|
||||
if: needs.gate.outputs.archied_version != ''
|
||||
needs: [plan, gate, agent-image]
|
||||
if: needs.plan.outputs.archied_version != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -290,8 +245,6 @@ 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
|
||||
@@ -303,7 +256,6 @@ jobs:
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
# archied and archie-ui embed the dashboard.
|
||||
- name: Build the dashboard
|
||||
working-directory: ui
|
||||
run: |
|
||||
@@ -312,7 +264,7 @@ jobs:
|
||||
|
||||
- name: Resolve archied version
|
||||
id: version
|
||||
run: echo "version=${{ needs.gate.outputs.archied_version }}" >> "$GITHUB_OUTPUT"
|
||||
run: echo "version=${{ needs.plan.outputs.archied_version }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build linux/amd64 binaries
|
||||
env:
|
||||
@@ -321,22 +273,8 @@ jobs:
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
set -e
|
||||
# Every process in the documented deployment ships in the zip, and
|
||||
# every one of them carries the archied version it was cut from:
|
||||
# they are one release, and an operator matching binaries by eye
|
||||
# needs each to say so.
|
||||
#
|
||||
# That claim is load-bearing and this list is the whole of it: the
|
||||
# v1.30.0 messaging extraction moved Telegram/email/webhook out of
|
||||
# archied and nothing added archie-messaging here, so a host install
|
||||
# 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 }} -X github.com/samcharles93/archie-core/internal/app/agentworker.version=${{ steps.version.outputs.version }}"
|
||||
mkdir -p dist
|
||||
# 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
|
||||
@@ -354,8 +292,6 @@ jobs:
|
||||
digest='${{ needs.agent-image.outputs.agent_digest }}'
|
||||
test -n "$digest"
|
||||
jq --arg image "git.catlow.cloud/sam/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
|
||||
# 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"
|
||||
echo "name=$name" >> "$GITHUB_OUTPUT"
|
||||
@@ -367,10 +303,6 @@ jobs:
|
||||
path: ${{ steps.zip.outputs.name }}.zip
|
||||
retention-days: 90
|
||||
|
||||
# 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
|
||||
|
||||
@@ -388,8 +320,6 @@ jobs:
|
||||
-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 }}
|
||||
@@ -410,7 +340,6 @@ jobs:
|
||||
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")" \
|
||||
@@ -418,21 +347,12 @@ jobs:
|
||||
"$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 }}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# 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:
|
||||
@@ -34,15 +30,11 @@ 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
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ name: Quality
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -20,9 +18,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# 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
|
||||
|
||||
@@ -45,6 +40,14 @@ jobs:
|
||||
go install mvdan.cc/gofumpt@v0.11.0
|
||||
bash tools/proto.sh install
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/golangci-lint
|
||||
key: golangci-lint-${{ hashFiles('.golangci-version', '.golangci.yml', 'go.sum') }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
golangci-lint-${{ hashFiles('.golangci-version', '.golangci.yml', 'go.sum') }}-
|
||||
golangci-lint-
|
||||
|
||||
- name: Ensure contract baseline ref
|
||||
run: |
|
||||
if ! git show-ref --verify --quiet refs/heads/main; then
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# 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:
|
||||
@@ -21,8 +18,6 @@ jobs:
|
||||
cut:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
# A mirror carries its own Actions secrets. An empty token checks out
|
||||
# fine and fails at the push instead, which reads as a broken release.
|
||||
- name: Check DEPLOY_TOKEN is configured
|
||||
env:
|
||||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||
@@ -32,8 +27,6 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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:
|
||||
@@ -45,8 +38,6 @@ 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
|
||||
|
||||
- name: Install Task
|
||||
@@ -60,6 +51,5 @@ jobs:
|
||||
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)"
|
||||
@@ -48,3 +48,4 @@ __pycache__/
|
||||
# Local symlink to the archipelago marketplace repo
|
||||
/archipelago
|
||||
.agents-run/
|
||||
/.pnpm-store/
|
||||
@@ -5,6 +5,14 @@ release's per-component sections are labelled beneath its heading.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.61.3] - 2026-11-08
|
||||
|
||||
### archie-ui
|
||||
|
||||
- Issue, pull request and repository links on tasks open on the forge the repository's connection points at, instead of GitHub.
|
||||
|
||||
- Settings: the Harness page is now part of Agent profiles. The setup terminal and the credential sign-in status sit on the same page as the Kit profiles they target, so a profile with a Kit can be signed in from the page that defines it.
|
||||
|
||||
## [1.61.2] - 2026-11-07
|
||||
|
||||
### archied
|
||||
|
||||
+19
-1
@@ -58,6 +58,9 @@ ENV PATH="/usr/local/go/bin:/go/bin:${PATH}"
|
||||
ARG GOLANGCI_LINT_VERSION=2.14.0
|
||||
ARG GOFUMPT_VERSION=0.11.0
|
||||
ARG BUF_VERSION=1.72.0
|
||||
# Pinned to the versions tools/proto.sh installs; buf generate shells out to them.
|
||||
ARG PROTOC_GEN_GO_VERSION=1.36.11
|
||||
ARG PROTOC_GEN_GO_GRPC_VERSION=1.6.2
|
||||
|
||||
RUN curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" \
|
||||
| tar -xz -C /usr/local/bin --strip-components=1 \
|
||||
@@ -66,7 +69,10 @@ RUN curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/v${G
|
||||
"https://github.com/mvdan/gofumpt/releases/download/v${GOFUMPT_VERSION}/gofumpt_v${GOFUMPT_VERSION}_linux_amd64" && \
|
||||
curl -fsSL -o /usr/local/bin/buf \
|
||||
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" && \
|
||||
chmod +x /usr/local/bin/gofumpt /usr/local/bin/buf
|
||||
chmod +x /usr/local/bin/gofumpt /usr/local/bin/buf && \
|
||||
GOBIN=/usr/local/bin go install "google.golang.org/protobuf/cmd/protoc-gen-go@v${PROTOC_GEN_GO_VERSION}" && \
|
||||
GOBIN=/usr/local/bin go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${PROTOC_GEN_GO_GRPC_VERSION}" && \
|
||||
go clean -cache -modcache
|
||||
|
||||
# ── Python via uv ─────────────────────────────────────────────────────
|
||||
ARG PYTHON_VERSION=3.14
|
||||
@@ -74,6 +80,18 @@ RUN curl -fsSL https://astral.sh/uv/install.sh | sh
|
||||
ENV PATH="/root/.local/bin:${PATH}"
|
||||
RUN uv python install --default "${PYTHON_VERSION}" && rm -rf /root/.cache/uv
|
||||
|
||||
# Point each toolchain at its cache volume (internal/storage). Unset, pnpm puts
|
||||
# its store on the worktree's filesystem, inside the repository the agent commits.
|
||||
ENV GOMODCACHE=/data/cache/go/mod \
|
||||
GOCACHE=/data/cache/go/build \
|
||||
npm_config_cache=/data/cache/node \
|
||||
npm_config_store_dir=/data/cache/pnpm \
|
||||
DENO_DIR=/data/cache/deno \
|
||||
BUN_INSTALL_CACHE_DIR=/data/cache/bun \
|
||||
PIP_CACHE_DIR=/data/cache/pip \
|
||||
UV_CACHE_DIR=/data/cache/pip \
|
||||
CARGO_HOME=/data/cache/cargo
|
||||
|
||||
COPY --from=builder /usr/local/bin/archie-agent /usr/local/bin/archie-agent
|
||||
|
||||
# The daemon injects NATS_URL and, when configured, NATS_TOKEN.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# Archie
|
||||
<h1>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="assets/brand/archie-wordmark-dark.svg">
|
||||
<img alt="Archie" src="assets/brand/archie-wordmark.svg" height="56">
|
||||
</picture>
|
||||
</h1>
|
||||
|
||||
**Event-driven Agentic Automation**
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#0e0f10"/><g fill="#51a580" transform="translate(96 96) scale(13.333) translate(-0 -0)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 319 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#51a580"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></svg>
|
||||
|
After Width: | Height: | Size: 194 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 630"><rect width="1200" height="630" fill="#0e0f10"/><svg x="320" y="209.6153846153846" width="560" height="150.76923076923077" viewBox="-4 21.4 312 84"><g fill="#51a580" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="#e8e6e1" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg><g fill="#a8a59f" transform="translate(224.91199999999998 460.38461538461536)"><path transform="translate(0.00 0)" d="M18.70-23.73L18.70-21.22L11.15-21.22L11.15 0L8.30 0L8.30-21.22L0.75-21.22L0.75-23.73"/><path transform="translate(19.45 0)" d="M5.61 0L2.89 0L2.89-25.16L5.61-25.16L5.61-14.69L5.75-14.69Q6.39-16.18 7.57-17.07Q8.74-17.95 10.71-17.95Q13.43-17.95 15.01-16.20Q16.59-14.45 16.59-11.25L16.59 0L13.87 0L13.87-10.78Q13.87-13.12 12.87-14.31Q11.87-15.50 9.89-15.50Q8.81-15.50 7.82-15.15Q6.83-14.79 6.22-14.04Q5.61-13.29 5.61-12.17"/><path transform="translate(38.76 0)" d="M9.49 0.41Q7.11 0.41 5.34-0.73Q3.57-1.87 2.58-3.93Q1.60-5.98 1.60-8.77Q1.60-11.56 2.58-13.62Q3.57-15.67 5.34-16.81Q7.11-17.95 9.49-17.95Q11.83-17.95 13.53-16.85Q15.23-15.74 16.15-13.80Q17.07-11.87 17.07-9.38L17.07-8.09L4.45-8.09L4.45-7.28Q4.45-5 5.83-3.49Q7.21-1.97 9.66-1.97Q11.32-1.97 12.56-2.75Q13.80-3.54 14.48-5L16.42-3.60Q15.57-1.84 13.77-0.71Q11.97 0.41 9.49 0.41M9.49-15.67Q8.02-15.67 6.89-14.99Q5.75-14.31 5.10-13.11Q4.45-11.90 4.45-10.37L4.45-10.13L14.14-10.13L14.14-10.51Q14.14-12.07 13.57-13.23Q12.99-14.38 11.93-15.03Q10.88-15.67 9.49-15.67"/><path transform="translate(57.43 0)" d=""/><path transform="translate(65.45 0)" d="M17.17-2.38L17.17 0L15.64 0Q14.55 0 13.87-0.46Q13.19-0.92 12.89-1.73Q12.68-2.24 12.61-2.86L12.44-2.86Q11.90-1.26 10.56-0.42Q9.21 0.41 7.38 0.41Q4.59 0.41 3.04-1.02Q1.50-2.45 1.50-4.90Q1.50-6.56 2.31-7.70Q3.13-8.84 4.78-9.44Q6.43-10.03 8.98-10.03L12.44-10.03L12.44-11.76Q12.44-13.63 11.42-14.62Q10.40-15.61 8.30-15.61Q6.73-15.61 5.64-14.89Q4.56-14.18 3.84-12.99L2.21-14.52Q2.92-15.91 4.49-16.93Q6.05-17.95 8.43-17.95Q11.59-17.95 13.38-16.39Q15.16-14.82 15.16-12.04L15.16-2.38L17.17-2.38M12.44-5.10L12.44-7.99L8.84-7.99Q6.53-7.99 5.44-7.31Q4.35-6.63 4.35-5.34L4.35-4.62Q4.35-3.33 5.30-2.62Q6.26-1.90 7.82-1.90Q9.18-1.90 10.22-2.33Q11.25-2.75 11.85-3.49Q12.44-4.22 12.44-5.10"/><path transform="translate(83.61 0)" d="M17.68 1.94Q17.68 3.74 16.73 4.91Q15.78 6.09 13.89 6.65Q12 7.21 9.18 7.21Q6.46 7.21 4.74 6.70Q3.03 6.19 2.24 5.22Q1.46 4.25 1.46 2.89Q1.46 1.46 2.21 0.65Q2.96-0.17 4.25-0.51L4.25-0.88Q3.50-1.26 3.09-1.85Q2.69-2.45 2.69-3.33Q2.69-4.66 3.54-5.36Q4.39-6.05 5.71-6.39L5.71-6.53Q4.15-7.28 3.28-8.67Q2.41-10.06 2.41-11.90Q2.41-13.70 3.23-15.06Q4.05-16.42 5.54-17.19Q7.04-17.95 9.01-17.95Q9.96-17.95 10.79-17.78Q11.63-17.61 12.34-17.27L12.34-17.58Q12.34-18.60 12.82-19.26Q13.29-19.92 14.38-19.92L17-19.92L17-17.54L13.67-17.54L13.67-16.42Q14.62-15.61 15.15-14.45Q15.67-13.29 15.67-11.90Q15.67-Line truncated
|
||||
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 21.40 312 84" role="img" aria-label="Archie"><title>Archie</title><g fill="#51a580" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="#e8e6e1" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 21.40 312 84" role="img" aria-label="Archie"><title>Archie</title><g fill="currentColor" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="currentColor" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 21.40 312 84" role="img" aria-label="Archie"><title>Archie</title><g fill="#51a580" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="#1f1f1d" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -19,9 +19,6 @@ bot_user = "vectis-labs-archie"
|
||||
type = "github"
|
||||
host = "https://github.com"
|
||||
token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" }
|
||||
# intake = "poll" # "poll", "webhook" or "both"
|
||||
# webhook_secret = { engine = "env", key = "ARCHIE_WEBHOOK_SECRET" }
|
||||
# webhook_addr = "0.0.0.0:8645"
|
||||
|
||||
[dispatch]
|
||||
trigger = "assignee" # "assignee", "label" or "either"
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
"/news/archie/1.61.0/": "/news/1.61.0/",
|
||||
"/news/archie/1.61.1/": "/news/1.61.1/",
|
||||
"/news/archie/1.61.2/": "/news/1.61.2/",
|
||||
"/news/archie/1.61.3/": "/news/1.61.3/",
|
||||
"/news/archie/1.7.0/": "/news/1.7.0/",
|
||||
"/news/archie/1.8.0/": "/news/1.8.0/",
|
||||
"/news/archie/1.9.0/": "/news/1.9.0/",
|
||||
@@ -203,6 +204,7 @@
|
||||
"/news/archied/1.61.0/": "/news/1.61.0/",
|
||||
"/news/archied/1.61.1/": "/news/1.61.1/",
|
||||
"/news/archied/1.61.2/": "/news/1.61.2/",
|
||||
"/news/archied/1.61.3/": "/news/1.61.3/",
|
||||
"/news/archied/1.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,9 @@
|
||||
[
|
||||
{
|
||||
"version": "1.61.3",
|
||||
"date": "2026-11-08",
|
||||
"body": "### archie-ui\n\n- Issue, pull request and repository links on tasks open on the forge the repository's connection points at, instead of GitHub.\n\n- Settings: the Harness page is now part of Agent profiles. The setup terminal and the credential sign-in status sit on the same page as the Kit profiles they target, so a profile with a Kit can be signed in from the page that defines it."
|
||||
},
|
||||
{
|
||||
"version": "1.61.2",
|
||||
"date": "2026-11-07",
|
||||
|
||||
@@ -78,7 +78,7 @@ accounts by unverified email, or create an administrator.
|
||||
| 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` |
|
||||
| Incoming webhooks: `captureintake`, access delivery engine | Verify HMAC before parsing; derive source/org from stored source; evaluate source delivery policies and egress rules. No browser-user credential is inferred. | Capture tests, `TestAuthorizeDelivery` |
|
||||
| Control-plane configuration, secrets, harness and extensions | Browser policy and instance-only restrictions where registered; service contracts carry principal/org; task grants cannot invoke administrative RPCs. | HTTP deny matrix, `TestAdministrationRoutes`, `TestChannelReloadRoute`, `TestConfineHarnessOrg` |
|
||||
| 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` |
|
||||
|
||||
@@ -35,7 +35,6 @@ require (
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.3 // indirect
|
||||
github.com/kevinburke/ssh_config v1.6.0 // indirect
|
||||
github.com/klauspost/compress v1.20.3 // indirect
|
||||
github.com/mattn/go-colorable v0.1.16 // indirect
|
||||
github.com/mattn/go-isatty v0.0.24 // indirect
|
||||
github.com/mfridman/interpolate v0.0.2 // indirect
|
||||
@@ -79,14 +78,15 @@ require (
|
||||
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.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
|
||||
github.com/google/jsonschema-go v0.4.3
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/hashicorp/go-hclog v1.6.3
|
||||
github.com/hashicorp/go-plugin v1.8.0
|
||||
github.com/hiddeco/sshsig v0.2.0
|
||||
github.com/jackc/pgx/v5 v5.11.0
|
||||
github.com/klauspost/compress v1.20.3
|
||||
github.com/moby/moby/api v1.56.1
|
||||
github.com/moby/moby/client v0.6.2
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0
|
||||
|
||||
@@ -76,8 +76,6 @@ github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
|
||||
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-telegram/bot v1.27.0 h1:PG9yBDzM8O26oUerE9SZwWlHon4RpH8WcNslZ7CEZmE=
|
||||
github.com/go-telegram/bot v1.27.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/go-webauthn/webauthn v0.18.2 h1:0BeftmEHU7i3Dv0VFwBtidy/ba37Vcdjvqst9EYu8Sk=
|
||||
@@ -106,6 +104,8 @@ github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/
|
||||
github.com/hashicorp/go-plugin v1.8.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8=
|
||||
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
|
||||
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
|
||||
github.com/hiddeco/sshsig v0.2.0 h1:gMWllgKCITXdydVkDL+Zro0PU96QI55LwUwebSwNTSw=
|
||||
github.com/hiddeco/sshsig v0.2.0/go.mod h1:nJc98aGgiH6Yql2doqH4CTBVHexQA40Q+hMMLHP4EqE=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
|
||||
@@ -41,14 +42,6 @@ func AcceptCapture(spec agentrun.CaptureTool, accepted int, value json.RawMessag
|
||||
return spec.Name + " recorded", true
|
||||
}
|
||||
|
||||
// ServeCaptureMCP serves a stage's capture tools over MCP and appends each
|
||||
// accepted call to sink as one JSON line. A rejected call is answered with
|
||||
// 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)
|
||||
@@ -142,12 +135,15 @@ func ServeCaptureFiles(ctx context.Context, specPath, capturesPath string, t mcp
|
||||
}
|
||||
defer sink.Close()
|
||||
server := mcp.NewServer(&mcp.Implementation{Name: "archie", Version: "1"}, nil)
|
||||
var ready atomic.Bool
|
||||
server.AddReceivingMiddleware(func(next mcp.MethodHandler) mcp.MethodHandler {
|
||||
return func(ctx context.Context, method string, req mcp.Request) (mcp.Result, error) {
|
||||
result, err := next(ctx, method, req)
|
||||
if err == nil && (method == "tools/list" || method == "tools/call") {
|
||||
if err := os.WriteFile(capturesPath+".ready", nil, 0o600); err != nil {
|
||||
return nil, fmt.Errorf("record MCP initialization: %w", err)
|
||||
if err == nil && (method == "tools/list" || method == "tools/call") && !ready.Load() {
|
||||
// A call is already recorded by now, so a failed marker must not
|
||||
// turn it into a tool error; the runner reports the missing marker.
|
||||
if os.WriteFile(capturesPath+".ready", nil, 0o600) == nil {
|
||||
ready.Store(true)
|
||||
}
|
||||
}
|
||||
return result, err
|
||||
|
||||
@@ -34,7 +34,7 @@ func TestHarnessRequiresMCPInitialization(t *testing.T) {
|
||||
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{})
|
||||
result, err := NewHarnessRunner().Run(t.Context(), workspace, req, agentrun.Reporter{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
|
||||
switch event.Type {
|
||||
case "assistant":
|
||||
o.assistant(event.Message, report)
|
||||
o.assistant(event.Message)
|
||||
case "user":
|
||||
o.user(event.Message, report)
|
||||
case "result":
|
||||
@@ -55,7 +55,7 @@ func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage, _ agentrun.Reporter) {
|
||||
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage) {
|
||||
var message struct {
|
||||
ID string `json:"id"`
|
||||
Usage json.RawMessage `json:"usage"`
|
||||
|
||||
@@ -11,6 +11,9 @@ import (
|
||||
// process groups are unavailable.
|
||||
func setProcessGroup(*exec.Cmd) {}
|
||||
|
||||
// reapGroup has nothing to do where process groups are unavailable.
|
||||
func reapGroup(*exec.Cmd) {}
|
||||
|
||||
// runAsHarnessUser refuses a named harness user where user switching is
|
||||
// unavailable, rather than running the harness as the worker.
|
||||
func runAsHarnessUser(_ *exec.Cmd, name string) error {
|
||||
|
||||
@@ -22,6 +22,14 @@ func setProcessGroup(cmd *exec.Cmd) {
|
||||
cmd.Cancel = func() error { return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) }
|
||||
}
|
||||
|
||||
// reapGroup kills whatever the command left running in its process group, so a
|
||||
// daemonised child cannot outlive the invocation that started it.
|
||||
func reapGroup(cmd *exec.Cmd) {
|
||||
if cmd.Process != nil {
|
||||
_ = syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
|
||||
}
|
||||
}
|
||||
|
||||
// runAsHarnessUser drops the invocation to the Kit's user. A worker running
|
||||
// as root refuses to start a harness with no user, because the harness would
|
||||
// then share the worker's user and could read its credentials.
|
||||
|
||||
@@ -54,18 +54,11 @@ type HarnessOutput interface {
|
||||
// guarantees do not depend on the CLI obeying its prompt: the runner checks
|
||||
// the worktree and the repository's refs and configuration after every
|
||||
// invocation, runs the gate itself, and owns the process's lifetime.
|
||||
type HarnessRunner struct {
|
||||
newOutput func() HarnessOutput
|
||||
// mcpCommand starts archie's MCP server; it defaults to this binary's
|
||||
// own "mcp" subcommand.
|
||||
mcpCommand []string
|
||||
}
|
||||
type HarnessRunner struct{}
|
||||
|
||||
// NewHarnessRunner returns a runner using newOutput to read each
|
||||
// invocation. A nil newOutput reads with the adapter the request names.
|
||||
func NewHarnessRunner(newOutput func() HarnessOutput) *HarnessRunner {
|
||||
return &HarnessRunner{newOutput: newOutput}
|
||||
}
|
||||
// NewHarnessRunner returns a runner that reads each invocation with the
|
||||
// adapter the request names.
|
||||
func NewHarnessRunner() *HarnessRunner { return &HarnessRunner{} }
|
||||
|
||||
func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
if err := validateHarness(req); err != nil {
|
||||
@@ -133,7 +126,7 @@ func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.
|
||||
return res, err
|
||||
}
|
||||
|
||||
gateOutput, gateErr := runHarnessGate(runCtx, req.Gate.Commands, workspace)
|
||||
gateOutput, gateErr := runHarnessGate(runCtx, req.Harness, req.Gate.Commands, workspace)
|
||||
if gateErr == nil {
|
||||
res.Status = agentrun.StatusPassed
|
||||
return res, nil
|
||||
@@ -144,7 +137,11 @@ func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.
|
||||
if res.Iterations >= maxIterations {
|
||||
return park(res, StopGate, gateOutput), nil
|
||||
}
|
||||
verb, prompt = resumeVerb(req.Harness, session), "The quality gate failed. Fix the cause, then stop.\n\n"+gateOutput
|
||||
verb = resumeVerb(req.Harness, session)
|
||||
if len(verb) == 0 {
|
||||
return park(res, StopGate, gateOutput), nil
|
||||
}
|
||||
prompt = "The quality gate failed. Fix the cause, then stop.\n\n" + gateOutput
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,9 +168,6 @@ func settle(runCtx context.Context, workspace string, before repoState, req agen
|
||||
}
|
||||
|
||||
func (r *HarnessRunner) output(adapter string) HarnessOutput {
|
||||
if r.newOutput != nil {
|
||||
return r.newOutput()
|
||||
}
|
||||
if a, ok := LookupHarnessAdapter(adapter); ok {
|
||||
return a.NewOutput()
|
||||
}
|
||||
@@ -230,7 +224,9 @@ func harnessArgv(h *agentrun.HarnessSpec, verb []string, prompt, session, mcpCon
|
||||
}
|
||||
|
||||
// resumeVerb continues the session the last invocation reported, falling
|
||||
// back to the most recent session when the CLI reported none.
|
||||
// back to the most recent session when the CLI reported none. It returns nil
|
||||
// when neither is possible: resuming with an empty session ID would start a
|
||||
// broken command.
|
||||
func resumeVerb(h *agentrun.HarnessSpec, sessionID string) []string {
|
||||
if len(h.Resume) > 0 && sessionID != "" {
|
||||
return slices.Clone(h.Resume)
|
||||
@@ -238,7 +234,7 @@ func resumeVerb(h *agentrun.HarnessSpec, sessionID string) []string {
|
||||
if len(h.Continue) > 0 {
|
||||
return slices.Clone(h.Continue)
|
||||
}
|
||||
return slices.Clone(h.Resume)
|
||||
return nil
|
||||
}
|
||||
|
||||
// invoke runs one harness invocation in its own process group, feeding
|
||||
@@ -270,8 +266,16 @@ func invoke(ctx context.Context, workspace string, h *agentrun.HarnessSpec, argv
|
||||
for scanner.Scan() {
|
||||
out.Line(scanner.Bytes(), report)
|
||||
}
|
||||
_, _ = io.Copy(io.Discard, output)
|
||||
if err := cmd.Wait(); err != nil {
|
||||
if err := scanner.Err(); err != nil {
|
||||
// Stop the CLI rather than leave it writing into a pipe nobody parses.
|
||||
_ = cmd.Cancel()
|
||||
_, _ = io.Copy(io.Discard, output)
|
||||
_ = cmd.Wait()
|
||||
return fmt.Errorf("read harness output: %w", err)
|
||||
}
|
||||
waitErr := cmd.Wait()
|
||||
reapGroup(cmd)
|
||||
if err := waitErr; err != nil {
|
||||
if ctx.Err() != nil {
|
||||
return ctx.Err()
|
||||
}
|
||||
@@ -304,14 +308,24 @@ func harnessPrompt(workspace string, req agentrun.Request) string {
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func runHarnessGate(ctx context.Context, commands []agentrun.Command, workspace string) (string, error) {
|
||||
// runHarnessGate runs the gate commands confined like the harness: they
|
||||
// execute code the harness just wrote, so they get its user, its environment
|
||||
// and its process group rather than the worker's.
|
||||
func runHarnessGate(ctx context.Context, h *agentrun.HarnessSpec, commands []agentrun.Command, workspace string) (string, error) {
|
||||
for _, c := range commands {
|
||||
if len(c.Argv) == 0 {
|
||||
continue
|
||||
}
|
||||
cmd := exec.CommandContext(ctx, c.Argv[0], c.Argv[1:]...)
|
||||
cmd.Dir = workspace
|
||||
cmd.WaitDelay = killGrace
|
||||
cmd.Env = append([]string{}, h.Env...)
|
||||
setProcessGroup(cmd)
|
||||
if err := runAsHarnessUser(cmd, h.User); err != nil {
|
||||
return "", err
|
||||
}
|
||||
output, err := cmd.CombinedOutput()
|
||||
reapGroup(cmd)
|
||||
switch {
|
||||
case c.ExpectFailure && err == nil:
|
||||
return fmt.Sprintf("[%s] expected this command to fail, but it passed:\n%s", c.Name, clipGate(output)),
|
||||
@@ -507,18 +521,14 @@ func (r *HarnessRunner) prepareCaptures(req agentrun.Request) (config, captures
|
||||
return fail(err)
|
||||
}
|
||||
specPath, capturesPath, configPath := filepath.Join(dir, "tools.json"), filepath.Join(dir, "captures.jsonl"), filepath.Join(dir, "mcp.json")
|
||||
command := r.mcpCommand
|
||||
if len(command) == 0 {
|
||||
self, err := os.Executable()
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
command = []string{self}
|
||||
self, err := os.Executable()
|
||||
if err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
server := map[string]any{
|
||||
"env": harnessMCPEnvironment(req.Harness.Env),
|
||||
"command": command[0],
|
||||
"args": slices.Concat(command[1:], []string{"mcp", "-spec", specPath, "-captures", capturesPath}),
|
||||
"command": self,
|
||||
"args": []string{"mcp", "-spec", specPath, "-captures", capturesPath},
|
||||
}
|
||||
cfg, err := json.Marshal(map[string]any{"mcpServers": map[string]any{"archie": server}})
|
||||
if err != nil {
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/google/jsonschema-go/jsonschema"
|
||||
|
||||
@@ -15,15 +16,18 @@ import (
|
||||
|
||||
// toolCallDetailBytes caps the summary ToolCallReport.Detail carries. This
|
||||
// rides on every task's observability event stream, so one large file read
|
||||
// must not dominate it the way baselineMissionBytes-sized content is allowed
|
||||
// to dominate a builder's own context.
|
||||
// must not dominate it.
|
||||
const toolCallDetailBytes = 300
|
||||
|
||||
func ClipToolCallDetail(s string) string {
|
||||
if len(s) <= toolCallDetailBytes {
|
||||
return s
|
||||
}
|
||||
return s[:toolCallDetailBytes] + "…"
|
||||
cut := toolCallDetailBytes
|
||||
for cut > 0 && !utf8.RuneStart(s[cut]) {
|
||||
cut--
|
||||
}
|
||||
return s[:cut] + "…"
|
||||
}
|
||||
|
||||
func ProjectScopedRules(workspace, extra string) string {
|
||||
|
||||
@@ -36,24 +36,22 @@ func (l ToolLimits) EnsureSpillDir() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Options builds the tool-set options for a single turn or stage.
|
||||
// There is no aggregate turn output budget; only per-result caps apply.
|
||||
// Options builds the tool-set options for a single turn or stage. Only
|
||||
// per-result caps apply; there is no aggregate turn output budget.
|
||||
func (l ToolLimits) Options(excludeToolsets ...string) ToolSetOptions {
|
||||
opts := ToolSetOptions{
|
||||
return ToolSetOptions{
|
||||
MaxResultChars: l.MaxResultChars,
|
||||
ExcludeToolsets: excludeToolsets,
|
||||
SpillDir: l.SpillDir,
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
// ToolSetOptions bounds what a built tool set may do and return.
|
||||
//
|
||||
// The zero value builds every available tool with no result limits, which is
|
||||
// the behaviour this package had before the options existed.
|
||||
// The zero value builds every available tool with no result limits.
|
||||
type ToolSetOptions struct {
|
||||
// SpillDir receives complete results displaced by the per-tool cap. Empty
|
||||
// selects inline truncation. There is deliberately no aggregate turn cap.
|
||||
// selects inline truncation.
|
||||
SpillDir string
|
||||
|
||||
// MaxResultChars caps a single tool result. Entries setting
|
||||
@@ -78,8 +76,7 @@ type ToolSetOptions struct {
|
||||
}
|
||||
|
||||
// reportToolCallCompletion notifies opts.OnToolCall, if set, of one
|
||||
// completed call. Factored out of toolExecute's closure so the branching
|
||||
// here doesn't add to that function's own cognitive-complexity budget.
|
||||
// completed call.
|
||||
func reportToolCallCompletion(opts ToolSetOptions, entry tools.ToolEntry, result string, err error) {
|
||||
if opts.OnToolCall == nil {
|
||||
return
|
||||
@@ -241,9 +238,6 @@ func toolExecute(entry tools.ToolEntry, opts ToolSetOptions) func(context.Contex
|
||||
// requireApproval blocks until entry's approval is granted, returning an
|
||||
// error if it is denied, times out, or the approver misbehaves.
|
||||
func requireApproval(ctx context.Context, entry tools.ToolEntry, opts ToolSetOptions, args map[string]any) error {
|
||||
if opts.Approval == nil {
|
||||
return fmt.Errorf("tool %s requires approval but no approver is configured", entry.Name)
|
||||
}
|
||||
approveCtx, cancel := context.WithTimeout(ctx, tools.ToolApprovalTimeout)
|
||||
defer cancel()
|
||||
desc := entry.Description
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package agentexec
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
|
||||
@@ -14,16 +15,16 @@ type EventPublisher interface {
|
||||
|
||||
// ForwardTaskEvents publishes every event from sub to SubjectForEvents(taskID)
|
||||
// until sub closes. Failures are logged.
|
||||
func ForwardTaskEvents(sub *events.Sub, pub EventPublisher, taskID int64, log *slog.Logger) {
|
||||
func ForwardTaskEvents(ctx context.Context, sub *events.Sub, pub EventPublisher, taskID int64, log *slog.Logger) {
|
||||
subject := SubjectForEvents(taskID)
|
||||
for e := range sub.C {
|
||||
data, err := json.Marshal(e)
|
||||
if err != nil {
|
||||
log.Warn("task event marshal failed", "task", taskID, "kind", e.Kind, "err", err)
|
||||
log.WarnContext(ctx, "task event marshal failed", "task", taskID, "kind", e.Kind, "err", err)
|
||||
continue
|
||||
}
|
||||
if err := pub.Publish(subject, data); err != nil {
|
||||
log.Warn("task event publish failed", "task", taskID, "kind", e.Kind, "err", err)
|
||||
log.WarnContext(ctx, "task event publish failed", "task", taskID, "kind", e.Kind, "err", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "959d5b3d-d376-4416-9abb-71e0b8a36047", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "1f5ed274-0baa-4558-b00f-36ef98d28ebc", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "5aa154a9-9315-4a6c-8de0-750cb35139cf", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "ef74547a-736e-4bb9-bd68-16cc1592b2a3", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "398b087e-942b-4d67-904c-1778d3b20063", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "ecbfdcf2-446c-4386-a89f-eeaf43e48b46", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "c10b3042-e990-49db-8937-954b6fe11570", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "3a3327f8-ad24-46d7-a194-e0ce68f9f871", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "init", "cwd": "/workspace", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "tools": ["Task", "Bash", "Edit", "Read", "Write"], "mcp_servers": [], "model": "claude-opus-5-5", "permissionMode": "bypassPermissions", "slash_commands": [], "terminal_slash_commands": [], "apiKeySource": "none", "claude_code_version": "2.1.282", "output_style": "default", "agents": [], "skills": [], "plugins": [], "capabilities": ["interrupt_receipt_v1", "interrupt_cancel_queued_v1", "msg_lifecycle_v1", "mcp_read_resource_v1", "mcp_tool_ui_meta_v1"], "analytics_disabled": false, "product_feedback_disabled": false, "uuid": "0ad7c54e-a817-406b-af22-8f647b4e0021", "memory_paths": {}, "messaging_socket_path": "", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "per_turn_effort_active": true, "view_mode": "default"}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZ2iQ3sZ59vJ9CCae9", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "name": "Bash", "input": {"command": "echo hello", "description": "Print hello"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 23584, "cache_read_input_tokens": 10119, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 23584}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "b4c3b51e-0a58-4b28-8c5a-20a2ff2aaadb", "timestamp": "2026-09-25T17:22:54.134Z", "request_id": "req_011CfQYZ2Ddp5YubZj8vB9Fb", "wire_tool_inputs": {"toolu_01P8qrSZwqH1jjZXfrZETjKz": {"command": "echo hello", "description": "Print hello"}}}
|
||||
{"type": "rate_limit_event", "rate_limit_info": {"status": "allowed_warning", "resetsAt": 1790377200, "rateLimitType": "seven_day", "utilization": 0.98, "isUsingOverage": false, "surpassedThreshold": 0.75, "unifiedWindows": {"five_hour": {"utilization": 0.76, "resetsAt": 1790366400}, "seven_day": {"utilization": 0.98, "resetsAt": 1790377200}}}, "uuid": "a91b2340-329e-4c73-8e1a-307860859743", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "type": "tool_result", "content": "hello", "is_error": false}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "6beae671-52a0-499a-b72b-f9321c1d9e14", "timestamp": "2026-09-25T17:22:54.460Z", "tool_use_result": {"stdout": "hello", "stderr": "", "interrupted": false, "isImage": false, "noOutputExpected": false}}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZHW9AJ164FSYj39uG", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01YNNETbc61jN44ATXrmHdEC", "name": "Bash", "input": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 580, "cache_read_input_tokens": 33703, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 580}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "3b14941d-c8eb-45f4-b555-829e06119f19", "timestamp": "2026-09-25T17:22:56.420Z", "request_id": "req_011CfQYZH18nwJgBYNZs8XGq", "wire_tool_inputs": {"toolu_01YNNETbc61jN44ATXrmHdEC": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}}}
|
||||
{"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "content": "Exit code 1\ncat: /nonexistent-file: No such file or directory", "is_error": true, "tool_use_id": "toolu_01YNNETbc61jN44ATXrmHdEC"}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "395dc93d-0e4f-40b5-854b-77a128aa0990", "timestamp": "2026-09-25T17:22:56.442Z", "tool_use_result": "Error: Exit code 1\ncat: /nonexistent-file: No such file or directory"}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZRy8qPUaVcnVs9CQD", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session."}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 145, "cache_read_input_tokens": 34283, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "output_tokens": 89, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "8f97a329-c76c-4b90-b154-bda9468b969d", "timestamp": "2026-09-25T17:22:58.580Z", "request_id": "req_011CfQYZRSdq9mNMbE7n8okT"}
|
||||
@@ -1,17 +0,0 @@
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "959d5b3d-d376-4416-9abb-71e0b8a36047", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "1f5ed274-0baa-4558-b00f-36ef98d28ebc", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "5aa154a9-9315-4a6c-8de0-750cb35139cf", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "ef74547a-736e-4bb9-bd68-16cc1592b2a3", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "398b087e-942b-4d67-904c-1778d3b20063", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "ecbfdcf2-446c-4386-a89f-eeaf43e48b46", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "c10b3042-e990-49db-8937-954b6fe11570", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "3a3327f8-ad24-46d7-a194-e0ce68f9f871", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "init", "cwd": "/workspace", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "tools": ["Task", "Bash", "Edit", "Read", "Write"], "mcp_servers": [], "model": "claude-opus-5-5", "permissionMode": "bypassPermissions", "slash_commands": [], "terminal_slash_commands": [], "apiKeySource": "none", "claude_code_version": "2.1.282", "output_style": "default", "agents": [], "skills": [], "plugins": [], "capabilities": ["interrupt_receipt_v1", "interrupt_cancel_queued_v1", "msg_lifecycle_v1", "mcp_read_resource_v1", "mcp_tool_ui_meta_v1"], "analytics_disabled": false, "product_feedback_disabled": false, "uuid": "0ad7c54e-a817-406b-af22-8f647b4e0021", "memory_paths": {}, "messaging_socket_path": "", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "per_turn_effort_active": true, "view_mode": "default"}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZ2iQ3sZ59vJ9CCae9", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "name": "Bash", "input": {"command": "echo hello", "description": "Print hello"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 23584, "cache_read_input_tokens": 10119, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 23584}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "b4c3b51e-0a58-4b28-8c5a-20a2ff2aaadb", "timestamp": "2026-09-25T17:22:54.134Z", "request_id": "req_011CfQYZ2Ddp5YubZj8vB9Fb", "wire_tool_inputs": {"toolu_01P8qrSZwqH1jjZXfrZETjKz": {"command": "echo hello", "description": "Print hello"}}}
|
||||
{"type":"assistant","message":{"content":[{"type":"tool_use"
|
||||
{"type": "rate_limit_event", "rate_limit_info": {"status": "allowed_warning", "resetsAt": 1790377200, "rateLimitType": "seven_day", "utilization": 0.98, "isUsingOverage": false, "surpassedThreshold": 0.75, "unifiedWindows": {"five_hour": {"utilization": 0.76, "resetsAt": 1790366400}, "seven_day": {"utilization": 0.98, "resetsAt": 1790377200}}}, "uuid": "a91b2340-329e-4c73-8e1a-307860859743", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "type": "tool_result", "content": "hello", "is_error": false}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "6beae671-52a0-499a-b72b-f9321c1d9e14", "timestamp": "2026-09-25T17:22:54.460Z", "tool_use_result": {"stdout": "hello", "stderr": "", "interrupted": false, "isImage": false, "noOutputExpected": false}}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZHW9AJ164FSYj39uG", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01YNNETbc61jN44ATXrmHdEC", "name": "Bash", "input": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 580, "cache_read_input_tokens": 33703, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 580}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "3b14941d-c8eb-45f4-b555-829e06119f19", "timestamp": "2026-09-25T17:22:56.420Z", "request_id": "req_011CfQYZH18nwJgBYNZs8XGq", "wire_tool_inputs": {"toolu_01YNNETbc61jN44ATXrmHdEC": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}}}
|
||||
{"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "content": "Exit code 1\ncat: /nonexistent-file: No such file or directory", "is_error": true, "tool_use_id": "toolu_01YNNETbc61jN44ATXrmHdEC"}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "395dc93d-0e4f-40b5-854b-77a128aa0990", "timestamp": "2026-09-25T17:22:56.442Z", "tool_use_result": "Error: Exit code 1\ncat: /nonexistent-file: No such file or directory"}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZRy8qPUaVcnVs9CQD", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session."}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 145, "cache_read_input_tokens": 34283, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "output_tokens": 89, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "8f97a329-c76c-4b90-b154-bda9468b969d", "timestamp": "2026-09-25T17:22:58.580Z", "request_id": "req_011CfQYZRSdq9mNMbE7n8okT"}
|
||||
{"duration_api_ms": 7263, "stop_reason": "end_turn", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "total_cost_usd": 0.21507700000000002, "usage": {"input_tokens": 6, "cache_creation_input_tokens": 24309, "cache_read_input_tokens": 78105, "output_tokens": 248, "output_tokens_details": {"thinking_tokens": 0}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 24309, "ephemeral_5m_input_tokens": 0}, "inference_geo": "not_available", "iterations": [{"input_tokens": 2, "output_tokens": 89, "cache_read_input_tokens": 34283, "cache_creation_input_tokens": 145, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "type": "message"}], "speed": "standard"}, "modelUsage": {"claude-opus-5-5": {"inputTokens": 6, "outputTokens": 248, "cacheReadInputTokens": 78105, "cacheCreationInputTokens": 24309, "webSearchRequests": 0, "costUSD": 0.21507700000000002, "contextWindow": 1000000, "maxOutputTokens": 128000, "thinkingTokens": 0, "canonicalModel": "claude-opus-5-5", "provider": "firstParty", "costBasis": "list"}}, "permission_denials": [], "terminal_reason": "completed", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "subagent_stats": {"spawned": 0, "requested": {"background": 0, "foreground": 0, "unset": 0}, "started_in_background": 0, "max_depth": 0, "spawned_by_subagents": 0, "completed": 0, "failed": 0, "killed": {"parent": 0, "user": 0, "system": 0}, "refused": {"depth_limit": 0, "concurrency_limit": 0, "budget": 0}, "by_type": {}}, "is_error": false, "num_turns": 3, "subtype": "success", "api_error_status": null, "result": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session.", "ttft_ms": 3229, "type": "result", "duration_ms": 7717, "uuid": "d0b46ba2-f8ff-49eb-b35e-b4eb6b9b272b", "ttft_stream_ms": 2833, "time_to_request_ms": 102, "first_content_frame_ms": 2834, "queued_turn_count": 0, "result_index": 0}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "959d5b3d-d376-4416-9abb-71e0b8a36047", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "1f5ed274-0baa-4558-b00f-36ef98d28ebc", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "5aa154a9-9315-4a6c-8de0-750cb35139cf", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_started", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "ef74547a-736e-4bb9-bd68-16cc1592b2a3", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "398b087e-942b-4d67-904c-1778d3b20063", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "ecbfdcf2-446c-4386-a89f-eeaf43e48b46", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "c10b3042-e990-49db-8937-954b6fe11570", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "hook_response", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "3a3327f8-ad24-46d7-a194-e0ce68f9f871", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "system", "subtype": "init", "cwd": "/workspace", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "tools": ["Task", "Bash", "Edit", "Read", "Write"], "mcp_servers": [], "model": "claude-opus-5-5", "permissionMode": "bypassPermissions", "slash_commands": [], "terminal_slash_commands": [], "apiKeySource": "none", "claude_code_version": "2.1.282", "output_style": "default", "agents": [], "skills": [], "plugins": [], "capabilities": ["interrupt_receipt_v1", "interrupt_cancel_queued_v1", "msg_lifecycle_v1", "mcp_read_resource_v1", "mcp_tool_ui_meta_v1"], "analytics_disabled": false, "product_feedback_disabled": false, "uuid": "0ad7c54e-a817-406b-af22-8f647b4e0021", "memory_paths": {}, "messaging_socket_path": "", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "per_turn_effort_active": true, "view_mode": "default"}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZ2iQ3sZ59vJ9CCae9", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "name": "Bash", "input": {"command": "echo hello", "description": "Print hello"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 23584, "cache_read_input_tokens": 10119, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 23584}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "b4c3b51e-0a58-4b28-8c5a-20a2ff2aaadb", "timestamp": "2026-09-25T17:22:54.134Z", "request_id": "req_011CfQYZ2Ddp5YubZj8vB9Fb", "wire_tool_inputs": {"toolu_01P8qrSZwqH1jjZXfrZETjKz": {"command": "echo hello", "description": "Print hello"}}}
|
||||
{"type": "rate_limit_event", "rate_limit_info": {"status": "allowed_warning", "resetsAt": 1790377200, "rateLimitType": "seven_day", "utilization": 0.98, "isUsingOverage": false, "surpassedThreshold": 0.75, "unifiedWindows": {"five_hour": {"utilization": 0.76, "resetsAt": 1790366400}, "seven_day": {"utilization": 0.98, "resetsAt": 1790377200}}}, "uuid": "a91b2340-329e-4c73-8e1a-307860859743", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
|
||||
{"type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "type": "tool_result", "content": "hello", "is_error": false}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "6beae671-52a0-499a-b72b-f9321c1d9e14", "timestamp": "2026-09-25T17:22:54.460Z", "tool_use_result": {"stdout": "hello", "stderr": "", "interrupted": false, "isImage": false, "noOutputExpected": false}}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZHW9AJ164FSYj39uG", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01YNNETbc61jN44ATXrmHdEC", "name": "Bash", "input": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 580, "cache_read_input_tokens": 33703, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 580}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "3b14941d-c8eb-45f4-b555-829e06119f19", "timestamp": "2026-09-25T17:22:56.420Z", "request_id": "req_011CfQYZH18nwJgBYNZs8XGq", "wire_tool_inputs": {"toolu_01YNNETbc61jN44ATXrmHdEC": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}}}
|
||||
{"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "content": "Exit code 1\ncat: /nonexistent-file: No such file or directory", "is_error": true, "tool_use_id": "toolu_01YNNETbc61jN44ATXrmHdEC"}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "395dc93d-0e4f-40b5-854b-77a128aa0990", "timestamp": "2026-09-25T17:22:56.442Z", "tool_use_result": "Error: Exit code 1\ncat: /nonexistent-file: No such file or directory"}
|
||||
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZRy8qPUaVcnVs9CQD", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session."}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 145, "cache_read_input_tokens": 34283, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "output_tokens": 89, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "8f97a329-c76c-4b90-b154-bda9468b969d", "timestamp": "2026-09-25T17:22:58.580Z", "request_id": "req_011CfQYZRSdq9mNMbE7n8okT"}
|
||||
{"duration_api_ms": 7263, "stop_reason": "end_turn", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "total_cost_usd": 0.21507700000000002, "usage": {"input_tokens": 6, "cache_creation_input_tokens": 24309, "cache_read_input_tokens": 78105, "output_tokens": 248, "output_tokens_details": {"thinking_tokens": 0}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 24309, "ephemeral_5m_input_tokens": 0}, "inference_geo": "not_available", "iterations": [{"input_tokens": 2, "output_tokens": 89, "cache_read_input_tokens": 34283, "cache_creation_input_tokens": 145, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "type": "message"}], "speed": "standard"}, "modelUsage": {"claude-opus-5-5": {"inputTokens": 6, "outputTokens": 248, "cacheReadInputTokens": 78105, "cacheCreationInputTokens": 24309, "webSearchRequests": 0, "costUSD": 0.21507700000000002, "contextWindow": 1000000, "maxOutputTokens": 128000, "thinkingTokens": 0, "canonicalModel": "claude-opus-5-5", "provider": "firstParty", "costBasis": "list"}}, "permission_denials": [], "terminal_reason": "completed", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "subagent_stats": {"spawned": 0, "requested": {"background": 0, "foreground": 0, "unset": 0}, "started_in_background": 0, "max_depth": 0, "spawned_by_subagents": 0, "completed": 0, "failed": 0, "killed": {"parent": 0, "user": 0, "system": 0}, "refused": {"depth_limit": 0, "concurrency_limit": 0, "budget": 0}, "by_type": {}}, "is_error": false, "num_turns": 3, "subtype": "success", "api_error_status": null, "result": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session.", "ttft_ms": 3229, "type": "result", "duration_ms": 7717, "uuid": "d0b46ba2-f8ff-49eb-b35e-b4eb6b9b272b", "ttft_stream_ms": 2833, "time_to_request_ms": 102, "first_content_frame_ms": 2834, "queued_turn_count": 0, "result_index": 0}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
{"type":"thread.started","thread_id":"01a0db19-f9d6-7ad2-870c-c29b7fd8ab0a"}
|
||||
{"type":"turn.started"}
|
||||
{"type":"item.started","item":{"id":"item_0","type":"mcp_tool_call","server":"archie","tool":"record_verdict","arguments":{"verdict":"ok"},"result":null,"error":null,"status":"in_progress"}}
|
||||
{"type":"item.completed","item":{"id":"item_0","type":"mcp_tool_call","server":"archie","tool":"record_verdict","arguments":{"verdict":"ok"},"result":{"content":[{"type":"text","text":"record_verdict recorded"}],"structured_content":null},"error":null,"status":"completed"}}
|
||||
{"type":"item.started","item":{"id":"item_1","type":"file_change","changes":[{"path":"/tmp/hfx/note.txt","kind":"add"}],"status":"in_progress"}}
|
||||
{"type":"item.completed","item":{"id":"item_1","type":"file_change","changes":[{"path":"/tmp/hfx/note.txt","kind":"add"}],"status":"completed"}}
|
||||
{"type":"item.completed","item":{"id":"item_2","type":"agent_message","text":"done"}}
|
||||
{"type":"turn.completed","usage":{"input_tokens":96397,"cached_input_tokens":80896,"cache_write_input_tokens":0,"output_tokens":203,"reasoning_output_tokens":87}}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
{"type":"thread.started","thread_id":"01a0db18-e119-7872-bf13-3644369044fb"}
|
||||
{"type":"turn.started"}
|
||||
{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll run the two requested shell commands in order, exactly as written."}}
|
||||
{"type":"item.started","item":{"id":"item_1","type":"command_execution","command":"/usr/bin/bash -lc 'echo hello'","aggregated_output":"","exit_code":null,"status":"in_progress"}}
|
||||
{"type":"item.completed","item":{"id":"item_1","type":"command_execution","command":"/usr/bin/bash -lc 'echo hello'","aggregated_output":"hello\n","exit_code":0,"status":"completed"}}
|
||||
{"type":"item.started","item":{"id":"item_2","type":"command_execution","command":"/usr/bin/bash -lc 'cat /nonexistent-file'","aggregated_output":"","exit_code":null,"status":"in_progress"}}
|
||||
{"type":"item.completed","item":{"id":"item_2","type":"command_execution","command":"/usr/bin/bash -lc 'cat /nonexistent-file'","aggregated_output":"cat: /nonexistent-file: No such file or directory\n","exit_code":1,"status":"failed"}}
|
||||
{"type":"item.completed","item":{"id":"item_3","type":"agent_message","text":"done"}}
|
||||
{"type":"turn.completed","usage":{"input_tokens":72082,"cached_input_tokens":57600,"cache_write_input_tokens":0,"output_tokens":118,"reasoning_output_tokens":0}}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{"type":"user.message","data":{"content":"Call the archie record_verdict tool with verdict \"ok\", then reply done.","transformedContent":"<current_datetime>2026-09-26T10:24:51.899+10:00</current_datetime>\n\nCall the archie record_verdict tool with verdict \"ok\", then reply done.","messageId":"6edfda87-baa7-43ae-9085-b35df7730a5b","supportedNativeDocumentMimeTypes":[],"delivery":"idle","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"0","parentAgentTaskId":"695a0eb0-7c9f-403f-bf8a-11b359bbd6ef"},"id":"e6d6b78e-25a8-4718-9ab5-21730e4c1930","timestamp":"2026-09-26T00:24:51.899Z","parentId":"cf961d42-16aa-496f-81d2-f205e525c341"}
|
||||
{"type":"assistant.turn_start","data":{"turnId":"0","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62"},"id":"43c30d9f-a78d-49ab-a73d-a5059d6a8f33","timestamp":"2026-09-26T00:24:51.951Z","parentId":"d0f5807a-db5a-4bf5-bfca-0a0df80eb3e1"}
|
||||
{"type":"assistant.message","data":{"messageId":"10378468-f2b3-4f1f-bbca-876991380095","originatingMessageId":"6edfda87-baa7-43ae-9085-b35df7730a5b","model":"mai-code-1.1-flash","content":"","toolRequests":[{"toolCallId":"call_SCpBb7giULn1ses3WUvaZ646","name":"archie-record_verdict","arguments":{"verdict":"ok"},"type":"function","toolTitle":"record_verdict","mcpServerName":"archie","mcpToolName":"record_verdict"}],"interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"0","rte":true,"apiCallId":"o4IeQmLtNQWeaj+YWo08mszPXOF1AP702ynApqaRloJ8MNMmCNuUlmqMMdwDx27Tz5AVPoX1PWYGPBcL7y+TQE22HWxuzkAPH8S8LdvfGV+ancUM6NM1SeWCj3Q3JzZNPxQUkRqNJ7D2vvMLcAVYOMHfOU9+Bu1dTI/+opLLn4L85IaRKa20wJ3cN5Lh0kRIoBYWrYQwImIBAkjaPlIOJRUNku2BLwFcBeNciBkvwBW6v0dUAE3GOvt8Wi8u2ierGofUYTmv4PNRZJnEjE69og/rOlP+b7x8Zf6amoEaZoFBET1Kw8Or57gcsdumstObCF+2MI8oFfnMg3igVm8/ZHMmTlUebjfNsc2PlzVyFWZfT5SwY+LjyzE22QTggIQwZ1kNUI7baA3JMqo5PQuoztdTWtJuz/u42q43kOLKhnj+P2YGP/I5FBvLbDcghIsS","serverTools":{"provider":"openai-responses"}},"id":"9adeb15a-b245-4b11-948e-9e688e7b1dad","timestamp":"2026-09-26T00:24:55.924Z","parentId":"43c30d9f-a78d-49ab-a73d-a5059d6a8f33"}
|
||||
{"type":"tool.execution_start","data":{"toolCallId":"call_SCpBb7giULn1ses3WUvaZ646","toolName":"archie-record_verdict","arguments":{"verdict":"ok"},"turnId":"0","model":"mai-code-1.1-flash","toolTitle":"record_verdict","mcpServerName":"archie","mcpConfigServerName":"archie","mcpTransport":"stdio","mcpConfigSource":"user","mcpToolName":"record_verdict"},"id":"fffc906a-39af-4eb1-91ba-80fa0f8cb7f7","timestamp":"2026-09-26T00:24:55.927Z","parentId":"9adeb15a-b245-4b11-948e-9e688e7b1dad"}
|
||||
{"type":"tool.execution_complete","data":{"toolCallId":"call_SCpBb7giULn1ses3WUvaZ646","model":"mai-code-1.1-flash","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"0","rte":true,"success":true,"result":{"content":"record_verdict recorded","detailedContent":"record_verdict recorded","contents":[{"type":"text","text":"record_verdict recorded"}]},"toolTelemetry":{"metrics":{"mcp_result_content_bytes":23}}},"id":"97d661ef-f75b-4734-b358-c843a3e5543d","timestamp":"2026-09-26T00:24:55.931Z","parentId":"fffc906a-39af-4eb1-91ba-80fa0f8cb7f7"}
|
||||
{"type":"assistant.turn_end","data":{"turnId":"0"},"id":"6a3adff0-7017-4c44-8d8d-b32d94442b7b","timestamp":"2026-09-26T00:24:55.936Z","parentId":"97d661ef-f75b-4734-b358-c843a3e5543d"}
|
||||
{"type":"assistant.turn_start","data":{"turnId":"1","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62"},"id":"20538fbe-354e-4c37-a66d-dd169baaae6c","timestamp":"2026-09-26T00:24:55.937Z","parentId":"6a3adff0-7017-4c44-8d8d-b32d94442b7b"}
|
||||
{"type":"assistant.message_start","data":{"messageId":"fd2cd067-22f8-45a3-996e-5b5170455259","phase":"final_answer"},"ephemeral":true,"id":"0aa849db-670e-4d8c-bf28-4b67fedbfefd","timestamp":"2026-09-26T00:24:58.682Z","parentId":"20538fbe-354e-4c37-a66d-dd169baaae6c"}
|
||||
{"type":"assistant.message","data":{"messageId":"fd2cd067-22f8-45a3-996e-5b5170455259","originatingMessageId":"6edfda87-baa7-43ae-9085-b35df7730a5b","model":"mai-code-1.1-flash","content":"done","toolRequests":[],"interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"1","phase":"final_answer","rte":true,"apiCallId":"rQ30ntxRLGIEBrvhcd/a8wMwoTOBA1A5DiGkpF5vfM/MXyIvo81P2W19LNGRYtko/DuDhi1S2NbJp2REVkOsV7QiReoS59ABuGoME9Jp5ccwWfjR4dtfrwZY7ARBkDjoE79/dt0e+73SvAIoP6Vc5DoJ1aBOlDb1Uo7sGxyPDUPNfnjFc0ZSSr1YHviwGcVOoSkB66IrY+zzdz+s43b+Kn9sDiFD/28bvxdH3o6tqmuuVYL35qGuyhoDUlRKk4JXTB8aAjw1IS+lXYVYHfoGhv6F+ZEIf9H/KOVioWCfW3wPEyNOiPyA0qH9gy8g6V1rminPG+6JgwPdZ3QVEuOddFQjj8OjpTLHYKyKVDRxwNq7p0WEH1Wgb8wPpSZpHtAHoHL5rlsSCWcZcoAKFU/Eh+pi9ms073CsMyjhwu+x93O5x8z/pv8CD8BRkJuT0lH6","serverTools":{"provider":"openai-responses"}},"id":"c1b6cb34-b547-4b09-a057-042129d8e8e6","timestamp":"2026-09-26T00:24:59.033Z","parentId":"20538fbe-354e-4c37-a66d-dd169baaae6c"}
|
||||
{"type":"assistant.turn_end","data":{"turnId":"1"},"id":"ac711ef0-98c9-4903-8605-d0a075038156","timestamp":"2026-09-26T00:24:59.037Z","parentId":"c1b6cb34-b547-4b09-a057-042129d8e8e6"}
|
||||
{"type":"assistant.idle","data":{},"ephemeral":true,"id":"3cdd0759-c01f-4670-bd89-1d7d265057c5","timestamp":"2026-09-26T00:24:59.042Z","parentId":"dde7674c-f216-47d1-99dc-b1a42340e3ab"}
|
||||
{"type":"result","timestamp":"2026-09-26T00:24:59.048Z","sessionId":"46ce5d05-adf6-45ac-82bc-167a3c48a146","exitCode":0,"usage":{"premiumRequests":1,"totalApiDurationMs":7028,"sessionDurationMs":10510,"codeChanges":{"linesAdded":0,"linesRemoved":0,"filesModified":[]}}}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
{"type":"user.message","data":{"content":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file","transformedContent":"<current_datetime>2026-09-26T10:24:05.291+10:00</current_datetime>\n\nRun exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file","messageId":"592e4a25-4edd-4138-8428-04377528629d","supportedNativeDocumentMimeTypes":[],"delivery":"idle","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"0","parentAgentTaskId":"a7334356-386f-4883-a45b-c0202257c75e"},"id":"30170ef7-73c3-4ddc-b68a-420fa53126c5","timestamp":"2026-09-26T00:24:05.291Z","parentId":"c5779a53-653b-4d88-9a5d-5d04392191bc"}
|
||||
{"type":"assistant.turn_start","data":{"turnId":"0","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a"},"id":"7eaf3f4d-f167-4458-87ee-3d5590b00c18","timestamp":"2026-09-26T00:24:05.334Z","parentId":"14d0190b-e039-42f9-a4b9-0a75ae807f1f"}
|
||||
{"type":"assistant.message","data":{"messageId":"6b6bea7c-2344-47a1-95db-1f8d6e682666","originatingMessageId":"592e4a25-4edd-4138-8428-04377528629d","model":"mai-code-1.1-flash","content":"","toolRequests":[{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","name":"bash","arguments":{"command":"echo hello","description":"Run the first required shell command","mode":"sync","initial_wait":10},"type":"function","intentionSummary":"Run the first required shell command"}],"interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"0","rte":true,"apiCallId":"f62pmo58wYEiXCowGq2scylnq7Sl72p0HPwz/uzwyAxSnDimAMaUhplE5ob+c/7UI4GlY/FKov+OuTgP6cZYK7vKyWfmHE9irEusbHzDNwaNyfjyJzDuyko5LEHYhPYh4tVFCdob6X764KL1JPVls66S+KZU6pxGyqW5Z9SuYNl1pw/T/mtRZamdmejkxNtprl6c6SZjn//mGF8QAUE5TTHGCUf4ZVynuCu8OplI6+WU4ecM86bUgFHRxHdAml3UpXrLnhhqGf/24sMtIaZdm5XhxNYtpTn1HD5ZDHsyS0pJBAstHCT3zpdjkkg+oy+9I7cfZ8D/aE8tLJjRO36rY69+r2QhLB7gko41WnZhgeTlxtgIaUpEbA5RT325gzH2y70ryklfEwUfM3vecHLbSmBPBVo/2Si5tAMzaX9/fePrelVxJZmogzX2zFEM7oZH","serverTools":{"provider":"openai-responses"}},"id":"18daf5a9-28ad-4e32-a964-c7a7b2fa3561","timestamp":"2026-09-26T00:24:07.616Z","parentId":"7eaf3f4d-f167-4458-87ee-3d5590b00c18"}
|
||||
{"type":"tool.execution_start","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","toolName":"bash","arguments":{"command":"echo hello","description":"Run the first required shell command","mode":"sync","initial_wait":10},"turnId":"0","model":"mai-code-1.1-flash","shellToolInfo":{"possiblePaths":[],"hasWriteFileRedirection":false}},"id":"495b5003-1cae-48ab-a3cf-299aebdbcd57","timestamp":"2026-09-26T00:24:07.617Z","parentId":"18daf5a9-28ad-4e32-a964-c7a7b2fa3561"}
|
||||
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","partialOutput":"hello\n"},"ephemeral":true,"id":"bfa8c93e-8702-4405-9f34-fcf2e488a5f7","timestamp":"2026-09-26T00:24:07.671Z","parentId":"495b5003-1cae-48ab-a3cf-299aebdbcd57"}
|
||||
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","partialOutput":"hello\n"},"ephemeral":true,"id":"f2a7773b-fc90-4dec-90a2-7f59a9703002","timestamp":"2026-09-26T00:24:07.671Z","parentId":"495b5003-1cae-48ab-a3cf-299aebdbcd57"}
|
||||
{"type":"tool.execution_complete","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","model":"mai-code-1.1-flash","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"0","rte":true,"shellExecution":{"exitCode":0},"success":true,"result":{"content":"hello\n<shellId: 0 completed with exit code 0>","detailedContent":"hello\n<shellId: 0 completed with exit code 0>"},"toolTelemetry":{"properties":{"customTimeout":"true","executionMode":"sync","detached":"false","sandboxApplied":"false","sandboxOptOutRequested":"false"},"metrics":{"commandTimeout":30000}}},"id":"1998c4e2-5bc7-48ec-b25a-22e09e0b8c94","timestamp":"2026-09-26T00:24:07.676Z","parentId":"495b5003-1cae-48ab-a3cf-299aebdbcd57"}
|
||||
{"type":"assistant.turn_end","data":{"turnId":"0"},"id":"5f5a4959-c817-4e68-b29b-393bc2489708","timestamp":"2026-09-26T00:24:07.681Z","parentId":"1998c4e2-5bc7-48ec-b25a-22e09e0b8c94"}
|
||||
{"type":"assistant.turn_start","data":{"turnId":"1","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a"},"id":"e637d527-fe9a-40a3-b686-7d351233ac5e","timestamp":"2026-09-26T00:24:07.682Z","parentId":"5f5a4959-c817-4e68-b29b-393bc2489708"}
|
||||
{"type":"assistant.message","data":{"messageId":"ee78bdc4-8346-4970-95ed-de15d5b92dbb","originatingMessageId":"592e4a25-4edd-4138-8428-04377528629d","model":"mai-code-1.1-flash","content":"","toolRequests":[{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","name":"bash","arguments":{"command":"cat /nonexistent-file","description":"Run the second required shell command to trigger the expected error","mode":"sync","initial_wait":10},"type":"function","intentionSummary":"Run the second required shell command to trigger the expected error"}],"interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"1","rte":true,"apiCallId":"KG3rWA5KnDXtL/Ftwooj+JjuuS+L+ah1aYHMcnKw9dFSwz3o2iOv3slDRYSqE5e2KrWgrIFsDtMAgiXlXahwtf8vnIpJgcRQrv2dJqpiPx955GxFNfsv0y+LitYKH69Iv+707wPPOfekR97bhzfXA2QGjna6+0FzEW/ZHT8LfAIfiyqai9XiXiOhZOTKVxAJ5xmJSZqDTtt8V+Ut2EL/3LCl19/wYTTF0YAHEjSovoQP19hx3RAqXCMhnJd1Uy4q4mlsNNvbGIPbcZwLrfNVTnVa9BV4mECvecH9IeJ9axMUZS/lA/jU3Da5VNCEtsXOYnhk6DX8tSNQLB+NYumqzmk2X+dUq2Wb3Y8W/MoL7c0//NSYqYDbRjLkEpaaKZYiibA/KFE5XVp48Gdd+cnzODhH1K4O39xTwAHjQlflj1s39qRqMRw6CL6tDf/frGwU","serverTools":{"provider":"openai-responses"}},"id":"64c89fe7-be35-41f2-9127-034874b52d95","timestamp":"2026-09-26T00:24:09.954Z","parentId":"e637d527-fe9a-40a3-b686-7d351233ac5e"}
|
||||
{"type":"tool.execution_start","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","toolName":"bash","arguments":{"command":"cat /nonexistent-file","description":"Run the second required shell command to trigger the expected error","mode":"sync","initial_wait":10},"turnId":"1","model":"mai-code-1.1-flash","shellToolInfo":{"possiblePaths":[],"hasWriteFileRedirection":false}},"id":"a240e698-9aaa-43d3-bdb8-517399bb9c2a","timestamp":"2026-09-26T00:24:09.956Z","parentId":"64c89fe7-be35-41f2-9127-034874b52d95"}
|
||||
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","partialOutput":"cat: /nonexistent-file: No such file or directory\n"},"ephemeral":true,"id":"554fa3fb-6bb0-4b8d-b2ec-723131f48064","timestamp":"2026-09-26T00:24:09.966Z","parentId":"a240e698-9aaa-43d3-bdb8-517399bb9c2a"}
|
||||
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","partialOutput":"cat: /nonexistent-file: No such file or directory\n"},"ephemeral":true,"id":"94dae986-d597-40a5-831c-388182db7301","timestamp":"2026-09-26T00:24:09.966Z","parentId":"a240e698-9aaa-43d3-bdb8-517399bb9c2a"}
|
||||
{"type":"tool.execution_complete","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","model":"mai-code-1.1-flash","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"1","rte":true,"shellExecution":{"exitCode":1},"success":true,"result":{"content":"cat: /nonexistent-file: No such file or directory\n<shellId: 1 completed with exit code 1>","detailedContent":"cat: /nonexistent-file: No such file or directory\n<shellId: 1 completed with exit code 1>"},"toolTelemetry":{"properties":{"customTimeout":"true","executionMode":"sync","detached":"false","sandboxApplied":"false","sandboxOptOutRequested":"false","shell_error_category":"command_nonzero_exit"},"metrics":{"commandTimeout":30000,"exit_code":1}}},"id":"f22d0b04-9056-4d5c-b798-6a3eb26cc2b1","timestamp":"2026-09-26T00:24:09.971Z","parentId":"a240e698-9aaa-43d3-bdb8-517399bb9c2a"}
|
||||
{"type":"assistant.turn_end","data":{"turnId":"1"},"id":"f823f0b3-33d8-4ca5-a111-733fa58c66e9","timestamp":"2026-09-26T00:24:09.975Z","parentId":"f22d0b04-9056-4d5c-b798-6a3eb26cc2b1"}
|
||||
{"type":"assistant.turn_start","data":{"turnId":"2","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a"},"id":"361e7d6b-7832-4137-9d71-b2ca66d90526","timestamp":"2026-09-26T00:24:09.975Z","parentId":"f823f0b3-33d8-4ca5-a111-733fa58c66e9"}
|
||||
{"type":"assistant.message_start","data":{"messageId":"d92c3a5f-329a-4b84-8548-76a9f6acf6a9","phase":"final_answer"},"ephemeral":true,"id":"09bcf00a-0f8e-44c7-9539-98ac6b25f150","timestamp":"2026-09-26T00:24:11.613Z","parentId":"361e7d6b-7832-4137-9d71-b2ca66d90526"}
|
||||
{"type":"assistant.message","data":{"messageId":"d92c3a5f-329a-4b84-8548-76a9f6acf6a9","originatingMessageId":"592e4a25-4edd-4138-8428-04377528629d","model":"mai-code-1.1-flash","content":"done","toolRequests":[],"interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"2","phase":"final_answer","rte":true,"apiCallId":"HnNPE0K4S9Sfzu3aBEKNBu0bN71YXywM7Iou7HJYeGMBSegpo3BPJcfUERt8oGnSgEpfS5aEntUzNMfpuS91+3QbHxfDkApmOYcWeU/YXFlpQkgeT8bhYmNQ0g+Lpo7Zf45jMikQQ23xdX7r4zQHEXBud6cWLde+ujXNZ4Tc3mq1fPTvsa2Z4qD9gCRKwFksOqOQR4UeRuRRxIr2qWEXs61qj4xfH7BM0IAbm07zCyv6arLfHHhtbe/wXkv7fBWCbtQufB+KRW8Z5Wo+6peGgEi4x9ayQETTUG3K/q6nUY3wbHVquOI/UYHZewJFwPDfleQq2l6Okim8ftIIvoNfyvIy1GRDS/n/UnrUpDG1NNmgJDDcDIManTx9wpywEGR/K8gzfl98ddcd5N+6RC4G678wPu9AQef65ztQyKJB5jFLzkhI1LPc5+yTY0V8gZMA","serverTools":{"provider":"openai-responses"}},"id":"4657559f-58ec-4922-bed9-7fc89cdc7de9","timestamp":"2026-09-26T00:24:11.832Z","parentId":"361e7d6b-7832-4137-9d71-b2ca66d90526"}
|
||||
{"type":"assistant.turn_end","data":{"turnId":"2"},"id":"b5ad8a1e-47f2-460b-ac09-0fe63f266271","timestamp":"2026-09-26T00:24:11.833Z","parentId":"4657559f-58ec-4922-bed9-7fc89cdc7de9"}
|
||||
{"type":"assistant.idle","data":{},"ephemeral":true,"id":"1bcbd91f-9903-4b9a-8c22-cfea0d567a80","timestamp":"2026-09-26T00:24:11.838Z","parentId":"e800bf25-1659-4023-8e1c-55270f374526"}
|
||||
{"type":"result","timestamp":"2026-09-26T00:24:11.847Z","sessionId":"bdf5531e-b8a4-4baf-bed2-d914242fa387","exitCode":0,"usage":{"premiumRequests":1,"totalApiDurationMs":6371,"sessionDurationMs":14653,"codeChanges":{"linesAdded":0,"linesRemoved":0,"filesModified":[]}}}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
{"type":"session","version":3,"id":"01a0db18-e4a1-7000-9cbe-7467b0385e65","timestamp":"2026-09-26T00:23:56.833Z","cwd":"/tmp/hfx"}
|
||||
{"type":"agent_start"}
|
||||
{"type":"turn_start"}
|
||||
{"type":"message_start","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"attribution":"user","timestamp":1790382237281}}
|
||||
{"type":"message_end","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"attribution":"user","timestamp":1790382237281}}
|
||||
{"type":"message_start","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Simple","thinkingSignature":"reasoning_content"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1790382237472,"responseId":"065106e6-b09d-48f7-b6c6-e4e85fde221b"}}
|
||||
{"type":"message_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Simple: run echo hello, then cat /nonexistent-file. One at a time.","thinkingSignature":"reasoning_content"},{"type":"toolCall","id":"call_00_nr3UPjdQx9tkGIlERsCP4300","name":"bash","arguments":{"command":"echo hello","i":"Running echo hello"},"partialArgs":"{\"command\": \"echo hello\", \"i\": \"Running echo hello\"}","streamIndex":0,"intent":"Running echo hello"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":25222,"output":75,"cacheRead":0,"cacheWrite":0,"totalTokens":25297,"reasoningTokens":19,"cost":{"input":0.0037833,"output":0.000044999999999999996,"cacheRead":0,"cacheWrite":0,"total":0.0038282999999999998}},"stopReason":"toolUse","timestamp":1790382237472,"responseId":"065106e6-b09d-48f7-b6c6-e4e85fde221b","duration":1472.9358650000001,"ttft":1164.486779,"completedAt":1790382238970}}
|
||||
{"type":"tool_execution_start","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","args":{"command":"echo hello"},"intent":"Running echo hello"}
|
||||
{"type":"tool_execution_update","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[{"type":"text","text":"hello\n"}],"details":{}}}
|
||||
{"type":"tool_execution_update","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038}}}
|
||||
{"type":"tool_execution_end","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","result":{"content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038}},"isError":false}
|
||||
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038},"isError":false,"timestamp":1790382239011}}
|
||||
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038},"isError":false,"timestamp":1790382239011}}
|
||||
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Simple: run echo hello, then cat /nonexistent-file. One at a time.","thinkingSignature":"reasoning_content"},{"type":"toolCall","id":"call_00_nr3UPjdQx9tkGIlERsCP4300","name":"bash","arguments":{"command":"echo hello","i":"Running echo hello"},"partialArgs":"{\"command\": \"echo hello\", \"i\": \"Running echo hello\"}","streamIndex":0,"intent":"Running echo hello"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":25222,"output":75,"cacheRead":0,"cacheWrite":0,"totalTokens":25297,"reasoningTokens":19,"cost":{"input":0.0037833,"output":0.000044999999999999996,"cacheRead":0,"cacheWrite":0,"total":0.0038282999999999998}},"stopReason":"toolUse","timestamp":1790382237472,"responseId":"065106e6-b09d-48f7-b6c6-e4e85fde221b","duration":1472.9358650000001,"ttft":1164.486779},"toolResults":[{"role":"toolResult","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038},"isError":false,"timestamp":1790382239011}]}
|
||||
{"type":"turn_start"}
|
||||
{"type":"message_start","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","name":"bash","arguments":{"command":"cat /nonexistent-file","i":"Reading nonexistent file"},"partialArgs":"{\"command\": \"cat /nonexistent-file\", \"i\": \"Reading nonexistent file\"}","streamIndex":0}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1790382239018,"responseId":"d232767b-4ac0-4264-b166-1234dd27e949"}}
|
||||
{"type":"message_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","name":"bash","arguments":{"command":"cat /nonexistent-file","i":"Reading nonexistent file"},"partialArgs":"{\"command\": \"cat /nonexistent-file\", \"i\": \"Reading nonexistent file\"}","streamIndex":0,"intent":"Reading nonexistent file"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":231,"output":61,"cacheRead":25088,"cacheWrite":0,"totalTokens":25380,"cost":{"input":0.000034649999999999995,"output":0.000036599999999999995,"cacheRead":0.000075264,"cacheWrite":0,"total":0.000146514}},"stopReason":"toolUse","timestamp":1790382239018,"responseId":"d232767b-4ac0-4264-b166-1234dd27e949","duration":1915.5203490000004,"completedAt":1790382240956}}
|
||||
{"type":"tool_execution_start","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","args":{"command":"cat /nonexistent-file"},"intent":"Reading nonexistent file"}
|
||||
{"type":"tool_execution_update","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n"}],"details":{}}}
|
||||
{"type":"tool_execution_update","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1}}}
|
||||
{"type":"tool_execution_end","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","result":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true},"isError":true}
|
||||
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true,"timestamp":1790382240960}}
|
||||
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true,"timestamp":1790382240960}}
|
||||
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","name":"bash","arguments":{"command":"cat /nonexistent-file","i":"Reading nonexistent file"},"partialArgs":"{\"command\": \"cat /nonexistent-file\", \"i\": \"Reading nonexistent file\"}","streamIndex":0,"intent":"Reading nonexistent file"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":231,"output":61,"cacheRead":25088,"cacheWrite":0,"totalTokens":25380,"cost":{"input":0.000034649999999999995,"output":0.000036599999999999995,"cacheRead":0.000075264,"cacheWrite":0,"total":0.000146514}},"stopReason":"toolUse","timestamp":1790382239018,"responseId":"d232767b-4ac0-4264-b166-1234dd27e949","duration":1915.5203490000004},"toolResults":[{"role":"toolResult","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true,"timestamp":1790382240960}]}
|
||||
{"type":"turn_start"}
|
||||
{"type":"message_start","message":{"role":"assistant","content":[{"type":"text","text":"done\n\n("}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1790382240964,"responseId":"5183f0c3-4531-44b6-b80a-61b6290dfb22"}}
|
||||
{"type":"message_end","message":{"role":"assistant","content":[{"type":"text","text":"done\n\n(2) exited 1: `cat: /nonexistent-file: No such file or directory`"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":205,"output":25,"cacheRead":25216,"cacheWrite":0,"totalTokens":25446,"cost":{"input":0.000030749999999999995,"output":0.000014999999999999999,"cacheRead":0.000075648,"cacheWrite":0,"total":0.00012139799999999999}},"stopReason":"stop","timestamp":1790382240964,"responseId":"5183f0c3-4531-44b6-b80a-61b6290dfb22","duration":1189.6723079999992,"ttft":1106.6433019999995,"completedAt":1790382242178}}
|
||||
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"text","text":"done\n\n(2) exited 1: `cat: /nonexistent-file: No such file or directory`"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":205,"output":25,"cacheRead":25216,"cacheWrite":0,"totalTokens":25446,"cost":{"input":0.000030749999999999995,"output":0.000014999999999999999,"cacheRead":0.000075648,"cacheWrite":0,"total":0.00012139799999999999}},"stopReason":"stop","timestamp":1790382240964,"responseId":"5183f0c3-4531-44b6-b80a-61b6290dfb22","duration":1189.6723079999992,"ttft":1106.6433019999995},"toolResults":[]}
|
||||
{"type":"agent_end","messages":[],"isTerminal":true}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
{"type":"session","version":3,"id":"01a0db18-e183-7432-9e4b-4b16bfc83856","timestamp":"2026-09-26T00:23:56.037Z","cwd":"/tmp/hfx"}
|
||||
{"type":"agent_start"}
|
||||
{"type":"turn_start"}
|
||||
{"type":"message_start","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"timestamp":1790382237711}}
|
||||
{"type":"message_end","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"timestamp":1790382237711}}
|
||||
{"type":"message_start","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_4w3gr4ma","name":"bash","arguments":{"command":"echo hello"},"partialArgs":"{\"command\":\"echo hello\"}","streamIndex":0}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"pending","timestamp":1790382237724,"responseId":"chatcmpl-176"}}
|
||||
{"type":"message_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_4w3gr4ma","name":"bash","arguments":{"command":"echo hello"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":36426,"output":12,"cacheRead":0,"cacheWrite":0,"reasoning":0,"totalTokens":36438,"cost":{"input":0.0054639,"output":0.000006,"cacheRead":0,"cacheWrite":0,"total":0.0054699}},"stopReason":"toolUse","timestamp":1790382237724,"responseId":"chatcmpl-176","rawStopReason":"tool_calls"}}
|
||||
{"type":"tool_execution_start","toolCallId":"call_4w3gr4ma","toolName":"bash","args":{"command":"echo hello"}}
|
||||
{"type":"tool_execution_update","toolCallId":"call_4w3gr4ma","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[]}}
|
||||
{"type":"tool_execution_update","toolCallId":"call_4w3gr4ma","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[{"type":"text","text":"hello\n"}],"details":{}}}
|
||||
{"type":"tool_execution_end","toolCallId":"call_4w3gr4ma","toolName":"bash","result":{"content":[{"type":"text","text":"hello\n"}]},"isError":false}
|
||||
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_4w3gr4ma","toolName":"bash","content":[{"type":"text","text":"hello\n"}],"isError":false,"timestamp":1790382240554}}
|
||||
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_4w3gr4ma","toolName":"bash","content":[{"type":"text","text":"hello\n"}],"isError":false,"timestamp":1790382240554}}
|
||||
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_4w3gr4ma","name":"bash","arguments":{"command":"echo hello"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":36426,"output":12,"cacheRead":0,"cacheWrite":0,"reasoning":0,"totalTokens":36438,"cost":{"input":0.0054639,"output":0.000006,"cacheRead":0,"cacheWrite":0,"total":0.0054699}},"stopReason":"toolUse","timestamp":1790382237724,"responseId":"chatcmpl-176","rawStopReason":"tool_calls"},"toolResults":[{"role":"toolResult","toolCallId":"call_4w3gr4ma","toolName":"bash","content":[{"type":"text","text":"hello\n"}],"isError":false,"timestamp":1790382240554}]}
|
||||
{"type":"turn_start"}
|
||||
{"type":"message_start","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_cta082t7","name":"bash","arguments":{"command":"cat /nonexistent-file"},"partialArgs":"{\"command\":\"cat /nonexistent-file\"}","streamIndex":0}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"pending","timestamp":1790382240561,"responseId":"chatcmpl-207"}}
|
||||
{"type":"message_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_cta082t7","name":"bash","arguments":{"command":"cat /nonexistent-file"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5007,"output":15,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36382,"cost":{"input":0.00075105,"output":0.000007499999999999999,"cacheRead":0,"cacheWrite":0,"total":0.00075855}},"stopReason":"toolUse","timestamp":1790382240561,"responseId":"chatcmpl-207","rawStopReason":"tool_calls"}}
|
||||
{"type":"tool_execution_start","toolCallId":"call_cta082t7","toolName":"bash","args":{"command":"cat /nonexistent-file"}}
|
||||
{"type":"tool_execution_update","toolCallId":"call_cta082t7","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[]}}
|
||||
{"type":"tool_execution_update","toolCallId":"call_cta082t7","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n"}],"details":{}}}
|
||||
{"type":"tool_execution_end","toolCallId":"call_cta082t7","toolName":"bash","result":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{}},"isError":true}
|
||||
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_cta082t7","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{},"isError":true,"timestamp":1790382242598}}
|
||||
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_cta082t7","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{},"isError":true,"timestamp":1790382242598}}
|
||||
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_cta082t7","name":"bash","arguments":{"command":"cat /nonexistent-file"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5007,"output":15,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36382,"cost":{"input":0.00075105,"output":0.000007499999999999999,"cacheRead":0,"cacheWrite":0,"total":0.00075855}},"stopReason":"toolUse","timestamp":1790382240561,"responseId":"chatcmpl-207","rawStopReason":"tool_calls"},"toolResults":[{"role":"toolResult","toolCallId":"call_cta082t7","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{},"isError":true,"timestamp":1790382242598}]}
|
||||
{"type":"turn_start"}
|
||||
{"type":"message_start","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Both","thinkingSignature":"reasoning"}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"pending","timestamp":1790382242606,"responseId":"chatcmpl-491"}}
|
||||
{"type":"message_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Both commands run. Reply \"done\".","thinkingSignature":"reasoning"},{"type":"text","text":"done"}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5045,"output":11,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36416,"cost":{"input":0.0007567499999999999,"output":0.0000055,"cacheRead":0,"cacheWrite":0,"total":0.0007622499999999999}},"stopReason":"stop","timestamp":1790382242606,"responseId":"chatcmpl-491","rawStopReason":"stop"}}
|
||||
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Both commands run. Reply \"done\".","thinkingSignature":"reasoning"},{"type":"text","text":"done"}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5045,"output":11,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36416,"cost":{"input":0.0007567499999999999,"output":0.0000055,"cacheRead":0,"cacheWrite":0,"total":0.0007622499999999999}},"stopReason":"stop","timestamp":1790382242606,"responseId":"chatcmpl-491","rawStopReason":"stop"},"toolResults":[]}
|
||||
{"type":"agent_end","messages":[],"willRetry":false}
|
||||
{"type":"agent_settled"}
|
||||
@@ -33,6 +33,7 @@ import (
|
||||
// worktreerpc; local git operations run on the bind-mounted worktree.
|
||||
type remoteTrees interface {
|
||||
Push(ctx context.Context) error
|
||||
workflow.BaselineLedger
|
||||
}
|
||||
|
||||
type hybridTrees struct {
|
||||
@@ -185,7 +186,7 @@ func applyToolLimits(agent agentrun.Runner, policy config.ToolPolicy, allow []st
|
||||
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
|
||||
return agentexec.HarnessStages{Runner: agentexec.NewHarnessRunner(), Spec: *req.Harness}, nil
|
||||
}
|
||||
var agent agentrun.Runner
|
||||
if mcpSet != nil && mcpSet.Registry != nil {
|
||||
@@ -246,7 +247,7 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
bus = events.NewBus()
|
||||
sub := bus.Subscribe(64)
|
||||
defer sub.Close()
|
||||
go agentexec.ForwardTaskEvents(sub, dependencies.events, req.Task.ID, log)
|
||||
go agentexec.ForwardTaskEvents(ctx, sub, dependencies.events, req.Task.ID, log)
|
||||
}
|
||||
|
||||
tc := &workflow.TaskContext{
|
||||
@@ -263,6 +264,9 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
Log: log,
|
||||
Guardrails: dependencies.guardrails,
|
||||
}
|
||||
if dependencies.trees != nil {
|
||||
tc.Baseline = dependencies.trees
|
||||
}
|
||||
tc.Instructions = req.Instructions
|
||||
configureTaskContext(tc, workDir)
|
||||
|
||||
|
||||
@@ -3,25 +3,18 @@ package agentworker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/agentexec"
|
||||
"github.com/samcharles93/archie-core/internal/domain/health"
|
||||
"github.com/samcharles93/archie-core/internal/domain/presence"
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/agentboot"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/agentgit"
|
||||
agentnats "github.com/samcharles93/archie-core/internal/infrastructure/agenttransport/nats"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/readiness"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/workflowsteps"
|
||||
"github.com/samcharles93/archie-core/internal/installtype"
|
||||
"github.com/samcharles93/archie-core/internal/logging"
|
||||
"github.com/samcharles93/archie-core/internal/storage"
|
||||
"github.com/samcharles93/archie-core/internal/taskrun"
|
||||
@@ -67,8 +60,6 @@ type workerTransport interface {
|
||||
Close()
|
||||
LogPublisher() agentexec.LogPublisher
|
||||
SubscribeTasks(context.Context, int64, agentnats.TaskHandler, *slog.Logger) (agentnats.Subscription, error)
|
||||
PutPresence(context.Context, storecontract.Presence) error
|
||||
BrokerReady() bool
|
||||
}
|
||||
|
||||
type workerDependencies struct {
|
||||
@@ -174,13 +165,6 @@ func run(ctx context.Context, settings Settings, log *slog.Logger, dependencies
|
||||
}
|
||||
}()
|
||||
|
||||
registry := health.NewRegistry(readiness.NewContractProbe("nats", 0, func(context.Context) error {
|
||||
if !transport.BrokerReady() {
|
||||
return errors.New("broker disconnected")
|
||||
}
|
||||
return nil
|
||||
}))
|
||||
go presence.Run(ctx, presence.Agent, presence.Build{InstanceID: strconv.FormatInt(taskID, 10), Version: Version(), InstallType: installtype.Type()}, transport, registry, log)
|
||||
log.InfoContext(ctx, "archie-agent ready", "nats", settings.NATSURL)
|
||||
dependencies.wait(ctx, log)
|
||||
return nil
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/modelcatalog"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/publicnet"
|
||||
"github.com/samcharles93/archie-core/internal/releaseupdate"
|
||||
)
|
||||
|
||||
@@ -301,7 +302,7 @@ func (b *boot) recheckAlerts(ctx context.Context) {
|
||||
// as skipped; one that fails is retried by the store on its schedule.
|
||||
func (b *boot) deliverAlerts(store alert.Deliverer) func(context.Context) {
|
||||
client := &http.Client{Timeout: 15 * time.Second}
|
||||
public := alertwebhook.PublicClient()
|
||||
public := publicnet.Client(10*time.Second, 15*time.Second)
|
||||
// The system org's webhook may sit on the instance's own network; another
|
||||
// org's reaches the public internet only.
|
||||
clientFor := func(owner org.OrgID) *http.Client {
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -43,7 +42,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/workintake"
|
||||
"github.com/samcharles93/archie-core/internal/events"
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
forgewebhook "github.com/samcharles93/archie-core/internal/forge/webhook"
|
||||
"github.com/samcharles93/archie-core/internal/gateway"
|
||||
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
||||
@@ -680,7 +678,6 @@ func (b *boot) buildDaemon() {
|
||||
b.d.Denials = denials
|
||||
}
|
||||
b.d.PlaybookLedger = playbookLedger(b.stateStore, b.log)
|
||||
b.setupForgeWebhook()
|
||||
}
|
||||
|
||||
func playbookLedger(source any, log *slog.Logger) storecontract.PlaybookDispatcher {
|
||||
@@ -691,43 +688,6 @@ func playbookLedger(source any, log *slog.Logger) storecontract.PlaybookDispatch
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *boot) setupForgeWebhook() {
|
||||
cfg, log := b.cfg, b.log
|
||||
if cfg.Forge.Intake != config.ForgeIntakeWebhook && cfg.Forge.Intake != config.ForgeIntakeBoth {
|
||||
return
|
||||
}
|
||||
parser, ok := b.forgeClient.(forge.WebhookParser)
|
||||
if !ok {
|
||||
log.Error("forge webhook disabled: the forge cannot parse webhooks", "forge_type", cfg.Forge.Type)
|
||||
return
|
||||
}
|
||||
secretValue, err := b.secrets.Resolve(cfg.Forge.WebhookSecret)
|
||||
if err != nil || secretValue == "" {
|
||||
log.Error("forge webhook disabled: secret unavailable",
|
||||
"engine", cfg.Forge.WebhookSecret.Engine, "key", cfg.Forge.WebhookSecret.Key, "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
receiver := forgewebhook.New(secretValue, parser, cfg.Dispatch.Trigger, cfg.Label, cfg.BotUser, b.d.PublishTask, b.d.PublishReaction, b.withdrawIssue, log)
|
||||
host, port := parseListenAddr(cfg.Forge.WebhookAddr, "0.0.0.0", 8645)
|
||||
addr := fmt.Sprintf("%s:%d", host, port)
|
||||
srv := &http.Server{Addr: addr, Handler: receiver, ReadHeaderTimeout: 5 * time.Second}
|
||||
|
||||
b.startGateways = append(b.startGateways, func() {
|
||||
go func() {
|
||||
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||
log.Error("forge webhook server stopped", "err", err)
|
||||
}
|
||||
}()
|
||||
log.Info("forge webhook listening", "addr", addr)
|
||||
})
|
||||
b.addCleanup(func() {
|
||||
shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
_ = srv.Shutdown(shutdownCtx)
|
||||
})
|
||||
}
|
||||
|
||||
func (b *boot) publishConfig(ctx context.Context, cfg config.Config) {
|
||||
b.cfgHolder.Set(cfg)
|
||||
// The daemon owns the published configuration view.
|
||||
|
||||
@@ -12,11 +12,9 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
@@ -253,23 +251,6 @@ func persistEvents(ctx context.Context, sink *events.Sub, st storecontract.TaskS
|
||||
}
|
||||
}
|
||||
|
||||
// parseListenAddr splits "host:port" into components, using defaults
|
||||
// when the input is empty or missing a part.
|
||||
func parseListenAddr(addr, defaultHost string, defaultPort int) (string, int) {
|
||||
if addr == "" {
|
||||
return defaultHost, defaultPort
|
||||
}
|
||||
host, portStr, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
return defaultHost, defaultPort
|
||||
}
|
||||
port, err := strconv.Atoi(portStr)
|
||||
if err != nil || port < 0 {
|
||||
return host, defaultPort
|
||||
}
|
||||
return host, port
|
||||
}
|
||||
|
||||
// subscribeSystemLogs subscribes to every task's system log subject at once.
|
||||
// archie-agent's own log lines ship here (agentexec.SubjectForSystem) rather
|
||||
// than staying on its stderr, and this is where they land: one wildcard
|
||||
@@ -362,7 +343,7 @@ func registerTaskRPCServers(nc *natsio.Conn, resolve func(context.Context, *work
|
||||
resolved, err := resolve(ctx, t, config.OperationPR)
|
||||
return resolved.Forge, err
|
||||
}}
|
||||
trees := &worktreerpc.Server{Runs: runs, Log: log, Resolve: func(ctx context.Context, t *workflow.Task) (*worktree.Manager, error) {
|
||||
trees := &worktreerpc.Server{Runs: runs, Log: log, Baselines: worktreerpc.NewBaselineClaims(), Resolve: func(ctx context.Context, t *workflow.Task) (*worktree.Manager, error) {
|
||||
resolved, err := resolve(ctx, t, config.OperationPush)
|
||||
return resolved.Trees, err
|
||||
}}
|
||||
|
||||
@@ -3,15 +3,19 @@ package archied
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/go-git/go-git/v6"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/daemon"
|
||||
"github.com/samcharles93/archie-core/internal/domain/access"
|
||||
"github.com/samcharles93/archie-core/internal/domain/org"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
|
||||
"github.com/samcharles93/archie-core/internal/worktree"
|
||||
)
|
||||
@@ -98,16 +102,34 @@ func (b *boot) openRepositoryConnection(ctx context.Context, principal access.Pr
|
||||
if !strings.Contains(host, "://") {
|
||||
host = "https://" + host
|
||||
}
|
||||
out.Forge = b.connectionForge(ctx, connection, principal.Org, token)
|
||||
cfg := b.cfgHolder.Get()
|
||||
username := connection.Account
|
||||
gitToken := token
|
||||
var minted forge.GitCredential
|
||||
if issuer, ok := out.Forge.(forge.GitCredentialIssuer); ok {
|
||||
minted, err = issuer.GitCredential(ctx, repository.Owner, repository.Name)
|
||||
switch {
|
||||
case errors.Is(err, errors.ErrUnsupported):
|
||||
case err != nil:
|
||||
b.log.WarnContext(ctx, "git credential unavailable", "connection", connection.ID, "error", err)
|
||||
return failure("credential_unavailable", fmt.Sprintf("%s could not issue a credential for %s/%s. Check the app is installed on it.", connection.Name, repository.Owner, repository.Name))
|
||||
default:
|
||||
username, gitToken = minted.Username, minted.Token
|
||||
}
|
||||
}
|
||||
if username == "" && connection.Type == "gitea" {
|
||||
username, err = connectionAccount(ctx, connection.Type, host, token)
|
||||
if err != nil {
|
||||
return failure("account_unverified", "The forge account could not be verified. Check the credential and its permissions.")
|
||||
}
|
||||
}
|
||||
cfg := b.cfgHolder.Get()
|
||||
out.Trees = &worktree.Manager{WorkDir: worktree.OrgWorkDir(cfg.WorkDir, string(principal.Org)), Token: token, AuthUser: username, BaseURL: host, BotUser: cfg.BotUser, BotEmail: cfg.BotEmail, Log: b.log}
|
||||
out.Forge = b.connectionForge(ctx, connection, principal.Org, token)
|
||||
botUser, botEmail := commitIdentity(cfg, connection, minted, username)
|
||||
signer, code, message := b.connectionSigner(connection)
|
||||
if code != "" {
|
||||
return failure(code, message)
|
||||
}
|
||||
out.Trees = &worktree.Manager{WorkDir: worktree.OrgWorkDir(cfg.WorkDir, string(principal.Org)), Token: gitToken, AuthUser: username, BaseURL: host, BotUser: botUser, BotEmail: botEmail, Signer: signer, Log: b.log}
|
||||
if operation == config.OperationPR {
|
||||
if _, disabled := out.Forge.(*forge.NoopForge); disabled {
|
||||
return failure("forge_unavailable", "Enable the forge extension for this connection.")
|
||||
@@ -115,3 +137,40 @@ func (b *boot) openRepositoryConnection(ctx context.Context, principal access.Pr
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// commitIdentity is the author of commits made through a connection: its
|
||||
// configured commit identity, else the identity the forge minted with the
|
||||
// credential, else the root bot fields, else its account.
|
||||
func commitIdentity(cfg config.Config, connection config.ForgeConnection, minted forge.GitCredential, account string) (string, string) {
|
||||
if connection.CommitName != "" {
|
||||
return connection.CommitName, configuration.DefaultBotEmail(connection.Type, connection.CommitName, connection.CommitEmail)
|
||||
}
|
||||
if minted.CommitName != "" {
|
||||
return minted.CommitName, minted.CommitEmail
|
||||
}
|
||||
if cfg.BotUser != "" {
|
||||
return cfg.BotUser, cfg.BotEmail
|
||||
}
|
||||
user := account
|
||||
if user == "" {
|
||||
user = "archie"
|
||||
}
|
||||
return user, configuration.DefaultBotEmail(connection.Type, user, connection.CommitEmail)
|
||||
}
|
||||
|
||||
// connectionSigner resolves the connection's SSH signing key. It returns nil
|
||||
// when none is configured, or a failure code and message.
|
||||
func (b *boot) connectionSigner(connection config.ForgeConnection) (git.Signer, string, string) {
|
||||
if connection.SigningKey.Key == "" {
|
||||
return nil, "", ""
|
||||
}
|
||||
key, err := b.secrets.Resolve(connection.SigningKey)
|
||||
if err != nil || key == "" {
|
||||
return nil, "signing_key_unavailable", fmt.Sprintf("The signing key for %s is unavailable. Check its secret reference.", connection.Name)
|
||||
}
|
||||
signer, err := worktree.NewSSHSigner([]byte(key))
|
||||
if err != nil {
|
||||
return nil, "signing_key_invalid", fmt.Sprintf("The signing key for %s is not an OpenSSH private key.", connection.Name)
|
||||
}
|
||||
return signer, "", ""
|
||||
}
|
||||
@@ -29,15 +29,6 @@ func (b *boot) taskActions() taskactions.Service {
|
||||
)
|
||||
}
|
||||
|
||||
// withdrawIssue declines the task an issue queued, if it has one.
|
||||
func (b *boot) withdrawIssue(ctx context.Context, owner, repo string, number int, reason string) error {
|
||||
task, err := b.stateStore.TaskByIssue(ctx, owner, repo, number)
|
||||
if err != nil || task == nil {
|
||||
return err
|
||||
}
|
||||
return b.taskActions().Withdraw(ctx, task.ID, reason)
|
||||
}
|
||||
|
||||
func (b *boot) cancelTask(id int64) bool {
|
||||
if b.d == nil {
|
||||
return false
|
||||
|
||||
@@ -35,6 +35,7 @@ func (b taskBroker) TaskSubjects(ctx context.Context, taskID int64, credential s
|
||||
agentexec.SubjectForEvents(taskID),
|
||||
spanrelay.Subject(taskID),
|
||||
worktreerpc.SubjectFor(task.Identity, worktreerpc.SubjectPush),
|
||||
worktreerpc.SubjectFor(task.Identity, worktreerpc.SubjectBaseline),
|
||||
messagerpc.SubjectFor(task.Identity),
|
||||
}, forgerpc.Subjects(task.Identity)...)
|
||||
return nats.TaskSubjects{Publish: publish, Subscribe: []string{agentnats.SubjectForTask(taskID)}}, nil
|
||||
|
||||
@@ -24,12 +24,12 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/toolbuilder"
|
||||
)
|
||||
|
||||
func (b *server) setupCurators(ctx context.Context) bool {
|
||||
func (b *server) setupCurators(ctx context.Context) error {
|
||||
log := b.log.With("component", "curator")
|
||||
model, err := b.chatModels.ModelFor(ctx)
|
||||
if err != nil {
|
||||
log.WarnContext(ctx, "curators disabled: chat model unavailable; configure a chat model and restart the gateway", "err", err)
|
||||
return false
|
||||
return fmt.Errorf("curators disabled until the gateway restarts with a chat model: %w", err)
|
||||
}
|
||||
skillsRoot := b.cfg.SkillsDir
|
||||
if skillsRoot == "" {
|
||||
@@ -60,7 +60,7 @@ func (b *server) setupCurators(ctx context.Context) bool {
|
||||
b.addCleanup(shutdownCuratorRuntime(rt, log))
|
||||
reg := b.curatorRegistry
|
||||
b.addCleanup(shutdownCuratorRegistry(reg, log))
|
||||
return true
|
||||
return nil
|
||||
}
|
||||
|
||||
//nolint:contextcheck // shutdown runs after the parent context is cancelled
|
||||
@@ -218,7 +218,10 @@ func (b *server) watchCurators(ctx context.Context, version int64) error {
|
||||
|
||||
func (b *server) startCurators(ctx context.Context) error {
|
||||
// Curators wake on this process's turns and read its conversations.
|
||||
if !b.setupCurators(ctx) {
|
||||
// A disabled runtime is reported, so the dashboard shows why curators do
|
||||
// not apply rather than a process that never reported.
|
||||
if err := b.setupCurators(ctx); err != nil {
|
||||
b.applyStatus.Report(ctx, controlplanestore.CuratorsKind, 0, err)
|
||||
return nil
|
||||
}
|
||||
if err := b.curatorRuntime.Start(ctx); err != nil {
|
||||
|
||||
@@ -64,6 +64,9 @@ type channelInstance struct {
|
||||
chat messaging.ChatContract
|
||||
// plan is what an org's channel was built from.
|
||||
plan *orgChannelPlan
|
||||
// needs names the required settings an enabled channel lacks; such a
|
||||
// channel is reported stopped with it rather than started to fail.
|
||||
needs string
|
||||
|
||||
mu sync.Mutex
|
||||
channel channels.Channel
|
||||
@@ -168,8 +171,7 @@ func compose(ctx context.Context, d deps) (*Service, error) {
|
||||
}
|
||||
|
||||
// composeChannels builds the configured channel set: the installed channel
|
||||
// extensions that extension settings (or a [chat.telegram] file
|
||||
// configuration) enable. Each instance carries the factory a restart uses to
|
||||
// extensions that extension settings enable. Each instance carries the factory a restart uses to
|
||||
// build a replacement from a new resolved configuration.
|
||||
func composeChannels(ctx context.Context, d deps) ([]*channelInstance, error) {
|
||||
instances := make([]*channelInstance, 0, len(d.ExtensionChannels))
|
||||
|
||||
@@ -17,11 +17,7 @@ import (
|
||||
type ResolvedConfig struct {
|
||||
Options Options
|
||||
// Identity is this process's certificate; nil is plaintext, loopback only.
|
||||
Identity *rpctls.Identity
|
||||
// Telegram is the [chat.telegram] configuration. It does not compose a
|
||||
// channel in this process: it enables the telegram channel extension, with
|
||||
// the same keys, through openExtensionChannels.
|
||||
Telegram config.TelegramConfig
|
||||
Identity *rpctls.Identity
|
||||
ShowToolCalls bool
|
||||
Logging config.Config
|
||||
}
|
||||
@@ -31,7 +27,6 @@ type projection struct {
|
||||
stateStore ServiceTarget
|
||||
messaging config.ServiceConnection
|
||||
tls config.TLS
|
||||
telegram config.TelegramConfig
|
||||
showToolCalls bool
|
||||
logging config.Config
|
||||
}
|
||||
@@ -64,7 +59,6 @@ func Resolve(o Options, log *slog.Logger) (ResolvedConfig, error) {
|
||||
return ResolvedConfig{
|
||||
Options: o,
|
||||
Identity: id,
|
||||
Telegram: proj.telegram,
|
||||
ShowToolCalls: proj.showToolCalls,
|
||||
Logging: proj.logging,
|
||||
}, nil
|
||||
@@ -87,7 +81,6 @@ func project(cfg config.Config) projection {
|
||||
stateStore: ServiceTarget{Target: cfg.Services.Get(config.ServiceNameState).Target},
|
||||
messaging: cfg.Services.Get(config.ServiceNameMessaging),
|
||||
tls: cfg.TLS,
|
||||
telegram: cfg.Chat.Telegram,
|
||||
showToolCalls: cfg.Chat.ShowToolCalls,
|
||||
logging: config.Config{StateDir: cfg.StateDir, Log: cfg.Log, Telemetry: cfg.Telemetry},
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/channels/status"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/messaging"
|
||||
"github.com/samcharles93/archie-core/internal/secret"
|
||||
)
|
||||
|
||||
// servingChannel reports itself running once it starts, which is what an
|
||||
@@ -214,34 +213,3 @@ func TestReconcileAppliesShowToolCalls(t *testing.T) {
|
||||
t.Fatalf("reconcile stale: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestTelegramFileSetting pins the mapping that keeps an existing
|
||||
// [chat.telegram] file configuration working through the channel extension:
|
||||
// the token stays a secret reference for the host to resolve, the allowlist
|
||||
// joins the same way the extension parses it, and no token means no setting.
|
||||
func TestTelegramFileSetting(t *testing.T) {
|
||||
setting, ok := telegramFileSetting(config.TelegramConfig{
|
||||
Token: secret.SecretRef{Engine: "env", Key: "ARCHIE_TELEGRAM_TOKEN"},
|
||||
AllowedUserIDs: []int64{111, 222},
|
||||
}, true)
|
||||
if !ok {
|
||||
t.Fatal("setting not produced for a configured token")
|
||||
}
|
||||
if setting.Name != "telegram" || !setting.Enabled {
|
||||
t.Fatalf("setting = %+v, want name telegram enabled", setting)
|
||||
}
|
||||
want := map[string]string{
|
||||
"token_ref": "env:ARCHIE_TELEGRAM_TOKEN",
|
||||
"allowed_user_ids": "111,222",
|
||||
"show_tool_calls": "true",
|
||||
}
|
||||
for key, value := range want {
|
||||
if setting.Settings[key] != value {
|
||||
t.Errorf("settings[%q] = %q, want %q", key, setting.Settings[key], value)
|
||||
}
|
||||
}
|
||||
|
||||
if _, ok := telegramFileSetting(config.TelegramConfig{}, false); ok {
|
||||
t.Fatal("empty token produced a setting, want none")
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package archiemessaging
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"maps"
|
||||
@@ -12,11 +13,9 @@ import (
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/servicekit"
|
||||
"github.com/samcharles93/archie-core/internal/channels"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/storepkg"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/channelext"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/extension"
|
||||
"github.com/samcharles93/archie-core/internal/secret"
|
||||
)
|
||||
@@ -25,7 +24,7 @@ import (
|
||||
const refSuffix = "_ref"
|
||||
|
||||
// telegramChannel is the package name the Telegram channel extension installs
|
||||
// under, and the config keys [chat.telegram] that enable it.
|
||||
// under.
|
||||
const telegramChannel = "telegram"
|
||||
|
||||
// channelFactory builds extension channel instances on demand, so channels
|
||||
@@ -71,12 +70,11 @@ func (f *channelFactory) channelPackage(ctx context.Context, name string) (store
|
||||
}
|
||||
|
||||
// openExtensionChannels builds a channel for each installed channel package
|
||||
// whose authority is accepted and that extension-settings enables. A
|
||||
// [chat.telegram] file configuration enables the telegram package the same
|
||||
// way, with the same config keys, so an existing config keeps working without
|
||||
// a server login. Changing the set takes a restart, as every channel binding
|
||||
// does. Running extensions stop with ctx.
|
||||
func openExtensionChannels(ctx context.Context, source extension.Source, secrets *secret.Registry, log *slog.Logger, telegram config.TelegramConfig, showToolCalls bool) ([]*channelInstance, *channelFactory) {
|
||||
// whose authority is accepted and that extension-settings enables. The
|
||||
// host passes the telegram channel the show_tool_calls session default.
|
||||
// Changing the set takes a restart, as every channel binding does. Running
|
||||
// extensions stop with ctx.
|
||||
func openExtensionChannels(ctx context.Context, source extension.Source, secrets *secret.Registry, log *slog.Logger, showToolCalls bool) ([]*channelInstance, *channelFactory) {
|
||||
cache, err := configuration.DefaultCacheDir()
|
||||
if err != nil {
|
||||
log.WarnContext(ctx, "channel extensions unavailable: no cache directory", "err", err)
|
||||
@@ -92,15 +90,6 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
|
||||
log.WarnContext(ctx, "channel extensions unavailable: installed packages", "err", err)
|
||||
return nil, nil
|
||||
}
|
||||
if file, ok := telegramFileSetting(telegram, showToolCalls); ok {
|
||||
stored := settings[telegramChannel]
|
||||
if stored.Settings == nil {
|
||||
stored.Settings = map[string]string{}
|
||||
}
|
||||
maps.Copy(stored.Settings, file.Settings)
|
||||
stored.Name, stored.Enabled = telegramChannel, true
|
||||
settings[telegramChannel] = stored
|
||||
}
|
||||
host := extension.NewHost(log)
|
||||
factory := &channelFactory{host: host, source: source, cacheDir: filepath.Join(cache, "extensions", "channels"), secrets: secrets}
|
||||
var instances []*channelInstance
|
||||
@@ -114,7 +103,26 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
|
||||
if index < 0 {
|
||||
continue
|
||||
}
|
||||
ch, err := factory.build(ctx, pkg, pkg.Descriptor.Contributes.Extensions[index].Path, pkg.Name, setting.Settings)
|
||||
if missing := pkg.Descriptor.MissingSettings(setting.Settings); len(missing) > 0 {
|
||||
needs := "Missing " + strings.Join(missing, ", ")
|
||||
log.WarnContext(ctx, "channel extension not started: required settings missing", "channel", pkg.Name, "missing", missing)
|
||||
instances = append(instances, &channelInstance{
|
||||
name: pkg.Name,
|
||||
needs: needs,
|
||||
rebuild: func(ResolvedConfig) (channels.Channel, error) { return nil, errors.New(needs) },
|
||||
})
|
||||
built[pkg.Name] = true
|
||||
continue
|
||||
}
|
||||
values := setting.Settings
|
||||
if pkg.Name == telegramChannel {
|
||||
values = maps.Clone(values)
|
||||
if values == nil {
|
||||
values = map[string]string{}
|
||||
}
|
||||
values["show_tool_calls"] = strconv.FormatBool(showToolCalls)
|
||||
}
|
||||
ch, err := factory.build(ctx, pkg, pkg.Descriptor.Contributes.Extensions[index].Path, pkg.Name, values)
|
||||
if err != nil {
|
||||
log.WarnContext(ctx, "channel extension not started", "channel", pkg.Name, "err", err)
|
||||
continue
|
||||
@@ -126,8 +134,18 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
|
||||
rebuild: func(ResolvedConfig) (channels.Channel, error) { return ch, nil },
|
||||
})
|
||||
}
|
||||
if _, ok := telegramFileSetting(telegram, showToolCalls); ok && !built[telegramChannel] {
|
||||
log.WarnContext(ctx, "chat.telegram is configured but the telegram channel package is not installed; install the telegram channel extension to enable the bot")
|
||||
if setting := settings[telegramChannel]; setting.Enabled && !slices.ContainsFunc(installed, func(pkg storepkg.Installed) bool { return pkg.Name == telegramChannel }) {
|
||||
// Report it as a channel, so the dashboard shows why the enabled
|
||||
// bot is not running instead of showing nothing.
|
||||
const needs = "The Telegram channel extension is not installed"
|
||||
log.WarnContext(ctx, "telegram is enabled but its channel extension is not installed")
|
||||
instances = append(instances, &channelInstance{
|
||||
name: telegramChannel,
|
||||
needs: needs,
|
||||
rebuild: func(ResolvedConfig) (channels.Channel, error) {
|
||||
return nil, errors.New("telegram channel extension is not installed")
|
||||
},
|
||||
})
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
@@ -136,29 +154,6 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
|
||||
return instances, factory
|
||||
}
|
||||
|
||||
// telegramFileSetting renders [chat.telegram] as the extension setting that
|
||||
// enables the telegram channel package. The token stays a reference: the host
|
||||
// resolves token_ref through the secret registry, so this process never holds
|
||||
// the bot credential.
|
||||
func telegramFileSetting(cfg config.TelegramConfig, showToolCalls bool) (controlplanerpc.ExtensionSetting, bool) {
|
||||
if cfg.Token == (secret.SecretRef{}) {
|
||||
return controlplanerpc.ExtensionSetting{}, false
|
||||
}
|
||||
ids := make([]string, 0, len(cfg.AllowedUserIDs))
|
||||
for _, id := range cfg.AllowedUserIDs {
|
||||
ids = append(ids, strconv.FormatInt(id, 10))
|
||||
}
|
||||
return controlplanerpc.ExtensionSetting{
|
||||
Name: telegramChannel,
|
||||
Enabled: true,
|
||||
Settings: map[string]string{
|
||||
"token_ref": cfg.Token.Engine + ":" + cfg.Token.Key,
|
||||
"allowed_user_ids": strings.Join(ids, ","),
|
||||
"show_tool_calls": strconv.FormatBool(showToolCalls),
|
||||
},
|
||||
}, true
|
||||
}
|
||||
|
||||
func buildExtensionChannel(ctx context.Context, host *extension.Host, source extension.Source, cacheDir string, pkg storepkg.Installed, file, name string, settings map[string]string, secrets *secret.Registry) (channels.Channel, error) {
|
||||
binary, sum, err := extension.Materialize(ctx, source.Packages, cacheDir, pkg, file)
|
||||
if err != nil {
|
||||
|
||||
@@ -118,7 +118,7 @@ func (s *Service) planOrgChannel(ctx context.Context, entry controlplanerpc.OrgC
|
||||
switch {
|
||||
case settings.Agent == "":
|
||||
return orgChannelPlan{}, errors.New("no agent named")
|
||||
case len(settings.Telegram.AllowedUserIDs) == 0:
|
||||
case len(settings.AllowedUserIDs) == 0:
|
||||
return orgChannelPlan{}, errors.New("no allowed telegram users")
|
||||
case binding == (secret.SecretRef{}):
|
||||
return orgChannelPlan{}, fmt.Errorf("no credential binding %q", telegramCredential)
|
||||
@@ -130,7 +130,7 @@ func (s *Service) planOrgChannel(ctx context.Context, entry controlplanerpc.OrgC
|
||||
if string(principal.Org) != entry.Org || !principal.Kind.Agent() {
|
||||
return orgChannelPlan{}, errors.New("agent is not an agent of this org")
|
||||
}
|
||||
return orgChannelPlan{org: entry.Org, binding: binding, allowed: settings.Telegram.AllowedUserIDs, show: settings.ShowToolCalls, agent: principal}, nil
|
||||
return orgChannelPlan{org: entry.Org, binding: binding, allowed: settings.AllowedUserIDs, show: settings.ShowToolCalls, agent: principal}, nil
|
||||
}
|
||||
|
||||
// telegramBindings maps each org to the secret its Telegram bot token is bound
|
||||
|
||||
@@ -41,9 +41,7 @@ func (s *Service) reconcileOnce(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
layered, version, err := s.settingsSource.RuntimeChatConfig(ctx, config.ChatConfig{
|
||||
Telegram: base.Telegram, ShowToolCalls: base.ShowToolCalls,
|
||||
})
|
||||
layered, version, err := s.settingsSource.RuntimeChatConfig(ctx, config.ChatConfig{ShowToolCalls: base.ShowToolCalls})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -51,7 +49,7 @@ func (s *Service) reconcileOnce(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
next := base
|
||||
next.Telegram, next.ShowToolCalls = layered.Telegram, layered.ShowToolCalls
|
||||
next.ShowToolCalls = layered.ShowToolCalls
|
||||
if next.ShowToolCalls != base.ShowToolCalls {
|
||||
s.applyShowToolCalls(next.ShowToolCalls)
|
||||
}
|
||||
|
||||
@@ -77,17 +77,15 @@ func Run(ctx context.Context, o Options) error {
|
||||
reporter := applystatus.New(applystatus.Messaging, stateStore, log)
|
||||
extensions := extension.Source{Query: controlPlaneClient, Packages: stateStore}
|
||||
defer superviseSecretEngines(ctx, extensions, secrets, reporter, log)()
|
||||
chatSettings, channelVersion, settingsErr := controlPlaneClient.RuntimeChatConfig(ctx, config.ChatConfig{
|
||||
Telegram: cfg.Telegram, ShowToolCalls: cfg.ShowToolCalls,
|
||||
})
|
||||
chatSettings, channelVersion, settingsErr := controlPlaneClient.RuntimeChatConfig(ctx, config.ChatConfig{ShowToolCalls: cfg.ShowToolCalls})
|
||||
if settingsErr != nil {
|
||||
return fmt.Errorf("load channel settings: %w", settingsErr)
|
||||
}
|
||||
reporter.Report(ctx, controlplanerpc.ChannelSettingsKind, channelVersion, nil)
|
||||
go reporter.Run(ctx)
|
||||
go presence.Run(ctx, presence.Messaging, servicekit.Build(), stateStore, health, log)
|
||||
cfg.Telegram, cfg.ShowToolCalls = chatSettings.Telegram, chatSettings.ShowToolCalls
|
||||
extensionChannels, extensionFactory = openExtensionChannels(ctx, extensions, secrets, log, cfg.Telegram, cfg.ShowToolCalls)
|
||||
cfg.ShowToolCalls = chatSettings.ShowToolCalls
|
||||
extensionChannels, extensionFactory = openExtensionChannels(ctx, extensions, secrets, log, cfg.ShowToolCalls)
|
||||
channelStatusStore = stateStore
|
||||
settingsSource, applyReporter, appliedVersion, orgChannels = controlPlaneClient, reporter, channelVersion, &orgChannelDeps{Source: controlPlaneClient, Principals: stateStore}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func (s *Service) runChannel(ctx context.Context, c *channelInstance) {
|
||||
if ch == nil {
|
||||
// Disabled: there is no channel to run until an enable builds one.
|
||||
c.mu.Unlock()
|
||||
s.status.MarkStopped(c.name, "")
|
||||
s.status.MarkStopped(c.name, c.needs)
|
||||
if s.awaitChannel(ctx, c, 0) == channelShutdown {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -28,13 +28,15 @@ const (
|
||||
|
||||
// serviceWatch remembers since when each service has been unhealthy.
|
||||
type serviceWatch struct {
|
||||
since map[string]time.Time
|
||||
booted time.Time
|
||||
since map[string]time.Time
|
||||
}
|
||||
|
||||
// unhealthy returns the services that have been down or degraded for longer
|
||||
// than serviceGrace, and forgets those that recovered. A service gone silent
|
||||
// counts from its last report, which is stored, so a restart of this store does
|
||||
// not restart the grace; one that never reported counts from first sight.
|
||||
// counts from its last report, but never from before this store booted: the
|
||||
// whole stack usually restarts together, and every peer's last report predates
|
||||
// the restart until it reports again.
|
||||
func (w *serviceWatch) unhealthy(mesh []presence.Service, now time.Time) []string {
|
||||
if w.since == nil {
|
||||
w.since = map[string]time.Time{}
|
||||
@@ -51,7 +53,7 @@ func (w *serviceWatch) unhealthy(mesh []presence.Service, now time.Time) []strin
|
||||
since, ok := w.since[service.Service]
|
||||
if !ok {
|
||||
since = now
|
||||
if service.State == presence.StateDown && !service.ReportedAt.IsZero() {
|
||||
if service.State == presence.StateDown && service.ReportedAt.After(w.booted) {
|
||||
since = service.ReportedAt
|
||||
}
|
||||
w.since[service.Service] = since
|
||||
@@ -95,7 +97,7 @@ func (b *server) sweepAlerts(ctx context.Context, store alert.Store) {
|
||||
ListPresence(context.Context) ([]storecontract.Presence, error)
|
||||
})
|
||||
reporter := alert.Reporter{Raiser: store, Log: b.log, By: "state-store"}
|
||||
var watch serviceWatch
|
||||
watch := serviceWatch{booted: time.Now()}
|
||||
ticker := time.NewTicker(alertSweepInterval)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
|
||||
@@ -390,7 +390,7 @@ func (b *server) runCredentials(ctx context.Context) (*staterpc.TaskGrants, erro
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("state store does not support run credentials")
|
||||
}
|
||||
grants := &staterpc.TaskGrants{Store: store}
|
||||
grants := &staterpc.TaskGrants{Store: store, Log: b.log}
|
||||
if err := grants.Sweep(ctx); err != nil {
|
||||
return nil, fmt.Errorf("sweep expired run credentials: %w", err)
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package config
|
||||
|
||||
// ChatFrontEnd is one conversational front-end [chat] can enable. ID is its
|
||||
// stable identifier.
|
||||
type ChatFrontEnd struct {
|
||||
ID string
|
||||
Name string
|
||||
Configured bool
|
||||
}
|
||||
|
||||
// FrontEnds returns every chat front-end this configuration enables, in
|
||||
// dashboard order. Whitespace-only values do not count as configured.
|
||||
func (c ChatConfig) FrontEnds() []ChatFrontEnd {
|
||||
return []ChatFrontEnd{
|
||||
{
|
||||
ID: "telegram",
|
||||
Name: "Telegram",
|
||||
Configured: c.Telegram.Token != (SecretRef{}),
|
||||
},
|
||||
}
|
||||
}
|
||||
+18
-26
@@ -64,25 +64,32 @@ func ValidOperation(op string) bool { return slices.Contains(Operations(), op) }
|
||||
// instance's root configuration.
|
||||
type ForgeConnection struct {
|
||||
// ID is the stable reference a repository binding and a permission name.
|
||||
ID string `toml:"id" json:"id" yaml:"id"`
|
||||
ID string `json:"id"`
|
||||
// Name is the operator-facing label.
|
||||
Name string `toml:"name" json:"name" yaml:"name"`
|
||||
Name string `json:"name"`
|
||||
// Type selects the forge implementation: the name of an enabled forge
|
||||
// extension, or the compiled-in forge of that name.
|
||||
Type string `toml:"type" json:"type" yaml:"type"`
|
||||
Type string `json:"type"`
|
||||
// Host is the forge's host, e.g. "github.com".
|
||||
Host string `toml:"host" json:"host" yaml:"host"`
|
||||
Host string `json:"host"`
|
||||
// Account is the external account the credential authenticates as. It is
|
||||
// recorded, and checked against the account a verification actually
|
||||
// reached; it is never used to infer authority.
|
||||
Account string `toml:"account" json:"account" yaml:"account"`
|
||||
Account string `json:"account"`
|
||||
// Token references the credential. The connection records the reference,
|
||||
// never a token value.
|
||||
Token SecretRef `toml:"token" json:"token" yaml:"token"`
|
||||
Token SecretRef `json:"token"`
|
||||
// CommitName and CommitEmail author commits made through the connection.
|
||||
// Empty falls back to the account and the forge's default email.
|
||||
CommitName string `json:"commit_name,omitempty"`
|
||||
CommitEmail string `json:"commit_email,omitempty"`
|
||||
// SigningKey references an OpenSSH private key that signs those commits.
|
||||
// Unset leaves them unsigned.
|
||||
SigningKey SecretRef `json:"signing_key,omitzero"`
|
||||
// Permits names, per execution identity ID, the operations that identity
|
||||
// may perform through this connection. An identity with no entry may
|
||||
// perform none: the connection itself is not a grant.
|
||||
Permits map[string][]string `toml:"permits" json:"permits,omitempty" yaml:"permits"`
|
||||
Permits map[string][]string `json:"permits,omitempty"`
|
||||
}
|
||||
|
||||
// Permitted reports whether the identity may perform op through this
|
||||
@@ -226,30 +233,11 @@ type Provider struct {
|
||||
Disabled bool `toml:"-" yaml:"-" json:"-"`
|
||||
}
|
||||
|
||||
// Forge intake modes for Forge.Intake. Poll is the default; webhook reacts to
|
||||
// forge events as they arrive instead of (or in addition to) polling.
|
||||
const (
|
||||
ForgeIntakePoll = "poll"
|
||||
ForgeIntakeWebhook = "webhook"
|
||||
ForgeIntakeBoth = "both"
|
||||
)
|
||||
|
||||
// Forge configures the code forge integration.
|
||||
type Forge struct {
|
||||
Type string `toml:"type" yaml:"type"`
|
||||
Host string `toml:"host" yaml:"host"`
|
||||
Token SecretRef `toml:"token" yaml:"token"`
|
||||
// Intake selects how forge issues become work: "poll" (default),
|
||||
// "webhook", or "both". Webhook intake reacts to forge events the moment
|
||||
// they arrive instead of up to poll_interval later.
|
||||
Intake string `toml:"intake" yaml:"intake"`
|
||||
// WebhookSecret is the shared secret used to verify GitHub webhook
|
||||
// signatures (X-Hub-Signature-256). Required when Intake is "webhook" or
|
||||
// "both".
|
||||
WebhookSecret SecretRef `toml:"webhook_secret" yaml:"webhook_secret"`
|
||||
// WebhookAddr is the host:port the webhook receiver listens on. Required
|
||||
// when Intake is "webhook" or "both".
|
||||
WebhookAddr string `toml:"webhook_addr" yaml:"webhook_addr"`
|
||||
}
|
||||
|
||||
// Dispatch configures how archied discovers work and reacts on pickup.
|
||||
@@ -370,6 +358,10 @@ type Config struct {
|
||||
// MaxRetries caps how many times a parked task is retried before
|
||||
// being permanently parked (status "dead"). Defaults to 3.
|
||||
MaxRetries int `toml:"max_retries" yaml:"max_retries"`
|
||||
// IntakePerPass caps how many tasks one issue poll creates, so a backlog
|
||||
// found at once (the first poll after an outage) drains over several
|
||||
// passes. Defaults to 20.
|
||||
IntakePerPass int `toml:"intake_per_pass" yaml:"intake_per_pass"`
|
||||
// StateDir is the host directory archie keeps non-database state in: the
|
||||
// embedded NATS store and its endpoint file, the task-log registry, and
|
||||
// the readiness disk probe's data target. Bootstrap-only.
|
||||
|
||||
@@ -740,9 +740,23 @@ func encodeRegistryAuth(credential string) (string, error) {
|
||||
return base64.URLEncoding.EncodeToString(payload), nil
|
||||
}
|
||||
|
||||
// inContainer reports whether this process runs in a container, where Docker
|
||||
// and Podman each leave a marker file.
|
||||
func inContainer() bool {
|
||||
for _, marker := range []string{"/.dockerenv", "/run/.containerenv"} {
|
||||
if _, err := os.Stat(marker); err == nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// selfNetwork returns the user-defined network this process's container is
|
||||
// on, or "".
|
||||
func selfNetwork(ctx context.Context, cli *client.Client, log *slog.Logger) string {
|
||||
if !inContainer() {
|
||||
return ""
|
||||
}
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
log.WarnContext(ctx, "container network auto-detect: os.Hostname failed, spawned containers will use the default bridge network and won't resolve sibling services by name — set containers.network explicitly", "err", err)
|
||||
|
||||
@@ -2588,6 +2588,126 @@ func (*VerifyPushResponse) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{48}
|
||||
}
|
||||
|
||||
type GitCredentialRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Repo *RepoRef `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GitCredentialRequest) Reset() {
|
||||
*x = GitCredentialRequest{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[49]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GitCredentialRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GitCredentialRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GitCredentialRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[49]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GitCredentialRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GitCredentialRequest) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{49}
|
||||
}
|
||||
|
||||
func (x *GitCredentialRequest) GetRepo() *RepoRef {
|
||||
if x != nil {
|
||||
return x.Repo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GitCredentialResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
|
||||
ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
|
||||
CommitName string `protobuf:"bytes,4,opt,name=commit_name,json=commitName,proto3" json:"commit_name,omitempty"`
|
||||
CommitEmail string `protobuf:"bytes,5,opt,name=commit_email,json=commitEmail,proto3" json:"commit_email,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GitCredentialResponse) Reset() {
|
||||
*x = GitCredentialResponse{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[50]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GitCredentialResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GitCredentialResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GitCredentialResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[50]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GitCredentialResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GitCredentialResponse) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{50}
|
||||
}
|
||||
|
||||
func (x *GitCredentialResponse) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GitCredentialResponse) GetToken() string {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GitCredentialResponse) GetExpiresAt() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.ExpiresAt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GitCredentialResponse) GetCommitName() string {
|
||||
if x != nil {
|
||||
return x.CommitName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GitCredentialResponse) GetCommitEmail() string {
|
||||
if x != nil {
|
||||
return x.CommitEmail
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetRepoArchiveRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Repo *RepoRef `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
@@ -2598,7 +2718,7 @@ type GetRepoArchiveRequest struct {
|
||||
|
||||
func (x *GetRepoArchiveRequest) Reset() {
|
||||
*x = GetRepoArchiveRequest{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[49]
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[51]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -2610,7 +2730,7 @@ func (x *GetRepoArchiveRequest) String() string {
|
||||
func (*GetRepoArchiveRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetRepoArchiveRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[49]
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[51]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -2623,7 +2743,7 @@ func (x *GetRepoArchiveRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use GetRepoArchiveRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetRepoArchiveRequest) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{49}
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{51}
|
||||
}
|
||||
|
||||
func (x *GetRepoArchiveRequest) GetRepo() *RepoRef {
|
||||
@@ -2649,7 +2769,7 @@ type GetRepoArchiveResponse struct {
|
||||
|
||||
func (x *GetRepoArchiveResponse) Reset() {
|
||||
*x = GetRepoArchiveResponse{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[50]
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[52]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -2661,7 +2781,7 @@ func (x *GetRepoArchiveResponse) String() string {
|
||||
func (*GetRepoArchiveResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetRepoArchiveResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[50]
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[52]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -2674,7 +2794,7 @@ func (x *GetRepoArchiveResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use GetRepoArchiveResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetRepoArchiveResponse) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{50}
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{52}
|
||||
}
|
||||
|
||||
func (x *GetRepoArchiveResponse) GetData() []byte {
|
||||
@@ -2684,464 +2804,6 @@ func (x *GetRepoArchiveResponse) GetData() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ParseWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) Reset() {
|
||||
*x = ParseWebhookRequest{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[51]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ParseWebhookRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ParseWebhookRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[51]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ParseWebhookRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ParseWebhookRequest) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{51}
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) GetHeaders() map[string]string {
|
||||
if x != nil {
|
||||
return x.Headers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookRequest) GetBody() []byte {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ParseWebhookResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Types that are valid to be assigned to Event:
|
||||
//
|
||||
// *ParseWebhookResponse_Issue
|
||||
// *ParseWebhookResponse_Review
|
||||
// *ParseWebhookResponse_ReviewComment
|
||||
Event isParseWebhookResponse_Event `protobuf_oneof:"event"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) Reset() {
|
||||
*x = ParseWebhookResponse{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[52]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ParseWebhookResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ParseWebhookResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[52]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ParseWebhookResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ParseWebhookResponse) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{52}
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetEvent() isParseWebhookResponse_Event {
|
||||
if x != nil {
|
||||
return x.Event
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetIssue() *IssueEvent {
|
||||
if x != nil {
|
||||
if x, ok := x.Event.(*ParseWebhookResponse_Issue); ok {
|
||||
return x.Issue
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetReview() *ReviewEvent {
|
||||
if x != nil {
|
||||
if x, ok := x.Event.(*ParseWebhookResponse_Review); ok {
|
||||
return x.Review
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseWebhookResponse) GetReviewComment() *ReviewCommentEvent {
|
||||
if x != nil {
|
||||
if x, ok := x.Event.(*ParseWebhookResponse_ReviewComment); ok {
|
||||
return x.ReviewComment
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isParseWebhookResponse_Event interface {
|
||||
isParseWebhookResponse_Event()
|
||||
}
|
||||
|
||||
type ParseWebhookResponse_Issue struct {
|
||||
Issue *IssueEvent `protobuf:"bytes,1,opt,name=issue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ParseWebhookResponse_Review struct {
|
||||
Review *ReviewEvent `protobuf:"bytes,2,opt,name=review,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ParseWebhookResponse_ReviewComment struct {
|
||||
ReviewComment *ReviewCommentEvent `protobuf:"bytes,3,opt,name=review_comment,json=reviewComment,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*ParseWebhookResponse_Issue) isParseWebhookResponse_Event() {}
|
||||
|
||||
func (*ParseWebhookResponse_Review) isParseWebhookResponse_Event() {}
|
||||
|
||||
func (*ParseWebhookResponse_ReviewComment) isParseWebhookResponse_Event() {}
|
||||
|
||||
type IssueEvent struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
|
||||
State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
|
||||
IsPullRequest bool `protobuf:"varint,3,opt,name=is_pull_request,json=isPullRequest,proto3" json:"is_pull_request,omitempty"`
|
||||
Repo *RepoRef `protobuf:"bytes,4,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
Number int32 `protobuf:"varint,5,opt,name=number,proto3" json:"number,omitempty"`
|
||||
Title string `protobuf:"bytes,6,opt,name=title,proto3" json:"title,omitempty"`
|
||||
Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
Labels []string `protobuf:"bytes,8,rep,name=labels,proto3" json:"labels,omitempty"`
|
||||
Assignees []string `protobuf:"bytes,9,rep,name=assignees,proto3" json:"assignees,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IssueEvent) Reset() {
|
||||
*x = IssueEvent{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[53]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IssueEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IssueEvent) ProtoMessage() {}
|
||||
|
||||
func (x *IssueEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[53]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use IssueEvent.ProtoReflect.Descriptor instead.
|
||||
func (*IssueEvent) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{53}
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetState() string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetIsPullRequest() bool {
|
||||
if x != nil {
|
||||
return x.IsPullRequest
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetRepo() *RepoRef {
|
||||
if x != nil {
|
||||
return x.Repo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetNumber() int32 {
|
||||
if x != nil {
|
||||
return x.Number
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetLabels() []string {
|
||||
if x != nil {
|
||||
return x.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *IssueEvent) GetAssignees() []string {
|
||||
if x != nil {
|
||||
return x.Assignees
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReviewEvent struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
|
||||
Repo *RepoRef `protobuf:"bytes,2,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
PrNumber int32 `protobuf:"varint,3,opt,name=pr_number,json=prNumber,proto3" json:"pr_number,omitempty"`
|
||||
ReviewId int64 `protobuf:"varint,4,opt,name=review_id,json=reviewId,proto3" json:"review_id,omitempty"`
|
||||
Author string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"`
|
||||
State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state,omitempty"`
|
||||
Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) Reset() {
|
||||
*x = ReviewEvent{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[54]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ReviewEvent) ProtoMessage() {}
|
||||
|
||||
func (x *ReviewEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[54]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ReviewEvent.ProtoReflect.Descriptor instead.
|
||||
func (*ReviewEvent) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{54}
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetRepo() *RepoRef {
|
||||
if x != nil {
|
||||
return x.Repo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetPrNumber() int32 {
|
||||
if x != nil {
|
||||
return x.PrNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetReviewId() int64 {
|
||||
if x != nil {
|
||||
return x.ReviewId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetAuthor() string {
|
||||
if x != nil {
|
||||
return x.Author
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetState() string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewEvent) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReviewCommentEvent struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
|
||||
Repo *RepoRef `protobuf:"bytes,2,opt,name=repo,proto3" json:"repo,omitempty"`
|
||||
PrNumber int32 `protobuf:"varint,3,opt,name=pr_number,json=prNumber,proto3" json:"pr_number,omitempty"`
|
||||
ReviewId int64 `protobuf:"varint,4,opt,name=review_id,json=reviewId,proto3" json:"review_id,omitempty"`
|
||||
CommentId int64 `protobuf:"varint,5,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"`
|
||||
Author string `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"`
|
||||
Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
Path string `protobuf:"bytes,8,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Line int32 `protobuf:"varint,9,opt,name=line,proto3" json:"line,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) Reset() {
|
||||
*x = ReviewCommentEvent{}
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[55]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ReviewCommentEvent) ProtoMessage() {}
|
||||
|
||||
func (x *ReviewCommentEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_forge_v1_forge_proto_msgTypes[55]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ReviewCommentEvent.ProtoReflect.Descriptor instead.
|
||||
func (*ReviewCommentEvent) Descriptor() ([]byte, []int) {
|
||||
return file_forge_v1_forge_proto_rawDescGZIP(), []int{55}
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetRepo() *RepoRef {
|
||||
if x != nil {
|
||||
return x.Repo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetPrNumber() int32 {
|
||||
if x != nil {
|
||||
return x.PrNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetReviewId() int64 {
|
||||
if x != nil {
|
||||
return x.ReviewId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetCommentId() int64 {
|
||||
if x != nil {
|
||||
return x.CommentId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetAuthor() string {
|
||||
if x != nil {
|
||||
return x.Author
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetPath() string {
|
||||
if x != nil {
|
||||
return x.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ReviewCommentEvent) GetLine() int32 {
|
||||
if x != nil {
|
||||
return x.Line
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_forge_v1_forge_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_forge_v1_forge_proto_rawDesc = "" +
|
||||
@@ -3299,53 +2961,22 @@ const file_forge_v1_forge_proto_rawDesc = "" +
|
||||
"\x19AcceptInvitationsResponse\":\n" +
|
||||
"\x11VerifyPushRequest\x12%\n" +
|
||||
"\x04repo\x18\x01 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\"\x14\n" +
|
||||
"\x12VerifyPushResponse\"P\n" +
|
||||
"\x12VerifyPushResponse\"=\n" +
|
||||
"\x14GitCredentialRequest\x12%\n" +
|
||||
"\x04repo\x18\x01 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\"\xc8\x01\n" +
|
||||
"\x15GitCredentialResponse\x12\x1a\n" +
|
||||
"\busername\x18\x01 \x01(\tR\busername\x12\x14\n" +
|
||||
"\x05token\x18\x02 \x01(\tR\x05token\x129\n" +
|
||||
"\n" +
|
||||
"expires_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12\x1f\n" +
|
||||
"\vcommit_name\x18\x04 \x01(\tR\n" +
|
||||
"commitName\x12!\n" +
|
||||
"\fcommit_email\x18\x05 \x01(\tR\vcommitEmail\"P\n" +
|
||||
"\x15GetRepoArchiveRequest\x12%\n" +
|
||||
"\x04repo\x18\x01 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x10\n" +
|
||||
"\x03ref\x18\x02 \x01(\tR\x03ref\",\n" +
|
||||
"\x16GetRepoArchiveResponse\x12\x12\n" +
|
||||
"\x04data\x18\x01 \x01(\fR\x04data\"\xab\x01\n" +
|
||||
"\x13ParseWebhookRequest\x12D\n" +
|
||||
"\aheaders\x18\x01 \x03(\v2*.forge.v1.ParseWebhookRequest.HeadersEntryR\aheaders\x12\x12\n" +
|
||||
"\x04body\x18\x02 \x01(\fR\x04body\x1a:\n" +
|
||||
"\fHeadersEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc5\x01\n" +
|
||||
"\x14ParseWebhookResponse\x12,\n" +
|
||||
"\x05issue\x18\x01 \x01(\v2\x14.forge.v1.IssueEventH\x00R\x05issue\x12/\n" +
|
||||
"\x06review\x18\x02 \x01(\v2\x15.forge.v1.ReviewEventH\x00R\x06review\x12E\n" +
|
||||
"\x0ereview_comment\x18\x03 \x01(\v2\x1c.forge.v1.ReviewCommentEventH\x00R\rreviewCommentB\a\n" +
|
||||
"\x05event\"\x81\x02\n" +
|
||||
"\n" +
|
||||
"IssueEvent\x12\x16\n" +
|
||||
"\x06action\x18\x01 \x01(\tR\x06action\x12\x14\n" +
|
||||
"\x05state\x18\x02 \x01(\tR\x05state\x12&\n" +
|
||||
"\x0fis_pull_request\x18\x03 \x01(\bR\risPullRequest\x12%\n" +
|
||||
"\x04repo\x18\x04 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x16\n" +
|
||||
"\x06number\x18\x05 \x01(\x05R\x06number\x12\x14\n" +
|
||||
"\x05title\x18\x06 \x01(\tR\x05title\x12\x12\n" +
|
||||
"\x04body\x18\a \x01(\tR\x04body\x12\x16\n" +
|
||||
"\x06labels\x18\b \x03(\tR\x06labels\x12\x1c\n" +
|
||||
"\tassignees\x18\t \x03(\tR\tassignees\"\xc8\x01\n" +
|
||||
"\vReviewEvent\x12\x16\n" +
|
||||
"\x06action\x18\x01 \x01(\tR\x06action\x12%\n" +
|
||||
"\x04repo\x18\x02 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x1b\n" +
|
||||
"\tpr_number\x18\x03 \x01(\x05R\bprNumber\x12\x1b\n" +
|
||||
"\treview_id\x18\x04 \x01(\x03R\breviewId\x12\x16\n" +
|
||||
"\x06author\x18\x05 \x01(\tR\x06author\x12\x14\n" +
|
||||
"\x05state\x18\x06 \x01(\tR\x05state\x12\x12\n" +
|
||||
"\x04body\x18\a \x01(\tR\x04body\"\x80\x02\n" +
|
||||
"\x12ReviewCommentEvent\x12\x16\n" +
|
||||
"\x06action\x18\x01 \x01(\tR\x06action\x12%\n" +
|
||||
"\x04repo\x18\x02 \x01(\v2\x11.forge.v1.RepoRefR\x04repo\x12\x1b\n" +
|
||||
"\tpr_number\x18\x03 \x01(\x05R\bprNumber\x12\x1b\n" +
|
||||
"\treview_id\x18\x04 \x01(\x03R\breviewId\x12\x1d\n" +
|
||||
"\n" +
|
||||
"comment_id\x18\x05 \x01(\x03R\tcommentId\x12\x16\n" +
|
||||
"\x06author\x18\x06 \x01(\tR\x06author\x12\x12\n" +
|
||||
"\x04body\x18\a \x01(\tR\x04body\x12\x12\n" +
|
||||
"\x04path\x18\b \x01(\tR\x04path\x12\x12\n" +
|
||||
"\x04line\x18\t \x01(\x05R\x04line2\x97\x0e\n" +
|
||||
"\x04data\x18\x01 \x01(\fR\x04data2\x9a\x0e\n" +
|
||||
"\fForgeService\x12D\n" +
|
||||
"\tConfigure\x12\x1a.forge.v1.ConfigureRequest\x1a\x1b.forge.v1.ConfigureResponse\x12S\n" +
|
||||
"\x0eAssignedIssues\x12\x1f.forge.v1.AssignedIssuesRequest\x1a .forge.v1.AssignedIssuesResponse\x12V\n" +
|
||||
@@ -3370,8 +3001,8 @@ const file_forge_v1_forge_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"VerifyPush\x12\x1b.forge.v1.VerifyPushRequest\x1a\x1c.forge.v1.VerifyPushResponse\x12G\n" +
|
||||
"\n" +
|
||||
"LinkBranch\x12\x1b.forge.v1.LinkBranchRequest\x1a\x1c.forge.v1.LinkBranchResponse\x12M\n" +
|
||||
"\fParseWebhook\x12\x1d.forge.v1.ParseWebhookRequest\x1a\x1e.forge.v1.ParseWebhookResponse\x12U\n" +
|
||||
"LinkBranch\x12\x1b.forge.v1.LinkBranchRequest\x1a\x1c.forge.v1.LinkBranchResponse\x12P\n" +
|
||||
"\rGitCredential\x12\x1e.forge.v1.GitCredentialRequest\x1a\x1f.forge.v1.GitCredentialResponse\x12U\n" +
|
||||
"\x0eGetRepoArchive\x12\x1f.forge.v1.GetRepoArchiveRequest\x1a .forge.v1.GetRepoArchiveResponse0\x01B\xa4\x01\n" +
|
||||
"\fcom.forge.v1B\n" +
|
||||
"ForgeProtoP\x01ZGgithub.com/samcharles93/archie-core/internal/contracts/forge/v1;forgev1\xa2\x02\x03FXX\xaa\x02\bForge.V1\xca\x02\bForge\\V1\xe2\x02\x14Forge\\V1\\GPBMetadata\xea\x02\tForge::V1b\x06proto3"
|
||||
@@ -3388,7 +3019,7 @@ func file_forge_v1_forge_proto_rawDescGZIP() []byte {
|
||||
return file_forge_v1_forge_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_forge_v1_forge_proto_msgTypes = make([]protoimpl.MessageInfo, 58)
|
||||
var file_forge_v1_forge_proto_msgTypes = make([]protoimpl.MessageInfo, 54)
|
||||
var file_forge_v1_forge_proto_goTypes = []any{
|
||||
(*ConfigureRequest)(nil), // 0: forge.v1.ConfigureRequest
|
||||
(*ConfigureResponse)(nil), // 1: forge.v1.ConfigureResponse
|
||||
@@ -3439,19 +3070,15 @@ var file_forge_v1_forge_proto_goTypes = []any{
|
||||
(*AcceptInvitationsResponse)(nil), // 46: forge.v1.AcceptInvitationsResponse
|
||||
(*VerifyPushRequest)(nil), // 47: forge.v1.VerifyPushRequest
|
||||
(*VerifyPushResponse)(nil), // 48: forge.v1.VerifyPushResponse
|
||||
(*GetRepoArchiveRequest)(nil), // 49: forge.v1.GetRepoArchiveRequest
|
||||
(*GetRepoArchiveResponse)(nil), // 50: forge.v1.GetRepoArchiveResponse
|
||||
(*ParseWebhookRequest)(nil), // 51: forge.v1.ParseWebhookRequest
|
||||
(*ParseWebhookResponse)(nil), // 52: forge.v1.ParseWebhookResponse
|
||||
(*IssueEvent)(nil), // 53: forge.v1.IssueEvent
|
||||
(*ReviewEvent)(nil), // 54: forge.v1.ReviewEvent
|
||||
(*ReviewCommentEvent)(nil), // 55: forge.v1.ReviewCommentEvent
|
||||
nil, // 56: forge.v1.ConfigureRequest.SettingsEntry
|
||||
nil, // 57: forge.v1.ParseWebhookRequest.HeadersEntry
|
||||
(*timestamppb.Timestamp)(nil), // 58: google.protobuf.Timestamp
|
||||
(*GitCredentialRequest)(nil), // 49: forge.v1.GitCredentialRequest
|
||||
(*GitCredentialResponse)(nil), // 50: forge.v1.GitCredentialResponse
|
||||
(*GetRepoArchiveRequest)(nil), // 51: forge.v1.GetRepoArchiveRequest
|
||||
(*GetRepoArchiveResponse)(nil), // 52: forge.v1.GetRepoArchiveResponse
|
||||
nil, // 53: forge.v1.ConfigureRequest.SettingsEntry
|
||||
(*timestamppb.Timestamp)(nil), // 54: google.protobuf.Timestamp
|
||||
}
|
||||
var file_forge_v1_forge_proto_depIdxs = []int32{
|
||||
56, // 0: forge.v1.ConfigureRequest.settings:type_name -> forge.v1.ConfigureRequest.SettingsEntry
|
||||
53, // 0: forge.v1.ConfigureRequest.settings:type_name -> forge.v1.ConfigureRequest.SettingsEntry
|
||||
2, // 1: forge.v1.PullRequestRef.repo:type_name -> forge.v1.RepoRef
|
||||
4, // 2: forge.v1.AssignedIssuesResponse.issues:type_name -> forge.v1.Issue
|
||||
4, // 3: forge.v1.IssuesWithLabelResponse.issues:type_name -> forge.v1.Issue
|
||||
@@ -3470,9 +3097,9 @@ var file_forge_v1_forge_proto_depIdxs = []int32{
|
||||
27, // 16: forge.v1.GetPullRequestResponse.pull_request:type_name -> forge.v1.PullRequest
|
||||
2, // 17: forge.v1.GetPullRequestDiffRequest.repo:type_name -> forge.v1.RepoRef
|
||||
3, // 18: forge.v1.ListReviewsRequest.pull_request:type_name -> forge.v1.PullRequestRef
|
||||
58, // 19: forge.v1.Review.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
54, // 19: forge.v1.Review.submitted_at:type_name -> google.protobuf.Timestamp
|
||||
33, // 20: forge.v1.ListReviewsResponse.reviews:type_name -> forge.v1.Review
|
||||
58, // 21: forge.v1.ReviewComment.created_at:type_name -> google.protobuf.Timestamp
|
||||
54, // 21: forge.v1.ReviewComment.created_at:type_name -> google.protobuf.Timestamp
|
||||
3, // 22: forge.v1.ListReviewCommentsRequest.pull_request:type_name -> forge.v1.PullRequestRef
|
||||
35, // 23: forge.v1.ListReviewCommentsResponse.comments:type_name -> forge.v1.ReviewComment
|
||||
3, // 24: forge.v1.ReplyToReviewRequest.pull_request:type_name -> forge.v1.PullRequestRef
|
||||
@@ -3481,65 +3108,60 @@ var file_forge_v1_forge_proto_depIdxs = []int32{
|
||||
2, // 27: forge.v1.LinkBranchRequest.repo:type_name -> forge.v1.RepoRef
|
||||
2, // 28: forge.v1.AcceptInvitationsRequest.repositories:type_name -> forge.v1.RepoRef
|
||||
2, // 29: forge.v1.VerifyPushRequest.repo:type_name -> forge.v1.RepoRef
|
||||
2, // 30: forge.v1.GetRepoArchiveRequest.repo:type_name -> forge.v1.RepoRef
|
||||
57, // 31: forge.v1.ParseWebhookRequest.headers:type_name -> forge.v1.ParseWebhookRequest.HeadersEntry
|
||||
53, // 32: forge.v1.ParseWebhookResponse.issue:type_name -> forge.v1.IssueEvent
|
||||
54, // 33: forge.v1.ParseWebhookResponse.review:type_name -> forge.v1.ReviewEvent
|
||||
55, // 34: forge.v1.ParseWebhookResponse.review_comment:type_name -> forge.v1.ReviewCommentEvent
|
||||
2, // 35: forge.v1.IssueEvent.repo:type_name -> forge.v1.RepoRef
|
||||
2, // 36: forge.v1.ReviewEvent.repo:type_name -> forge.v1.RepoRef
|
||||
2, // 37: forge.v1.ReviewCommentEvent.repo:type_name -> forge.v1.RepoRef
|
||||
0, // 38: forge.v1.ForgeService.Configure:input_type -> forge.v1.ConfigureRequest
|
||||
7, // 39: forge.v1.ForgeService.AssignedIssues:input_type -> forge.v1.AssignedIssuesRequest
|
||||
8, // 40: forge.v1.ForgeService.IssuesWithLabel:input_type -> forge.v1.IssuesWithLabelRequest
|
||||
9, // 41: forge.v1.ForgeService.Comment:input_type -> forge.v1.CommentRequest
|
||||
11, // 42: forge.v1.ForgeService.CreateIssue:input_type -> forge.v1.CreateIssueRequest
|
||||
13, // 43: forge.v1.ForgeService.CloseIssue:input_type -> forge.v1.CloseIssueRequest
|
||||
19, // 44: forge.v1.ForgeService.React:input_type -> forge.v1.ReactRequest
|
||||
21, // 45: forge.v1.ForgeService.SetStateLabel:input_type -> forge.v1.SetStateLabelRequest
|
||||
23, // 46: forge.v1.ForgeService.CreatePR:input_type -> forge.v1.CreatePRRequest
|
||||
25, // 47: forge.v1.ForgeService.PRState:input_type -> forge.v1.PRStateRequest
|
||||
15, // 48: forge.v1.ForgeService.ClosePR:input_type -> forge.v1.ClosePRRequest
|
||||
17, // 49: forge.v1.ForgeService.MergePR:input_type -> forge.v1.MergePRRequest
|
||||
28, // 50: forge.v1.ForgeService.GetPullRequest:input_type -> forge.v1.GetPullRequestRequest
|
||||
30, // 51: forge.v1.ForgeService.GetPullRequestDiff:input_type -> forge.v1.GetPullRequestDiffRequest
|
||||
32, // 52: forge.v1.ForgeService.ListReviews:input_type -> forge.v1.ListReviewsRequest
|
||||
36, // 53: forge.v1.ForgeService.ListReviewComments:input_type -> forge.v1.ListReviewCommentsRequest
|
||||
38, // 54: forge.v1.ForgeService.ReplyToReview:input_type -> forge.v1.ReplyToReviewRequest
|
||||
41, // 55: forge.v1.ForgeService.CreateReviewComments:input_type -> forge.v1.CreateReviewCommentsRequest
|
||||
45, // 56: forge.v1.ForgeService.AcceptInvitations:input_type -> forge.v1.AcceptInvitationsRequest
|
||||
47, // 57: forge.v1.ForgeService.VerifyPush:input_type -> forge.v1.VerifyPushRequest
|
||||
43, // 58: forge.v1.ForgeService.LinkBranch:input_type -> forge.v1.LinkBranchRequest
|
||||
51, // 59: forge.v1.ForgeService.ParseWebhook:input_type -> forge.v1.ParseWebhookRequest
|
||||
49, // 60: forge.v1.ForgeService.GetRepoArchive:input_type -> forge.v1.GetRepoArchiveRequest
|
||||
1, // 61: forge.v1.ForgeService.Configure:output_type -> forge.v1.ConfigureResponse
|
||||
5, // 62: forge.v1.ForgeService.AssignedIssues:output_type -> forge.v1.AssignedIssuesResponse
|
||||
6, // 63: forge.v1.ForgeService.IssuesWithLabel:output_type -> forge.v1.IssuesWithLabelResponse
|
||||
10, // 64: forge.v1.ForgeService.Comment:output_type -> forge.v1.CommentResponse
|
||||
12, // 65: forge.v1.ForgeService.CreateIssue:output_type -> forge.v1.CreateIssueResponse
|
||||
14, // 66: forge.v1.ForgeService.CloseIssue:output_type -> forge.v1.CloseIssueResponse
|
||||
20, // 67: forge.v1.ForgeService.React:output_type -> forge.v1.ReactResponse
|
||||
22, // 68: forge.v1.ForgeService.SetStateLabel:output_type -> forge.v1.SetStateLabelResponse
|
||||
24, // 69: forge.v1.ForgeService.CreatePR:output_type -> forge.v1.CreatePRResponse
|
||||
26, // 70: forge.v1.ForgeService.PRState:output_type -> forge.v1.PRStateResponse
|
||||
16, // 71: forge.v1.ForgeService.ClosePR:output_type -> forge.v1.ClosePRResponse
|
||||
18, // 72: forge.v1.ForgeService.MergePR:output_type -> forge.v1.MergePRResponse
|
||||
29, // 73: forge.v1.ForgeService.GetPullRequest:output_type -> forge.v1.GetPullRequestResponse
|
||||
31, // 74: forge.v1.ForgeService.GetPullRequestDiff:output_type -> forge.v1.GetPullRequestDiffResponse
|
||||
34, // 75: forge.v1.ForgeService.ListReviews:output_type -> forge.v1.ListReviewsResponse
|
||||
37, // 76: forge.v1.ForgeService.ListReviewComments:output_type -> forge.v1.ListReviewCommentsResponse
|
||||
39, // 77: forge.v1.ForgeService.ReplyToReview:output_type -> forge.v1.ReplyToReviewResponse
|
||||
42, // 78: forge.v1.ForgeService.CreateReviewComments:output_type -> forge.v1.CreateReviewCommentsResponse
|
||||
46, // 79: forge.v1.ForgeService.AcceptInvitations:output_type -> forge.v1.AcceptInvitationsResponse
|
||||
48, // 80: forge.v1.ForgeService.VerifyPush:output_type -> forge.v1.VerifyPushResponse
|
||||
44, // 81: forge.v1.ForgeService.LinkBranch:output_type -> forge.v1.LinkBranchResponse
|
||||
52, // 82: forge.v1.ForgeService.ParseWebhook:output_type -> forge.v1.ParseWebhookResponse
|
||||
50, // 83: forge.v1.ForgeService.GetRepoArchive:output_type -> forge.v1.GetRepoArchiveResponse
|
||||
61, // [61:84] is the sub-list for method output_type
|
||||
38, // [38:61] is the sub-list for method input_type
|
||||
38, // [38:38] is the sub-list for extension type_name
|
||||
38, // [38:38] is the sub-list for extension extendee
|
||||
0, // [0:38] is the sub-list for field type_name
|
||||
2, // 30: forge.v1.GitCredentialRequest.repo:type_name -> forge.v1.RepoRef
|
||||
54, // 31: forge.v1.GitCredentialResponse.expires_at:type_name -> google.protobuf.Timestamp
|
||||
2, // 32: forge.v1.GetRepoArchiveRequest.repo:type_name -> forge.v1.RepoRef
|
||||
0, // 33: forge.v1.ForgeService.Configure:input_type -> forge.v1.ConfigureRequest
|
||||
7, // 34: forge.v1.ForgeService.AssignedIssues:input_type -> forge.v1.AssignedIssuesRequest
|
||||
8, // 35: forge.v1.ForgeService.IssuesWithLabel:input_type -> forge.v1.IssuesWithLabelRequest
|
||||
9, // 36: forge.v1.ForgeService.Comment:input_type -> forge.v1.CommentRequest
|
||||
11, // 37: forge.v1.ForgeService.CreateIssue:input_type -> forge.v1.CreateIssueRequest
|
||||
13, // 38: forge.v1.ForgeService.CloseIssue:input_type -> forge.v1.CloseIssueRequest
|
||||
19, // 39: forge.v1.ForgeService.React:input_type -> forge.v1.ReactRequest
|
||||
21, // 40: forge.v1.ForgeService.SetStateLabel:input_type -> forge.v1.SetStateLabelRequest
|
||||
23, // 41: forge.v1.ForgeService.CreatePR:input_type -> forge.v1.CreatePRRequest
|
||||
25, // 42: forge.v1.ForgeService.PRState:input_type -> forge.v1.PRStateRequest
|
||||
15, // 43: forge.v1.ForgeService.ClosePR:input_type -> forge.v1.ClosePRRequest
|
||||
17, // 44: forge.v1.ForgeService.MergePR:input_type -> forge.v1.MergePRRequest
|
||||
28, // 45: forge.v1.ForgeService.GetPullRequest:input_type -> forge.v1.GetPullRequestRequest
|
||||
30, // 46: forge.v1.ForgeService.GetPullRequestDiff:input_type -> forge.v1.GetPullRequestDiffRequest
|
||||
32, // 47: forge.v1.ForgeService.ListReviews:input_type -> forge.v1.ListReviewsRequest
|
||||
36, // 48: forge.v1.ForgeService.ListReviewComments:input_type -> forge.v1.ListReviewCommentsRequest
|
||||
38, // 49: forge.v1.ForgeService.ReplyToReview:input_type -> forge.v1.ReplyToReviewRequest
|
||||
41, // 50: forge.v1.ForgeService.CreateReviewComments:input_type -> forge.v1.CreateReviewCommentsRequest
|
||||
45, // 51: forge.v1.ForgeService.AcceptInvitations:input_type -> forge.v1.AcceptInvitationsRequest
|
||||
47, // 52: forge.v1.ForgeService.VerifyPush:input_type -> forge.v1.VerifyPushRequest
|
||||
43, // 53: forge.v1.ForgeService.LinkBranch:input_type -> forge.v1.LinkBranchRequest
|
||||
49, // 54: forge.v1.ForgeService.GitCredential:input_type -> forge.v1.GitCredentialRequest
|
||||
51, // 55: forge.v1.ForgeService.GetRepoArchive:input_type -> forge.v1.GetRepoArchiveRequest
|
||||
1, // 56: forge.v1.ForgeService.Configure:output_type -> forge.v1.ConfigureResponse
|
||||
5, // 57: forge.v1.ForgeService.AssignedIssues:output_type -> forge.v1.AssignedIssuesResponse
|
||||
6, // 58: forge.v1.ForgeService.IssuesWithLabel:output_type -> forge.v1.IssuesWithLabelResponse
|
||||
10, // 59: forge.v1.ForgeService.Comment:output_type -> forge.v1.CommentResponse
|
||||
12, // 60: forge.v1.ForgeService.CreateIssue:output_type -> forge.v1.CreateIssueResponse
|
||||
14, // 61: forge.v1.ForgeService.CloseIssue:output_type -> forge.v1.CloseIssueResponse
|
||||
20, // 62: forge.v1.ForgeService.React:output_type -> forge.v1.ReactResponse
|
||||
22, // 63: forge.v1.ForgeService.SetStateLabel:output_type -> forge.v1.SetStateLabelResponse
|
||||
24, // 64: forge.v1.ForgeService.CreatePR:output_type -> forge.v1.CreatePRResponse
|
||||
26, // 65: forge.v1.ForgeService.PRState:output_type -> forge.v1.PRStateResponse
|
||||
16, // 66: forge.v1.ForgeService.ClosePR:output_type -> forge.v1.ClosePRResponse
|
||||
18, // 67: forge.v1.ForgeService.MergePR:output_type -> forge.v1.MergePRResponse
|
||||
29, // 68: forge.v1.ForgeService.GetPullRequest:output_type -> forge.v1.GetPullRequestResponse
|
||||
31, // 69: forge.v1.ForgeService.GetPullRequestDiff:output_type -> forge.v1.GetPullRequestDiffResponse
|
||||
34, // 70: forge.v1.ForgeService.ListReviews:output_type -> forge.v1.ListReviewsResponse
|
||||
37, // 71: forge.v1.ForgeService.ListReviewComments:output_type -> forge.v1.ListReviewCommentsResponse
|
||||
39, // 72: forge.v1.ForgeService.ReplyToReview:output_type -> forge.v1.ReplyToReviewResponse
|
||||
42, // 73: forge.v1.ForgeService.CreateReviewComments:output_type -> forge.v1.CreateReviewCommentsResponse
|
||||
46, // 74: forge.v1.ForgeService.AcceptInvitations:output_type -> forge.v1.AcceptInvitationsResponse
|
||||
48, // 75: forge.v1.ForgeService.VerifyPush:output_type -> forge.v1.VerifyPushResponse
|
||||
44, // 76: forge.v1.ForgeService.LinkBranch:output_type -> forge.v1.LinkBranchResponse
|
||||
50, // 77: forge.v1.ForgeService.GitCredential:output_type -> forge.v1.GitCredentialResponse
|
||||
52, // 78: forge.v1.ForgeService.GetRepoArchive:output_type -> forge.v1.GetRepoArchiveResponse
|
||||
56, // [56:79] is the sub-list for method output_type
|
||||
33, // [33:56] is the sub-list for method input_type
|
||||
33, // [33:33] is the sub-list for extension type_name
|
||||
33, // [33:33] is the sub-list for extension extendee
|
||||
0, // [0:33] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_forge_v1_forge_proto_init() }
|
||||
@@ -3547,18 +3169,13 @@ func file_forge_v1_forge_proto_init() {
|
||||
if File_forge_v1_forge_proto != nil {
|
||||
return
|
||||
}
|
||||
file_forge_v1_forge_proto_msgTypes[52].OneofWrappers = []any{
|
||||
(*ParseWebhookResponse_Issue)(nil),
|
||||
(*ParseWebhookResponse_Review)(nil),
|
||||
(*ParseWebhookResponse_ReviewComment)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_forge_v1_forge_proto_rawDesc), len(file_forge_v1_forge_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 58,
|
||||
NumMessages: 54,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@ const (
|
||||
ForgeService_AcceptInvitations_FullMethodName = "/forge.v1.ForgeService/AcceptInvitations"
|
||||
ForgeService_VerifyPush_FullMethodName = "/forge.v1.ForgeService/VerifyPush"
|
||||
ForgeService_LinkBranch_FullMethodName = "/forge.v1.ForgeService/LinkBranch"
|
||||
ForgeService_ParseWebhook_FullMethodName = "/forge.v1.ForgeService/ParseWebhook"
|
||||
ForgeService_GitCredential_FullMethodName = "/forge.v1.ForgeService/GitCredential"
|
||||
ForgeService_GetRepoArchive_FullMethodName = "/forge.v1.ForgeService/GetRepoArchive"
|
||||
)
|
||||
|
||||
@@ -78,10 +78,10 @@ type ForgeServiceClient interface {
|
||||
AcceptInvitations(ctx context.Context, in *AcceptInvitationsRequest, opts ...grpc.CallOption) (*AcceptInvitationsResponse, error)
|
||||
VerifyPush(ctx context.Context, in *VerifyPushRequest, opts ...grpc.CallOption) (*VerifyPushResponse, error)
|
||||
LinkBranch(ctx context.Context, in *LinkBranchRequest, opts ...grpc.CallOption) (*LinkBranchResponse, error)
|
||||
// ParseWebhook decodes one webhook delivery the host has already
|
||||
// authenticated. A delivery that is not an event the host acts on returns no
|
||||
// event; an undecodable body is INVALID_ARGUMENT.
|
||||
ParseWebhook(ctx context.Context, in *ParseWebhookRequest, opts ...grpc.CallOption) (*ParseWebhookResponse, error)
|
||||
// GitCredential returns a short-lived credential for cloning and pushing one
|
||||
// repository, and the identity commits through it should carry. A forge that
|
||||
// authenticates git with its configured token answers UNIMPLEMENTED.
|
||||
GitCredential(ctx context.Context, in *GitCredentialRequest, opts ...grpc.CallOption) (*GitCredentialResponse, error)
|
||||
// GetRepoArchive streams a gzipped tar of the repository at a ref.
|
||||
GetRepoArchive(ctx context.Context, in *GetRepoArchiveRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetRepoArchiveResponse], error)
|
||||
}
|
||||
@@ -304,10 +304,10 @@ func (c *forgeServiceClient) LinkBranch(ctx context.Context, in *LinkBranchReque
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *forgeServiceClient) ParseWebhook(ctx context.Context, in *ParseWebhookRequest, opts ...grpc.CallOption) (*ParseWebhookResponse, error) {
|
||||
func (c *forgeServiceClient) GitCredential(ctx context.Context, in *GitCredentialRequest, opts ...grpc.CallOption) (*GitCredentialResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ParseWebhookResponse)
|
||||
err := c.cc.Invoke(ctx, ForgeService_ParseWebhook_FullMethodName, in, out, cOpts...)
|
||||
out := new(GitCredentialResponse)
|
||||
err := c.cc.Invoke(ctx, ForgeService_GitCredential_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -367,10 +367,10 @@ type ForgeServiceServer interface {
|
||||
AcceptInvitations(context.Context, *AcceptInvitationsRequest) (*AcceptInvitationsResponse, error)
|
||||
VerifyPush(context.Context, *VerifyPushRequest) (*VerifyPushResponse, error)
|
||||
LinkBranch(context.Context, *LinkBranchRequest) (*LinkBranchResponse, error)
|
||||
// ParseWebhook decodes one webhook delivery the host has already
|
||||
// authenticated. A delivery that is not an event the host acts on returns no
|
||||
// event; an undecodable body is INVALID_ARGUMENT.
|
||||
ParseWebhook(context.Context, *ParseWebhookRequest) (*ParseWebhookResponse, error)
|
||||
// GitCredential returns a short-lived credential for cloning and pushing one
|
||||
// repository, and the identity commits through it should carry. A forge that
|
||||
// authenticates git with its configured token answers UNIMPLEMENTED.
|
||||
GitCredential(context.Context, *GitCredentialRequest) (*GitCredentialResponse, error)
|
||||
// GetRepoArchive streams a gzipped tar of the repository at a ref.
|
||||
GetRepoArchive(*GetRepoArchiveRequest, grpc.ServerStreamingServer[GetRepoArchiveResponse]) error
|
||||
mustEmbedUnimplementedForgeServiceServer()
|
||||
@@ -446,8 +446,8 @@ func (UnimplementedForgeServiceServer) VerifyPush(context.Context, *VerifyPushRe
|
||||
func (UnimplementedForgeServiceServer) LinkBranch(context.Context, *LinkBranchRequest) (*LinkBranchResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method LinkBranch not implemented")
|
||||
}
|
||||
func (UnimplementedForgeServiceServer) ParseWebhook(context.Context, *ParseWebhookRequest) (*ParseWebhookResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ParseWebhook not implemented")
|
||||
func (UnimplementedForgeServiceServer) GitCredential(context.Context, *GitCredentialRequest) (*GitCredentialResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GitCredential not implemented")
|
||||
}
|
||||
func (UnimplementedForgeServiceServer) GetRepoArchive(*GetRepoArchiveRequest, grpc.ServerStreamingServer[GetRepoArchiveResponse]) error {
|
||||
return status.Error(codes.Unimplemented, "method GetRepoArchive not implemented")
|
||||
@@ -851,20 +851,20 @@ func _ForgeService_LinkBranch_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ForgeService_ParseWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ParseWebhookRequest)
|
||||
func _ForgeService_GitCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GitCredentialRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ForgeServiceServer).ParseWebhook(ctx, in)
|
||||
return srv.(ForgeServiceServer).GitCredential(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ForgeService_ParseWebhook_FullMethodName,
|
||||
FullMethod: ForgeService_GitCredential_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ForgeServiceServer).ParseWebhook(ctx, req.(*ParseWebhookRequest))
|
||||
return srv.(ForgeServiceServer).GitCredential(ctx, req.(*GitCredentialRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -972,8 +972,8 @@ var ForgeService_ServiceDesc = grpc.ServiceDesc{
|
||||
Handler: _ForgeService_LinkBranch_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ParseWebhook",
|
||||
Handler: _ForgeService_ParseWebhook_Handler,
|
||||
MethodName: "GitCredential",
|
||||
Handler: _ForgeService_GitCredential_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
|
||||
@@ -901,94 +901,6 @@ func (*ResumeBindingResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_binding_proto_rawDescGZIP(), []int{17}
|
||||
}
|
||||
|
||||
type ArmedBindingsForSourceRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ArmedBindingsForSourceRequest) Reset() {
|
||||
*x = ArmedBindingsForSourceRequest{}
|
||||
mi := &file_state_v1_binding_proto_msgTypes[18]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ArmedBindingsForSourceRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ArmedBindingsForSourceRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ArmedBindingsForSourceRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_binding_proto_msgTypes[18]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ArmedBindingsForSourceRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ArmedBindingsForSourceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_binding_proto_rawDescGZIP(), []int{18}
|
||||
}
|
||||
|
||||
func (x *ArmedBindingsForSourceRequest) GetSource() string {
|
||||
if x != nil {
|
||||
return x.Source
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ArmedBindingsForSourceResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Bindings []*Binding `protobuf:"bytes,1,rep,name=bindings,proto3" json:"bindings,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ArmedBindingsForSourceResponse) Reset() {
|
||||
*x = ArmedBindingsForSourceResponse{}
|
||||
mi := &file_state_v1_binding_proto_msgTypes[19]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ArmedBindingsForSourceResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ArmedBindingsForSourceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ArmedBindingsForSourceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_binding_proto_msgTypes[19]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ArmedBindingsForSourceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ArmedBindingsForSourceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_binding_proto_rawDescGZIP(), []int{19}
|
||||
}
|
||||
|
||||
func (x *ArmedBindingsForSourceResponse) GetBindings() []*Binding {
|
||||
if x != nil {
|
||||
return x.Bindings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_state_v1_binding_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_state_v1_binding_proto_rawDesc = "" +
|
||||
@@ -1045,11 +957,7 @@ const file_state_v1_binding_proto_rawDesc = "" +
|
||||
"\x14PauseBindingResponse\"&\n" +
|
||||
"\x14ResumeBindingRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\"\x17\n" +
|
||||
"\x15ResumeBindingResponse\"7\n" +
|
||||
"\x1dArmedBindingsForSourceRequest\x12\x16\n" +
|
||||
"\x06source\x18\x01 \x01(\tR\x06source\"O\n" +
|
||||
"\x1eArmedBindingsForSourceResponse\x12-\n" +
|
||||
"\bbindings\x18\x01 \x03(\v2\x11.state.v1.BindingR\bbindings2\x81\x06\n" +
|
||||
"\x15ResumeBindingResponse2\x94\x05\n" +
|
||||
"\x0eBindingService\x12P\n" +
|
||||
"\rInsertBinding\x12\x1e.state.v1.InsertBindingRequest\x1a\x1f.state.v1.InsertBindingResponse\x12G\n" +
|
||||
"\n" +
|
||||
@@ -1059,8 +967,7 @@ const file_state_v1_binding_proto_rawDesc = "" +
|
||||
"\rDeleteBinding\x12\x1e.state.v1.DeleteBindingRequest\x1a\x1f.state.v1.DeleteBindingResponse\x12S\n" +
|
||||
"\x0eApproveBinding\x12\x1f.state.v1.ApproveBindingRequest\x1a .state.v1.ApproveBindingResponse\x12M\n" +
|
||||
"\fPauseBinding\x12\x1d.state.v1.PauseBindingRequest\x1a\x1e.state.v1.PauseBindingResponse\x12P\n" +
|
||||
"\rResumeBinding\x12\x1e.state.v1.ResumeBindingRequest\x1a\x1f.state.v1.ResumeBindingResponse\x12k\n" +
|
||||
"\x16ArmedBindingsForSource\x12'.state.v1.ArmedBindingsForSourceRequest\x1a(.state.v1.ArmedBindingsForSourceResponseB\xa6\x01\n" +
|
||||
"\rResumeBinding\x12\x1e.state.v1.ResumeBindingRequest\x1a\x1f.state.v1.ResumeBindingResponseB\xa6\x01\n" +
|
||||
"\fcom.state.v1B\fBindingProtoP\x01ZGgithub.com/samcharles93/archie-core/internal/contracts/state/v1;statev1\xa2\x02\x03SXX\xaa\x02\bState.V1\xca\x02\bState\\V1\xe2\x02\x14State\\V1\\GPBMetadata\xea\x02\tState::V1b\x06proto3"
|
||||
|
||||
var (
|
||||
@@ -1075,62 +982,57 @@ func file_state_v1_binding_proto_rawDescGZIP() []byte {
|
||||
return file_state_v1_binding_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_state_v1_binding_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
|
||||
var file_state_v1_binding_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
|
||||
var file_state_v1_binding_proto_goTypes = []any{
|
||||
(*BindingMatcher)(nil), // 0: state.v1.BindingMatcher
|
||||
(*Binding)(nil), // 1: state.v1.Binding
|
||||
(*InsertBindingRequest)(nil), // 2: state.v1.InsertBindingRequest
|
||||
(*InsertBindingResponse)(nil), // 3: state.v1.InsertBindingResponse
|
||||
(*GetBindingRequest)(nil), // 4: state.v1.GetBindingRequest
|
||||
(*GetBindingResponse)(nil), // 5: state.v1.GetBindingResponse
|
||||
(*ListBindingsRequest)(nil), // 6: state.v1.ListBindingsRequest
|
||||
(*ListBindingsResponse)(nil), // 7: state.v1.ListBindingsResponse
|
||||
(*UpdateBindingRequest)(nil), // 8: state.v1.UpdateBindingRequest
|
||||
(*UpdateBindingResponse)(nil), // 9: state.v1.UpdateBindingResponse
|
||||
(*DeleteBindingRequest)(nil), // 10: state.v1.DeleteBindingRequest
|
||||
(*DeleteBindingResponse)(nil), // 11: state.v1.DeleteBindingResponse
|
||||
(*ApproveBindingRequest)(nil), // 12: state.v1.ApproveBindingRequest
|
||||
(*ApproveBindingResponse)(nil), // 13: state.v1.ApproveBindingResponse
|
||||
(*PauseBindingRequest)(nil), // 14: state.v1.PauseBindingRequest
|
||||
(*PauseBindingResponse)(nil), // 15: state.v1.PauseBindingResponse
|
||||
(*ResumeBindingRequest)(nil), // 16: state.v1.ResumeBindingRequest
|
||||
(*ResumeBindingResponse)(nil), // 17: state.v1.ResumeBindingResponse
|
||||
(*ArmedBindingsForSourceRequest)(nil), // 18: state.v1.ArmedBindingsForSourceRequest
|
||||
(*ArmedBindingsForSourceResponse)(nil), // 19: state.v1.ArmedBindingsForSourceResponse
|
||||
(*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp
|
||||
(*BindingMatcher)(nil), // 0: state.v1.BindingMatcher
|
||||
(*Binding)(nil), // 1: state.v1.Binding
|
||||
(*InsertBindingRequest)(nil), // 2: state.v1.InsertBindingRequest
|
||||
(*InsertBindingResponse)(nil), // 3: state.v1.InsertBindingResponse
|
||||
(*GetBindingRequest)(nil), // 4: state.v1.GetBindingRequest
|
||||
(*GetBindingResponse)(nil), // 5: state.v1.GetBindingResponse
|
||||
(*ListBindingsRequest)(nil), // 6: state.v1.ListBindingsRequest
|
||||
(*ListBindingsResponse)(nil), // 7: state.v1.ListBindingsResponse
|
||||
(*UpdateBindingRequest)(nil), // 8: state.v1.UpdateBindingRequest
|
||||
(*UpdateBindingResponse)(nil), // 9: state.v1.UpdateBindingResponse
|
||||
(*DeleteBindingRequest)(nil), // 10: state.v1.DeleteBindingRequest
|
||||
(*DeleteBindingResponse)(nil), // 11: state.v1.DeleteBindingResponse
|
||||
(*ApproveBindingRequest)(nil), // 12: state.v1.ApproveBindingRequest
|
||||
(*ApproveBindingResponse)(nil), // 13: state.v1.ApproveBindingResponse
|
||||
(*PauseBindingRequest)(nil), // 14: state.v1.PauseBindingRequest
|
||||
(*PauseBindingResponse)(nil), // 15: state.v1.PauseBindingResponse
|
||||
(*ResumeBindingRequest)(nil), // 16: state.v1.ResumeBindingRequest
|
||||
(*ResumeBindingResponse)(nil), // 17: state.v1.ResumeBindingResponse
|
||||
(*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp
|
||||
}
|
||||
var file_state_v1_binding_proto_depIdxs = []int32{
|
||||
0, // 0: state.v1.Binding.matcher:type_name -> state.v1.BindingMatcher
|
||||
20, // 1: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
|
||||
20, // 2: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
|
||||
18, // 1: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
|
||||
18, // 2: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
|
||||
1, // 3: state.v1.InsertBindingRequest.binding:type_name -> state.v1.Binding
|
||||
1, // 4: state.v1.GetBindingResponse.binding:type_name -> state.v1.Binding
|
||||
1, // 5: state.v1.ListBindingsResponse.bindings:type_name -> state.v1.Binding
|
||||
1, // 6: state.v1.UpdateBindingRequest.binding:type_name -> state.v1.Binding
|
||||
1, // 7: state.v1.ArmedBindingsForSourceResponse.bindings:type_name -> state.v1.Binding
|
||||
2, // 8: state.v1.BindingService.InsertBinding:input_type -> state.v1.InsertBindingRequest
|
||||
4, // 9: state.v1.BindingService.GetBinding:input_type -> state.v1.GetBindingRequest
|
||||
6, // 10: state.v1.BindingService.ListBindings:input_type -> state.v1.ListBindingsRequest
|
||||
8, // 11: state.v1.BindingService.UpdateBinding:input_type -> state.v1.UpdateBindingRequest
|
||||
10, // 12: state.v1.BindingService.DeleteBinding:input_type -> state.v1.DeleteBindingRequest
|
||||
12, // 13: state.v1.BindingService.ApproveBinding:input_type -> state.v1.ApproveBindingRequest
|
||||
14, // 14: state.v1.BindingService.PauseBinding:input_type -> state.v1.PauseBindingRequest
|
||||
16, // 15: state.v1.BindingService.ResumeBinding:input_type -> state.v1.ResumeBindingRequest
|
||||
18, // 16: state.v1.BindingService.ArmedBindingsForSource:input_type -> state.v1.ArmedBindingsForSourceRequest
|
||||
3, // 17: state.v1.BindingService.InsertBinding:output_type -> state.v1.InsertBindingResponse
|
||||
5, // 18: state.v1.BindingService.GetBinding:output_type -> state.v1.GetBindingResponse
|
||||
7, // 19: state.v1.BindingService.ListBindings:output_type -> state.v1.ListBindingsResponse
|
||||
9, // 20: state.v1.BindingService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
|
||||
11, // 21: state.v1.BindingService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
|
||||
13, // 22: state.v1.BindingService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
|
||||
15, // 23: state.v1.BindingService.PauseBinding:output_type -> state.v1.PauseBindingResponse
|
||||
17, // 24: state.v1.BindingService.ResumeBinding:output_type -> state.v1.ResumeBindingResponse
|
||||
19, // 25: state.v1.BindingService.ArmedBindingsForSource:output_type -> state.v1.ArmedBindingsForSourceResponse
|
||||
17, // [17:26] is the sub-list for method output_type
|
||||
8, // [8:17] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
2, // 7: state.v1.BindingService.InsertBinding:input_type -> state.v1.InsertBindingRequest
|
||||
4, // 8: state.v1.BindingService.GetBinding:input_type -> state.v1.GetBindingRequest
|
||||
6, // 9: state.v1.BindingService.ListBindings:input_type -> state.v1.ListBindingsRequest
|
||||
8, // 10: state.v1.BindingService.UpdateBinding:input_type -> state.v1.UpdateBindingRequest
|
||||
10, // 11: state.v1.BindingService.DeleteBinding:input_type -> state.v1.DeleteBindingRequest
|
||||
12, // 12: state.v1.BindingService.ApproveBinding:input_type -> state.v1.ApproveBindingRequest
|
||||
14, // 13: state.v1.BindingService.PauseBinding:input_type -> state.v1.PauseBindingRequest
|
||||
16, // 14: state.v1.BindingService.ResumeBinding:input_type -> state.v1.ResumeBindingRequest
|
||||
3, // 15: state.v1.BindingService.InsertBinding:output_type -> state.v1.InsertBindingResponse
|
||||
5, // 16: state.v1.BindingService.GetBinding:output_type -> state.v1.GetBindingResponse
|
||||
7, // 17: state.v1.BindingService.ListBindings:output_type -> state.v1.ListBindingsResponse
|
||||
9, // 18: state.v1.BindingService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
|
||||
11, // 19: state.v1.BindingService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
|
||||
13, // 20: state.v1.BindingService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
|
||||
15, // 21: state.v1.BindingService.PauseBinding:output_type -> state.v1.PauseBindingResponse
|
||||
17, // 22: state.v1.BindingService.ResumeBinding:output_type -> state.v1.ResumeBindingResponse
|
||||
15, // [15:23] is the sub-list for method output_type
|
||||
7, // [7:15] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_state_v1_binding_proto_init() }
|
||||
@@ -1144,7 +1046,7 @@ func file_state_v1_binding_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_state_v1_binding_proto_rawDesc), len(file_state_v1_binding_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 20,
|
||||
NumMessages: 18,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -19,15 +19,14 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
BindingService_InsertBinding_FullMethodName = "/state.v1.BindingService/InsertBinding"
|
||||
BindingService_GetBinding_FullMethodName = "/state.v1.BindingService/GetBinding"
|
||||
BindingService_ListBindings_FullMethodName = "/state.v1.BindingService/ListBindings"
|
||||
BindingService_UpdateBinding_FullMethodName = "/state.v1.BindingService/UpdateBinding"
|
||||
BindingService_DeleteBinding_FullMethodName = "/state.v1.BindingService/DeleteBinding"
|
||||
BindingService_ApproveBinding_FullMethodName = "/state.v1.BindingService/ApproveBinding"
|
||||
BindingService_PauseBinding_FullMethodName = "/state.v1.BindingService/PauseBinding"
|
||||
BindingService_ResumeBinding_FullMethodName = "/state.v1.BindingService/ResumeBinding"
|
||||
BindingService_ArmedBindingsForSource_FullMethodName = "/state.v1.BindingService/ArmedBindingsForSource"
|
||||
BindingService_InsertBinding_FullMethodName = "/state.v1.BindingService/InsertBinding"
|
||||
BindingService_GetBinding_FullMethodName = "/state.v1.BindingService/GetBinding"
|
||||
BindingService_ListBindings_FullMethodName = "/state.v1.BindingService/ListBindings"
|
||||
BindingService_UpdateBinding_FullMethodName = "/state.v1.BindingService/UpdateBinding"
|
||||
BindingService_DeleteBinding_FullMethodName = "/state.v1.BindingService/DeleteBinding"
|
||||
BindingService_ApproveBinding_FullMethodName = "/state.v1.BindingService/ApproveBinding"
|
||||
BindingService_PauseBinding_FullMethodName = "/state.v1.BindingService/PauseBinding"
|
||||
BindingService_ResumeBinding_FullMethodName = "/state.v1.BindingService/ResumeBinding"
|
||||
)
|
||||
|
||||
// BindingServiceClient is the client API for BindingService service.
|
||||
@@ -42,7 +41,6 @@ type BindingServiceClient interface {
|
||||
ApproveBinding(ctx context.Context, in *ApproveBindingRequest, opts ...grpc.CallOption) (*ApproveBindingResponse, error)
|
||||
PauseBinding(ctx context.Context, in *PauseBindingRequest, opts ...grpc.CallOption) (*PauseBindingResponse, error)
|
||||
ResumeBinding(ctx context.Context, in *ResumeBindingRequest, opts ...grpc.CallOption) (*ResumeBindingResponse, error)
|
||||
ArmedBindingsForSource(ctx context.Context, in *ArmedBindingsForSourceRequest, opts ...grpc.CallOption) (*ArmedBindingsForSourceResponse, error)
|
||||
}
|
||||
|
||||
type bindingServiceClient struct {
|
||||
@@ -133,16 +131,6 @@ func (c *bindingServiceClient) ResumeBinding(ctx context.Context, in *ResumeBind
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *bindingServiceClient) ArmedBindingsForSource(ctx context.Context, in *ArmedBindingsForSourceRequest, opts ...grpc.CallOption) (*ArmedBindingsForSourceResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ArmedBindingsForSourceResponse)
|
||||
err := c.cc.Invoke(ctx, BindingService_ArmedBindingsForSource_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// BindingServiceServer is the server API for BindingService service.
|
||||
// All implementations must embed UnimplementedBindingServiceServer
|
||||
// for forward compatibility.
|
||||
@@ -155,7 +143,6 @@ type BindingServiceServer interface {
|
||||
ApproveBinding(context.Context, *ApproveBindingRequest) (*ApproveBindingResponse, error)
|
||||
PauseBinding(context.Context, *PauseBindingRequest) (*PauseBindingResponse, error)
|
||||
ResumeBinding(context.Context, *ResumeBindingRequest) (*ResumeBindingResponse, error)
|
||||
ArmedBindingsForSource(context.Context, *ArmedBindingsForSourceRequest) (*ArmedBindingsForSourceResponse, error)
|
||||
mustEmbedUnimplementedBindingServiceServer()
|
||||
}
|
||||
|
||||
@@ -190,9 +177,6 @@ func (UnimplementedBindingServiceServer) PauseBinding(context.Context, *PauseBin
|
||||
func (UnimplementedBindingServiceServer) ResumeBinding(context.Context, *ResumeBindingRequest) (*ResumeBindingResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ResumeBinding not implemented")
|
||||
}
|
||||
func (UnimplementedBindingServiceServer) ArmedBindingsForSource(context.Context, *ArmedBindingsForSourceRequest) (*ArmedBindingsForSourceResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ArmedBindingsForSource not implemented")
|
||||
}
|
||||
func (UnimplementedBindingServiceServer) mustEmbedUnimplementedBindingServiceServer() {}
|
||||
func (UnimplementedBindingServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
@@ -358,24 +342,6 @@ func _BindingService_ResumeBinding_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BindingService_ArmedBindingsForSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ArmedBindingsForSourceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BindingServiceServer).ArmedBindingsForSource(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: BindingService_ArmedBindingsForSource_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BindingServiceServer).ArmedBindingsForSource(ctx, req.(*ArmedBindingsForSourceRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// BindingService_ServiceDesc is the grpc.ServiceDesc for BindingService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -415,10 +381,6 @@ var BindingService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ResumeBinding",
|
||||
Handler: _BindingService_ResumeBinding_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ArmedBindingsForSource",
|
||||
Handler: _BindingService_ArmedBindingsForSource_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "state/v1/binding.proto",
|
||||
|
||||
@@ -36,10 +36,6 @@ func (s *ledgerStore) ListBindings(context.Context) ([]binding.Binding, error) {
|
||||
return []binding.Binding{dispatchBinding}, nil
|
||||
}
|
||||
|
||||
func (s *ledgerStore) ArmedBindingsForSource(context.Context, string) ([]binding.Binding, error) {
|
||||
return []binding.Binding{dispatchBinding}, nil
|
||||
}
|
||||
|
||||
func (s *ledgerStore) ListUndispatchedCaptures(context.Context, []string, int) ([]storecontract.CapturedEvent, error) {
|
||||
s.mu.Lock()
|
||||
pending := !s.claimed["capture"]
|
||||
|
||||
+132
-42
@@ -304,6 +304,14 @@ func (d *Daemon) Startup(ctx context.Context) error {
|
||||
// an unreachable host would otherwise hold boot open indefinitely.
|
||||
const sweepTimeout = 2 * time.Minute
|
||||
|
||||
// A clone waits, holding its slot, until the work volume has minCloneSpace
|
||||
// free, and parks as transient if it does not within diskWaitLimit.
|
||||
const (
|
||||
minCloneSpace = 5 << 30
|
||||
diskCheckEvery = 15 * time.Second
|
||||
diskWaitLimit = 10 * time.Minute
|
||||
)
|
||||
|
||||
// sweepAccess accepts pending invitations and verifies push access through
|
||||
// every organisation connection, each in its own goroutine.
|
||||
func (d *Daemon) sweepAccess(ctx context.Context) {
|
||||
@@ -366,6 +374,9 @@ func (d *Daemon) Run(ctx context.Context) error {
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
if d.Tasks == nil {
|
||||
d.dispatchBindings(ctx)
|
||||
}
|
||||
d.Cycle(ctx)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -381,15 +392,17 @@ func (d *Daemon) Run(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
// drainLoop is the only task drainer while Run is active. It runs apart from
|
||||
// the poll tick so a queued task starts within about a second regardless of
|
||||
// poll_interval or forge latency. Submit never blocks, so a full dispatcher
|
||||
// drainLoop is the only task drainer and capture dispatcher while Run is
|
||||
// active. It runs apart from the poll tick so a captured event becomes a
|
||||
// running task within about a second regardless of poll_interval or forge
|
||||
// latency. Submit never blocks, so a full dispatcher
|
||||
// just leaves tasks waiting on slots and the loop stays paced by the ticker.
|
||||
func (d *Daemon) drainLoop(ctx context.Context) {
|
||||
ticker := time.NewTicker(time.Second)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
d.markPass("drain")
|
||||
d.dispatchBindings(ctx)
|
||||
d.drainNATS(ctx)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -403,15 +416,8 @@ func (d *Daemon) drainLoop(ctx context.Context) {
|
||||
// work, using the given forge client and dispatch config. complete is false when any part of the poll failed or was skipped, so
|
||||
// the result must not be read as the whole eligible set.
|
||||
func (d *Daemon) pollIssuesWithConfig(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo) (issues []forge.Issue, complete bool) {
|
||||
// Webhook intake hears about issues as they change; polling as well would
|
||||
// spend forge API quota to find the same work. The receiver runs from the
|
||||
// root forge settings, so their mode decides for every identity.
|
||||
if d.Cfg.Get().Forge.Intake == config.ForgeIntakeWebhook {
|
||||
return nil, false
|
||||
}
|
||||
labelled := func() ([]forge.Issue, bool) {
|
||||
// Empty-label rule shared with workintake.MatchesDispatch: a label
|
||||
// trigger needs a non-empty label or it would match every open issue.
|
||||
// A label trigger needs a non-empty label or it would match every open issue.
|
||||
if cfg.Label == "" {
|
||||
d.Log.ErrorContext(ctx, "label trigger configured with an empty label; refusing to poll (an empty label matches every open issue)", "repo", repo.FullName())
|
||||
return nil, false
|
||||
@@ -469,6 +475,7 @@ func (d *Daemon) RunOnce(ctx context.Context) {
|
||||
d.Log.WarnContext(ctx, "built-in job failed", "job", job.ID, "err", err)
|
||||
}
|
||||
}
|
||||
d.dispatchBindings(ctx)
|
||||
d.Cycle(ctx)
|
||||
if d.Tasks == nil {
|
||||
return
|
||||
@@ -486,13 +493,63 @@ func (d *Daemon) RunOnce(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// Cycle is one poll pass: turn captured events and review reactions into
|
||||
// tasks; maintenance runs as built-in schedules. Draining queued tasks is the caller's job
|
||||
// (drainLoop in Run, drainNATS in RunOnce) so there is one drainer.
|
||||
// Cycle is one poll pass: turn review reactions into tasks; maintenance runs
|
||||
// as built-in schedules. Captured events are dispatched by the caller
|
||||
// (drainLoop in Run, once in RunOnce) so they start within about a second.
|
||||
func (d *Daemon) Cycle(ctx context.Context) {
|
||||
d.markPass("cycle")
|
||||
d.dispatchBindings(ctx)
|
||||
d.drainReactions(ctx)
|
||||
d.retryTransientParks(ctx)
|
||||
}
|
||||
|
||||
// retryTransientParks requeues tasks parked for an environmental cause once
|
||||
// their backoff has passed. The store parks a task needs_decision, which
|
||||
// raises the alert, when its retries run out, so this never loops on one.
|
||||
func (d *Daemon) retryTransientParks(ctx context.Context) {
|
||||
if d.Store == nil {
|
||||
return
|
||||
}
|
||||
now := time.Now()
|
||||
var after storecontract.TaskCursor
|
||||
for {
|
||||
page, err := d.Store.TasksPage(ctx, storecontract.TaskPage{Statuses: []string{workflow.StatusParked}, After: after, Limit: 200})
|
||||
if err != nil {
|
||||
d.Log.WarnContext(ctx, "list parked tasks for retry failed", "err", err)
|
||||
return
|
||||
}
|
||||
for _, t := range page {
|
||||
if taskstate.TransientRetryDue(t.ParkClass, t.RetryCount, t.UpdatedAt, now) {
|
||||
d.retryTransientPark(ctx, t.ID)
|
||||
}
|
||||
}
|
||||
if len(page) < 200 {
|
||||
return
|
||||
}
|
||||
last := page[len(page)-1]
|
||||
after = storecontract.TaskCursor{UpdatedAt: last.UpdatedAt, ID: last.ID}
|
||||
}
|
||||
}
|
||||
|
||||
// retryTransientPark requeues one task on its stored retry mode, which the
|
||||
// list projection omits: a remediation must keep continuing its branch.
|
||||
func (d *Daemon) retryTransientPark(ctx context.Context, id int64) {
|
||||
t, err := d.Store.TaskByID(ctx, id)
|
||||
if err != nil {
|
||||
d.Log.WarnContext(ctx, "load task for transient retry failed", "task", id, "err", err)
|
||||
return
|
||||
}
|
||||
if err := d.Store.RetryTask(ctx, id, workflow.StatusParked, "", t.RetryMode, workflowtask.Resume{}, false); err != nil {
|
||||
if !errors.Is(err, storecontract.ErrStaleTransition) {
|
||||
d.Log.WarnContext(ctx, "transient park retry failed", "task", id, "err", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
d.emit(ctx, events.Event{
|
||||
Kind: events.KindTaskRetried, TaskID: id, Workflow: t.Workflow,
|
||||
Repo: strings.Trim(t.Owner+"/"+t.Repo, "/"), Issue: t.IssueNumber,
|
||||
Detail: "retried automatically after a transient park",
|
||||
Data: map[string]any{"retry_count": t.RetryCount + 1, "previous_reason": t.ParkReason},
|
||||
})
|
||||
}
|
||||
|
||||
func (d *Daemon) cleanupExpiredStorage(ctx context.Context) error {
|
||||
@@ -563,9 +620,11 @@ func (d *Daemon) dispatchOrgBindings(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
enabled := make([]string, 0, len(bindings))
|
||||
armed := make([]binding.Binding, 0, len(bindings))
|
||||
for _, b := range bindings {
|
||||
if b.OrgID == org.OrgFromContext(ctx) && b.Status == binding.StatusArmed && b.Matcher.Source != "" && enablement.Enabled(b.OrgID, b.Workflow) {
|
||||
enabled = append(enabled, b.ID)
|
||||
armed = append(armed, b)
|
||||
}
|
||||
}
|
||||
if len(enabled) == 0 {
|
||||
@@ -583,21 +642,16 @@ func (d *Daemon) dispatchOrgBindings(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
for _, c := range captures {
|
||||
d.dispatchCapture(ctx, c, workflows, enablement)
|
||||
d.dispatchCapture(ctx, c, armed, workflows)
|
||||
}
|
||||
}
|
||||
|
||||
// dispatchCapture offers one capture to every armed binding on its source. A
|
||||
// disabled workflow's binding is skipped like an unarmed one, so the capture
|
||||
// waits rather than recording a failure every cycle.
|
||||
func (d *Daemon) dispatchCapture(ctx context.Context, c storecontract.CapturedEvent, workflows workflow.WorkflowDefinitionCollection, enablement workflowtask.WorkflowEnablement) {
|
||||
armed, err := d.BindingDispatcher.ArmedBindingsForSource(ctx, c.Source)
|
||||
if err != nil {
|
||||
d.Log.WarnContext(ctx, "armed bindings lookup", "source", c.Source, "error", err)
|
||||
return
|
||||
}
|
||||
// dispatchCapture offers one capture to every armed binding that matches it.
|
||||
// armed holds only the org's armed bindings on enabled workflows, so a
|
||||
// disabled workflow's capture waits rather than recording a failure every pass.
|
||||
func (d *Daemon) dispatchCapture(ctx context.Context, c storecontract.CapturedEvent, armed []binding.Binding, workflows workflow.WorkflowDefinitionCollection) {
|
||||
for _, b := range armed {
|
||||
if b.OrgID == org.OrgFromContext(ctx) && b.Matcher.Matches(c.Source, c.Dispatchable()) && enablement.Enabled(b.OrgID, b.Workflow) {
|
||||
if b.Matcher.Matches(c.Source, c.Dispatchable()) {
|
||||
d.dispatchOneBinding(ctx, b, c, workflows)
|
||||
}
|
||||
}
|
||||
@@ -879,7 +933,9 @@ func (d *Daemon) botUserForTask(task *workflowtask.Task) string {
|
||||
// through WaitForTasks.
|
||||
func (d *Daemon) drainNATS(ctx context.Context) {
|
||||
dispatcher := d.taskDispatcher()
|
||||
for ctx.Err() == nil {
|
||||
// A full dispatcher leaves work in the stream and the store, not parked
|
||||
// on slots where it already reads as running.
|
||||
for ctx.Err() == nil && dispatcher.hasRoom() {
|
||||
msg, err := d.Tasks.Fetch(ctx)
|
||||
if err != nil && !errors.Is(err, eventbus.ErrNoMessage) {
|
||||
d.Log.ErrorContext(ctx, "nats fetch failed", "err", err)
|
||||
@@ -900,11 +956,12 @@ func (d *Daemon) drainNATS(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// claimRequeued submits every task the store's claim fallback holds. It does
|
||||
// claimRequeued submits tasks from the store's claim fallback while the
|
||||
// dispatcher has room; the rest stay unclaimed for a later pass. It does
|
||||
// not go back to the stream between claims: each empty fetch waits a full poll
|
||||
// timeout, so a backlog left by a restart would outlast the systemd watchdog.
|
||||
func (d *Daemon) claimRequeued(ctx context.Context, dispatcher *taskDispatcher) {
|
||||
for ctx.Err() == nil {
|
||||
for ctx.Err() == nil && dispatcher.hasRoom() {
|
||||
task, err := d.Store.ClaimNext(ctx)
|
||||
if err != nil {
|
||||
d.Log.ErrorContext(ctx, "sqlite claim failed", "err", err)
|
||||
@@ -970,6 +1027,9 @@ type taskDispatcher struct {
|
||||
slotsFree *sync.Cond
|
||||
repoTail map[string]chan struct{}
|
||||
pending int
|
||||
// waiting counts submitted tasks that hold no slot yet, so a drain pass
|
||||
// stops claiming once queued work alone fills the limit.
|
||||
waiting int
|
||||
// holds maps a task id to the capacity its run holds, so a run waiting on
|
||||
// a callee can give that capacity back and take it again by task id.
|
||||
holds map[int64]*taskHold
|
||||
@@ -1186,6 +1246,7 @@ func (d *taskDispatcher) Submit(
|
||||
|
||||
d.mu.Lock()
|
||||
d.pending++
|
||||
d.waiting++
|
||||
d.mu.Unlock()
|
||||
go func() {
|
||||
defer d.finishRun(hold)
|
||||
@@ -1194,12 +1255,22 @@ func (d *taskDispatcher) Submit(
|
||||
}
|
||||
d.mu.Lock()
|
||||
d.takeSlotLocked()
|
||||
d.waiting--
|
||||
hold.slot = true
|
||||
d.mu.Unlock()
|
||||
process(ctx, task, hold)
|
||||
}()
|
||||
}
|
||||
|
||||
// hasRoom reports whether a newly submitted task could take a slot without
|
||||
// queueing behind work already submitted. A run waiting on a callee holds no
|
||||
// slot, so its callee still finds room.
|
||||
func (d *taskDispatcher) hasRoom() bool {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
return d.limit <= 0 || d.active+d.waiting < d.limit
|
||||
}
|
||||
|
||||
// inFlight is how many submitted tasks have not returned yet.
|
||||
func (d *taskDispatcher) inFlight() int {
|
||||
d.mu.Lock()
|
||||
@@ -1219,11 +1290,8 @@ func (d *taskDispatcher) Wait() {
|
||||
// afresh each cycle so a rotated credential or a new connection applies to
|
||||
// the next poll.
|
||||
func (d *Daemon) poll(ctx context.Context) error {
|
||||
// Webhook intake replaces polling; an empty pass is not a failure.
|
||||
if d.Cfg.Get().Forge.Intake == config.ForgeIntakeWebhook {
|
||||
return nil
|
||||
}
|
||||
var failed []string
|
||||
room := d.Cfg.Get().IntakePerPass
|
||||
for _, source := range d.issueSources(ctx) {
|
||||
if !d.identityActive(ctx, source.Identity) {
|
||||
continue
|
||||
@@ -1241,10 +1309,8 @@ func (d *Daemon) poll(ctx context.Context) error {
|
||||
} else {
|
||||
failed = append(failed, repo.FullName())
|
||||
}
|
||||
for _, is := range issues {
|
||||
if d.Tasks != nil {
|
||||
d.pollNATS(ctx, source.Forge, cfg, repo, is, strings.Join(is.Labels, ","), tag)
|
||||
}
|
||||
if d.Tasks != nil {
|
||||
d.publishDiscovered(ctx, source.Forge, cfg, repo, issues, tag, &room)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1321,16 +1387,34 @@ func (d *Daemon) withdrawUnpolled(ctx context.Context, repo config.Repo, identit
|
||||
}
|
||||
}
|
||||
|
||||
// pollNATS publishes discovered issues to NATS (new flow).
|
||||
func (d *Daemon) pollNATS(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo, is forge.Issue, labels, identity string) {
|
||||
// publishDiscovered publishes a repo's discovered issues until the pass has
|
||||
// created its cap of tasks. room is what is left of the cap; the issues left
|
||||
// over are found again by the next poll, because an issue with a task is
|
||||
// skipped and one without is not. A cap of zero or less is no cap.
|
||||
func (d *Daemon) publishDiscovered(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo, issues []forge.Issue, identity string, room *int) {
|
||||
capped := *room > 0
|
||||
for _, is := range issues {
|
||||
if capped && *room == 0 {
|
||||
d.Log.InfoContext(ctx, "intake cap reached; remaining issues wait for the next poll", "repo", repo.FullName())
|
||||
return
|
||||
}
|
||||
if d.pollNATS(ctx, fg, cfg, repo, is, strings.Join(is.Labels, ","), identity) && capped {
|
||||
*room--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pollNATS publishes a discovered issue to NATS and reports whether it created
|
||||
// a task.
|
||||
func (d *Daemon) pollNATS(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo, is forge.Issue, labels, identity string) bool {
|
||||
// Read-only existence check prevents rediscovering an existing task.
|
||||
existing, err := d.Store.TaskByIssue(ctx, repo.Owner, repo.Name, is.Number)
|
||||
if err != nil {
|
||||
d.Log.ErrorContext(ctx, "task lookup failed", "repo", repo.FullName(), "issue", is.Number, "err", err)
|
||||
return
|
||||
return false
|
||||
}
|
||||
if existing != nil {
|
||||
return
|
||||
return false
|
||||
}
|
||||
// Classify and encode here: the envelope, its routing kind and its
|
||||
// subject belong to the work-intake domain, not to the transport.
|
||||
@@ -1347,9 +1431,10 @@ func (d *Daemon) pollNATS(ctx context.Context, fg forge.Forge, cfg config.Config
|
||||
}
|
||||
if err := d.PublishTask(ctx, task); err != nil {
|
||||
d.Log.ErrorContext(ctx, "task publish failed", "repo", repo.FullName(), "issue", is.Number, "err", err)
|
||||
return
|
||||
return false
|
||||
}
|
||||
d.acknowledge(ctx, fg, cfg, repo, is)
|
||||
return true
|
||||
}
|
||||
|
||||
// PublishTask validates a task envelope, stamps the producing identity's
|
||||
@@ -1727,6 +1812,11 @@ func (d *Daemon) prepareWorkspace(ctx context.Context, task *workflow.Task, tree
|
||||
}
|
||||
target = worktree.Target(task.Branch)
|
||||
}
|
||||
if err := worktree.AwaitSpace(ctx, trees.FreeBytes, minCloneSpace, diskCheckEvery, diskWaitLimit); err != nil {
|
||||
d.Log.WarnContext(ctx, "worktree prepare delayed", "task", task.ID, "err", err)
|
||||
d.parkRunningTask(ctx, task, "worktree prepare failed: "+err.Error(), taskstate.ParkTransient)
|
||||
return "", false
|
||||
}
|
||||
// Every task gets an independent full clone.
|
||||
prepare := func() (string, string, error) {
|
||||
return trees.Prepare(ctx, task.Owner, task.Repo, repo.BaseBranch(), task.IssueNumber, task.Title, task.Body, task.Labels, target)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
package daemon
|
||||
@@ -626,3 +626,27 @@ func TestDrainPassClaimsABacklogWithoutWaitingPerTask(t *testing.T) {
|
||||
t.Fatalf("the pass waited on the stream %d times for 5 claims, want 1", got)
|
||||
}
|
||||
}
|
||||
|
||||
// A drain pass claims only what the dispatcher can run. Submit never blocks,
|
||||
// so claiming past capacity marked the whole requeued backlog as running while
|
||||
// the tasks sat waiting on slots.
|
||||
func TestDrainPassClaimsOnlyWhatTheDispatcherCanRun(t *testing.T) {
|
||||
release := make(chan struct{})
|
||||
defer close(release)
|
||||
store := &queuedStore{park: func() { <-release }}
|
||||
for id := range int64(10) {
|
||||
store.queue = append(store.queue, &workflow.Task{ID: id + 1, Owner: "acme", Repo: "app"})
|
||||
}
|
||||
cfg := config.Config{}
|
||||
cfg.Containers.MaxConcurrency = 2
|
||||
d := &Daemon{
|
||||
Cfg: config.NewHolder(cfg),
|
||||
Log: slog.New(slog.DiscardHandler),
|
||||
Store: store,
|
||||
Tasks: &countingTasks{},
|
||||
}
|
||||
d.drainNATS(context.Background())
|
||||
if got := len(store.queue); got != 8 {
|
||||
t.Fatalf("pass left %d tasks unclaimed, want 8", got)
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
package daemon
|
||||
@@ -0,0 +1,71 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
)
|
||||
|
||||
type taskLookup struct {
|
||||
storecontract.TaskStore
|
||||
have map[int]bool
|
||||
}
|
||||
|
||||
func (s taskLookup) TaskByIssue(_ context.Context, _, _ string, number int) (*workflow.Task, error) {
|
||||
if s.have[number] {
|
||||
return &workflow.Task{IssueNumber: number}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
type publishCounter struct {
|
||||
stubTasks
|
||||
published int
|
||||
}
|
||||
|
||||
func (p *publishCounter) PublishUnique(context.Context, string, string, []byte) error {
|
||||
p.published++
|
||||
return nil
|
||||
}
|
||||
|
||||
// One poll creates at most the cap of tasks; the rest wait for a later poll,
|
||||
// and an issue that already has a task neither counts nor is created twice.
|
||||
func TestPublishDiscoveredCap(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
issues int
|
||||
existing []int
|
||||
cap int
|
||||
want int
|
||||
}{
|
||||
{"cap below backlog", 10, nil, 3, 3},
|
||||
{"backlog below cap", 2, nil, 3, 2},
|
||||
{"existing tasks do not use the cap", 6, []int{1, 2}, 3, 3},
|
||||
{"no cap", 10, nil, 0, 10},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
bus := &publishCounter{}
|
||||
have := map[int]bool{}
|
||||
for _, n := range tt.existing {
|
||||
have[n] = true
|
||||
}
|
||||
d := &Daemon{Log: slog.New(slog.DiscardHandler), Store: taskLookup{have: have}, Tasks: bus}
|
||||
var issues []forge.Issue
|
||||
for n := 1; n <= tt.issues; n++ {
|
||||
issues = append(issues, forge.Issue{Number: n, Labels: []string{"archie"}})
|
||||
}
|
||||
room := tt.cap
|
||||
repo := config.Repo{Owner: "acme", Name: "widget"}
|
||||
d.publishDiscovered(t.Context(), nil, config.Config{}, repo, issues, "", &room)
|
||||
if bus.published != tt.want {
|
||||
t.Fatalf("published %d tasks, want %d", bus.published, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
workflowtask "github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
"github.com/samcharles93/archie-core/internal/taskstate"
|
||||
)
|
||||
|
||||
type retryStore struct {
|
||||
storecontract.TaskStore
|
||||
parked []workflow.Task
|
||||
retried []int64
|
||||
}
|
||||
|
||||
func (s *retryStore) TasksPage(context.Context, storecontract.TaskPage) ([]workflow.Task, error) {
|
||||
return s.parked, nil
|
||||
}
|
||||
|
||||
func (s *retryStore) TaskByID(_ context.Context, id int64) (*workflow.Task, error) {
|
||||
return &workflow.Task{ID: id}, nil
|
||||
}
|
||||
|
||||
func (s *retryStore) RetryTask(_ context.Context, id int64, _, _, _ string, _ workflowtask.Resume, _ bool) error {
|
||||
s.retried = append(s.retried, id)
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestRetryTransientParks(t *testing.T) {
|
||||
old := time.Now().Add(-24 * time.Hour)
|
||||
store := &retryStore{parked: []workflow.Task{
|
||||
{ID: 1, ParkClass: taskstate.ParkTransient, UpdatedAt: old},
|
||||
{ID: 2, ParkClass: taskstate.ParkTransient, UpdatedAt: time.Now()},
|
||||
{ID: 3, ParkClass: taskstate.ParkNeedsDecision, UpdatedAt: old},
|
||||
{ID: 4, ParkClass: taskstate.ParkTransient, RetryCount: taskstate.MaxTransientRetries, UpdatedAt: old},
|
||||
}}
|
||||
d := &Daemon{Store: store, Log: slog.New(slog.DiscardHandler)}
|
||||
d.retryTransientParks(t.Context())
|
||||
if len(store.retried) != 1 || store.retried[0] != 1 {
|
||||
t.Fatalf("retried = %v, want only task 1 (due, transient, retries left)", store.retried)
|
||||
}
|
||||
}
|
||||
@@ -56,10 +56,6 @@ func (s *orgBindingStore) ListBindings(context.Context) ([]binding.Binding, erro
|
||||
return s.bindings, nil
|
||||
}
|
||||
|
||||
func (s *orgBindingStore) ArmedBindingsForSource(_ context.Context, source string) ([]binding.Binding, error) {
|
||||
return slices.DeleteFunc(slices.Clone(s.bindings), func(b binding.Binding) bool { return b.Matcher.Source != source }), nil
|
||||
}
|
||||
|
||||
func (s *orgBindingStore) ListUndispatchedCaptures(_ context.Context, bindings []string, _ int) ([]storecontract.CapturedEvent, error) {
|
||||
var captures []storecontract.CapturedEvent
|
||||
for _, b := range s.bindings {
|
||||
|
||||
@@ -4,6 +4,7 @@ package applystatus
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"slices"
|
||||
@@ -166,7 +167,12 @@ func (r *Reporter) restamp(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (r *Reporter) write(ctx context.Context, status storecontract.ApplyStatus) {
|
||||
if err := r.store.PutApplyStatus(ctx, status); err != nil {
|
||||
err := r.store.PutApplyStatus(ctx, status)
|
||||
switch {
|
||||
case err == nil:
|
||||
case errors.Is(err, context.Canceled):
|
||||
r.log.DebugContext(ctx, "apply status not reported; cancelled", "kind", status.Kind)
|
||||
default:
|
||||
r.log.WarnContext(ctx, "apply status not reported", "kind", status.Kind, "err", err)
|
||||
}
|
||||
}
|
||||
@@ -139,10 +139,11 @@ func Mesh(records []storecontract.Presence, now time.Time) []Service {
|
||||
if record.Service != Agent {
|
||||
continue
|
||||
}
|
||||
// An agent reports for one task and stops when the task ends, so a
|
||||
// silent agent is finished, not failed: only running agents are listed.
|
||||
worker := Service{Presence: record, State: state(record, true, now)}
|
||||
if worker.State == StateDown {
|
||||
worker.Detail = ""
|
||||
worker.Checks = nil
|
||||
continue
|
||||
}
|
||||
workers = append(workers, worker)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ type DispatchFilter struct {
|
||||
// BindingDispatcher looks up armed bindings, lists undispatched captures and
|
||||
// records dispatches.
|
||||
type BindingDispatcher interface {
|
||||
ArmedBindingsForSource(ctx context.Context, source string) ([]binding.Binding, error)
|
||||
RecordDispatch(
|
||||
ctx context.Context,
|
||||
bindingID string,
|
||||
|
||||
@@ -27,6 +27,110 @@ type Descriptor struct {
|
||||
Requires []PackageRef `yaml:"requires"`
|
||||
Authority Authority `yaml:"authority"`
|
||||
Files []File `yaml:"files"`
|
||||
// Settings are what an operator enters for the package's extensions to
|
||||
// run, which the dashboard renders as a form.
|
||||
Settings []Setting `yaml:"settings"`
|
||||
}
|
||||
|
||||
// Setting is one value an extension reads from its operator-entered settings.
|
||||
// A secret setting holds an engine:key reference, never the secret, and its
|
||||
// key ends in "_ref" so the host resolves it before the extension starts.
|
||||
type Setting struct {
|
||||
Key string `yaml:"key" json:"key"`
|
||||
Label string `yaml:"label" json:"label"`
|
||||
Description string `yaml:"description" json:"description,omitempty"`
|
||||
Secret bool `yaml:"secret" json:"secret,omitempty"`
|
||||
Required bool `yaml:"required" json:"required,omitempty"`
|
||||
// Type is how the value is entered and checked; empty means a string.
|
||||
Type string `yaml:"type" json:"type,omitempty"`
|
||||
// Options are the allowed values of a select setting.
|
||||
Options []string `yaml:"options" json:"options,omitempty"`
|
||||
}
|
||||
|
||||
// SettingType names how a setting's value is entered and validated.
|
||||
type SettingType string
|
||||
|
||||
// Setting types. The empty type is a string.
|
||||
const (
|
||||
SettingString SettingType = "string"
|
||||
SettingNumber SettingType = "number"
|
||||
SettingBoolean SettingType = "boolean"
|
||||
SettingDuration SettingType = "duration"
|
||||
SettingList SettingType = "list"
|
||||
SettingSelect SettingType = "select"
|
||||
)
|
||||
|
||||
// Kind returns the setting's type with the default applied.
|
||||
func (s Setting) Kind() SettingType {
|
||||
if s.Type == "" {
|
||||
return SettingString
|
||||
}
|
||||
return SettingType(s.Type)
|
||||
}
|
||||
|
||||
func (s Setting) validateType() error {
|
||||
switch s.Kind() {
|
||||
case SettingString, SettingNumber, SettingBoolean, SettingDuration, SettingList, SettingSelect:
|
||||
default:
|
||||
return fmt.Errorf("setting %q: unknown type %q", s.Key, s.Type)
|
||||
}
|
||||
if s.Secret && s.Kind() != SettingString {
|
||||
return fmt.Errorf("setting %q: a secret setting is a string", s.Key)
|
||||
}
|
||||
if s.Required && s.Kind() == SettingBoolean {
|
||||
return fmt.Errorf("setting %q: a boolean setting cannot be required, false counts as filled", s.Key)
|
||||
}
|
||||
if s.Kind() != SettingSelect {
|
||||
if len(s.Options) > 0 {
|
||||
return fmt.Errorf("setting %q: options belong to a select setting", s.Key)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if len(s.Options) == 0 {
|
||||
return fmt.Errorf("setting %q: a select setting needs options", s.Key)
|
||||
}
|
||||
seen := make(map[string]bool, len(s.Options))
|
||||
for _, option := range s.Options {
|
||||
if option == "" || seen[option] {
|
||||
return fmt.Errorf("setting %q: options must be non-empty and unique", s.Key)
|
||||
}
|
||||
seen[option] = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var settingKeyPattern = regexp.MustCompile(`^[a-z][a-z0-9_]*$`)
|
||||
|
||||
// MissingSettings returns the labels of the required settings values lacks.
|
||||
func (d Descriptor) MissingSettings(values map[string]string) []string {
|
||||
var missing []string
|
||||
for _, setting := range d.Settings {
|
||||
if setting.Required && strings.TrimSpace(values[setting.Key]) == "" {
|
||||
missing = append(missing, setting.Label)
|
||||
}
|
||||
}
|
||||
return missing
|
||||
}
|
||||
|
||||
func (d Descriptor) validateSettings() error {
|
||||
seen := make(map[string]bool, len(d.Settings))
|
||||
for i, setting := range d.Settings {
|
||||
switch {
|
||||
case !settingKeyPattern.MatchString(setting.Key):
|
||||
return fmt.Errorf("setting %d: key %q must be lower-case letters, digits and underscores", i, setting.Key)
|
||||
case seen[setting.Key]:
|
||||
return fmt.Errorf("setting %q is declared twice", setting.Key)
|
||||
case strings.TrimSpace(setting.Label) == "":
|
||||
return fmt.Errorf("setting %q: label is required", setting.Key)
|
||||
case setting.Secret != strings.HasSuffix(setting.Key, "_ref"):
|
||||
return fmt.Errorf("setting %q: a secret setting's key ends in _ref, and only a secret's does", setting.Key)
|
||||
}
|
||||
if err := setting.validateType(); err != nil {
|
||||
return err
|
||||
}
|
||||
seen[setting.Key] = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Contributions names the declarative families supplied by a package.
|
||||
@@ -138,6 +242,9 @@ func (d Descriptor) Validate() error {
|
||||
if err := d.Authority.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.validateSettings(); err != nil {
|
||||
return err
|
||||
}
|
||||
executable, err := d.validateExtensions()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package workflow
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// BaselineClaim answers a task's request to repair a red baseline.
|
||||
type BaselineClaim struct {
|
||||
// Lead is true when the caller owns the repair and must run it.
|
||||
Lead bool
|
||||
// Task is the task that owns the repair when Lead is false.
|
||||
Task int64
|
||||
// Done is true once that task has finished; Failure is its failure, empty
|
||||
// when it repaired the baseline on its own branch.
|
||||
Done bool
|
||||
Failure string
|
||||
}
|
||||
|
||||
// BaselineLedger makes one task repair a red baseline per repository revision
|
||||
// and command. Every task runs in its own container, so the ledger lives with
|
||||
// the daemon.
|
||||
type BaselineLedger interface {
|
||||
ClaimBaselineFix(ctx context.Context, key string) (BaselineClaim, error)
|
||||
FinishBaselineFix(ctx context.Context, key, failure string) error
|
||||
}
|
||||
|
||||
const defaultBaselinePoll = 15 * time.Second
|
||||
|
||||
// repairBaselineOnce runs the repair when this task leads it, or reports the
|
||||
// verdict of the task that does. Without a ledger every task repairs its own.
|
||||
func repairBaselineOnce(ctx context.Context, tc *TaskContext, argv []string, out []byte) error {
|
||||
if tc.Baseline == nil {
|
||||
return runBaselineFix(ctx, tc, argv, out)
|
||||
}
|
||||
revision, err := exec.CommandContext(ctx, "git", "-C", tc.Dir, "rev-parse", "HEAD").Output()
|
||||
if err != nil {
|
||||
return fmt.Errorf("resolve baseline revision: %w", err)
|
||||
}
|
||||
key := strings.TrimSpace(string(revision)) + " " + strings.Join(argv, " ")
|
||||
poll := tc.baselinePoll
|
||||
if poll <= 0 {
|
||||
poll = defaultBaselinePoll
|
||||
}
|
||||
for {
|
||||
claim, err := tc.Baseline.ClaimBaselineFix(ctx, key)
|
||||
if err != nil {
|
||||
return fmt.Errorf("claim baseline fix: %w", err)
|
||||
}
|
||||
switch {
|
||||
case claim.Lead:
|
||||
fixErr := runBaselineFix(ctx, tc, argv, out)
|
||||
failure := ""
|
||||
if fixErr != nil {
|
||||
failure = clip(fixErr.Error(), baselineParkOutputBytes)
|
||||
}
|
||||
if err := tc.Baseline.FinishBaselineFix(context.WithoutCancel(ctx), key, failure); err != nil {
|
||||
tc.Log.WarnContext(ctx, "release baseline fix claim", "err", err)
|
||||
}
|
||||
return fixErr
|
||||
case !claim.Done:
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case <-time.After(poll):
|
||||
}
|
||||
default:
|
||||
return baselineSharedError(argv, string(out), claim)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// gateProgressLine matches the package-download chatter `go` prints before the
|
||||
// real failure.
|
||||
var gateProgressLine = regexp.MustCompile(`^go: (downloading|finding|extracting) `)
|
||||
|
||||
// trimGateProgress drops download progress from gate output so the failing
|
||||
// command's own lines lead.
|
||||
func trimGateProgress(out string) string {
|
||||
if !strings.Contains(out, "go: ") {
|
||||
return out
|
||||
}
|
||||
lines := strings.Split(out, "\n")
|
||||
kept := lines[:0]
|
||||
for _, line := range lines {
|
||||
if !gateProgressLine.MatchString(line) {
|
||||
kept = append(kept, line)
|
||||
}
|
||||
}
|
||||
return strings.Join(kept, "\n")
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package workflow
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
)
|
||||
|
||||
type countingRunner struct{ runs int }
|
||||
|
||||
func (r *countingRunner) Run(context.Context, string, agentrun.Request, agentrun.Reporter) (agentrun.Result, error) {
|
||||
r.runs++
|
||||
return agentrun.Result{Version: agentrun.ProtocolVersion, Status: "failed"}, nil
|
||||
}
|
||||
|
||||
// scriptedLedger answers claims from a fixed list, then repeats the last one.
|
||||
type scriptedLedger struct {
|
||||
claims []BaselineClaim
|
||||
finished []string
|
||||
}
|
||||
|
||||
func (l *scriptedLedger) ClaimBaselineFix(context.Context, string) (BaselineClaim, error) {
|
||||
claim := l.claims[0]
|
||||
if len(l.claims) > 1 {
|
||||
l.claims = l.claims[1:]
|
||||
}
|
||||
return claim, nil
|
||||
}
|
||||
|
||||
func (l *scriptedLedger) FinishBaselineFix(_ context.Context, _, failure string) error {
|
||||
l.finished = append(l.finished, failure)
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestRedBaselineIsRepairedByOneTask(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
claims []BaselineClaim
|
||||
wantRuns int
|
||||
wantFinished int
|
||||
wantInErr string
|
||||
}{
|
||||
{
|
||||
name: "the task that leads repairs it",
|
||||
claims: []BaselineClaim{{Lead: true}},
|
||||
wantRuns: 1,
|
||||
wantFinished: 1,
|
||||
wantInErr: "did not repair it",
|
||||
},
|
||||
{
|
||||
name: "a task waits on the lead, then reports its failure",
|
||||
claims: []BaselineClaim{{Task: 7}, {Task: 7}, {Task: 7, Done: true, Failure: "builder status failed"}},
|
||||
wantInErr: "task 7 could not repair it: builder status failed",
|
||||
},
|
||||
{
|
||||
name: "a task reuses a repair made on another branch",
|
||||
claims: []BaselineClaim{{Task: 7, Done: true}},
|
||||
wantInErr: "task 7 repaired it on its own branch",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
for _, args := range [][]string{{"init", "-q"}, {"-c", "user.name=t", "-c", "user.email=t@t", "commit", "-q", "--allow-empty", "-m", "base"}} {
|
||||
if out, err := exec.CommandContext(t.Context(), "git", append([]string{"-C", dir}, args...)...).CombinedOutput(); err != nil {
|
||||
t.Fatalf("git %v: %v\n%s", args, err, out)
|
||||
}
|
||||
}
|
||||
agent := &countingRunner{}
|
||||
ledger := &scriptedLedger{claims: tt.claims}
|
||||
tc := &TaskContext{
|
||||
Task: &task.Task{ID: 1, Attempt: 1, Source: task.SourceTest},
|
||||
Repo: config.Repo{Owner: "acme", Name: "widgets"},
|
||||
Cfg: config.Config{Models: map[string]string{"default": "m"}},
|
||||
Dir: dir,
|
||||
Log: slog.Default(),
|
||||
Agent: agent,
|
||||
Baseline: ledger,
|
||||
baselinePoll: time.Millisecond,
|
||||
}
|
||||
|
||||
err := repairBaselineOnce(context.Background(), tc, []string{"task", "check"}, []byte("FAIL"))
|
||||
|
||||
if err == nil || !strings.Contains(err.Error(), tt.wantInErr) {
|
||||
t.Fatalf("err = %v, want it to contain %q", err, tt.wantInErr)
|
||||
}
|
||||
if agent.runs != tt.wantRuns {
|
||||
t.Errorf("fix agents run = %d, want %d", agent.runs, tt.wantRuns)
|
||||
}
|
||||
if len(ledger.finished) != tt.wantFinished {
|
||||
t.Errorf("claims finished = %d, want %d", len(ledger.finished), tt.wantFinished)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrimGateProgressKeepsTheFailure(t *testing.T) {
|
||||
in := "go: downloading github.com/a/b v1.0.0\ngo: downloading github.com/c/d v2.0.0\nprotoc-gen-go: executable file not found in $PATH\nFAIL\n"
|
||||
want := "protoc-gen-go: executable file not found in $PATH\nFAIL\n"
|
||||
if got := trimGateProgress(in); got != want {
|
||||
t.Fatalf("trimGateProgress = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,17 @@ func baselineEnvironmentError(argv []string, out, cause string) error {
|
||||
strings.Join(argv, " "), cause, clipTail(out, baselineParkOutputBytes))
|
||||
}
|
||||
|
||||
// baselineSharedError is the park reason for a task that did not repair the
|
||||
// baseline because another task owns that repair.
|
||||
func baselineSharedError(argv []string, out string, claim BaselineClaim) error {
|
||||
verdict := fmt.Sprintf("task %d repaired it on its own branch; retry once that change is merged", claim.Task)
|
||||
if claim.Failure != "" {
|
||||
verdict = fmt.Sprintf("task %d could not repair it: %s", claim.Task, claim.Failure)
|
||||
}
|
||||
return fmt.Errorf("baseline red -- %s fails at this revision and %s\n\ngate output:\n%s",
|
||||
strings.Join(argv, " "), verdict, clipTail(out, baselineParkOutputBytes))
|
||||
}
|
||||
|
||||
// baselineFixFailedError is the park reason for every failure after the
|
||||
// baseline repair agent was dispatched. A failure that names only the agent --
|
||||
// a provider 402, say -- and drops the gate output leaves the operator with no
|
||||
|
||||
@@ -37,10 +37,11 @@ func stageBaselineGateRun(ctx context.Context, tc *TaskContext) error {
|
||||
}
|
||||
cmd := exec.CommandContext(ctx, argv[0], argv[1:]...)
|
||||
cmd.Dir = tc.Dir
|
||||
out, err := cmd.CombinedOutput()
|
||||
raw, err := cmd.CombinedOutput()
|
||||
if err == nil {
|
||||
continue
|
||||
}
|
||||
out := []byte(trimGateProgress(string(raw)))
|
||||
// An environment failure cannot be repaired in the worktree, so park.
|
||||
if cause := gateEnvironmentCause(string(out), err); cause != "" {
|
||||
return baselineEnvironmentError(argv, string(out), cause)
|
||||
@@ -48,7 +49,7 @@ func stageBaselineGateRun(ctx context.Context, tc *TaskContext) error {
|
||||
tc.Log.WarnContext(ctx, "baseline red -- auto-fixing pre-existing gate failure",
|
||||
"cmd", strings.Join(argv, " "),
|
||||
"err", clipTail(string(out), baselineWarnLogBytes))
|
||||
if fixErr := runBaselineFix(ctx, tc, argv, out); fixErr != nil {
|
||||
if fixErr := repairBaselineOnce(ctx, tc, argv, out); fixErr != nil {
|
||||
return fixErr
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +243,8 @@ func newGateRepositoryStage(settings yaml.Node) (Stage, error) {
|
||||
func runGateCommand(ctx context.Context, dir string, command agentrun.Command) (string, error) {
|
||||
cmd := exec.CommandContext(ctx, command.Argv[0], command.Argv[1:]...)
|
||||
cmd.Dir = dir
|
||||
out, err := cmd.CombinedOutput()
|
||||
raw, err := cmd.CombinedOutput()
|
||||
out := []byte(trimGateProgress(string(raw)))
|
||||
name := strings.Join(command.Argv, " ")
|
||||
switch {
|
||||
case command.ExpectFailure && err == nil:
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package workflow
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// Attribute names are stable: a span-metrics generator groups by them, so keep
|
||||
// their values bounded (ids and names, never free text).
|
||||
const (
|
||||
attrTask = attribute.Key("archie.task.id")
|
||||
attrWorkflow = attribute.Key("archie.workflow")
|
||||
attrStep = attribute.Key("archie.step")
|
||||
attrAttempt = attribute.Key("archie.attempt")
|
||||
attrOutcome = attribute.Key("archie.outcome")
|
||||
)
|
||||
|
||||
func tracer() trace.Tracer {
|
||||
return otel.Tracer("github.com/samcharles93/archie-core/internal/domain/workflow")
|
||||
}
|
||||
|
||||
func taskAttrs(tc *TaskContext, workflow string) []attribute.KeyValue {
|
||||
return []attribute.KeyValue{
|
||||
attrTask.String(strconv.FormatInt(tc.Task.ID, 10)),
|
||||
attrWorkflow.String(workflow),
|
||||
attrAttempt.Int(tc.Task.Attempt),
|
||||
}
|
||||
}
|
||||
|
||||
// startRunSpan opens the span for one workflow run attempt.
|
||||
func startRunSpan(ctx context.Context, tc *TaskContext, workflow string) (context.Context, trace.Span) {
|
||||
return tracer().Start(ctx, "workflow.run", trace.WithAttributes(taskAttrs(tc, workflow)...))
|
||||
}
|
||||
|
||||
// startStepSpan opens the span for one top-level step.
|
||||
func startStepSpan(ctx context.Context, tc *TaskContext, step string) (context.Context, trace.Span) {
|
||||
return tracer().Start(ctx, "workflow.step",
|
||||
trace.WithAttributes(append(taskAttrs(tc, tc.Task.Workflow), attrStep.String(step))...))
|
||||
}
|
||||
|
||||
// startAgentSpan opens the span for one model-backed agent call.
|
||||
func startAgentSpan(ctx context.Context, tc *TaskContext, step, modelRef string) (context.Context, trace.Span) {
|
||||
return tracer().Start(ctx, "agent.run", trace.WithAttributes(
|
||||
append(taskAttrs(tc, tc.Task.Workflow), attrStep.String(step), attribute.String("gen_ai.request.model", modelRef))...))
|
||||
}
|
||||
|
||||
// endSpan records the outcome, marks a failure as an error, and ends span.
|
||||
func endSpan(span trace.Span, outcome string, err error) {
|
||||
span.SetAttributes(attrOutcome.String(outcome))
|
||||
if err != nil {
|
||||
span.RecordError(err)
|
||||
span.SetStatus(codes.Error, err.Error())
|
||||
}
|
||||
span.End()
|
||||
}
|
||||
|
||||
// setUsage records the call's token counts under the gen_ai conventions.
|
||||
func setUsage(span trace.Span, u agentrun.Usage) {
|
||||
span.SetAttributes(
|
||||
attribute.Int("gen_ai.usage.input_tokens", u.PromptTokens),
|
||||
attribute.Int("gen_ai.usage.output_tokens", u.CompletionTokens))
|
||||
}
|
||||
|
||||
// endRunSpan ends the run's span with the run's outcome; a park is an error.
|
||||
func endRunSpan(span trace.Span, o Outcome) {
|
||||
status := o.Status
|
||||
if status == "" {
|
||||
status = "interrupted"
|
||||
}
|
||||
var err error
|
||||
if o.Status == StatusParked {
|
||||
err = errors.New(o.Detail)
|
||||
}
|
||||
endSpan(span, status, err)
|
||||
}
|
||||
|
||||
// runStageSpan runs stage inside its own span.
|
||||
func runStageSpan(ctx context.Context, tc *TaskContext, stage Stage) error {
|
||||
ctx, span := startStepSpan(ctx, tc, stage.Name)
|
||||
err := stage.Run(ctx, tc)
|
||||
outcome, _ := stageOutcome(tc.skippedWhen, err)
|
||||
endSpan(span, string(outcome), err)
|
||||
return err
|
||||
}
|
||||
@@ -94,6 +94,9 @@ type TaskContext struct {
|
||||
// to record the step as skipped. It is per-attempt scratch state, reset by
|
||||
// wrapStep before every step.
|
||||
skippedWhen string
|
||||
// baselinePoll is how often a task waits on another's repair; zero uses
|
||||
// the default.
|
||||
baselinePoll time.Duration
|
||||
|
||||
Task *Task
|
||||
Repo config.Repo
|
||||
@@ -102,6 +105,9 @@ type TaskContext struct {
|
||||
Store Store
|
||||
Trees Trees
|
||||
Agent agentrun.Runner
|
||||
// Baseline makes one task repair a red baseline per repository revision.
|
||||
// Nil leaves every task to repair its own.
|
||||
Baseline BaselineLedger
|
||||
// Deliveries records the run's outward effects instead of performing them.
|
||||
// Nil performs them; a test run's RecordDeliveries sets it.
|
||||
Deliveries Deliveries
|
||||
@@ -356,6 +362,9 @@ func Run(ctx context.Context, wf Workflow, tc *TaskContext) {
|
||||
tc.runInterface, tc.runInterfaceSet = wf.Interface, true
|
||||
log := tc.Log.With("workflow", wf.Name, "repo", tc.Repo.FullName(), "issue", t.IssueNumber)
|
||||
|
||||
ctx, runSpan := startRunSpan(ctx, tc, wf.Name)
|
||||
defer func() { endRunSpan(runSpan, tc.Outcome) }()
|
||||
|
||||
stages, err := tc.resumeStages(wf.Stages)
|
||||
if err != nil {
|
||||
park(ctx, tc, err.Error())
|
||||
@@ -387,7 +396,7 @@ func Run(ctx context.Context, wf Workflow, tc *TaskContext) {
|
||||
tc.Log = stageLog
|
||||
stageLog.InfoContext(ctx, "stage starting")
|
||||
|
||||
err = stage.Run(ctx, tc)
|
||||
err = runStageSpan(ctx, tc, stage)
|
||||
tc.Log = previousLog
|
||||
|
||||
// Shutdown is not a failure: record the step as interrupted and return
|
||||
@@ -669,7 +678,14 @@ func (tc *TaskContext) RunAgentChild(ctx context.Context, name, alias, modelRef
|
||||
if err != nil {
|
||||
return agentrun.Result{}, err
|
||||
}
|
||||
_, span := startAgentSpan(ctx, tc, name, modelRef)
|
||||
res, runErr := run()
|
||||
setUsage(span, res.Usage)
|
||||
agentOutcome := taskstate.StepSucceeded
|
||||
if runErr != nil {
|
||||
agentOutcome = taskstate.StepFailed
|
||||
}
|
||||
endSpan(span, string(agentOutcome), runErr)
|
||||
tc.recordUsage(ctx, name, alias, modelRef, res.Usage)
|
||||
to, detail := taskstate.StepSucceeded, res.Summary
|
||||
if runErr != nil {
|
||||
|
||||
@@ -1,41 +1,7 @@
|
||||
package workintake
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// RequiresLabel reports whether the dispatch trigger matches on a label and
|
||||
// therefore needs a non-empty label to be meaningful.
|
||||
func RequiresLabel(trigger string) bool {
|
||||
return trigger == "label" || trigger == "either"
|
||||
}
|
||||
|
||||
// MatchesDispatch reports whether an issue is eligible work under the dispatch
|
||||
// trigger. labels and assignees are the issue's current labels and assignee
|
||||
// logins. An empty label never matches, even when the trigger is "label":
|
||||
// a missing label must not be mistaken for "every issue" (3209a1f).
|
||||
func MatchesDispatch(trigger, label, botUser string, labels, assignees []string) bool {
|
||||
switch trigger {
|
||||
case "label":
|
||||
return label != "" && containsLabel(labels, label)
|
||||
case "either":
|
||||
return containsAssignee(assignees, botUser) || (label != "" && containsLabel(labels, label))
|
||||
default: // "assignee"
|
||||
return containsAssignee(assignees, botUser)
|
||||
}
|
||||
}
|
||||
|
||||
// containsLabel matches label names exactly: GitHub label names are
|
||||
// case-sensitive and "Bug" and "bug" can coexist as distinct labels, matching
|
||||
// IssuesWithLabel's exact-match server-side filter.
|
||||
func containsLabel(labels []string, needle string) bool {
|
||||
return slices.Contains(labels, needle)
|
||||
}
|
||||
|
||||
// containsAssignee matches logins case-insensitively.
|
||||
func containsAssignee(assignees []string, botUser string) bool {
|
||||
return slices.ContainsFunc(assignees, func(a string) bool {
|
||||
return strings.EqualFold(a, botUser)
|
||||
})
|
||||
}
|
||||
+13
-50
@@ -5,7 +5,6 @@ package forge
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
@@ -198,55 +197,19 @@ type ReviewCommentWriter interface {
|
||||
CreateReviewComments(ctx context.Context, owner, repo string, number int, reviewedHeadSHA string, review ReviewSubmission) error
|
||||
}
|
||||
|
||||
// WebhookEvent is one decoded webhook delivery. At most one field is set; none
|
||||
// means a delivery the host does not act on.
|
||||
type WebhookEvent struct {
|
||||
Issue *IssueEvent
|
||||
Review *ReviewEvent
|
||||
ReviewComment *ReviewCommentEvent
|
||||
// GitCredential is a short-lived git credential for one repository and the
|
||||
// identity commits through it carry.
|
||||
type GitCredential struct {
|
||||
Username string
|
||||
Token string
|
||||
ExpiresAt time.Time
|
||||
CommitName string
|
||||
CommitEmail string
|
||||
}
|
||||
|
||||
// IssueEvent is an issue webhook, carrying what eligibility needs.
|
||||
type IssueEvent struct {
|
||||
Action string
|
||||
State string
|
||||
PullRequest bool
|
||||
Owner, Repo string
|
||||
Number int
|
||||
Title, Body string
|
||||
Labels []string
|
||||
Assignees []string
|
||||
}
|
||||
|
||||
// ReviewEvent is a submitted pull request review.
|
||||
type ReviewEvent struct {
|
||||
Action string
|
||||
Owner, Repo string
|
||||
PRNumber int
|
||||
ReviewID int64
|
||||
Author string
|
||||
State string
|
||||
Body string
|
||||
}
|
||||
|
||||
// ReviewCommentEvent is an inline pull request review comment.
|
||||
type ReviewCommentEvent struct {
|
||||
Action string
|
||||
Owner, Repo string
|
||||
PRNumber int
|
||||
ReviewID int64
|
||||
CommentID int64
|
||||
Author string
|
||||
Body string
|
||||
Path string
|
||||
Line int
|
||||
}
|
||||
|
||||
// ErrBadWebhook marks a delivery body the forge could not decode.
|
||||
var ErrBadWebhook = errors.New("undecodable webhook payload")
|
||||
|
||||
// WebhookParser decodes webhook deliveries. Callers verify the delivery's
|
||||
// signature first; implementations parse only what is authenticated.
|
||||
type WebhookParser interface {
|
||||
ParseWebhook(ctx context.Context, headers map[string]string, body []byte) (WebhookEvent, error)
|
||||
// GitCredentialIssuer is a forge that mints per-repository git credentials,
|
||||
// such as an app installation token. It returns errors.ErrUnsupported when
|
||||
// git should use the connection's stored token.
|
||||
type GitCredentialIssuer interface {
|
||||
GitCredential(ctx context.Context, owner, repo string) (GitCredential, error)
|
||||
}
|
||||
@@ -1,386 +0,0 @@
|
||||
// Package webhook receives forge issue and review webhooks, verifies their
|
||||
// HMAC, has the forge's parser decode them and publishes them through the
|
||||
// poller's publish path. Only
|
||||
// application/json payloads are accepted. A GET returns delivery Status.
|
||||
package webhook
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/workintake"
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
"github.com/samcharles93/archie-core/internal/webhookguard"
|
||||
)
|
||||
|
||||
// maxBodyBytes bounds a webhook payload before it is read. GitHub webhook
|
||||
// bodies are small; the cap exists so a hostile sender cannot exhaust memory.
|
||||
const maxBodyBytes = 1 << 20 // 1 MiB
|
||||
|
||||
// PublishFunc delivers a decoded, dispatch-matched task envelope to the
|
||||
// daemon's publish path. The composition root wires it to
|
||||
// (*daemon.Daemon).PublishTask, the same enqueue path the poller uses.
|
||||
type PublishFunc func(ctx context.Context, task workintake.TaskEnvelope) error
|
||||
|
||||
// WithdrawFunc declines the work an issue no longer asks for.
|
||||
type WithdrawFunc func(ctx context.Context, owner, repo string, number int, reason string) error
|
||||
|
||||
// ReactionPublishFunc publishes one review reaction.
|
||||
type ReactionPublishFunc func(ctx context.Context, reaction workintake.ReviewCommentEnvelope) error
|
||||
|
||||
// reactionRateLimit bounds reaction deliveries per remote source per window
|
||||
// (decision 6's per-source rate limiting, due now that the receiver carries a
|
||||
// second event family). It guards spend, not authorization: the owned-task
|
||||
// guard at the consumer remains the authorization boundary.
|
||||
const (
|
||||
reactionRateLimit = 60
|
||||
reactionRateWindow = time.Minute
|
||||
reactionRateBucketTTL = 5 * time.Minute
|
||||
)
|
||||
|
||||
// Receiver is the HTTP handler for forge webhooks. It verifies the signature,
|
||||
// decodes the event, applies the shared dispatch predicate, and publishes
|
||||
// matched issues.
|
||||
type Receiver struct {
|
||||
secret string
|
||||
parser forge.WebhookParser
|
||||
trigger string
|
||||
label string
|
||||
botUser string
|
||||
publish PublishFunc
|
||||
reactionPublish ReactionPublishFunc
|
||||
withdraw WithdrawFunc
|
||||
log *slog.Logger
|
||||
|
||||
mu sync.Mutex
|
||||
startedAt time.Time
|
||||
lastReceivedAt time.Time
|
||||
deliveries uint64
|
||||
publishes uint64
|
||||
reactionPublishes uint64
|
||||
|
||||
reactionLimiter map[string]*reactionWindow
|
||||
}
|
||||
|
||||
// reactionWindow is one remote's fixed-window rate budget.
|
||||
type reactionWindow struct {
|
||||
start time.Time
|
||||
count int
|
||||
}
|
||||
|
||||
// New returns an unstarted Receiver.
|
||||
func New(secret string, parser forge.WebhookParser, trigger, label, botUser string, publish PublishFunc, reactionPublish ReactionPublishFunc, withdraw WithdrawFunc, log *slog.Logger) *Receiver {
|
||||
if log == nil {
|
||||
log = slog.New(slog.DiscardHandler)
|
||||
}
|
||||
return &Receiver{
|
||||
secret: secret,
|
||||
parser: parser,
|
||||
trigger: trigger,
|
||||
label: label,
|
||||
botUser: botUser,
|
||||
publish: publish,
|
||||
reactionPublish: reactionPublish,
|
||||
withdraw: withdraw,
|
||||
reactionLimiter: map[string]*reactionWindow{},
|
||||
log: log.With("component", "forge-webhook"),
|
||||
startedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
// Status counts authenticated deliveries and published tasks.
|
||||
// LastReceivedAt is nil before the first delivery.
|
||||
type Status struct {
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
LastReceivedAt *time.Time `json:"last_received_at"`
|
||||
Deliveries uint64 `json:"deliveries"`
|
||||
Publishes uint64 `json:"publishes"`
|
||||
ReactionPublishes uint64 `json:"reaction_publishes"`
|
||||
}
|
||||
|
||||
// Status returns a snapshot of the receiver's activity counters.
|
||||
func (r *Receiver) Status() Status {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
s := Status{
|
||||
StartedAt: r.startedAt,
|
||||
Deliveries: r.deliveries,
|
||||
Publishes: r.publishes,
|
||||
ReactionPublishes: r.reactionPublishes,
|
||||
}
|
||||
if !r.lastReceivedAt.IsZero() {
|
||||
last := r.lastReceivedAt
|
||||
s.LastReceivedAt = &last
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// recordDelivery marks one authenticated, parseable webhook as received.
|
||||
// Called only after HMAC verification and payload parsing succeed, so an
|
||||
// unauthenticated request (anyone spamming the endpoint with a bad
|
||||
// signature) can never inflate the "receiver is alive" signal.
|
||||
func (r *Receiver) recordDelivery() {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
r.deliveries++
|
||||
r.lastReceivedAt = time.Now()
|
||||
}
|
||||
|
||||
// recordPublish marks one delivery as having produced a task.
|
||||
func (r *Receiver) recordPublish() {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
r.publishes++
|
||||
}
|
||||
|
||||
// recordReactionPublish marks one delivery as having produced a reaction.
|
||||
func (r *Receiver) recordReactionPublish() {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
r.reactionPublishes++
|
||||
}
|
||||
|
||||
// ServeHTTP handles one forge webhook delivery. GitHub only ever POSTs here,
|
||||
// so any GET is answered with the receiver's Status instead -- an operator
|
||||
// (or a monitor) can curl the same address the webhook is configured against
|
||||
// to check liveness, with no separate health-check surface to wire up.
|
||||
func (r *Receiver) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
if req.Method == http.MethodGet {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(r.Status())
|
||||
return
|
||||
}
|
||||
if req.Method != http.MethodPost {
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(io.LimitReader(req.Body, maxBodyBytes))
|
||||
if err != nil {
|
||||
r.log.ErrorContext(req.Context(), "read body", "err", err)
|
||||
http.Error(w, "read error", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// HMAC verification. An invalid or missing signature is rejected and
|
||||
// logged, never silently accepted.
|
||||
sig := req.Header.Get("X-Hub-Signature-256")
|
||||
if !webhookguard.VerifyHMAC(body, sig, r.secret) {
|
||||
r.log.WarnContext(req.Context(), "invalid signature", "remote", req.RemoteAddr)
|
||||
http.Error(w, "invalid signature", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
headers := make(map[string]string, len(req.Header))
|
||||
for name := range req.Header {
|
||||
headers[name] = req.Header.Get(name)
|
||||
}
|
||||
event, err := r.parser.ParseWebhook(req.Context(), headers, body)
|
||||
if errors.Is(err, forge.ErrBadWebhook) {
|
||||
r.log.WarnContext(req.Context(), "parse webhook", "err", err)
|
||||
http.Error(w, "bad payload", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
r.log.ErrorContext(req.Context(), "parse webhook", "err", err)
|
||||
http.Error(w, "parse unavailable", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
// Authenticated and parseable: this is a genuine forge delivery,
|
||||
// independent of whether it turns out to be dispatch-eligible.
|
||||
r.recordDelivery()
|
||||
|
||||
switch {
|
||||
case event.Issue != nil:
|
||||
r.serveIssueEvent(w, req, event.Issue)
|
||||
case event.Review != nil:
|
||||
r.serveReviewEvent(w, req, event.Review)
|
||||
case event.ReviewComment != nil:
|
||||
r.serveReviewCommentEvent(w, req, event.ReviewComment)
|
||||
default:
|
||||
// Not an event this receiver decodes (ping, push, etc.).
|
||||
// Acknowledge and ignore.
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
}
|
||||
|
||||
// serveIssueEvent is the receiver's original contract: an eligible issue
|
||||
// event becomes a task envelope on the task path.
|
||||
func (r *Receiver) serveIssueEvent(w http.ResponseWriter, req *http.Request, issueEvent *forge.IssueEvent) {
|
||||
task, ok := r.taskFromEvent(issueEvent)
|
||||
if !ok {
|
||||
// Delivered but not eligible work (PR, closed, unrelated action,
|
||||
// dispatch mismatch). A withdrawal declines the work it queued;
|
||||
// anything else is acknowledged without publishing.
|
||||
if reason, withdrawn := r.withdrawal(issueEvent); withdrawn && r.withdraw != nil {
|
||||
if err := r.withdraw(req.Context(), issueEvent.Owner, issueEvent.Repo, issueEvent.Number, reason); err != nil {
|
||||
r.log.ErrorContext(req.Context(), "withdraw task", "repo", issueEvent.Owner+"/"+issueEvent.Repo, "issue", issueEvent.Number, "err", err)
|
||||
http.Error(w, "withdraw failed", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
return
|
||||
}
|
||||
|
||||
if err := r.publish(req.Context(), task); err != nil {
|
||||
r.log.ErrorContext(req.Context(), "publish task", "task", task.Ref(), "err", err)
|
||||
http.Error(w, "publish failed", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
r.recordPublish()
|
||||
r.log.InfoContext(req.Context(), "published", "task", task.Ref())
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
|
||||
// serveReviewEvent turns a submitted review into a reaction, the webhook
|
||||
// half of decision 2: the same typed reaction the poller produces, so
|
||||
// PublishUnique dedups the two sources. Only "submitted" carries a verdict
|
||||
// or summary to remediate; edited and dismissed restate or withdraw one.
|
||||
func (r *Receiver) serveReviewEvent(w http.ResponseWriter, req *http.Request, e *forge.ReviewEvent) {
|
||||
if e.Action != "submitted" {
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
return
|
||||
}
|
||||
if !r.allowReactionDelivery(req.RemoteAddr) {
|
||||
r.log.WarnContext(req.Context(), "reaction rate limit exceeded", "remote", req.RemoteAddr)
|
||||
http.Error(w, "rate limited", http.StatusTooManyRequests)
|
||||
return
|
||||
}
|
||||
if r.reactionPublish == nil {
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
return
|
||||
}
|
||||
reaction := workintake.ReviewCommentEnvelope{
|
||||
Owner: e.Owner,
|
||||
Repo: e.Repo,
|
||||
PRNumber: e.PRNumber,
|
||||
Kind: workintake.ReviewReactionReview,
|
||||
ReviewID: e.ReviewID,
|
||||
Author: e.Author,
|
||||
State: e.State,
|
||||
Body: e.Body,
|
||||
}
|
||||
r.deliverReaction(w, req, reaction)
|
||||
}
|
||||
|
||||
// serveReviewCommentEvent publishes an inline comment as a reaction. The
|
||||
// comment carries its parent review's ID, so the consumer can collect it
|
||||
// into that review's unit (decision 5) rather than starting a round of its
|
||||
// own.
|
||||
func (r *Receiver) serveReviewCommentEvent(w http.ResponseWriter, req *http.Request, e *forge.ReviewCommentEvent) {
|
||||
if e.Action != "created" {
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
return
|
||||
}
|
||||
if !r.allowReactionDelivery(req.RemoteAddr) {
|
||||
r.log.WarnContext(req.Context(), "reaction rate limit exceeded", "remote", req.RemoteAddr)
|
||||
http.Error(w, "rate limited", http.StatusTooManyRequests)
|
||||
return
|
||||
}
|
||||
if r.reactionPublish == nil {
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
return
|
||||
}
|
||||
reaction := workintake.ReviewCommentEnvelope{
|
||||
Owner: e.Owner,
|
||||
Repo: e.Repo,
|
||||
PRNumber: e.PRNumber,
|
||||
Kind: workintake.ReviewReactionComment,
|
||||
ReviewID: e.ReviewID,
|
||||
CommentID: e.CommentID,
|
||||
Author: e.Author,
|
||||
Body: e.Body,
|
||||
Path: e.Path,
|
||||
Line: e.Line,
|
||||
}
|
||||
r.deliverReaction(w, req, reaction)
|
||||
}
|
||||
|
||||
func (r *Receiver) deliverReaction(w http.ResponseWriter, req *http.Request, reaction workintake.ReviewCommentEnvelope) {
|
||||
if err := r.reactionPublish(req.Context(), reaction); err != nil {
|
||||
r.log.ErrorContext(req.Context(), "publish reaction", "key", reaction.IdempotencyKey(), "err", err)
|
||||
http.Error(w, "publish failed", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
r.recordReactionPublish()
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
|
||||
// allowReactionDelivery consumes one reaction slot for the remote source.
|
||||
// A fixed window keeps the bookkeeping trivial; the failure mode is a burst
|
||||
// slightly over one window, which the consumer's dedup and round cap bound.
|
||||
func (r *Receiver) allowReactionDelivery(remote string) bool {
|
||||
now := time.Now()
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
for k, v := range r.reactionLimiter {
|
||||
if now.Sub(v.start) > reactionRateBucketTTL {
|
||||
delete(r.reactionLimiter, k)
|
||||
}
|
||||
}
|
||||
w, ok := r.reactionLimiter[remote]
|
||||
if !ok || now.Sub(w.start) > reactionRateWindow {
|
||||
r.reactionLimiter[remote] = &reactionWindow{start: now, count: 0}
|
||||
w = r.reactionLimiter[remote]
|
||||
}
|
||||
w.count++
|
||||
return w.count <= reactionRateLimit
|
||||
}
|
||||
|
||||
// withdrawal reports whether an issues event takes an issue out of dispatch:
|
||||
// it was closed, or lost the label or assignee that made it work.
|
||||
func (r *Receiver) withdrawal(event *forge.IssueEvent) (string, bool) {
|
||||
if event.PullRequest || event.Owner == "" || event.Repo == "" {
|
||||
return "", false
|
||||
}
|
||||
switch event.Action {
|
||||
case "closed":
|
||||
return "the issue was closed", true
|
||||
case "unlabeled", "unassigned":
|
||||
if !workintake.MatchesDispatch(r.trigger, r.label, r.botUser, event.Labels, event.Assignees) {
|
||||
return "the issue was " + event.Action, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
// taskFromEvent reports the task an issues event makes eligible, or
|
||||
// (zero, false) when it is not eligible work.
|
||||
func (r *Receiver) taskFromEvent(event *forge.IssueEvent) (workintake.TaskEnvelope, bool) {
|
||||
if event.PullRequest {
|
||||
return workintake.TaskEnvelope{}, false
|
||||
}
|
||||
// Only events that could newly make an issue eligible. unlabeled,
|
||||
// unassigned, closed, and edited never queue work.
|
||||
switch event.Action {
|
||||
case "opened", "reopened", "labeled", "assigned":
|
||||
default:
|
||||
return workintake.TaskEnvelope{}, false
|
||||
}
|
||||
if event.State != "open" {
|
||||
return workintake.TaskEnvelope{}, false
|
||||
}
|
||||
if !workintake.MatchesDispatch(r.trigger, r.label, r.botUser, event.Labels, event.Assignees) {
|
||||
return workintake.TaskEnvelope{}, false
|
||||
}
|
||||
if event.Owner == "" || event.Repo == "" {
|
||||
r.log.Warn("event missing repository", "action", event.Action)
|
||||
return workintake.TaskEnvelope{}, false
|
||||
}
|
||||
return workintake.TaskEnvelope{
|
||||
Owner: event.Owner,
|
||||
Repo: event.Repo,
|
||||
Number: event.Number,
|
||||
Title: event.Title,
|
||||
Body: event.Body,
|
||||
Labels: event.Labels,
|
||||
Kind: workintake.KindForLabels(event.Labels),
|
||||
}, true
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package webhook
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
)
|
||||
|
||||
// An issue leaves dispatch when it is closed or loses what made it work; an
|
||||
// unlabel or unassign that still leaves it eligible withdraws nothing.
|
||||
func TestWithdrawal(t *testing.T) {
|
||||
r := New("", nil, "either", "archie", "bot", nil, nil, nil, nil)
|
||||
tests := []struct {
|
||||
name string
|
||||
event forge.IssueEvent
|
||||
want bool
|
||||
}{
|
||||
{"closed", forge.IssueEvent{Action: "closed", State: "closed"}, true},
|
||||
{"label removed, still assigned", forge.IssueEvent{Action: "unlabeled", Assignees: []string{"bot"}}, false},
|
||||
{"label removed, nothing left", forge.IssueEvent{Action: "unlabeled"}, true},
|
||||
{"unassigned, still labelled", forge.IssueEvent{Action: "unassigned", Labels: []string{"archie"}}, false},
|
||||
{"unassigned, nothing left", forge.IssueEvent{Action: "unassigned"}, true},
|
||||
{"edited", forge.IssueEvent{Action: "edited"}, false},
|
||||
{"a pull request closing", forge.IssueEvent{Action: "closed", PullRequest: true}, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tt.event.Owner, tt.event.Repo = "acme", "widget"
|
||||
if _, got := r.withdrawal(&tt.event); got != tt.want {
|
||||
t.Fatalf("withdrawal = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ var dashboardPages = []DashboardPage{
|
||||
{Path: "/settings/plugins", Label: "Plugins", Description: "Extension directories loaded at startup."},
|
||||
{Path: "/settings/secret-engines", Label: "Secret engines"},
|
||||
{Path: "/settings/container-runtime", Label: "Container runtime"},
|
||||
{Path: "/settings/harness", Label: "Harness", Description: "OAuth credential bindings and setup terminal."},
|
||||
{Path: "/settings/agent-profiles", Label: "Agent profiles", Description: "Execution profiles (image or Kit harness), credential sign-in status and the harness setup terminal."},
|
||||
}
|
||||
|
||||
// DashboardPages returns a copy of the dashboard page registry.
|
||||
|
||||
@@ -518,6 +518,10 @@ func (r *TurnRunner) generateAndComplete(
|
||||
MaxOutputTokens: prep.modelDetails.MaxOutputTokens,
|
||||
}, recorder)
|
||||
if err != nil {
|
||||
turn.ToolCalls = recorder.events
|
||||
if n := len(recorder.events); n > 0 {
|
||||
err = fmt.Errorf("%w (last completed step: %s)", err, recorder.events[n-1].Name)
|
||||
}
|
||||
return "", r.failTurn(ctx, turn, err)
|
||||
}
|
||||
assistant := messaging.Message{
|
||||
@@ -578,6 +582,15 @@ func (r *TurnRunner) failTurn(ctx context.Context, turn TurnRecord, cause error)
|
||||
}
|
||||
turn.Error = cause.Error()
|
||||
turn.UpdatedAt = time.Now().UTC()
|
||||
if r.Log != nil {
|
||||
level := slog.LevelError
|
||||
if turn.Status == TurnStatusCancelled {
|
||||
level = slog.LevelWarn
|
||||
}
|
||||
r.Log.Log(ctx, level, "chat turn did not complete",
|
||||
"turn", turn.TurnID, "session", turn.SessionID, "status", string(turn.Status),
|
||||
"tool_calls", len(turn.ToolCalls), "error", cause)
|
||||
}
|
||||
if err := r.saveTurn(ctx, turn); err != nil {
|
||||
return errors.Join(cause, fmt.Errorf("save failed chat turn: %w", err))
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import (
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/agentexec"
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
"github.com/samcharles93/archie-core/internal/events"
|
||||
@@ -148,6 +147,7 @@ func (t *Transport) EventPublisher() agentexec.EventPublisher { return t.conn }
|
||||
// RemoteTrees is the proxied half of workflow.Trees.
|
||||
type RemoteTrees interface {
|
||||
Push(ctx context.Context) error
|
||||
workflow.BaselineLedger
|
||||
}
|
||||
|
||||
// Forger constructs the identity-scoped forge RPC client.
|
||||
@@ -376,12 +376,3 @@ func (*Transport) respondTask(msg *natsio.Msg, response *taskrun.Response, runEr
|
||||
log.Error("taskrun respond failed", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
// PutPresence publishes the worker's task-scoped record.
|
||||
func (t *Transport) PutPresence(ctx context.Context, record storecontract.Presence) error {
|
||||
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
defer cancel()
|
||||
return t.state.PutPresence(ctx, record)
|
||||
}
|
||||
|
||||
func (t *Transport) BrokerReady() bool { return t.conn.IsConnected() }
|
||||
@@ -15,6 +15,7 @@ const (
|
||||
defaultPollInterval = 60 * time.Second
|
||||
defaultWebListen = "127.0.0.1:8484" // "off" disables
|
||||
defaultMaxRetries = 3
|
||||
defaultIntakePerPass = 20
|
||||
defaultForgeType = "github"
|
||||
defaultForgeHost = "https://github.com"
|
||||
defaultDispatchTrigger = "assignee"
|
||||
@@ -225,6 +226,9 @@ func (l *Loader) applyGeneralDefaults(cfg *config.Config) {
|
||||
if cfg.MaxRetries == 0 {
|
||||
cfg.MaxRetries = defaultMaxRetries
|
||||
}
|
||||
if cfg.IntakePerPass == 0 {
|
||||
cfg.IntakePerPass = defaultIntakePerPass
|
||||
}
|
||||
}
|
||||
|
||||
func expandHomePath(path string) string {
|
||||
@@ -250,9 +254,6 @@ func applyForgeDefaults(cfg *config.Config) {
|
||||
if cfg.Forge.Host == "" {
|
||||
cfg.Forge.Host = defaultForgeHost
|
||||
}
|
||||
if cfg.Forge.Intake == "" {
|
||||
cfg.Forge.Intake = config.ForgeIntakePoll
|
||||
}
|
||||
}
|
||||
|
||||
// applyAccessDefaults fills the access surfaces' settings. See
|
||||
@@ -294,7 +295,7 @@ func applyDispatchDefaults(cfg *config.Config) {
|
||||
func applyIdentityDefaults(cfg *config.Config) {
|
||||
if len(cfg.Identities) > 0 {
|
||||
for i := range cfg.Identities {
|
||||
cfg.Identities[i].BotEmail = defaultBotEmail(cfg.Forge.Type, cfg.Identities[i].BotUser, cfg.Identities[i].BotEmail)
|
||||
cfg.Identities[i].BotEmail = DefaultBotEmail(cfg.Forge.Type, cfg.Identities[i].BotUser, cfg.Identities[i].BotEmail)
|
||||
}
|
||||
if len(cfg.Identities) == 1 && cfg.BotUser == "" {
|
||||
cfg.BotUser = cfg.Identities[0].BotUser
|
||||
@@ -303,10 +304,11 @@ func applyIdentityDefaults(cfg *config.Config) {
|
||||
}
|
||||
}
|
||||
}
|
||||
cfg.BotEmail = defaultBotEmail(cfg.Forge.Type, cfg.BotUser, cfg.BotEmail)
|
||||
cfg.BotEmail = DefaultBotEmail(cfg.Forge.Type, cfg.BotUser, cfg.BotEmail)
|
||||
}
|
||||
|
||||
func defaultBotEmail(forgeType, user, email string) string {
|
||||
// DefaultBotEmail is the forge-appropriate commit email for user when email is empty.
|
||||
func DefaultBotEmail(forgeType, user, email string) string {
|
||||
if user == "" || email != "" {
|
||||
return email
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@ var DeniedKeys = map[string]string{
|
||||
"forge.type": "Constructs the forge client at startup.",
|
||||
"forge.host": "Constructs the forge client at startup.",
|
||||
"forge.token": "Binds the forge account at startup.",
|
||||
"forge.intake": "Constructs the poll and webhook intake at startup.",
|
||||
"forge.webhook_secret": "Binds the webhook receiver at startup.",
|
||||
"forge.webhook_addr": "Binds the webhook listener at startup.",
|
||||
"bot_user": "Pins the daemon's forge identity and task-grant namespace at startup.",
|
||||
"bot_email": "Pins the forge account's commit identity at startup.",
|
||||
"org": "Pins the deployment's org at startup.",
|
||||
|
||||
@@ -38,7 +38,6 @@ var forgeTypePattern = regexp.MustCompile(`^[a-z0-9][a-z0-9-]*$`)
|
||||
var (
|
||||
dispatchTriggers = []string{dispatchTriggerAssignee, dispatchTriggerLabel, dispatchTriggerEither}
|
||||
natsModes = []string{config.NATSModeEmbedded, config.NATSModeExternal}
|
||||
forgeIntakes = []string{config.ForgeIntakePoll, config.ForgeIntakeWebhook, config.ForgeIntakeBoth}
|
||||
memoryEngines = []string{memoryEngineBuiltin}
|
||||
)
|
||||
|
||||
@@ -60,9 +59,6 @@ func validate(cfg *config.Config) error {
|
||||
// validateBootstrap checks the settings a file configuration still owns,
|
||||
// skipping those the control plane stores.
|
||||
func validateBootstrap(cfg *config.Config) error {
|
||||
if err := validateForgeIntake(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateIdentityStructure(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -176,31 +172,6 @@ func DispatchTriggerValid(trigger string) bool {
|
||||
return oneOf(trigger, dispatchTriggers)
|
||||
}
|
||||
|
||||
// validateForgeIntake checks the intake mode and webhook settings, and
|
||||
// rejects webhook intake with [[identities]] or on an identity.
|
||||
func validateForgeIntake(cfg *config.Config) error {
|
||||
intake := cfg.Forge.Intake
|
||||
if intake == "" {
|
||||
intake = config.ForgeIntakePoll
|
||||
}
|
||||
if !oneOf(intake, forgeIntakes) {
|
||||
return fmt.Errorf("%w: forge.intake %q (want %s)", ErrInvalidInput, cfg.Forge.Intake, list(forgeIntakes))
|
||||
}
|
||||
if intake == config.ForgeIntakeWebhook || intake == config.ForgeIntakeBoth {
|
||||
if len(cfg.Identities) > 0 {
|
||||
return fmt.Errorf("%w: forge.intake %q is not supported alongside [[identities]]: webhook intake is single-identity only, so every identity would silently keep polling (drop the [[identities]] blocks, or set forge.intake = %q and let each identity poll)",
|
||||
ErrInvalidInput, intake, config.ForgeIntakePoll)
|
||||
}
|
||||
if cfg.Forge.WebhookSecret == (config.SecretRef{}) {
|
||||
return fmt.Errorf("%w: forge.webhook_secret is required when forge.intake is %q", ErrInvalidInput, intake)
|
||||
}
|
||||
if cfg.Forge.WebhookAddr == "" {
|
||||
return fmt.Errorf("%w: forge.webhook_addr is required when forge.intake is %q", ErrInvalidInput, intake)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateProviders rejects base URLs carrying credentials or query state.
|
||||
// A provider URL is used to build API requests, so userinfo or a stray query
|
||||
// string would be silently attached to every call.
|
||||
|
||||
@@ -77,7 +77,6 @@ func RuntimeChatConfigFrom(ctx context.Context, reader ResourceReader, base conf
|
||||
}
|
||||
out = config.ChatConfig{
|
||||
Operator: settings.Operator, ShowToolCalls: settings.ShowToolCalls, MaxSteps: settings.MaxSteps,
|
||||
Telegram: config.TelegramConfig{AllowedUserIDs: settings.Telegram.AllowedUserIDs, Token: settings.Telegram.Token},
|
||||
RateLimit: config.RateLimitConfig{Window: time.Duration(settings.RateLimit.Window), MaxRequests: settings.RateLimit.MaxRequests},
|
||||
UnrestrictedFilesystem: settings.UnrestrictedFilesystem, Workspace: settings.Workspace,
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/distribution"
|
||||
"github.com/samcharles93/archie-core/internal/installtype"
|
||||
"github.com/samcharles93/archie-core/internal/releaseupdate"
|
||||
@@ -19,19 +18,16 @@ type ChannelSettings struct {
|
||||
Operator string `json:"operator"`
|
||||
ShowToolCalls bool `json:"show_tool_calls"`
|
||||
MaxSteps int `json:"max_steps"`
|
||||
Telegram TelegramSettings `json:"telegram"`
|
||||
RateLimit RateLimitSettings `json:"rate_limit"`
|
||||
UnrestrictedFilesystem bool `json:"unrestricted_filesystem"`
|
||||
Workspace string `json:"workspace"`
|
||||
// Agent is the identity an org's channel chats as. The system org's
|
||||
// channel acts for no one and leaves it empty.
|
||||
Agent string `json:"agent"`
|
||||
}
|
||||
|
||||
type TelegramSettings struct {
|
||||
AllowedUserIDs []int64 `json:"allowed_user_ids"`
|
||||
Token config.SecretRef `json:"token_ref"`
|
||||
CredentialConfigured bool `json:"credential_configured"`
|
||||
// AllowedUserIDs lists the Telegram users an org's bot answers. The
|
||||
// instance's bot takes its users and token from the telegram package's
|
||||
// extension settings.
|
||||
AllowedUserIDs []int64 `json:"allowed_user_ids"`
|
||||
}
|
||||
|
||||
// RateLimitSettings is the inbound rate-limit object, and it reads the Go-cased
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
// Aliases for the channel-settings document defined in controlplanerpc.
|
||||
type (
|
||||
channelSettings = controlplanerpc.ChannelSettings
|
||||
telegramSettings = controlplanerpc.TelegramSettings
|
||||
rateLimitSettings = controlplanerpc.RateLimitSettings
|
||||
channelDuration = controlplanerpc.ChannelDuration
|
||||
)
|
||||
@@ -25,7 +24,6 @@ func seedChannels(cfg config.Config) any {
|
||||
chat := cfg.Chat
|
||||
return channelSettings{
|
||||
Operator: chat.Operator, Workspace: chat.Workspace, UnrestrictedFilesystem: chat.UnrestrictedFilesystem, ShowToolCalls: chat.ShowToolCalls, MaxSteps: chat.MaxSteps,
|
||||
Telegram: telegramSettings{AllowedUserIDs: chat.Telegram.AllowedUserIDs, Token: chat.Telegram.Token, CredentialConfigured: chat.Telegram.Token != (config.SecretRef{})},
|
||||
RateLimit: rateLimitSettings{Window: channelDuration(chat.RateLimit.Window), MaxRequests: chat.RateLimit.MaxRequests},
|
||||
}
|
||||
}
|
||||
@@ -50,24 +48,24 @@ func normalizeChannels(input []byte) ([]byte, error) {
|
||||
|
||||
// checkChannelWrite keeps an org to the settings its own channel consumes.
|
||||
// The workspace, filesystem, step, rate-limit and operator settings configure
|
||||
// the instance's gateway, and the bot token resolves against the instance's
|
||||
// secret engines, so an org's bot takes its token from the org's credential
|
||||
// binding named telegram instead. The system org's channel acts for no one, so
|
||||
// it names no agent.
|
||||
// the instance's gateway, and an org's bot takes its token from the org's
|
||||
// credential binding named telegram. The system org's channel acts for no one,
|
||||
// so it names no agent and no bot users: the instance's bot is the telegram
|
||||
// package, configured in its extension settings.
|
||||
func checkChannelWrite(orgID string, value []byte) error {
|
||||
var doc channelSettings
|
||||
if err := json.Unmarshal(value, &doc); err != nil {
|
||||
return err
|
||||
}
|
||||
if orgID == storecontract.DefaultOrgID {
|
||||
if doc.Agent != "" {
|
||||
return fmt.Errorf("%w: the instance channel acts for no agent", ErrValidation)
|
||||
if doc.Agent != "" || len(doc.AllowedUserIDs) > 0 {
|
||||
return fmt.Errorf("%w: the instance channel acts for no agent and its Telegram users are the telegram extension's settings", ErrValidation)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if doc.Operator != "" || doc.Workspace != "" || doc.UnrestrictedFilesystem || doc.MaxSteps != 0 ||
|
||||
doc.RateLimit != (rateLimitSettings{}) || doc.Telegram.Token != (config.SecretRef{}) {
|
||||
return fmt.Errorf("%w: operator, workspace, filesystem, step, rate-limit and token settings are the instance's; an org sets its Telegram users, tool-call display and agent, and binds its bot token as the credential telegram", ErrValidation)
|
||||
doc.RateLimit != (rateLimitSettings{}) {
|
||||
return fmt.Errorf("%w: operator, workspace, filesystem, step and rate-limit settings are the instance's; an org sets its Telegram users, tool-call display and agent, and binds its bot token as the credential telegram", ErrValidation)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -19,12 +19,12 @@ func TestChannelSettingsWritesStayWithinTheirOrg(t *testing.T) {
|
||||
name, org, value string
|
||||
refused bool
|
||||
}{
|
||||
{"system org sets the instance channel", storecontract.DefaultOrgID, `{"operator":"sam","workspace":"/srv","telegram":{"allowed_user_ids":[1]}}`, false},
|
||||
{"system org sets the instance channel", storecontract.DefaultOrgID, `{"operator":"sam","workspace":"/srv"}`, false},
|
||||
{"system org names bot users", storecontract.DefaultOrgID, `{"allowed_user_ids":[1]}`, true},
|
||||
{"system org names an agent", storecontract.DefaultOrgID, `{"agent":"a1"}`, true},
|
||||
{"another org sets its users and agent", "acme", `{"agent":"a1","show_tool_calls":true,"telegram":{"allowed_user_ids":[7]}}`, false},
|
||||
{"another org sets its users and agent", "acme", `{"agent":"a1","show_tool_calls":true,"allowed_user_ids":[7]}`, false},
|
||||
{"another org sets the host workspace", "acme", `{"workspace":"/srv"}`, true},
|
||||
{"another org lifts the filesystem limit", "acme", `{"unrestricted_filesystem":true}`, true},
|
||||
{"another org names a token secret", "acme", `{"telegram":{"token_ref":{"engine":"env","key":"INSTANCE_BOT"}}}`, true},
|
||||
{"another org sets the instance rate limit", "acme", `{"rate_limit":{"max_requests":5}}`, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
||||
@@ -202,9 +202,9 @@ var orgSeededKinds = map[string]bool{
|
||||
// instance's, so nothing is stored for it and the instance's values are not
|
||||
// copied in.
|
||||
var orgEmptyDocuments = map[string]string{
|
||||
ChannelSettingsKind: `{"operator":"","show_tool_calls":false,"max_steps":0,"telegram":{"allowed_user_ids":[],"token_ref":{},"credential_configured":false},"rate_limit":{"window":0,"max_requests":0},"unrestricted_filesystem":false,"workspace":"","agent":""}`,
|
||||
ChannelSettingsKind: `{"operator":"","show_tool_calls":false,"max_steps":0,"allowed_user_ids":[],"rate_limit":{"window":0,"max_requests":0},"unrestricted_filesystem":false,"workspace":"","agent":""}`,
|
||||
TaskPolicyKind: `{"notify_webhook":"","notify_min_severity":"","notify_secret":{}}`,
|
||||
SchedulingPolicyKind: `{"poll_interval":"","max_retries":0,"dispatch":{"trigger":"","ack_reaction":""}}`,
|
||||
SchedulingPolicyKind: `{"poll_interval":"","max_retries":0,"intake_per_pass":0,"dispatch":{"trigger":"","ack_reaction":""}}`,
|
||||
}
|
||||
|
||||
// resource seeds an org's workflow documents on first use, including orgs
|
||||
|
||||
@@ -28,34 +28,29 @@ func TestForgeLayeringReadsTheConnection(t *testing.T) {
|
||||
base := config.Config{
|
||||
Forge: config.Forge{
|
||||
Type: "github", Host: "file.example.com",
|
||||
Token: config.SecretRef{Engine: "env", Key: "FILE_TOKEN"},
|
||||
Intake: config.ForgeIntakeBoth,
|
||||
WebhookSecret: config.SecretRef{Engine: "env", Key: "HOOK"},
|
||||
Token: config.SecretRef{Engine: "env", Key: "FILE_TOKEN"},
|
||||
},
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
connections string
|
||||
wantType string
|
||||
wantHost string
|
||||
wantKey string
|
||||
wantWebhookKept bool
|
||||
name string
|
||||
connections string
|
||||
wantType string
|
||||
wantHost string
|
||||
wantKey string
|
||||
}{
|
||||
{
|
||||
name: "the root connection replaces the file's forge",
|
||||
connections: `[{"id":"default","name":"Instance","type":"gitea","host":"gitea.example.com","token":{"engine":"vault","key":"forge/root"}}]`,
|
||||
wantType: "gitea",
|
||||
wantHost: "gitea.example.com",
|
||||
wantKey: "forge/root",
|
||||
wantWebhookKept: true,
|
||||
name: "the root connection replaces the file's forge",
|
||||
connections: `[{"id":"default","name":"Instance","type":"gitea","host":"gitea.example.com","token":{"engine":"vault","key":"forge/root"}}]`,
|
||||
wantType: "gitea",
|
||||
wantHost: "gitea.example.com",
|
||||
wantKey: "forge/root",
|
||||
},
|
||||
{
|
||||
name: "a document with no root connection disables the forge",
|
||||
connections: `[{"id":"acme","name":"Acme","type":"github","host":"github.com"}]`,
|
||||
wantType: "",
|
||||
wantHost: "",
|
||||
wantKey: "",
|
||||
wantWebhookKept: true,
|
||||
name: "a document with no root connection disables the forge",
|
||||
connections: `[{"id":"acme","name":"Acme","type":"github","host":"github.com"}]`,
|
||||
wantType: "",
|
||||
wantHost: "",
|
||||
wantKey: "",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -67,9 +62,6 @@ func TestForgeLayeringReadsTheConnection(t *testing.T) {
|
||||
if cfg.Forge.Type != tt.wantType || cfg.Forge.Host != tt.wantHost || cfg.Forge.Token.Key != tt.wantKey {
|
||||
t.Fatalf("forge = %+v, want type %q host %q key %q", cfg.Forge, tt.wantType, tt.wantHost, tt.wantKey)
|
||||
}
|
||||
if kept := cfg.Forge.WebhookSecret.Key == "HOOK" && cfg.Forge.Intake == config.ForgeIntakeBoth; kept != tt.wantWebhookKept {
|
||||
t.Fatalf("webhook intake/secret = %q/%q, want them kept from the file", cfg.Forge.Intake, cfg.Forge.WebhookSecret.Key)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loaded 100 of 183 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user