Compare commits

..
14 Commits
Author SHA1 Message Date
sam 4944ec8473 chore(release): v1.48.1
deploy / gate (push) Failing after 3m28s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-10-07 01:00:30 +11:00
sam 204b65a0e3 fix(controlplane): update-settings selects a release channel; services run only the installed update scripts 2026-10-07 01:00:28 +11:00
sam cbedb8a504 chore(release): v1.48.0
deploy / gate (push) Failing after 5m4s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-10-07 00:57:07 +11:00
sam a8dbab0cff feat(controlplane): update commands are an update-settings kind edited on Status, defaulting to the installed scripts 2026-10-07 00:57:01 +11:00
sam 789ff73fe9 fix(scripts): archie-update-install loads the archie env file so a shell run can back up the bundled database 2026-10-07 00:53:23 +11:00
sam 5176938e95 ci(deploy): build the archied and agent images in parallel so the release zip waits only on the agent image 2026-10-07 00:35:13 +11:00
sam 69a1ee677d chore(release): v1.47.3
deploy / gate (push) Failing after 3m29s
deploy / build-and-push (push) Skipped
deploy / dist-zip (push) Skipped
2026-10-07 00:33:23 +11:00
sam b3cf2c59a8 fix(webui): extension Accept and Remove dialogs act on the selected extension 2026-10-07 00:32:44 +11:00
sam 8ebaeb6d38 chore(release): v1.47.2
deploy / gate (push) Failing after 5m8s
deploy / build-and-push (push) Skipped
deploy / dist-zip (push) Skipped
2026-10-06 03:25:44 +11:00
sam ce58768e6b fix(webui): show real source endpoints and New source on the Inspector tab instead of a placeholder 2026-10-06 03:25:12 +11:00
sam d49918ae76 chore(release): v1.47.1
deploy / gate (push) Failing after 5m40s
deploy / build-and-push (push) Skipped
deploy / dist-zip (push) Skipped
2026-10-06 03:05:39 +11:00
sam 8cb5391035 docs(news): regenerate for the corrected 1.47.0 notes 2026-10-06 03:04:35 +11:00
sam ab9db7cfe3 feat(install): bundled PostgreSQL has no network and is reached by Unix socket; print an AppArmor profile instead of disabling the userns restriction 2026-10-06 03:04:12 +11:00
sam 3d02d1d2d9 fix(install): do not start the services when the bundled PostgreSQL failed to start 2026-10-06 02:38:56 +11:00
37 changed files with 461 additions and 162 deletions

No files matched your search

+43 -12
View File
@@ -170,9 +170,7 @@ jobs:
echo "This commit is not a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest release."
fi
build-and-push:
outputs:
agent_digest: ${{ steps.agent.outputs.digest }}
archied-image:
needs: gate
runs-on: ubuntu-latest
steps:
@@ -264,6 +262,43 @@ jobs:
cache-from: type=gha,scope=archied
cache-to: type=gha,mode=max,scope=archied
agent-image:
outputs:
agent_digest: ${{ steps.agent.outputs.digest }}
needs: gate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
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: |
sha="$(git rev-parse "${GITHUB_REF}^{commit}")"
echo "sha=$sha" >> "$GITHUB_OUTPUT"
echo "short=${sha:0:12}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Resolve runtime version
id: versions
run: |
RUNTIME_TAG="$(git tag --points-at HEAD --list 'archie/v*' | sort -V | tail -1)"
RELEASE_TAG="$(git tag --points-at HEAD --list 'v*' | sort -V | tail -1)"
RUNTIME_VERSION="${RUNTIME_TAG#archie/}"
[ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION="${RELEASE_TAG#v}"
echo "runtime_tag=$RUNTIME_TAG" >> "$GITHUB_OUTPUT"
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT"
- name: Build and push archie-agent
id: agent
if: steps.versions.outputs.runtime_tag != '' || steps.versions.outputs.release_tag != ''
@@ -283,14 +318,10 @@ jobs:
# Packages every host-run binary (archied, archie-gateway,
# archie-state-store, archie-ui, archie-messaging) as a
# linux/amd64 zip for a
# non-Docker install. Independent of build-and-push: it never touches the
# archied/archie-agent image jobs, and a gateway-only release (no
# archie/v* tag) still produces this zip -- it's keyed to the archied tag
# alone. archie-agent is deliberately excluded: it only ever runs inside
# the Docker image build-and-push already publishes, never as a host
# binary (archie-core-8cda.4.7.1).
# non-Docker install. It waits only for the agent image, whose digest
# release.json pins; archie-agent itself never ships as a host binary.
dist-zip:
needs: [gate, build-and-push]
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
@@ -350,9 +381,9 @@ jobs:
for cmd in $(jq -r '.required_topology.units[]' release.json); do
cp "dist/$cmd" "$name/"
done
cp deployments/INSTRUCTIONS.md CHANGELOG.md docker-compose.yml "$name/"
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$name/"
cp scripts/archie-update-* "$name/"
digest='${{ needs.build-and-push.outputs.agent_digest }}'
digest='${{ needs.agent-image.outputs.agent_digest }}'
test -n "$digest"
jq --arg image "ghcr.io/samcharles93/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
# README.md doesn't exist yet in this repo; include it once it does
+34 -1
View File
@@ -5,6 +5,39 @@ release's per-component sections are labelled beneath its heading.
## [Unreleased]
## [1.48.1] - 2026-10-07
### archied
- **Settings → Status → Updates** now chooses only the release channel (stable, prereleases, or a pinned version). Update checks and installs always run the `archie-update-*` scripts installed beside the binaries; the dashboard can no longer set the command that runs.
## [1.48.0] - 2026-10-07
### archied
- **Settings → Status → Updates** edits the update check and install commands. They default to the `archie-update-*` scripts installed beside the binaries, so a zip install shows **Install** on the Versions card with nothing configured. The `update_check_command` and `update_install_command` keys under `[chat.telegram]` are no longer read; remove them from `config.toml`.
- `archie-update-install` run from a shell now reads `~/.config/archie/env`, so the pre-update backup of the bundled database no longer fails with `no password supplied`. Run it with `--auto` to install the newest release.
## [1.47.3] - 2026-10-07
### archied
- **Settings → Extensions**: **Accept** in the authority review now accepts the extension, and **Remove** removes it. Both previously closed the dialog without doing anything.
## [1.47.2] - 2026-10-06
### archied
- **Events → Inspector** now lists your capture sources with their real URLs and a **New source** button, replacing the `/webhooks/capture/<source>` placeholder. Sources no longer sit on the Bindings tab.
## [1.47.1] - 2026-10-06
### archied
- The bundled PostgreSQL has no network and publishes no port: the services reach it through its Unix socket under `~/.local/share/archie/postgres`, so it no longer collides with another PostgreSQL on 5432. Leaving the database question blank in `archied setup` selects it.
- The installer does not start the services when the bundled PostgreSQL fails to start; it names the command to read its logs.
- On hosts that restrict unprivileged user namespaces (Ubuntu 23.10+), the installer prints an AppArmor profile allowing them for the Archie binaries only.
## [1.47.0] - 2026-10-06
### archied
@@ -13,7 +46,7 @@ release's per-component sections are labelled beneath its heading.
- `archied setup` asks for the PostgreSQL URL. Left blank, it uses the bundled Compose database with a generated password stored in `~/.config/archie/env` as `PGPASSWORD`, not in `config.toml`.
- The bundled PostgreSQL listens on 127.0.0.1 only. A database created before this release keeps its old `archie` password; enter its URL at setup or recreate the volume.
- The release zip carries `docker-compose.yml`.
- Extensions need unprivileged user namespaces. On Ubuntu 23.10 and later run `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0` or extensions fail to start.
- Extensions need unprivileged user namespaces, which Ubuntu 23.10 and later restrict. Allow them for the Archie binaries with an AppArmor profile; from the next release the installer prints it. Do not disable the restriction system-wide.
- fix(app): assign the temp-file close result on the error path
- fix(webhook): set a ReadHeaderTimeout on the forge webhook receivers
- fix(forge): refuse a review line number that does not fit an int
+3 -2
View File
@@ -117,8 +117,9 @@ or a hosted provider API key.
checkout instead. Re-run `archied setup` at any time to change the answers.
Extensions run in an unprivileged user namespace. Ubuntu 23.10 and later
block these by default; allow them with
`sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`.
block these by default; on such a host the installer prints an AppArmor
profile that allows them for the Archie binaries only, to install with
`sudo`.
2. **Check it is up.**
-7
View File
@@ -146,16 +146,9 @@ class = "ollama"
# "openrouter/openai/gpt-5.6-sol",
# ]
# Optional self-hosted update adapter. Both values are argv arrays (never
# shell snippets). The check command must write a releaseupdate.Snapshot JSON
# document to stdout; configure the installer as well to show Approve/Defer.
# [chat.telegram]
# The bot token from @BotFather, resolved through a configured secret engine.
# token = { engine = "bws", key = "TELEGRAM_BOT_TOKEN" }
# Run by archie-messaging, which serves /update, so these commands execute on
# whichever host runs that process.
# update_check_command = ["/usr/local/bin/archie-update-check"]
# update_install_command = ["/usr/local/bin/archie-update-install"]
# Email and the generic inbound webhook are archipelago channel extensions
# (channels/email, channels/webhook): install, accept and enable them from the
+3 -2
View File
@@ -98,8 +98,9 @@ path. `--from-source` (or `ARCHIE_UPDATE_SOURCE_BUILD=1`) explicitly clones and
builds the selected release instead.
The update check command accepts `--channel stable` (default), `--channel next`
(includes prereleases), or `--channel exact-pin --pin 1.2.3`. Set these arguments
in the control plane's channel settings alongside the existing check command.
(includes prereleases), or `--channel exact-pin --pin 1.2.3`. The services run
only the scripts installed beside their binaries; Settings → Status → Updates
chooses the channel they select from.
The notification destination remains separate from the release channel.
For scheduled, unattended runs, `archie-update-install --auto` discovers the
+1 -3
View File
@@ -25,9 +25,7 @@ services:
image: postgres:18
environment:
POSTGRES_USER: archie
# archied setup generates PGPASSWORD into ~/.config/archie/env; the fallback is
# the dev password deployments/dev.toml uses.
POSTGRES_PASSWORD: ${PGPASSWORD:-archie}
POSTGRES_PASSWORD: archie
POSTGRES_DB: archie
# postgres:18 moved its default PGDATA under a versioned path; pin the
# classic location so the named volume keeps working across image updates.
+4 -9
View File
@@ -5,16 +5,11 @@ point an external app's webhook at archie, see the real payload it sends,
map the fields you care about, bind them to a workflow, and watch the next
matching event turn into a task -- no code, no redeploy, no restart.
## 1. Send a test event
## 1. Create a source and send a test event
Point whatever external app you want archie to react to at:
```
POST http://<your-archied-host>:8484/webhooks/capture/<source>
```
`<source>` is a name you choose for this sender (e.g. `sentry`, `github-ci`,
`stripe`) -- it's just a URL path segment, not a preset list. Send one real
Open **Events → Inspector** and click **New source**. Archie shows the
source's URL and signing secret once; copy both. Point the external app's
webhook at that URL. Send one real
event however is easiest for a first test, e.g.:
```bash
+10
View File
@@ -62,6 +62,11 @@
"/news/archie/1.45.0/": "/news/1.45.0/",
"/news/archie/1.46.0/": "/news/1.46.0/",
"/news/archie/1.47.0/": "/news/1.47.0/",
"/news/archie/1.47.1/": "/news/1.47.1/",
"/news/archie/1.47.2/": "/news/1.47.2/",
"/news/archie/1.47.3/": "/news/1.47.3/",
"/news/archie/1.48.0/": "/news/1.48.0/",
"/news/archie/1.48.1/": "/news/1.48.1/",
"/news/archie/1.5.0/": "/news/1.5.0/",
"/news/archie/1.6.0/": "/news/1.6.0/",
"/news/archie/1.7.0/": "/news/1.7.0/",
@@ -141,6 +146,11 @@
"/news/archied/1.45.0/": "/news/1.45.0/",
"/news/archied/1.46.0/": "/news/1.46.0/",
"/news/archied/1.47.0/": "/news/1.47.0/",
"/news/archied/1.47.1/": "/news/1.47.1/",
"/news/archied/1.47.2/": "/news/1.47.2/",
"/news/archied/1.47.3/": "/news/1.47.3/",
"/news/archied/1.48.0/": "/news/1.48.0/",
"/news/archied/1.48.1/": "/news/1.48.1/",
"/news/archied/1.5.0/": "/news/1.5.0/",
"/news/archied/1.6.0/": "/news/1.6.0/",
"/news/archied/1.7.0/": "/news/1.7.0/",
+26 -1
View File
@@ -1,8 +1,33 @@
[
{
"version": "1.48.1",
"date": "2026-10-07",
"body": "### archied\n\n- **Settings → Status → Updates** now chooses only the release channel (stable, prereleases, or a pinned version). Update checks and installs always run the `archie-update-*` scripts installed beside the binaries; the dashboard can no longer set the command that runs."
},
{
"version": "1.48.0",
"date": "2026-10-07",
"body": "### archied\n\n- **Settings → Status → Updates** edits the update check and install commands. They default to the `archie-update-*` scripts installed beside the binaries, so a zip install shows **Install** on the Versions card with nothing configured. The `update_check_command` and `update_install_command` keys under `[chat.telegram]` are no longer read; remove them from `config.toml`.\n- `archie-update-install` run from a shell now reads `~/.config/archie/env`, so the pre-update backup of the bundled database no longer fails with `no password supplied`. Run it with `--auto` to install the newest release."
},
{
"version": "1.47.3",
"date": "2026-10-07",
"body": "### archied\n\n- **Settings → Extensions**: **Accept** in the authority review now accepts the extension, and **Remove** removes it. Both previously closed the dialog without doing anything."
},
{
"version": "1.47.2",
"date": "2026-10-06",
"body": "### archied\n\n- **Events → Inspector** now lists your capture sources with their real URLs and a **New source** button, replacing the `/webhooks/capture/<source>` placeholder. Sources no longer sit on the Bindings tab."
},
{
"version": "1.47.1",
"date": "2026-10-06",
"body": "### archied\n\n- The bundled PostgreSQL has no network and publishes no port: the services reach it through its Unix socket under `~/.local/share/archie/postgres`, so it no longer collides with another PostgreSQL on 5432. Leaving the database question blank in `archied setup` selects it.\n- The installer does not start the services when the bundled PostgreSQL fails to start; it names the command to read its logs.\n- On hosts that restrict unprivileged user namespaces (Ubuntu 23.10+), the installer prints an AppArmor profile allowing them for the Archie binaries only."
},
{
"version": "1.47.0",
"date": "2026-10-06",
"body": "### archied\n\n- Install with one command: `curl -fsSL https://raw.githubusercontent.com/samcharles93/archie-core/main/install.sh | bash` downloads this release, verifies its checksum and runs `archied setup`. `--from-source` builds a checkout instead.\n- `archied setup` asks for the PostgreSQL URL. Left blank, it uses the bundled Compose database with a generated password stored in `~/.config/archie/env` as `PGPASSWORD`, not in `config.toml`.\n- The bundled PostgreSQL listens on 127.0.0.1 only. A database created before this release keeps its old `archie` password; enter its URL at setup or recreate the volume.\n- The release zip carries `docker-compose.yml`.\n- Extensions need unprivileged user namespaces. On Ubuntu 23.10 and later run `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0` or extensions fail to start.\n- fix(app): assign the temp-file close result on the error path\n- fix(webhook): set a ReadHeaderTimeout on the forge webhook receivers\n- fix(forge): refuse a review line number that does not fit an int\n- fix(storepkg): mask the tar mode to the permission bits before narrowing\n- fix(webui): navigate the Events chain once, not twice\n- feat(tools): fail the gate when docs cite a path that no longer exists\n- fix(webhookguard): verify uppercase-hex HMAC signatures\n- fix(configuration): make bot_user required, defaulted, and named\n- feat(workflow): add the command.run step type\n- fix(controlplane): an absent MCP server field inherits the file value\n- fix(build): restore the go fix fixpoint, and give the formatter one owner\n- fix(archied): restore contextcheck directives and drop unused adapter\n- feat(secretengine): serve secret engines as go-plugin extensions\n- refactor(statestore): own package for the State Store service; access reset moves to archie-state-store\n- refactor(archied): gateway owns model work; daemon drops chat runtime, tools, memory and curators\n- refactor(archiegateway): own package for the Gateway service\n- fix(services): services wait for peers instead of exiting; restarted broker keeps its endpoint\n- refactor(archieplaybooks): fold archie-playbooks into archied playbooks lint|serve\n- refactor(agentrun): agent stage contract moves to the domain layer\n- refactor(agentexec): model loop moves to agentexec/modelloop\n- fix(configuration): bindings encryption keys must use the env engine\n- feat(storepkg): fetch packages from any registry, plain HTTP on loopback only\n- feat(webui): install, accept and enable extensions from the dashboard\n- feat(presence): every service re-stamps a presence record in the State Store\n- refactor(plugin): delete Yaegi daemon plugins and plugin_dir\n- refactor(module): the log action is built in; delete the module loader and reconciler\n- refactor(skill): delete Yaegi skill scripts and the run_go_script tool\n- refactor(examples): the firewall workflow moves to archipelago\n- feat(presence): services card on the status page and archied status\n- feat(archiemessaging): verify update reports against archied's presence and restore release announcements\n- fix(configuration): an overlay stands in for a missing config file; dev overlay is complete\n- feat(access): edit org, workspace and object policies from the dashboard; refuse owner lockout\n- feat(access): instance network rules at the capture receiver; policies reload without a restart\n- feat(staterpc): attribute State Store calls to the calling service; policy audit records it\n- feat(controlplane): playbooks and agent profiles install from packages; the daemon reads eda-playbooks live\n- feat(forgeext): forge surface served by extensions; forge.type names the installed package\n- refactor(forge): github and gitea leave core; webhooks parse in the forge extension\n- feat(staterpc): the State Store derives org and actor from the principal archie-ui forwards\n- feat(channelext): chat channels served by extensions; messaging runs the enabled ones\n- refactor(channels): webhook and email run only as extensions; their channel settings go\n- feat(skills): skill packages project into a skills resource the gateway reads live\n- fix(gatewayrpc): sender_id and rate_limited cross the chat wire\n- fix(controlplane): change history names kinds and reads only the caller's org\n- feat(contracts)!: requests no longer name their org; the State Store derives it from the caller\n- feat(identity): personal API tokens, created and revoked from the dashboard, act as their owner\n- fix(archieui): a sign-in provider outage is a health issue, not a startup failure\n- feat(staterpc): one run credential per task, kept in the State Store, authorizes its store calls and its push\n- fix(forgerpc): forge calls need the run credential and reach only the run's own repository\n- feat(controlplane): identity credential grants edited from the dashboard and applied live\n- feat(daemon): a workflow that names an identity runs as it; the dispatcher needs run on the workflow\n- feat(staterpc): eveLine truncated
"body": "### archied\n\n- Install with one command: `curl -fsSL https://raw.githubusercontent.com/samcharles93/archie-core/main/install.sh | bash` downloads this release, verifies its checksum and runs `archied setup`. `--from-source` builds a checkout instead.\n- `archied setup` asks for the PostgreSQL URL. Left blank, it uses the bundled Compose database with a generated password stored in `~/.config/archie/env` as `PGPASSWORD`, not in `config.toml`.\n- The bundled PostgreSQL listens on 127.0.0.1 only. A database created before this release keeps its old `archie` password; enter its URL at setup or recreate the volume.\n- The release zip carries `docker-compose.yml`.\n- Extensions need unprivileged user namespaces, which Ubuntu 23.10 and later restrict. Allow them for the Archie binaries with an AppArmor profile; from the next release the installer prints it. Do not disable the restriction system-wide.\n- fix(app): assign the temp-file close result on the error path\n- fix(webhook): set a ReadHeaderTimeout on the forge webhook receivers\n- fix(forge): refuse a review line number that does not fit an int\n- fix(storepkg): mask the tar mode to the permission bits before narrowing\n- fix(webui): navigate the Events chain once, not twice\n- feat(tools): fail the gate when docs cite a path that no longer exists\n- fix(webhookguard): verify uppercase-hex HMAC signatures\n- fix(configuration): make bot_user required, defaulted, and named\n- feat(workflow): add the command.run step type\n- fix(controlplane): an absent MCP server field inherits the file value\n- fix(build): restore the go fix fixpoint, and give the formatter one owner\n- fix(archied): restore contextcheck directives and drop unused adapter\n- feat(secretengine): serve secret engines as go-plugin extensions\n- refactor(statestore): own package for the State Store service; access reset moves to archie-state-store\n- refactor(archied): gateway owns model work; daemon drops chat runtime, tools, memory and curators\n- refactor(archiegateway): own package for the Gateway service\n- fix(services): services wait for peers instead of exiting; restarted broker keeps its endpoint\n- refactor(archieplaybooks): fold archie-playbooks into archied playbooks lint|serve\n- refactor(agentrun): agent stage contract moves to the domain layer\n- refactor(agentexec): model loop moves to agentexec/modelloop\n- fix(configuration): bindings encryption keys must use the env engine\n- feat(storepkg): fetch packages from any registry, plain HTTP on loopback only\n- feat(webui): install, accept and enable extensions from the dashboard\n- feat(presence): every service re-stamps a presence record in the State Store\n- refactor(plugin): delete Yaegi daemon plugins and plugin_dir\n- refactor(module): the log action is built in; delete the module loader and reconciler\n- refactor(skill): delete Yaegi skill scripts and the run_go_script tool\n- refactor(examples): the firewall workflow moves to archipelago\n- feat(presence): services card on the status page and archied status\n- feat(archiemessaging): verify update reports against archied's presence and restore release announcements\n- fix(configuration): an overlay stands in for a missing config file; dev overlay is complete\n- feat(access): edit org, workspace and object policies from the dashboard; refuse owner lockout\n- feat(access): instance network rules at the capture receiver; policies reload without a restart\n- feat(staterpc): attribute State Store calls to the calling service; policy audit records it\n- feat(controlplane): playbooks and agent profiles install from packages; the daemon reads eda-playbooks live\n- feat(forgeext): forge surface served by extensions; forge.type names the installed package\n- refactor(forge): github and gitea leave core; webhooks parse in the forge extension\n- feat(staterpc): the State Store derives org and actor from the principal archie-ui forwards\n- feat(channelext): chat channels served by extensions; messaging runs the enabled ones\n- refactor(channels): webhook and email run only as extensions; their channel settings go\n- feat(skills): skill packages project into a skills resource the gateway reads live\n- fix(gatewayrpc): sender_id and rate_limited cross the chat wire\n- fix(controlplane): change history names kinds and reads only the caller's org\n- feat(contracts)!: requests no longer name their org; the State Store derives it from the caller\n- feat(identity): personal API tokens, created and revoked from the dashboard, act as their owner\n- fix(archieui): a sign-in provider outage is a health issue, not a startup failure\n- feat(staterpc): one run credential per task, kept in the State Store, authorizes its store calls and its push\n- fix(forgerpc): forge calls need the run credential and reach only the run's own repository\n- feat(controlplane): identity credential grants edited from the dashboard and applied live\n- feat(daemon): a workflow that names an identity runs asLine truncated
},
{
"version": "1.46.0",
+61 -13
View File
@@ -89,8 +89,8 @@ fi
mkdir -p "${ARCHIE_CONFIG_DIR}" "${ARCHIE_DATA_DIR}" "${ARCHIE_BIN_DIR}"
# 2. Binaries. STAGE ends up holding the binaries, release.json, the updater
# scripts and docker-compose.yml, whichever way they were obtained.
# 2. Binaries. STAGE ends up holding the binaries, release.json and the
# updater scripts, whichever way they were obtained.
TMP="$(mktemp -d)"
trap 'rm -rf "${TMP}"' EXIT
@@ -111,7 +111,7 @@ if [ "${FROM_SOURCE}" = true ]; then
for cmd in $(jq -er '.required_topology.units | join(" ")' "${SRC_DIR}/release.json"); do
(cd "${SRC_DIR}" && go build -ldflags "${LDFLAGS}" -o "${STAGE}/${cmd}" "./cmd/${cmd}")
done
cp "${SRC_DIR}/release.json" "${SRC_DIR}/docker-compose.yml" "${SRC_DIR}"/scripts/archie-update-* "${STAGE}/"
cp "${SRC_DIR}/release.json" "${SRC_DIR}"/scripts/archie-update-* "${STAGE}/"
else
if [ -z "${VERSION}" ]; then
tag="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p')"
@@ -138,7 +138,6 @@ for cmd in ${TOPOLOGY_UNITS}; do
install -m755 "${STAGE}/${cmd}" "${ARCHIE_BIN_DIR}/${cmd}"
done
install -m755 "${STAGE}"/archie-update-* "${ARCHIE_BIN_DIR}/"
install -m644 "${STAGE}/docker-compose.yml" "${ARCHIE_DATA_DIR}/docker-compose.yml"
echo " Installed ${TOPOLOGY_UNITS} and the updater to ${ARCHIE_BIN_DIR}/"
# 3. Configuration. archied setup asks every question and writes config.toml
@@ -161,17 +160,66 @@ else
echo " [SKIP] ${ARCHIE_CONFIG_DIR}/config.toml already exists. Re-run 'archied setup' to change it."
fi
# 4. PostgreSQL. Every service fails closed without it. The default database_url is
# the Compose postgres service, so start it when the config still uses it.
if ! grep -qE '@127\.0\.0\.1:5432/archie' "${ARCHIE_CONFIG_DIR}/config.toml"; then
# 4. PostgreSQL. Every service fails closed without it. The bundled database
# has no network at all: the services reach it through its Unix socket,
# mounted at PG_SOCKET_DIR, so it publishes no port and cannot collide with
# another PostgreSQL. Its password is the PGPASSWORD setup generated.
PG_SOCKET_DIR="${ARCHIE_DATA_DIR}/postgres"
PG_COMPOSE="${ARCHIE_DATA_DIR}/postgres.yml"
if ! grep -qF "host=${PG_SOCKET_DIR}" "${ARCHIE_CONFIG_DIR}/config.toml"; then
echo " [OK] Using the PostgreSQL server named by database_url."
elif command -v docker &>/dev/null && [ -f "${ARCHIE_DATA_DIR}/docker-compose.yml" ]; then
echo "==> Starting PostgreSQL 18 (docker compose up -d postgres)..."
touch "${ENV_FILE}" && chmod 600 "${ENV_FILE}"
docker compose --env-file "${ENV_FILE}" -f "${ARCHIE_DATA_DIR}/docker-compose.yml" up -d postgres ||
echo " [WARN] Could not start PostgreSQL. Start it before the services, or point database_url at your own PostgreSQL 18."
elif ! command -v docker &>/dev/null; then
echo " [WARN] Docker not found: the bundled PostgreSQL needs it. Install Docker, or run 'archied setup' with your own PostgreSQL 18 URL." >&2
AUTO_START=false
else
echo " [WARN] Docker not found: point database_url in ${ARCHIE_CONFIG_DIR}/config.toml at a PostgreSQL 18 server before starting the services."
echo "==> Starting the bundled PostgreSQL 18..."
mkdir -p "${PG_SOCKET_DIR}"
cat >"${PG_COMPOSE}" <<'EOF'
services:
postgres:
image: postgres:18
network_mode: none
environment:
POSTGRES_USER: archie
POSTGRES_PASSWORD: ${PGPASSWORD:-}
POSTGRES_DB: archie
POSTGRES_INITDB_ARGS: --auth-local=scram-sha-256
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- pg_data:/var/lib/postgresql/data
# :z relabels the directory for SELinux hosts.
- ./postgres:/var/run/postgresql:z
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U archie -d archie"]
interval: 5s
timeout: 5s
retries: 10
volumes:
pg_data:
EOF
if ! docker compose -p archie --env-file "${ENV_FILE}" -f "${PG_COMPOSE}" up -d --wait; then
echo " [WARN] The bundled PostgreSQL did not start, so the services are installed but not started." >&2
echo " Check: docker compose -p archie -f ${PG_COMPOSE} logs" >&2
AUTO_START=false
fi
fi
# Extensions run in an unprivileged user namespace. Ubuntu 23.10+ forbids
# those unless an AppArmor profile allows them, and only root can add one, so
# print the profile that allows it for these binaries alone.
if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)" = 1 ]; then
echo " [WARN] This host restricts user namespaces, so extensions will not start until you run:" >&2
cat >&2 <<EOF
sudo tee /etc/apparmor.d/archie >/dev/null <<'PROFILE'
abi <abi/4.0>,
include <tunables/global>
profile archie ${ARCHIE_BIN_DIR}/archie{d,-*} flags=(unconfined) {
userns,
}
PROFILE
sudo apparmor_parser -r /etc/apparmor.d/archie
EOF
fi
# 5. Systemd user service setup & linger configuration
+4 -17
View File
@@ -17,6 +17,7 @@ import (
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
"github.com/samcharles93/archie-core/internal/installtype"
"github.com/samcharles93/archie-core/internal/releaseupdate"
"github.com/samcharles93/archie-core/internal/tools"
@@ -95,23 +96,9 @@ func componentInstallTypeEnricher(nats config.NATSConfig) func(string) (string,
}
}
func makeUpdateService(s chatSetup) *releaseupdate.Service {
cfg := s.Cfg.Get()
if len(cfg.Chat.Telegram.UpdateCheckCommand) == 0 {
return nil
}
updates := &releaseupdate.Service{
Catalog: releaseupdate.CommandCatalog{Command: cfg.Chat.Telegram.UpdateCheckCommand},
StatePath: filepath.Join(cfg.WorkDir, "telegram-update-deferrals.json"),
InstallType: installtype.Type(),
Enrich: componentInstallTypeEnricher(cfg.NATS),
}
if len(cfg.Chat.Telegram.UpdateInstallCommand) != 0 {
updates.Installer = releaseupdate.CommandInstaller{
Command: cfg.Chat.Telegram.UpdateInstallCommand,
HealthURL: cfg.Health.URL(),
}
}
func makeUpdateService(reader controlplanerpc.ResourceReader, cfg config.Config) *releaseupdate.Service {
updates := controlplanerpc.UpdateService(reader, filepath.Join(cfg.WorkDir, "telegram-update-deferrals.json"), cfg.Health.URL())
updates.Enrich = componentInstallTypeEnricher(cfg.NATS)
return updates
}
@@ -86,7 +86,7 @@ func (b *server) setupChatRuntime(ctx context.Context, cfg config.Config, actor
},
cancelExecution: b.stateStore.CancelExecution,
})
b.updateService = makeUpdateService(chatSetup{Cfg: config.NewHolder(cfg)})
b.updateService = makeUpdateService(b.controlPlane, cfg)
return nil
}
+4
View File
@@ -19,6 +19,7 @@ import (
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/infrastructure/messagingrpc"
"github.com/samcharles93/archie-core/internal/releaseupdate"
"github.com/samcharles93/archie-core/internal/sdnotify"
"github.com/samcharles93/archie-core/internal/secret"
)
@@ -43,6 +44,9 @@ type deps struct {
// SettingsSource enables live channel-settings reconciliation. Nil disables
// it.
SettingsSource chatSettingsSource
// Updates serves /update from the stored update settings. Nil without a
// State Store.
Updates *releaseupdate.Service
// ApplyReporter records what this process applied. Nil reports nothing.
ApplyReporter *applystatus.Reporter
// AppliedVersion is the channel-settings version already running when the
+5
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"log/slog"
"net"
"path/filepath"
"google.golang.org/grpc"
@@ -20,6 +21,7 @@ import (
"github.com/samcharles93/archie-core/internal/infrastructure/messagingrpc"
"github.com/samcharles93/archie-core/internal/infrastructure/secretengine"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
"github.com/samcharles93/archie-core/internal/releaseupdate"
"github.com/samcharles93/archie-core/internal/secret"
)
@@ -52,6 +54,7 @@ func Run(ctx context.Context, o Options) error {
var settingsSource chatSettingsSource
var applyReporter *applystatus.Reporter
var appliedVersion int64
var updates *releaseupdate.Service
var extensionChannels []*channelInstance
if cfg.Options.StateStore.Target != "" {
stateStore, closeClient, dialErr := staterpc.Dial(cfg.Options.StateStore.Target, presence.Messaging, cfg.Options.StateStore.Token, staterpc.WaitForPeer)
@@ -81,6 +84,7 @@ func Run(ctx context.Context, o Options) error {
settings = messaging.NewSettingsCommand(messagingControlPlane{client: stateStore.ControlPlane()}).WithIdentities(stateStore)
channelStatusStore, presenceStore = stateStore, stateStore
settingsSource, applyReporter, appliedVersion = controlPlaneClient, reporter, channelVersion
updates = controlplanerpc.UpdateService(controlPlaneClient, filepath.Join(cfg.WorkDir, "telegram-update-deferrals.json"), cfg.HealthURL)
}
if cfg.Options.StateStore.Target == "" {
@@ -101,6 +105,7 @@ func Run(ctx context.Context, o Options) error {
SettingsSource: settingsSource,
ApplyReporter: applyReporter,
AppliedVersion: appliedVersion,
Updates: updates,
})
if err != nil {
return err
@@ -14,7 +14,6 @@ import (
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/presence"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/installtype"
"github.com/samcharles93/archie-core/internal/releaseannounce"
"github.com/samcharles93/archie-core/internal/releaseupdate"
"github.com/samcharles93/archie-core/internal/secret"
@@ -28,8 +27,8 @@ func configureTelegram(ctx context.Context, g *telegram.Gateway, cfg ResolvedCon
g.Reload = telegramReloader(cfg.Options, d.Secrets, d.Log)
g.RunningVersions = runningVersions(ctx, d.Presence, cfg.Options.DependencyTimeout)
if updates := updateService(cfg); updates != nil {
g.Updates = updates
if d.Updates != nil {
g.Updates = d.Updates
}
if cfg.WorkDir != "" {
g.UpdateReportPath = identityStatePath(cfg.WorkDir, "update-report", cfg.BotUser)
@@ -91,26 +90,6 @@ func gatewayVersionReporter(ctx context.Context, chat messaging.ChatContract, ti
}
}
// updateService builds /update from [chat.telegram] commands, or nil when
// none are configured.
func updateService(cfg ResolvedConfig) *releaseupdate.Service {
if len(cfg.Telegram.UpdateCheckCommand) == 0 {
return nil
}
updates := &releaseupdate.Service{
Catalog: releaseupdate.CommandCatalog{Command: cfg.Telegram.UpdateCheckCommand},
StatePath: filepath.Join(cfg.WorkDir, "telegram-update-deferrals.json"),
InstallType: installtype.Type(),
}
if len(cfg.Telegram.UpdateInstallCommand) != 0 {
updates.Installer = releaseupdate.CommandInstaller{
Command: cfg.Telegram.UpdateInstallCommand,
HealthURL: cfg.HealthURL,
}
}
return updates
}
// telegramReloader re-resolves the token and allowlist from this service's own
// configuration on /restart. A reload that cannot produce a token is refused so
// the running bot keeps the credential it is already authenticated with.
+3 -1
View File
@@ -17,6 +17,7 @@ import (
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
"github.com/samcharles93/archie-core/internal/infrastructure/captureintake"
"github.com/samcharles93/archie-core/internal/infrastructure/gatewayrpc"
"github.com/samcharles93/archie-core/internal/releaseupdate"
"github.com/samcharles93/archie-core/internal/webhookguard"
"github.com/samcharles93/archie-core/internal/webui"
)
@@ -29,6 +30,7 @@ type deps struct {
Log *slog.Logger
Store storecontract.TaskStore
Chat messaging.ChatContract
Updates *releaseupdate.Service
Health *health.Registry
ControlPlane controlpb.ControlPlaneServiceClient
Identities identity.Repository
@@ -107,7 +109,7 @@ func compose(d deps) *webui.Server {
srv.EventTypes = eventTypes
}
if d.Chat != nil {
srv.Chat = &webui.ChatService{Contract: d.Chat}
srv.Chat = &webui.ChatService{Contract: d.Chat, Updates: d.Updates}
}
wireCatalog(d, srv)
// The policy chain: wired together or not at all.
+4
View File
@@ -8,6 +8,7 @@ import (
"net"
"net/http"
"os"
"path/filepath"
"slices"
"time"
@@ -18,6 +19,8 @@ import (
"github.com/samcharles93/archie-core/internal/domain/applystatus"
"github.com/samcharles93/archie-core/internal/domain/presence"
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
"github.com/samcharles93/archie-core/internal/infrastructure/gatewayrpc"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
"github.com/samcharles93/archie-core/internal/webui"
@@ -87,6 +90,7 @@ func Run(ctx context.Context, options Options) error {
Log: log,
Store: tasks,
Chat: chat,
Updates: controlplanerpc.UpdateService(controlplanerpc.NewRPCClient(tasks.ControlPlane()), filepath.Join(configuration.DefaultWorkDir(), "ui-update-deferrals.json"), ""),
Health: newReadinessRegistry(opts, tasks, chat, chain, provider),
ControlPlane: tasks.ControlPlane(),
Identities: tasks,
@@ -9,6 +9,7 @@ import (
"github.com/samcharles93/archie-core/internal/domain/workintake"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
"github.com/samcharles93/archie-core/internal/releaseupdate"
)
const (
@@ -18,6 +19,7 @@ const (
PluginSettingsKind = "plugin-settings"
ContainerRuntimePoliciesKind = "container-runtime-policies"
ExtensionSettingsKind = controlplanerpc.ExtensionSettingsKind
UpdateSettingsKind = controlplanerpc.UpdateSettingsKind
)
type schedulingPolicy struct {
@@ -59,6 +61,8 @@ func operationalDefinitions() []Definition {
{Kind: ExtensionSettingsKind, Title: "Extension settings", ApplyMode: "live", Document: controlplanerpc.ExtensionSettings{}, Seed: func(config.Config) any { return controlplanerpc.ExtensionSettings{} }, Validate: validateExtensions},
// Live: the container pool reads these on every acquire and the dispatcher
// is resized on publish.
// Live: every check and install reads the channel afresh.
{Kind: UpdateSettingsKind, Title: "Update settings", ApplyMode: "live", Document: controlplanerpc.UpdateSettings{}, Seed: func(config.Config) any { return controlplanerpc.UpdateSettings{Channel: "stable"} }, Validate: validateUpdateSettings},
{Kind: ContainerRuntimePoliciesKind, Title: "Container runtime policies", ApplyMode: "live", Document: containerRuntimePolicies{}, Seed: seedContainerPolicies, Validate: validateContainers, Normalize: normalizeContainerPolicies},
}
}
@@ -119,3 +123,10 @@ func validateScheduling(input []byte) error {
return nil
})
}
// validateUpdateSettings refuses a channel the update scripts cannot select.
func validateUpdateSettings(input []byte) error {
return validateAs(input, func(doc controlplanerpc.UpdateSettings) error {
return releaseupdate.ValidateChannel(doc.Channel, doc.Pin)
})
}
-7
View File
@@ -534,8 +534,6 @@ func (c Config) Clone() Config {
c.Identities = cloneIdentities(c.Identities)
c.Chat.Models = append([]string(nil), c.Chat.Models...)
c.Chat.Telegram.AllowedUserIDs = append([]int64(nil), c.Chat.Telegram.AllowedUserIDs...)
c.Chat.Telegram.UpdateCheckCommand = append([]string(nil), c.Chat.Telegram.UpdateCheckCommand...)
c.Chat.Telegram.UpdateInstallCommand = append([]string(nil), c.Chat.Telegram.UpdateInstallCommand...)
c.Bindings.PreviousEncryptionKeys = append([]SecretRef(nil), c.Bindings.PreviousEncryptionKeys...)
c.Tools.MCPServers = cloneMCPServers(c.Tools.MCPServers)
// Services is a map of structs, so the header is shared by the value copy
@@ -918,11 +916,6 @@ type TelegramConfig struct {
// Token references the bot token from @BotFather through the configured
// secret engine. Empty disables the Telegram channel.
Token SecretRef `toml:"token" yaml:"token"`
// UpdateCheckCommand writes a releaseupdate.Snapshot JSON document to
// stdout. UpdateInstallCommand applies an already-approved update. Both
// are argv arrays, never shell snippets.
UpdateCheckCommand []string `toml:"update_check_command" yaml:"update_check_command"`
UpdateInstallCommand []string `toml:"update_install_command" yaml:"update_install_command"`
}
// Notify configures outbound notifications (n8n webhook → email etc.).
@@ -161,6 +161,12 @@ func DefaultWorkDir() string {
return filepath.Join(xdgDataHome(), "archie", "work")
}
// DefaultPostgresSocketDir is where the bundled PostgreSQL's Unix socket is
// mounted on the host.
func DefaultPostgresSocketDir() string {
return filepath.Join(xdgDataHome(), "archie", "postgres")
}
// DefaultConfigDir returns the directory archie's configuration lives in:
// $XDG_CONFIG_HOME/archie, or ~/.config/archie. It is the base every
// config-home-derived path is built on. It is not the -config source
@@ -10,6 +10,7 @@ import (
"strings"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration/tomlwrite"
)
@@ -144,9 +145,9 @@ func RunParams(ctx context.Context, p Prompter, discovery ModelDiscovery, secret
}
// stepDatabase returns the PostgreSQL URL. A blank answer on a fresh install
// means the bundled Compose database with a generated password. The password
// goes only to the env file as PGPASSWORD, which pgx and Compose both read, so
// config.toml holds no secret.
// means the bundled database: no network, reached through its Unix socket, with
// a generated password that goes only to the env file as PGPASSWORD, which pgx
// and Compose both read, so config.toml holds no secret.
func stepDatabase(ctx context.Context, p Prompter, secrets SecretSink, existing, param string) (string, error) {
if strings.TrimSpace(param) != "" {
return param, nil
@@ -170,5 +171,5 @@ func stepDatabase(ctx context.Context, p Prompter, secrets SecretSink, existing,
if err := secrets.Put("env", "PGPASSWORD", password); err != nil {
return "", fmt.Errorf("setup: store database password: %w", err)
}
return "postgres://archie@127.0.0.1:5432/archie?sslmode=disable", nil
return "postgres://archie@/archie?host=" + configuration.DefaultPostgresSocketDir(), nil
}
@@ -80,11 +80,10 @@ func RuntimeChatConfigFrom(ctx context.Context, reader ResourceReader, base conf
if err := json.Unmarshal(value, &settings); err != nil {
return err
}
check, install := base.Telegram.UpdateCheckCommand, base.Telegram.UpdateInstallCommand
out = config.ChatConfig{
Operator: settings.Operator, ShowToolCalls: settings.ShowToolCalls, MaxSteps: settings.MaxSteps,
Models: settings.Models,
Telegram: config.TelegramConfig{AllowedUserIDs: settings.Telegram.AllowedUserIDs, Token: settings.Telegram.Token, UpdateCheckCommand: check, UpdateInstallCommand: install},
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,
}
@@ -2,11 +2,14 @@ package controlplanerpc
import (
"bytes"
"context"
"encoding/json"
"fmt"
"time"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/installtype"
"github.com/samcharles93/archie-core/internal/releaseupdate"
)
// ChannelSettings is the channel-settings resource document, with
@@ -105,3 +108,33 @@ func (d *ChannelDuration) UnmarshalJSON(data []byte) error {
*d = ChannelDuration(nanos)
return nil
}
// UpdateSettingsKind holds which releases the update scripts select.
const UpdateSettingsKind = "update-settings"
// UpdateSettings is the update-settings document.
type UpdateSettings struct {
Channel string `json:"channel" title:"Release channel" doc:"stable, next (includes prereleases) or exact-pin."`
Pin string `json:"pin" title:"Pinned version" doc:"The version exact-pin installs."`
}
// UpdateService runs the stored update commands, reading them on every call.
// statePath keeps each recipient's deferrals; healthURL reaches the installer.
func UpdateService(reader ResourceReader, statePath, healthURL string) *releaseupdate.Service {
commands := releaseupdate.SettingsCommands{Load: updateCommands(reader), HealthURL: healthURL}
return &releaseupdate.Service{Catalog: commands, Installer: commands, StatePath: statePath, InstallType: installtype.Type()}
}
// updateCommands reads the update-settings resource. An unstored kind is the
// stable channel.
func updateCommands(reader ResourceReader) func(context.Context) (releaseupdate.Commands, error) {
return func(ctx context.Context) (releaseupdate.Commands, error) {
settings := UpdateSettings{Channel: "stable"}
if _, _, err := reader.Query(ctx, UpdateSettingsKind, func(value []byte) error {
return json.Unmarshal(value, &settings)
}); err != nil {
return releaseupdate.Commands{}, err
}
return releaseupdate.ScriptCommands(settings.Channel, settings.Pin), nil
}
}
+14 -5
View File
@@ -8,19 +8,28 @@ import (
"golang.org/x/mod/semver"
)
// ValidateChannel refuses an unknown channel, and an exact pin that is not a
// semantic version.
func ValidateChannel(channel, pin string) error {
if channel != "stable" && channel != "next" && channel != "exact-pin" {
return fmt.Errorf("unknown release channel %q", channel)
}
if channel == "exact-pin" && !semver.IsValid("v"+strings.TrimPrefix(pin, "v")) {
return fmt.Errorf("exact-pin requires a semantic version")
}
return nil
}
// SelectRelease compares release versions, never git-describe strings. Exact
// pins still have to exist in the catalog; a pin cannot invent a release.
func SelectRelease(tags []string, channel, pin string) (string, error) {
if channel == "" {
channel = "stable"
}
if channel != "stable" && channel != "next" && channel != "exact-pin" {
return "", fmt.Errorf("unknown release channel %q", channel)
if err := ValidateChannel(channel, pin); err != nil {
return "", err
}
pin = strings.TrimPrefix(pin, "v")
if channel == "exact-pin" && !semver.IsValid("v"+pin) {
return "", fmt.Errorf("exact-pin requires a semantic version")
}
fullVersion := regexp.MustCompile(`^v[0-9]+\.[0-9]+\.[0-9]+([+-].*)?$`)
newest := ""
for _, tag := range tags {
+74 -6
View File
@@ -5,8 +5,11 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
)
@@ -20,9 +23,8 @@ const updateResultSentinel = "ARCHIE_UPDATE_RESULT "
// argv command. It never invokes a shell; deployment tooling remains an
// administrator-owned adapter.
type CommandCatalog struct {
Command []string
ReleaseChannel string
Pin string
Command []string
Env []string
}
func (c CommandCatalog) Check(ctx context.Context) (Snapshot, error) {
@@ -30,9 +32,7 @@ func (c CommandCatalog) Check(ctx context.Context) (Snapshot, error) {
return Snapshot{}, fmt.Errorf("update check command is empty")
}
cmd := exec.CommandContext(ctx, c.Command[0], c.Command[1:]...)
if c.ReleaseChannel != "" {
cmd.Env = append(cmd.Environ(), "ARCHIE_UPDATE_RELEASE_CHANNEL="+c.ReleaseChannel, "ARCHIE_UPDATE_PIN="+c.Pin)
}
cmd.Env = append(cmd.Environ(), c.Env...)
output, err := cmd.Output()
if err != nil {
return Snapshot{}, fmt.Errorf("run update check: %w", err)
@@ -133,3 +133,71 @@ func componentVersions(snapshot Snapshot) map[string]Component {
}
return versions
}
// ErrNotConfigured is returned when the step's command is unset.
var ErrNotConfigured = errors.New("updates are not configured")
// Commands is what a deployment runs to check for and install updates. Env
// is added to the check's environment.
type Commands struct {
Check []string
Install []string
Env []string
}
// ScriptCommands runs the update scripts a release installs beside this
// binary, selecting releases from channel. Only these scripts ever run, so a
// setting cannot name an arbitrary program. A missing script is unset.
func ScriptCommands(channel, pin string) Commands {
exe, err := os.Executable()
if err != nil {
return Commands{}
}
script := func(name string) []string {
path := filepath.Join(filepath.Dir(exe), name)
if info, err := os.Stat(path); err != nil || info.Mode()&0o111 == 0 {
return nil
}
return []string{path}
}
return Commands{
Check: script("archie-update-check"),
Install: script("archie-update-install"),
Env: []string{"ARCHIE_UPDATE_RELEASE_CHANNEL=" + channel, "ARCHIE_UPDATE_PIN=" + pin},
}
}
// SettingsCommands is both Catalog and Installer. It loads Commands on every
// call so an edited setting applies without a restart.
type SettingsCommands struct {
Load func(context.Context) (Commands, error)
HealthURL string
}
func (s SettingsCommands) Check(ctx context.Context) (Snapshot, error) {
commands, err := s.Load(ctx)
if err != nil {
return Snapshot{}, err
}
if len(commands.Check) == 0 {
return Snapshot{}, ErrNotConfigured
}
return CommandCatalog{Command: commands.Check, Env: commands.Env}.Check(ctx)
}
func (s SettingsCommands) Install(ctx context.Context, snapshot Snapshot, meta InstallMeta, progress func(string)) (Result, error) {
commands, err := s.Load(ctx)
if err != nil {
return Result{}, err
}
if len(commands.Install) == 0 {
return Result{}, ErrNotConfigured
}
return CommandInstaller{Command: commands.Install, HealthURL: s.HealthURL}.Install(ctx, snapshot, meta, progress)
}
// Installable reports whether an install command is set.
func (s SettingsCommands) Installable(ctx context.Context) bool {
commands, err := s.Load(ctx)
return err == nil && len(commands.Install) != 0
}
+11 -1
View File
@@ -204,7 +204,17 @@ func (s *Service) Install(ctx context.Context, snapshot Snapshot, meta InstallMe
return s.Installer.Install(installCtx, snapshot, meta, progress)
}
func (s *Service) CanInstall() bool { return s != nil && s.Installer != nil }
func (s *Service) CanInstall() bool {
if s == nil || s.Installer == nil {
return false
}
if installer, ok := s.Installer.(interface{ Installable(context.Context) bool }); ok {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
return installer.Installable(ctx)
}
return true
}
type deferrals map[string]map[string]string
+13 -2
View File
@@ -3,6 +3,7 @@ package webui
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"reflect"
@@ -506,6 +507,16 @@ func (s *Server) handleChatPersona(w http.ResponseWriter, r *http.Request) {
writeJSON(w, map[string]any{"ok": true, "name": strings.ToLower(req.Name)})
}
// writeUpdateCheckError answers an unset check command as not configured, which
// the dashboard shows as such rather than as a failure.
func writeUpdateCheckError(w http.ResponseWriter, err error) {
if errors.Is(err, releaseupdate.ErrNotConfigured) {
http.Error(w, "updates are not configured", http.StatusNotImplemented)
return
}
http.Error(w, err.Error(), http.StatusBadGateway)
}
func (s *Server) handleChatUpdate(w http.ResponseWriter, r *http.Request) {
chat, ok := s.chatReady(w)
if !ok {
@@ -517,7 +528,7 @@ func (s *Server) handleChatUpdate(w http.ResponseWriter, r *http.Request) {
}
snapshot, err := chat.Updates.Check(r.Context(), 0)
if err != nil {
http.Error(w, err.Error(), http.StatusBadGateway)
writeUpdateCheckError(w, err)
return
}
writeJSON(w, map[string]any{
@@ -564,7 +575,7 @@ func (s *Server) handleChatUpdateInstall(w http.ResponseWriter, r *http.Request)
}
fresh, err := chat.Updates.Check(r.Context(), 0)
if err != nil {
http.Error(w, err.Error(), http.StatusBadGateway)
writeUpdateCheckError(w, err)
return
}
if !releaseupdate.SameAvailable(fresh, req.Snapshot) {
+1 -1
View File
@@ -71,7 +71,7 @@ func (s *Server) handleVersion(w http.ResponseWriter, r *http.Request) {
}
snapshot, err := s.Chat.Updates.Check(r.Context(), 0)
if err != nil {
http.Error(w, err.Error(), http.StatusBadGateway)
writeUpdateCheckError(w, err)
return
}
running := map[string]string{}
+8
View File
@@ -15,6 +15,14 @@ SOURCE_URL="${ARCHIE_SOURCE_URL:-https://github.com/samcharles93/archie-core.git
BIN_DIR="${ARCHIE_BIN_DIR:-$HOME/.local/bin}"
CONFIG_PATH="${ARCHIE_CONFIG_PATH:-${XDG_CONFIG_HOME:-$HOME/.config}/archie/config.toml}"
export PATH="/usr/local/go/bin:$PATH"
# The units load this file; a run from a shell needs it too, for PGPASSWORD.
ENV_FILE="$(dirname "$CONFIG_PATH")/env"
if [ -r "$ENV_FILE" ]; then
set -a
# shellcheck disable=SC1090
. "$ENV_FILE"
set +a
fi
# State for the managed image, independent of archied's daemon build stamp.
AGENT_VERSION_FILE="${ARCHIE_AGENT_VERSION_FILE:-$BIN_DIR/archie-agent.version}"
+1 -1
View File
@@ -93,7 +93,7 @@ archied_dirs() {
printf '%s\n' "cmd/archied" "Dockerfile.archied" "cmd/archie-ui" "internal/app/archieui" \
"Taskfile.yml" ".github/workflows/deploy.yml" "install.sh" \
"scripts/archie-update-install" "scripts/archie-update-check" \
"scripts/archie-update-watchdog" "deployments/INSTRUCTIONS.md" "docker-compose.yml"
"scripts/archie-update-watchdog" "deployments/INSTRUCTIONS.md"
}
# The UI Service ships with the archied release on purpose (archie-ui shares
+15 -15
View File
@@ -2,23 +2,23 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HarnessPage.js"
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),E=e=>w(e)===`[object Object]`,D=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,O=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,ne=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),re=/\B([A-Z])/g,ie=ee(e=>e.replace(re,`-$1`).toLowerCase()),ae=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),oe=ee(e=>e?`on${ae(e)}`:``),k=(e,t)=>!Object.is(e,t),se=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ce=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},le=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ue=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},de,fe=()=>de||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},pe=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function me(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?ve(r):me(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var he=/;(?![^(]*\))/g,ge=/:([^]+)/,_e=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function ve(e){let t={};return e.replace(_e,e=>e.startsWith(`/*`)?``:e).split(he).forEach(e=>{if(e){let n=e.split(ge);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function A(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=A(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function ye(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=A(t)),n&&(e.style=me(n)),e}var be=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,xe=n(be);be+``;function Se(e){return!!e||e===``}function Ce(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=De(e[i],t[i],n);return r}function we(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&De(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function Te(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?we(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!De(e[r],t[r],n))return!1}return String(e)===String(t)}function Ee(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function De(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Ee(e,t,n,Ce):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Ee(e,t,n,Te):String(e)===String(t))))}function Oe(e,t){return e.findIndex(e=>De(e,t))}var ke=e=>!!(e&&e.__v_isRef===!0),j=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?ke(e)?j(e.value):JSON.stringify(e,Ae,2):String(e),Ae=(e,t)=>ke(t)?Ae(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[je(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>je(e))}:b(t)?je(t):x(t)&&!p(t)&&!E(t)?String(t):t,je=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function Me(e){return e==null?`initial`:typeof Line truncated
`&&(e.tagName===`PRE`||e.tagName===`TEXTAREA`)&&(n=n.slice(1));let{textContent:r}=e;r!==n&&r!==n.replace(/\r\n|\r/g,`
`)&&(pi(e,0)||ri(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!O(a)||a[0]===`.`||t&&!O(a)||u&&u.includes(a)){if(ui(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&$t(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&us(x,n,t),h&&lr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Ho(()=>{x&&us(x,n,t),l&&g.enter(e),h&&lr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=ss(d[t]),g=h.type===Wo;e?(g&&!u&&t+1<p&&ss(d[t+1]).type===Wo&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,pi(r,1)||ri()),n(null,h,r,null,o,s,oi(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&si(f)&&f.data===`]`?a(t.anchor=f):(ri(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(hi(e,t)||ri(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,oi(d),s),r&&(r.vnode.el=t.el,eo(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&si(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var li=new Set([`src`,`srcset`,`href`,`poster`]);function ui(e,t,n){return li.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var di=`data-allow-mismatch`,fi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function pi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(di);)e=e.parentElement;return mi(e&&e.getAttribute(di),t)}function mi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(fi[t])}}function hi(e,t){return pi(e.parentElement,1)||gi(e)||_i(t)}function gi(e){return e.nodeType===1&&mi(e.getAttribute(di),1)}function _i({props:e}){let t=e&&e[di];return typeof t==`string`&&mi(t,1)}var vi=fe().requestIdleCallback||(e=>setTimeout(e,1)),yi=fe().cancelIdleCallback||(e=>clearTimeout(e)),bi=(e=1e4)=>t=>{let n=vi(t,{timeout:e});return()=>yi(n)};function xi(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Si=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(xi(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Ci=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},wi=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Ti(e,t){if(si(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(si(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Ei=e=>!!e.type.__asyncLoader;function Di(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return I({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Ti(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=ms;if(Xr(e),u)return()=>Oi(u,e);let t=t=>{l=null,Rn(t,e,13,!r)};if(s&&e.suspense||xs)return p().then(t=>()=>Oi(t,e)).catch(e=>(t(e),()=>r?W(r,{error:e}):null));let a=M(!1),c=M(),d=M(!!i),f,m;return Gi(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&ki(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Oi(u,e);if(c.value&&r)return W(r,{error:c.value});if(n&&!d Line truncated
`))),e[Sl]=yl(i);let a=r||i.props&&i.props.type===`number`;Bc(e,t?`change`:`input`,t=>{t.target.composing||e[Sl](wl(e.value,n,a))}),(n||a)&&Bc(e,`change`,()=>{e.value=wl(e.value,n,a)}),t||(Bc(e,`compositionstart`,bl),Bc(e,`compositionend`,xl),Bc(e,`change`,xl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Cl];delete e[Cl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Sl](wl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Sl]=yl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?le(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},El={deep:!0,created(e,t,n){e[Sl]=yl(n),Bc(e,`change`,()=>{let t=e._modelValue,n=jl(e),r=e.checked,i=e[Sl];if(p(t)){let e=Oe(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Ml(e,r))})},mounted:Dl,beforeUpdate(e,t,n){e[Sl]=yl(n),Dl(e,t,n)}};function Dl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=Oe(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=De(t,Ml(e,!0))}e.checked!==i&&(e.checked=i)}var Ol={created(e,{value:t},n){e.checked=De(t,n.props.value),e[Sl]=yl(n),Bc(e,`change`,()=>{e[Sl](jl(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Sl]=yl(r),t!==n&&(e.checked=De(t,r.props.value))}},kl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Bc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?le(jl(e)):jl(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Sl](i)}finally{qn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Sl]=yl(r)},mounted(e,{value:t}){Al(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Sl]=yl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!yee(t,n[1],n[0]))&&Al(e,t)}};function yee(e,t,n){if(!n||p(e))return De(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Al(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=jl(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Oe(t,o)>-1}else a.selected=t.has(o)}else if(De(jl(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function jl(e){return`_value`in e?e._value:e.value}function Ml(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Nl={created(e,t,n){Fl(e,t,n,null,`created`)},mounted(e,t,n){Fl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){Fl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){Fl(e,t,n,r,`updated`)}};function Pl(e,t){switch(e){case`SELECT`:return kl;case`TEXTAREA`:return Tl;default:switch(t){case`checkbox`:return El;case`radio`:return Ol;default:return Tl}}}function Fl(e,t,n,r,i){let a=Pl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function bee(){Tl.getSSRProps=({value:e})=>({value:e}),Ol.getSSRProps=({value:e},t)=>{if(t.props&&De(t.props.value,e))return{checked:!0}},El.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&Oe(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Nl.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Pl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var xee=[`ctrl`,`shift`,`alt`,`meta`],See={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>xee.some(n=>e[`${n}Key`]&&!t.includes(n))},Il=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=See[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Cee={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Ll=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ie(n.key);if(t.some(e=>e===r||Cee[e]===r))return e(n)}))},Rl=l({patchProp:Qc},Qs),zl,Bl=!1;function Vl(){return zl||=xo(Rl)}function Hl(){return zl=Bl?zl:So(Rl),Bl=!0,zl}var Ul=((...e)=>{Vl().render(...e)}),Wl=((...e)=>{Hl().hydrate(...e)}),Gl=((...e)=>{let t=Vl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Jl(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,ql(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a}, Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Mp;function Np(e){Mp=e}var Pp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Fp(e){let t=e instanceof Pp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Ip(e,t){let n=await fetch(e,t);if(Mp?.(n.status===401),!n.ok)throw new Pp(await jp(n),n.status);return n}async function Lp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=kp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Ip(e,s);return a?await c.json():void 0}var X={health:()=>Lp(`/health/detailed`),services:()=>Lp(`/api/services`),policies:()=>Lp(`/api/access/policies`),putPolicy:e=>Lp(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Lp(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>Lp(`/api/orgs`),orgCreate:e=>Lp(`/api/orgs`,{method:`POST`,body:e}),org:e=>Lp(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>Lp(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>Lp(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgMembers:e=>Lp(`/api/orgs/${encodeURIComponent(e)}/members`),setOrgMember:(e,t,n)=>Lp(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>Lp(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Ap({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>Lp(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),summary:()=>Lp(`/api/summary`),tasks:()=>Lp(`/api/tasks`),taskPage:async e=>{let t=await Ip(`/api/tasks`+Ap(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(kp)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>Lp(`/api/task-meta`),task:e=>Lp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Lp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Lp(`/api/tasks/${encodeURIComponent(e)}/changes`+Ap(t)),taskDebug:(e,t)=>Lp(`/api/tasks/${encodeURIComponent(e)}/debug`+Ap(t)),taskAction:(e,t,n)=>Lp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Lp(`/api/setup`),capabilities:()=>Lp(`/api/capabilities`),workflows:()=>Lp(`/api/workflows`),workflowEnabled:(e,t)=>Lp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Lp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Lp(`/api/skills`),channels:()=>Lp(`/api/channels`),curators:()=>Lp(`/api/curators`),channelReload:e=>Lp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Lp(`/api/config`),logs:e=>Lp(`/api/logs`+Ap(e)),taskLogs:(e,t)=>Lp(`/api/tasks/${encodeURIComponent(e)}/logs`+Ap(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Lp(`/api/version`),updateSnapshot:()=>Lp(`/api/chat/update`),updateInstall:e=>Lp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Lp(`/api/captures`+Ap({limit:e})),eventTypes:()=>Lp(`/api/event-types`),eventTypeCreate:e=>Lp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Lp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Lp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Lp(`/api/mappings`),mappingCreate:e=>Lp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Lp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Lp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Lp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Lp(`/api/bindings`),dispatches:(e,t)=>Lp(`/api/${e}/${encodeURIComponent(t)}/dispatches`),bindingCreate:e=>Lp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Lp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Lp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Lp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),bindingPause:e=>Lp(`/api/bindings/${encodeURIComponent(e)}/pause`,{method:`POST`}),bindingResume:e=>Lp(`/api/bindings/${encodeURIComponent(e)}/resume`,{method:`POST`}),harnessBindings:()=>Lp(`/api/harness/bindings`),sources:()=>Lp(`/api/sources`),sourceCreate:e=>Lp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Lp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Lp(`/api/sources/${encodeURIComponent(e)}/aLine truncated
`))),e[Sl]=yl(i);let a=r||i.props&&i.props.type===`number`;Bc(e,t?`change`:`input`,t=>{t.target.composing||e[Sl](wl(e.value,n,a))}),(n||a)&&Bc(e,`change`,()=>{e.value=wl(e.value,n,a)}),t||(Bc(e,`compositionstart`,bl),Bc(e,`compositionend`,xl),Bc(e,`change`,xl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Cl];delete e[Cl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Sl](wl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Sl]=yl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?le(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},El={deep:!0,created(e,t,n){e[Sl]=yl(n),Bc(e,`change`,()=>{let t=e._modelValue,n=jl(e),r=e.checked,i=e[Sl];if(p(t)){let e=Oe(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Ml(e,r))})},mounted:Dl,beforeUpdate(e,t,n){e[Sl]=yl(n),Dl(e,t,n)}};function Dl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=Oe(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=De(t,Ml(e,!0))}e.checked!==i&&(e.checked=i)}var Ol={created(e,{value:t},n){e.checked=De(t,n.props.value),e[Sl]=yl(n),Bc(e,`change`,()=>{e[Sl](jl(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Sl]=yl(r),t!==n&&(e.checked=De(t,r.props.value))}},kl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Bc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?le(jl(e)):jl(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Sl](i)}finally{qn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Sl]=yl(r)},mounted(e,{value:t}){Al(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Sl]=yl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!yee(t,n[1],n[0]))&&Al(e,t)}};function yee(e,t,n){if(!n||p(e))return De(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Al(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=jl(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Oe(t,o)>-1}else a.selected=t.has(o)}else if(De(jl(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function jl(e){return`_value`in e?e._value:e.value}function Ml(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Nl={created(e,t,n){Fl(e,t,n,null,`created`)},mounted(e,t,n){Fl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){Fl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){Fl(e,t,n,r,`updated`)}};function Pl(e,t){switch(e){case`SELECT`:return kl;case`TEXTAREA`:return Tl;default:switch(t){case`checkbox`:return El;case`radio`:return Ol;default:return Tl}}}function Fl(e,t,n,r,i){let a=Pl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function bee(){Tl.getSSRProps=({value:e})=>({value:e}),Ol.getSSRProps=({value:e},t)=>{if(t.props&&De(t.props.value,e))return{checked:!0}},El.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&Oe(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Nl.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Pl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var xee=[`ctrl`,`shift`,`alt`,`meta`],See={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>xee.some(n=>e[`${n}Key`]&&!t.includes(n))},Il=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=See[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Cee={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Ll=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ie(n.key);if(t.some(e=>e===r||Cee[e]===r))return e(n)}))},Rl=l({patchProp:Qc},Qs),zl,Bl=!1;function Vl(){return zl||=xo(Rl)}function Hl(){return zl=Bl?zl:So(Rl),Bl=!0,zl}var Ul=((...e)=>{Vl().render(...e)}),Wl=((...e)=>{Hl().hydrate(...e)}),Gl=((...e)=>{let t=Vl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Jl(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,ql(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a}, Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var jp;function Mp(e){jp=e}var Np=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Pp(e){let t=e instanceof Np?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Fp(e,t){let n=await fetch(e,t);if(jp?.(n.status===401),!n.ok)throw new Np(await Ap(n),n.status);return n}async function Ip(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Op,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Fp(e,s);return a?await c.json():void 0}var X={health:()=>Ip(`/health/detailed`),services:()=>Ip(`/api/services`),policies:()=>Ip(`/api/access/policies`),putPolicy:e=>Ip(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Ip(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>Ip(`/api/orgs`),orgCreate:e=>Ip(`/api/orgs`,{method:`POST`,body:e}),org:e=>Ip(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>Ip(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>Ip(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgMembers:e=>Ip(`/api/orgs/${encodeURIComponent(e)}/members`),setOrgMember:(e,t,n)=>Ip(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>Ip(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+kp({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>Ip(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),summary:()=>Ip(`/api/summary`),tasks:()=>Ip(`/api/tasks`),taskPage:async e=>{let t=await Fp(`/api/tasks`+kp(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Op)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>Ip(`/api/task-meta`),task:e=>Ip(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Ip(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Ip(`/api/tasks/${encodeURIComponent(e)}/changes`+kp(t)),taskDebug:(e,t)=>Ip(`/api/tasks/${encodeURIComponent(e)}/debug`+kp(t)),taskAction:(e,t,n)=>Ip(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Ip(`/api/setup`),capabilities:()=>Ip(`/api/capabilities`),workflows:()=>Ip(`/api/workflows`),workflowEnabled:(e,t)=>Ip(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Ip(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Ip(`/api/skills`),channels:()=>Ip(`/api/channels`),curators:()=>Ip(`/api/curators`),channelReload:e=>Ip(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Ip(`/api/config`),logs:e=>Ip(`/api/logs`+kp(e)),taskLogs:(e,t)=>Ip(`/api/tasks/${encodeURIComponent(e)}/logs`+kp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Ip(`/api/version`),updateSnapshot:()=>Ip(`/api/chat/update`),updateInstall:e=>Ip(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Ip(`/api/captures`+kp({limit:e})),eventTypes:()=>Ip(`/api/event-types`),eventTypeCreate:e=>Ip(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Ip(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Ip(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Ip(`/api/mappings`),mappingCreate:e=>Ip(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Ip(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Ip(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Ip(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Ip(`/api/bindings`),dispatches:(e,t)=>Ip(`/api/${e}/${encodeURIComponent(t)}/dispatches`),bindingCreate:e=>Ip(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Ip(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Ip(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Ip(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),bindingPause:e=>Ip(`/api/bindings/${encodeURIComponent(e)}/pause`,{method:`POST`}),bindingResume:e=>Ip(`/api/bindings/${encodeURIComponent(e)}/resume`,{method:`POST`}),harnessBindings:()=>Ip(`/api/harness/bindings`),sources:()=>Ip(`/api/sources`),sourceCreate:e=>Ip(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Ip(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Ip(`/api/sources/${encodeURIComponent(e)}/aLine truncated
`);u=r.pop()||``;for(let e of r){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&($p.value=n.session_id),n.type===`delta`&&(o+=n.text,im.value=im.value?{...im.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],im.value=im.value?{...im.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);em.value=[...em.value,{from:`assistant`,text:o,tool_calls:a}],im.value=null,nm.value=`Ready`,await ym()}catch(e){let t=e;t.name===`AbortError`&&!c?(im.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},nm.value=`Stopped`):(im.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Jp(r):void 0,isRetry:i},nm.value=`Error — retry available`)}finally{clearTimeout(l),_m=null,rm.value=!1}}function Mee(){nm.value=`Stopping…`,$p.value&&X.chatCancel($p.value).catch(()=>{}),vm()}function Nee(){Vi(()=>{ym().catch(e=>{nm.value=e.message||`Chat unavailable`})}),Gi(()=>{vm()})}var Pee=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Fee=I({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return Y(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(B(),V(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":N(Xp),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:A(r(!e.open))},[W(N(_d),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:A(r(e.open))},[W(N(qd),{size:22})],2)],8,Pee))}});function Tm(e){return typeof e==`string`?`'${e}'`:new Lee().serialize(e)}var Iee=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Em=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Iee.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Dm(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Em[n]?Em[n]:n+128,s=a<128&&Em[a]?Em[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Lee=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Dm(e,t):n===`number`&&r===`number`?e-t:Dm(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Dm),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`FloatLine truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Qp.value=n.session_id),n.type===`delta`&&(o+=n.text,rm.value=rm.value?{...rm.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],rm.value=rm.value?{...rm.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);$p.value=[...$p.value,{from:`assistant`,text:o,tool_calls:a}],rm.value=null,tm.value=`Ready`,await vm()}catch(e){let t=e;t.name===`AbortError`&&!c?(rm.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},tm.value=`Stopped`):(rm.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?qp(r):void 0,isRetry:i},tm.value=`Error — retry available`)}finally{clearTimeout(l),gm=null,nm.value=!1}}function Nee(){tm.value=`Stopping…`,Qp.value&&X.chatCancel(Qp.value).catch(()=>{}),_m()}function Pee(){Vi(()=>{vm().catch(e=>{tm.value=e.message||`Chat unavailable`})}),Gi(()=>{_m()})}var Fee=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Iee=I({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return Y(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(B(),V(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":N(Yp),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:A(r(!e.open))},[W(N(_d),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:A(r(e.open))},[W(N(qd),{size:22})],2)],8,Fee))}});function wm(e){return typeof e==`string`?`'${e}'`:new Ree().serialize(e)}var Lee=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Tm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Lee.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Em(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Tm[n]?Tm[n]:n+128,s=a<128&&Tm[a]?Tm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Ree=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Em(e,t):n===`number`&&r===`number`?e-t:Em(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Em),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`FloatLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?Fs(t.default({present:o.value})[0],{ref:e=>{let t=Zm(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),hg=I({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=ph(n.default()),r=e.findIndex(e=>e.type!==Go);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?q(t,i.props):t,o=as({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),gg=[`area`,`img`,`input`],_g=I({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&gg.includes(r)?()=>Fs(r,t):r===`template`?()=>Fs(hg,t,{default:n.default}):()=>Fs(e.as,t,{default:n.default})}});function vg(){let e=M();return{primitiveElement:e,currentElement:J(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Zm(e))}}var[yg,bg]=Mm(`CollapsibleRoot`),xg=I({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=fh(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=vn(r);return bg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Z(),(e,t)=>(B(),H(N(_g),{as:e.as,"as-child":r.asChild,"data-state":N(i)?`open`:`closed`,"data-disabled":N(a)?``:void 0},{default:P(()=>[R(e.$slots,`default`,{open:N(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Sg=I({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=yg();i.contentId||=ig(void 0,`reka-collapsible-content`);let a=M(),{forwardRef:o,currentElement:s}=Z(),c=M(0),l=M(0),u=J(()=>i.open.value),d=M(u.value),f=M();F(()=>[u.value,a.value?.present],async()=>{await qn();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=J(()=>d.value&&i.open.value);return Vi(()=>{requestAnimationFrame(()=>{d.value=!1})}),Qm(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(B(),H(N(mg),{ref_key:`presentRef`,ref:a,present:e.forceMount||N(i).open.value,"force-mount":!0},{default:P(({present:t})=>[W(N(_g),q(e.$attrs,{id:N(i).contentId,ref:N(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:N(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:N(i).open.value?`open`:`closed`,"data-disabled":N(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:P(()=>[!N(i).unmountOnHide.value||t?R(e.$slots,`default`,{key:0}):K(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Cg=I({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Z();let n=yg();return(e,r)=>(B(),H(N(_g),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":N(n).contentId,"aria-expanded":N(n).open.value,"data-state":N(n).open.value?`open`:`closed`,"data-disabled":N(n).disabled?.value?``:void 0,disabled:N(n).disabled?.value,onClick:N(n).onOpenToggle},{default:P(()=>[R(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function wg({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Tg({type:e,defaultValue:t,modelValue:n}){return e||wg({type:e,defaultValue:t,modelValue:n})}function Eg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Dg(e,t){let n=J(()=>Tg(e)),r=fh(e,`modelValue`,t,{defaultValue:Eg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Om(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Im(t,e)){let n=t.findIndex(t=>Om(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:J(()=>n.value===`single`)}}var[Og,kg]=Mm(`AccordionRoot`),Ag=I({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
`))}return()=>i.value||r.value||o.value?Fs(t.default({present:o.value})[0],{ref:e=>{let t=Xm(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),mg=I({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=fh(n.default()),r=e.findIndex(e=>e.type!==Go);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?q(t,i.props):t,o=as({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),hg=[`area`,`img`,`input`],gg=I({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&hg.includes(r)?()=>Fs(r,t):r===`template`?()=>Fs(mg,t,{default:n.default}):()=>Fs(e.as,t,{default:n.default})}});function _g(){let e=M();return{primitiveElement:e,currentElement:J(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:Xm(e))}}var[vg,yg]=jm(`CollapsibleRoot`),bg=I({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=dh(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=vn(r);return yg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Z(),(e,t)=>(B(),H(N(gg),{as:e.as,"as-child":r.asChild,"data-state":N(i)?`open`:`closed`,"data-disabled":N(a)?``:void 0},{default:P(()=>[R(e.$slots,`default`,{open:N(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),xg=I({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=vg();i.contentId||=rg(void 0,`reka-collapsible-content`);let a=M(),{forwardRef:o,currentElement:s}=Z(),c=M(0),l=M(0),u=J(()=>i.open.value),d=M(u.value),f=M();F(()=>[u.value,a.value?.present],async()=>{await qn();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=J(()=>d.value&&i.open.value);return Vi(()=>{requestAnimationFrame(()=>{d.value=!1})}),Zm(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(B(),H(N(pg),{ref_key:`presentRef`,ref:a,present:e.forceMount||N(i).open.value,"force-mount":!0},{default:P(({present:t})=>[W(N(gg),q(e.$attrs,{id:N(i).contentId,ref:N(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:N(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:N(i).open.value?`open`:`closed`,"data-disabled":N(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:P(()=>[!N(i).unmountOnHide.value||t?R(e.$slots,`default`,{key:0}):K(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Sg=I({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Z();let n=vg();return(e,r)=>(B(),H(N(gg),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":N(n).contentId,"aria-expanded":N(n).open.value,"data-state":N(n).open.value?`open`:`closed`,"data-disabled":N(n).disabled?.value?``:void 0,disabled:N(n).disabled?.value,onClick:N(n).onOpenToggle},{default:P(()=>[R(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Cg({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function wg({type:e,defaultValue:t,modelValue:n}){return e||Cg({type:e,defaultValue:t,modelValue:n})}function Tg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Eg(e,t){let n=J(()=>wg(e)),r=dh(e,`modelValue`,t,{defaultValue:Tg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Dm(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Fm(t,e)){let n=t.findIndex(t=>Dm(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:J(()=>n.value===`single`)}}var[Dg,Og]=jm(`AccordionRoot`),kg=I({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
- a positive number
- less than the value passed to \`max\` (or ${cS} if no \`max\` prop is set)
- less than the value passed to \`max\` (or ${sS} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`),null)}function pS(e){return dS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${cS}\`.`),cS)}var mS=I({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:cS},getValueLabel:{type:Function,required:!1,default:(e,t)=>dS(e)?`${Math.round(e/t*cS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Z();let i=fh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=fh(n,`max`,r,{passive:n.max===void 0});F(()=>i.value,async e=>{let t=fS(e,n.max);t!==e&&(await qn(),i.value=t)},{immediate:!0}),F(()=>n.max,e=>{let t=pS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=J(()=>Fm(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return uS({modelValue:i,max:a,progressState:o}),(e,t)=>(B(),H(N(_g),{"as-child":e.asChild,as:e.as,"aria-valuemax":N(a),"aria-valuemin":0,"aria-valuenow":dS(N(i))?N(i):void 0,"aria-valuetext":e.getValueText?.(N(i),N(a)),"aria-label":e.getValueLabel(N(i),N(a)),role:`progressbar`,"data-state":o.value,"data-value":N(i)??void 0,"data-max":N(a)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),hS=I({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=lS();return Z(),(e,r)=>(B(),H(N(_g),q(t,{"data-state":N(n).progressState.value,"data-value":N(n).modelValue?.value??void 0,"data-max":N(n).max.value}),{default:P(()=>[R(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),gS=`radio.select`;function _S(e,t,n){Pm(gS,n,{originalEvent:e,value:t})}var vS=I({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=fh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=vn(n),{forwardRef:o,currentElement:s}=Z(),c=Ih(s),l=zh(),u=J(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||_S(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(B(),V(z,null,[W(N(_g),q({id:e.id,ref:N(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":N(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":N(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:N(a),required:e.required,name:e.name},{...N(l),...e.$attrs},{onClick:Il(d,[`stop`])}),{default:P(()=>[R(e.$slots,`default`,{checked:N(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),N(c)&&e.name?(B(),H(N(K_),q({key:0,type:`radio`,tabindex:`-1`,value:N(a),checked:!!N(i),name:e.name,disabled:e.disabled,required:e.required},N(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):K(`v-if`,!0)],64))}}),[yS,bS]=Mm(`RadioGroupRoot`),xS=I({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Z(),o=fh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=vn(n),p=jh(f),m=Ih(a);return bS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(B(),H(N(Ob),{"as-child":``,orientation:N(l),dir:N(p),loop:N(c)},{default:P(()=>[W(N(_g),{ref:N(i),role:`radiogroup`,"data-disabled":N(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":N(l),"aria-required":N(d),dir:N(p)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(o)}),N(m)&&N(u)?(B(),H(N(K_),{key:0,required:N(d),disabled:N(s),value:N(o),name:N(u)},null,8,[`required`,`disabled`,`value`,`name`])):K(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Yee,SS]=Mm(`RadioGroupItem`),CS=I({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:HT(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>HT(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=UT(c),u=e+1<n.length?UT(n[e+1]):null;if(l&&u&&Dte(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=UT(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>HT(e)),rows:r.map(e=>e.map(e=>HT(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:HT(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:HT(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function UT(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function Dte(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Ote={class:`[overflow-wrap:anywhere]`},kte={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Ate={class:`font-mono text-[0.85em]`},jte={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Mte={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Nte={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Pte={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Fte={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Ite={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Lte={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Rte={key:8,class:`mb-2.5 last:mb-0`},zte=I({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>Ete(t.text));return(e,t)=>(B(),V(`div`,Ote,[(B(!0),V(z,null,L(n.value,(e,t)=>(B(),V(z,{key:t},[e.kind===`pre`?(B(),V(`pre`,kte,[U(`code`,Ate,j(e.code),1)])):e.kind===`table`?(B(),V(`table`,jte,[U(`thead`,null,[U(`tr`,null,[(B(!0),V(z,null,L(e.head,(e,t)=>(B(),V(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[W(VT,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(B(!0),V(z,null,L(e.rows,(e,t)=>(B(),V(`tr`,{key:t},[(B(!0),V(z,null,L(e,(e,t)=>(B(),V(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[W(VT,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(B(),V(`blockquote`,Mte,[W(VT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(B(),V(`h1`,Nte,[W(VT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(B(),V(`h2`,Pte,[W(VT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(B(),V(`h3`,Fte,[W(VT,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(B(),V(`ul`,Ite,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(VT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(B(),V(`ol`,Lte,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(VT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(B(),V(`p`,Rte,[W(VT,{inline:e.inline},null,8,[`inline`])])):K(``,!0)],64))),128))]))}}),Bte={class:`truncate`},Vte=I({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Qi(`RouterLink`);return B(),H(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:P(()=>[W(N(Gu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Bte,j(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Hte={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Ute={class:`font-semibold text-foreground`},Wte={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Gte=I({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=J(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=J(()=>t.tool.parameters||t.tool.Parameters||``),i=J(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=J(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(B(),H(Vte,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(B(),V(`div`,Hte,[W(N(Kd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Ute,j(n.value),1),r.value?(B(),V(`code`,Wte,j(r.value),1)):K(``,!0),U(`span`,{class:A(N(Y)(`text-fg-muted`,i.value&&`text-danger`))},j(a.value),3)]))}}),Kte={key:0,class:`mb-2 grid gap-0.5 text-xs`},qte={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Jte={key:3,class:`whitespace-pre-wrap`},WT=I({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(B(),V(`div`,{class:A([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:A(N(Y)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(B(),V(`div`,Kte,[(B(!0),V(z,null,L(e.tools,(t,n)=>(B(),H(Gte,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):K(``,!0),e.media.length?(B(),V(`div`,qte,[(B(!0),V(z,null,L(e.media,(e,t)=>(B(),H(vte,{key:t,attachment:e},null,8,[`attachment`]))),128))])):K(``,!0),e.assistant?(B(),H(zte,{key:2,text:e.text},null,8,[`text`])):(B(),V(`div`,Jte,j(e.text),1)),R(t.$slots,`default`)],2)],2))}}),Yte={class:`w-full self-center justify-self-center py-6 text-center`},Xte={class:`grid gap-2`},Zte=[`onCLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>MA?`${n.slice(0,MA).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var PA=[`title`],FA=I({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>aA(n.event)),a=J(()=>NA(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=J(()=>n.event.at?pk(n.event.at):`—`);return(e,t)=>(B(),H(N(kA),{class:A(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[Ll(Il(o,[`prevent`]),[`enter`]),Ll(Il(o,[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[G(j(n.event.kind||n.event.type||`event`),1)]),_:1}),W(N($),{class:`font-mono`},{default:P(()=>[G(j(i.value>0?`#${i.value}`:`—`),1)]),_:1}),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},j(a.value.text),9,PA)]),_:1}),W(N($),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),IA=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function LA(e){return(Number(e?.task_id)||0)>0}function RA(e,t){return t===`tasks`?LA(e):t!==`system`||!LA(e)}function zA(e,t){return e.filter(e=>RA(e,t))}function BA(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function VA(e,t){return`${e}:${t??0}`}function HA(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=VA(NA(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var UA={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},WA={class:`max-h-[28rem] overflow-y-auto`},GA=[`aria-expanded`,`aria-label`,`onClick`],KA=[`title`],qA=I({__name:`LiveActivityCard`,setup(e){let t=aE(),{activity:n,streamKind:r,streamState:i}=Au(hO()),a=M(`all`),o=J(()=>zA(n.value,a.value)),s=J(()=>BA(o.value.length,a.value)),c=Jt(new Set),l=J(()=>HA(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return NA(e.representative)}function p(e){return e.representative.at?pk(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(B(),H(N(ok),null,{default:P(()=>[W(N(dk),null,{default:P(()=>[W(N(fk),null,{default:P(()=>[...t[1]||=[G(`Live activity`,-1)]]),_:1}),W(N(sk),{class:`flex items-center gap-2`},{default:P(()=>[W(N(TA),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:N(IA)},null,8,[`modelValue`,`options`]),W(N(rk),{variant:N(r)},{default:P(()=>[G(j(N(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),W(N(ck),null,{default:P(()=>[U(`div`,UA,[U(`div`,WA,[W(N(DA),null,{default:P(()=>[W(N(jA),{class:`sticky top-0 z-10 bg-card`},{default:P(()=>[W(N(kA),null,{default:P(()=>[W(N(AA),null,{default:P(()=>[...t[2]||=[G(`Event`,-1)]]),_:1}),W(N(AA),null,{default:P(()=>[...t[3]||=[G(`Task`,-1)]]),_:1}),W(N(AA),null,{default:P(()=>[...t[4]||=[G(`Detail`,-1)]]),_:1}),W(N(AA),null,{default:P(()=>[...t[5]||=[G(`When`,-1)]]),_:1})]),_:1})]),_:1}),W(N(OA),null,{default:P(()=>[o.value.length?K(``,!0):(B(),H(N(kA),{key:0},{default:P(()=>[W(N($),{colspan:`4`},{default:P(()=>[W(N(YO),null,{default:P(()=>[W(N(QO),null,{default:P(()=>[W(N(tk),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(B(!0),V(z,{key:1},L(l.value,e=>(B(),V(z,{key:e.key},[e.count===1?(B(),H(FA,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(B(),V(z,{key:1},[W(N(kA),{class:A(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[Ll(Il(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Ll(Il(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[U(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Il(t=>u(e.key),[`stop`])},[d(e)?(B(),H(N(Qu),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(B(),H(N($u),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),G(` `+j(e.label)+` `,1),W(N(rk),{variant:`idle`},{default:P(()=>[G(`×`+j(e.count),1)]),_:2},1024)],8,GA)]),_:2},1024),W(N($),{class:`font-mono`},{default:P(()=>[G(j(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},j(f(e).text),9,KA)]),_:2},1024),W(N($),null,{default:P(()=>[G(j(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(B(!0),V(z,{key:0},L(e.events,(t,n)=>(B(),H(FA,{key:`${e.key}:${n}`,event:t,onO Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function mM(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function hM(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function gM(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function _M(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var vM=M([]),yM=M([]),bM=M(!0),xM=M(null),SM=M(null),CM=M(!1),wM=M(null);async function TM(){try{let e=await X.eventTypes();bM.value=e.enabled!==!1,vM.value=e.event_types||[],yM.value=e.proposals||[],xM.value=null}catch(e){xM.value=e.message||String(e)}}function EM(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function DM(e){wM.value=null,SM.value=e}function OM(e){let t=IM.value.find(t=>String(t.id)===e.sample_id);DM({mode:`proposal`,id:null,source:e.source,name:``,rule:EM(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function kM(e=``){DM({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function AM(e){DM({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:EM(e.rule),headersText:``,body:``,exampleHeaders:{}})}function jM(){SM.value=null}async function MM(){let e=SM.value;if(e){CM.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:_M(e.rule)});else{let t=e.mode===`paste`?pM(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:_M(e.rule),example:{headers:t,body:e.body}})}SM.value=null,await TM()}catch(e){wM.value=e.message||String(e)}finally{CM.value=!1}}}var NM=M(null);async function PM(){let e=NM.value;if(NM.value=null,e)try{await X.eventTypeDelete(e.id),await TM()}catch(e){xM.value=e.message||String(e)}}var FM=100,IM=M([]),LM=M(!0),RM=M(null),zM=M(!0),BM=M(null);async function VM(){try{let e=await X.captures(FM);LM.value=e.enabled!==!1,IM.value=e.captures||[],RM.value=null}catch(e){RM.value=e.message||String(e)}finally{zM.value=!1}}function HM(e){let t=IM.value.find(t=>t.id===e);return t&&(BM.value=t),!!t}function UM(){IM.value.length&&(BM.value=IM.value[0])}function WM(){gO(`captures`,()=>{VM(),TM()})}var GM=`archie.theme`,KM=`archie.density`,qM=`archie.motion`,JM=`archie.tooltips`;function YM(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function XM(e,t){try{localStorage.setItem(e,t)}catch{}}function ZM(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var QM=ku(`appearance`,()=>{let e=M(YM(GM,[`system`,`dark`,`light`],`dark`)),t=M(YM(KM,[`comfortable`,`compact`],`comfortable`)),n=M(YM(qM,[`system`,`reduced`],`system`)),r=M(YM(JM,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=ZM(e.value)}function o(t){e.value=t,a(),XM(GM,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,XM(KM,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,XM(qM,e)}function l(e){r.value=e,XM(JM,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),$M=I({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=Rh(n,t),{tooltipsEnabled:i}=Au(QM());return(e,t)=>(B(),H(N(RC),q({"data-slot":`tooltip`},N(r),{disabled:n.disabled||!N(i)}),{default:P(t=>[R(e.$slots,`default`,ye(is(t)))]),_:3},16,[`disabled`]))}}),eN=I({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=Rh(iw(n,`class`),r);return(e,t)=>(B(),H(N(HC),null,{default:P( Line truncated
Defaulting to \`null\`.`),null)}function fS(e){return uS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${sS}\`.`),sS)}var pS=I({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:sS},getValueLabel:{type:Function,required:!1,default:(e,t)=>uS(e)?`${Math.round(e/t*sS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Z();let i=dh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=dh(n,`max`,r,{passive:n.max===void 0});F(()=>i.value,async e=>{let t=dS(e,n.max);t!==e&&(await qn(),i.value=t)},{immediate:!0}),F(()=>n.max,e=>{let t=fS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=J(()=>Pm(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return lS({modelValue:i,max:a,progressState:o}),(e,t)=>(B(),H(N(gg),{"as-child":e.asChild,as:e.as,"aria-valuemax":N(a),"aria-valuemin":0,"aria-valuenow":uS(N(i))?N(i):void 0,"aria-valuetext":e.getValueText?.(N(i),N(a)),"aria-label":e.getValueLabel(N(i),N(a)),role:`progressbar`,"data-state":o.value,"data-value":N(i)??void 0,"data-max":N(a)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),mS=I({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=cS();return Z(),(e,r)=>(B(),H(N(gg),q(t,{"data-state":N(n).progressState.value,"data-value":N(n).modelValue?.value??void 0,"data-max":N(n).max.value}),{default:P(()=>[R(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),hS=`radio.select`;function gS(e,t,n){Nm(hS,n,{originalEvent:e,value:t})}var _S=I({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=dh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=vn(n),{forwardRef:o,currentElement:s}=Z(),c=Fh(s),l=Rh(),u=J(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||gS(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(B(),V(z,null,[W(N(gg),q({id:e.id,ref:N(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":N(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":N(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:N(a),required:e.required,name:e.name},{...N(l),...e.$attrs},{onClick:Il(d,[`stop`])}),{default:P(()=>[R(e.$slots,`default`,{checked:N(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),N(c)&&e.name?(B(),H(N(G_),q({key:0,type:`radio`,tabindex:`-1`,value:N(a),checked:!!N(i),name:e.name,disabled:e.disabled,required:e.required},N(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):K(`v-if`,!0)],64))}}),[vS,yS]=jm(`RadioGroupRoot`),bS=I({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Z(),o=dh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=vn(n),p=Ah(f),m=Fh(a);return yS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(B(),H(N(Db),{"as-child":``,orientation:N(l),dir:N(p),loop:N(c)},{default:P(()=>[W(N(gg),{ref:N(i),role:`radiogroup`,"data-disabled":N(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":N(l),"aria-required":N(d),dir:N(p)},{default:P(()=>[R(e.$slots,`default`,{modelValue:N(o)}),N(m)&&N(u)?(B(),H(N(G_),{key:0,required:N(d),disabled:N(s),value:N(o),name:N(u)},null,8,[`required`,`disabled`,`value`,`name`])):K(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Xee,xS]=jm(`RadioGroupItem`),SS=I({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:VT(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>VT(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=HT(c),u=e+1<n.length?HT(n[e+1]):null;if(l&&u&&Ote(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=HT(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>VT(e)),rows:r.map(e=>e.map(e=>VT(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:VT(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:VT(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function HT(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function Ote(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var kte={class:`[overflow-wrap:anywhere]`},Ate={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},jte={class:`font-mono text-[0.85em]`},Mte={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Nte={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Pte={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Fte={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Ite={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Lte={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Rte={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},zte={key:8,class:`mb-2.5 last:mb-0`},Bte=I({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>Dte(t.text));return(e,t)=>(B(),V(`div`,kte,[(B(!0),V(z,null,L(n.value,(e,t)=>(B(),V(z,{key:t},[e.kind===`pre`?(B(),V(`pre`,Ate,[U(`code`,jte,j(e.code),1)])):e.kind===`table`?(B(),V(`table`,Mte,[U(`thead`,null,[U(`tr`,null,[(B(!0),V(z,null,L(e.head,(e,t)=>(B(),V(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[W(BT,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(B(!0),V(z,null,L(e.rows,(e,t)=>(B(),V(`tr`,{key:t},[(B(!0),V(z,null,L(e,(e,t)=>(B(),V(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[W(BT,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(B(),V(`blockquote`,Nte,[W(BT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(B(),V(`h1`,Pte,[W(BT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(B(),V(`h2`,Fte,[W(BT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(B(),V(`h3`,Ite,[W(BT,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(B(),V(`ul`,Lte,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(BT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(B(),V(`ol`,Rte,[(B(!0),V(z,null,L(e.items,(e,t)=>(B(),V(`li`,{key:t},[W(BT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(B(),V(`p`,zte,[W(BT,{inline:e.inline},null,8,[`inline`])])):K(``,!0)],64))),128))]))}}),Vte={class:`truncate`},Hte=I({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Qi(`RouterLink`);return B(),H(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:P(()=>[W(N(Gu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Vte,j(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Ute={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Wte={class:`font-semibold text-foreground`},Gte={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Kte=I({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=J(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=J(()=>t.tool.parameters||t.tool.Parameters||``),i=J(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=J(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(B(),H(Hte,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(B(),V(`div`,Ute,[W(N(Kd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Wte,j(n.value),1),r.value?(B(),V(`code`,Gte,j(r.value),1)):K(``,!0),U(`span`,{class:A(N(Y)(`text-fg-muted`,i.value&&`text-danger`))},j(a.value),3)]))}}),qte={key:0,class:`mb-2 grid gap-0.5 text-xs`},Jte={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Yte={key:3,class:`whitespace-pre-wrap`},UT=I({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(B(),V(`div`,{class:A([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:A(N(Y)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(B(),V(`div`,qte,[(B(!0),V(z,null,L(e.tools,(t,n)=>(B(),H(Kte,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):K(``,!0),e.media.length?(B(),V(`div`,Jte,[(B(!0),V(z,null,L(e.media,(e,t)=>(B(),H(yte,{key:t,attachment:e},null,8,[`attachment`]))),128))])):K(``,!0),e.assistant?(B(),H(Bte,{key:2,text:e.text},null,8,[`text`])):(B(),V(`div`,Yte,j(e.text),1)),R(t.$slots,`default`)],2)],2))}}),Xte={class:`w-full self-center justify-self-center py-6 text-center`},Zte={class:`grid gap-2`},Qte=[`onCLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>jA?`${n.slice(0,jA).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var NA=[`title`],PA=I({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>iA(n.event)),a=J(()=>MA(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=J(()=>n.event.at?fk(n.event.at):`—`);return(e,t)=>(B(),H(N(OA),{class:A(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[Ll(Il(o,[`prevent`]),[`enter`]),Ll(Il(o,[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[G(j(n.event.kind||n.event.type||`event`),1)]),_:1}),W(N($),{class:`font-mono`},{default:P(()=>[G(j(i.value>0?`#${i.value}`:`—`),1)]),_:1}),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},j(a.value.text),9,NA)]),_:1}),W(N($),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),FA=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function IA(e){return(Number(e?.task_id)||0)>0}function LA(e,t){return t===`tasks`?IA(e):t!==`system`||!IA(e)}function RA(e,t){return e.filter(e=>LA(e,t))}function zA(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function BA(e,t){return`${e}:${t??0}`}function VA(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=BA(MA(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var HA={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},UA={class:`max-h-[28rem] overflow-y-auto`},WA=[`aria-expanded`,`aria-label`,`onClick`],GA=[`title`],KA=I({__name:`LiveActivityCard`,setup(e){let t=iE(),{activity:n,streamKind:r,streamState:i}=Au(mO()),a=M(`all`),o=J(()=>RA(n.value,a.value)),s=J(()=>zA(o.value.length,a.value)),c=Jt(new Set),l=J(()=>VA(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return MA(e.representative)}function p(e){return e.representative.at?fk(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(B(),H(N(ak),null,{default:P(()=>[W(N(uk),null,{default:P(()=>[W(N(dk),null,{default:P(()=>[...t[1]||=[G(`Live activity`,-1)]]),_:1}),W(N(ok),{class:`flex items-center gap-2`},{default:P(()=>[W(N(wA),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:N(FA)},null,8,[`modelValue`,`options`]),W(N(nk),{variant:N(r)},{default:P(()=>[G(j(N(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),W(N(sk),null,{default:P(()=>[U(`div`,HA,[U(`div`,UA,[W(N(EA),null,{default:P(()=>[W(N(AA),{class:`sticky top-0 z-10 bg-card`},{default:P(()=>[W(N(OA),null,{default:P(()=>[W(N(kA),null,{default:P(()=>[...t[2]||=[G(`Event`,-1)]]),_:1}),W(N(kA),null,{default:P(()=>[...t[3]||=[G(`Task`,-1)]]),_:1}),W(N(kA),null,{default:P(()=>[...t[4]||=[G(`Detail`,-1)]]),_:1}),W(N(kA),null,{default:P(()=>[...t[5]||=[G(`When`,-1)]]),_:1})]),_:1})]),_:1}),W(N(DA),null,{default:P(()=>[o.value.length?K(``,!0):(B(),H(N(OA),{key:0},{default:P(()=>[W(N($),{colspan:`4`},{default:P(()=>[W(N(JO),null,{default:P(()=>[W(N(ZO),null,{default:P(()=>[W(N(ek),null,{default:P(()=>[G(j(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(B(!0),V(z,{key:1},L(l.value,e=>(B(),V(z,{key:e.key},[e.count===1?(B(),H(PA,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(B(),V(z,{key:1},[W(N(OA),{class:A(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[Ll(Il(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Ll(Il(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:P(()=>[W(N($),{class:`font-medium`},{default:P(()=>[U(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:Il(t=>u(e.key),[`stop`])},[d(e)?(B(),H(N(Qu),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(B(),H(N($u),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),G(` `+j(e.label)+` `,1),W(N(nk),{variant:`idle`},{default:P(()=>[G(`×`+j(e.count),1)]),_:2},1024)],8,WA)]),_:2},1024),W(N($),{class:`font-mono`},{default:P(()=>[G(j(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),W(N($),{class:`w-[55%] max-w-0`},{default:P(()=>[U(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},j(f(e).text),9,GA)]),_:2},1024),W(N($),null,{default:P(()=>[G(j(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(B(!0),V(z,{key:0},L(e.events,(t,n)=>(B(),H(PA,{key:`${e.key}:${n}`,event:t,onO Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function pM(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function mM(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function hM(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function gM(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var _M=M([]),vM=M([]),yM=M(!0),bM=M(null),xM=M(null),SM=M(!1),CM=M(null);async function wM(){try{let e=await X.eventTypes();yM.value=e.enabled!==!1,_M.value=e.event_types||[],vM.value=e.proposals||[],bM.value=null}catch(e){bM.value=e.message||String(e)}}function TM(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function EM(e){CM.value=null,xM.value=e}function DM(e){let t=FM.value.find(t=>String(t.id)===e.sample_id);EM({mode:`proposal`,id:null,source:e.source,name:``,rule:TM(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function OM(e=``){EM({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function kM(e){EM({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:TM(e.rule),headersText:``,body:``,exampleHeaders:{}})}function AM(){xM.value=null}async function jM(){let e=xM.value;if(e){SM.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:gM(e.rule)});else{let t=e.mode===`paste`?fM(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:gM(e.rule),example:{headers:t,body:e.body}})}xM.value=null,await wM()}catch(e){CM.value=e.message||String(e)}finally{SM.value=!1}}}var MM=M(null);async function NM(){let e=MM.value;if(MM.value=null,e)try{await X.eventTypeDelete(e.id),await wM()}catch(e){bM.value=e.message||String(e)}}var PM=100,FM=M([]),IM=M(!0),LM=M(null),RM=M(!0),zM=M(null);async function BM(){try{let e=await X.captures(PM);IM.value=e.enabled!==!1,FM.value=e.captures||[],LM.value=null}catch(e){LM.value=e.message||String(e)}finally{RM.value=!1}}function VM(e){let t=FM.value.find(t=>t.id===e);return t&&(zM.value=t),!!t}function HM(){FM.value.length&&(zM.value=FM.value[0])}function UM(){hO(`captures`,()=>{BM(),wM()})}var WM={key:0,class:`text-xs text-fg-muted`},GM={key:1,class:`flex flex-col gap-1 text-xs`},KM={key:1},qM={key:2,class:`text-xs text-fg-muted`},JM=I({__name:`DispatchLinks`,props:{kind:{},id:{}},setup(e){let t=e,n=M([]),r=M(!1);F(()=>[t.kind,t.id],async()=>{r.value=!1;try{n.value=await X.dispatches(t.kind,t.id)}catch{n.value=[],r.value=!0}},{immediate:!0});let i=e=>({path:`/events`,query:{tab:`inspector`,capture:e}});return(e,a)=>{let o=Qi(`RouterLink`);return r.value?(B(),V(`p`,WM,`Dispatches unavailable.`)):n.value.length?(B(),V(`ul`,GM,[(B(!0),V(z,null,L(n.value,e=>(B(),V(`li`,{key:e.binding_id+e.capture_id,class:`flex flex-wrap items-center gap-x-2 font-mono text-fg-muted`},[t.kind===`bindings`?K(``,!0):(B(),H(o,{key:0,to:{path:`/events`,query:{tab:`bindings`}},class:`hover:text-foreground`},{default:P(()=>[G(`binding `+j(e.binding_id.slice(0,8))+` v`+j(e.binding_version),1)]),_:2},1024)),t.kind===`captures`?K(``,!0):(B(),H(o,{key:1,to:i(e.capture_id),class:`hover:text-foreground`},{default:P(()=>[G(`capture `+j(e.capture_id.slice(0,8)),1)]),_:2},1032,[`to`])),t.kind===`tasks`?K(``,!0):(B(),V(z,{key:2},[e.task_id?(B(),H(o,{key:0,to:`/tasks/${e.task_id}`,class:`text-foreground hover:underline`},{default:P(()=>[G(`task #`+j(e.task_id),1)]),_:2},1032,[`to`])):(B(),V(`span`,KM,j(e.reason||`claimed, no task recorded`),1))],64)),U(`span`,null,j(N(fk)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?K(``,!0):(B(),V(`p`,qM,` No dispatches yet. `))}}}),YM=I({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(B(),H(N(pd),{role:`status`,"aria-label":`Loading`,class:A(N(Y)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}});function XM(e,t){return t?e.filter(e=>e.event_type_id===t):[]}function ZM(e){return(e?.repository??`required`)!==`none`}function QM(e,t){return e.filter(e=>t===`any`||e.type===`any`||e.type===t)}function $M(e,t){switch(t){case`string`:return e;case`number`:return e.trim()!==``&&!Number.isNaN(Number(e))?Number(e):e;case`bool`:return e===`true`||e!==`false`&&e;default:try{return JSON.parse(e)}catch{return e}}}var eN={pending_approval:`pending approval`,armed:`armed`,paused:`paused`},tN={pending_approval:`warn`,armed:`ok`,paused:`idle`};function nN(e) Line truncated
`)}};CJ.defaultYaml={explicit:!1,version:`1.2`},CJ.defaultTags={"!!":`tag:yaml.org,2002:`};function wJ(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function TJ(e){let t=new Set;return gJ(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function EJ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function DJ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=TJ(e);let a=EJ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(cJ(t.node)||uJ(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function OJ(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=OJ(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=OJ(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=OJ(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=OJ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function kJ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>kJ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!fJ(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var AJ=class{constructor(e){Object.defineProperty(this,rJ,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!aJ(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=kJ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?OJ(i,{"":o},``,o):o}},jJ=class extends AJ{constructor(e){super(Zq),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],gJ(e,{Node:(e,t)=>{(iJ(t)||fJ(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(kJ(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=MJ(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(wJ(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function MJ(e,t,n){if(iJ(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(uJ(t)){let r=0;for(let i of t.items){let t=MJ(e,i,n);t>r&&(r=t)}return r}if(sJ(t)){let r=MJ(e,t.key,n),i=MJ(e,t.value,n);return Math.max(r,i)}return 1}var NJ=e=>!e||typeof e!=`function`&&typeof e!=`object`,PJ=class extends AJ{constructor(e){super(tJ),this.value=e}toJSON(e,t){return t?.keep?this.value:kJ(this.value,e,t)}toString(){return String(this.value)}};PJ.BLOCK_FOLDED=`BLOCK_FOLDED`,PJ.BLOCK_LITERAL=`BLOCK_LITERAL`,PJ.PLAIN=`PLAIN`,PJ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,PJ.QUOTE_SINGLE=`QUOTE_SINGLE`;var FJ=`tag:yaml.org,2002:`;function IJ(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function LJ(e,t,n){if(aJ(e)&&(e=e.contents),dJ(e))return e;if(sJ(e)){let t=n.schema[$q].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new jJ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=FJ+t.slice(2));let l=IJ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new PJ(e);return c&&(c.node=t),t Line truncated
`)?HJ(n,t):n.includes(`
`)?`
@@ -126,14 +126,14 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`).find(e=>e.trim())?.trim()}}function $Z(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(YZ)].map(e=>e[1]))]}function eQ(e){let t=BZ(e).toJS(),n=XZ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=`start`;r.push({id:s,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let c=[s],l=1,u=new Map,d=e=>{let t=u.get(e)??0;return u.set(e,t+1),t},f=(e,t,n,i,s,c,l)=>{let u=XZ(e)?e:{},f=typeof u.type==`string`?u.type:``,p=XZ(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`,g=s?`${s}/${m||f}`:m||f;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||JZ(f),type:f,detail:ZZ(f,p),summary:QZ(p),when:typeof u.when==`string`?u.when:void 0,retry:XZ(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,stage:g,occurrence:d(g),...c?{resume:c}:{}}}),m&&a.set(m,h);for(let e of $Z(u.settings,u.when))o.push({from:e,to:h});return h},p=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){if(XZ(t)&&XZ(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i=[],a=0;n.forEach(([t,o],s)=>{let u=(s-(n.length-1)/2)*KZ,d=c,m=c;(Array.isArray(o)?o:[]).forEach((i,o)=>{let c=f(i,`${e+1}-${t}-${o+1}`,u,(l+o)*GZ,t,r,[`steps`,e,`parallel`,t,o]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],a=Math.max(a,o+1)}),i.push(...d)}),c=i,l+=Math.max(a,1);continue}let n=f(t,String(e+1),0,l*GZ,void 0,void 0,[`steps`,e]);p(c,n,e-1),c=[n],l++}r.push({id:`add-end`,type:`add`,position:{x:104,y:l*GZ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``}}),p(c,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var tQ={agent:Ju,command:Fd,repo:ud,gate:Md,forge:vd,human:Hd,review:cd,workflow:Gd},nQ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function rQ(e){return tQ[e.split(`.`)[0]]??Gd}function iQ(e){return Object.keys(nQ).map(t=>({title:nQ[t],icon:tQ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function aQ(e,t){let n=BZ(e).getIn(t,!0);if(oJ(n))return n.toJSON()}function oQ(e,t,n){let r=BZ(e);return r.setIn(t,r.createNode(fQ(n))),r.toString()}function sQ(e,t,n){let r=BZ(e),i=r.get(`steps`,!0);if(lJ(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!lJ(i))return{source:e,path:[]};let a=Math.min(Math.max(t+1,0),i.items.length);return i.items.splice(a,0,r.createNode({type:n})),{source:r.toString(),path:[`steps`,a]}}function cQ(e,t){let n=BZ(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!lJ(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return oJ(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function lQ(e,t){let n=BZ(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);lJ(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function uQ(e,t,n){let r=BZ(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!lJ(i)||typeof a!=`number`)return{source:e,path:t};let o=a+n;if(o<0||o>=i.items.length)return{source:e,path:t};let[s]=i.items.splice(a,1);return i.items.splice(o,0,s),{source:r.toString(),path:[...t.slice(0,-1),o]}}function dQ(e,t){let n=BZ(e).toJS(),r=Array.isArray(n?.steps)?n.steps:[],i=typeof t[1]==`number`?t[1]:r.length,a=[],o=e=>{if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id==`string`&&a.push(t.id),typeof t.parallel==`object`&&t.parallel!==null)for(let e of Object.values(t.parallel))Array.isArray(e)&&e.forEach(o)};if(r.slice(0,i).forEach(o),t.length===5){let e=r[i]?.parallel?.[t[3]];Array.isArray(e)&&e.slice(0,t[4]).forEach(o)}return a}function fQ(e){if(Array.isArray(e))return e.map(fQ);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){if(r===void 0||r===``||r===null)continue;let e=fQ(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function pQ(e,t){let n=BZ(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():BZ(e).get(t)}function mQ(e,t,n){let r=BZ(e),i=fQ({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function hQ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function gQ(e,t=[]){let n=BZ(e),r=n.errors[0];if(r)return{ok:!1,message:AQ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!jQ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};le Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:EQ(e)}))}var wQ=/^(\s*)(-\s+)?/,TQ=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function EQ(e){let{code:t,comment:n}=DQ(e),r=OQ(t);return n&&r.push({text:n,kind:`comment`}),r}function DQ(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&(t=``);continue}if(r===`"`||r===`'`){t=r;continue}if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function OQ(e){if(!e)return[];let t=[],n=wQ.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=TQ.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...kQ(i[4]??``)]):[...t,...kQ(r)]}function kQ(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function AQ(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function jQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function MQ(e){return typeof e==`string`&&e.trim()!==``}var NQ={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},PQ={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},FQ={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},IQ={class:`min-w-0 flex-1`},LQ=[`value`,`placeholder`],RQ={class:`truncate font-mono text-[11px] text-fg-subtle`},zQ={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},BQ={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},VQ={key:1,class:`space-y-1.5`},HQ=[`title`],UQ=[`value`],WQ=[`value`],GQ={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},KQ=[`onClick`],qQ=[`onClick`],JQ={key:2,class:`divide-y divide-border rounded-md border border-border`},YQ=[`title`],XQ=[`value`,`onChange`],ZQ=[`value`],QQ=[`value`,`onInput`],$Q=[`value`,`onFocus`,`onInput`],e$=[`title`],t$={key:0,class:`text-xs text-danger`},n$={class:`space-y-2`},r$={class:`divide-y divide-border rounded-md border border-border`},i$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},a$=[`value`],o$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},s$=[`value`],c$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},l$=[`value`],u$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},d$={class:`flex items-center border-t border-border px-4 py-2.5`},f$=I({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>aQ(n.yaml,n.path)??{}),a=J(()=>typeof i.value.type==`string`?i.value.type:``),o=J(()=>n.vocabulary.find(e=>e.name===a.value)),s=J(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=J(()=>dQ(n.yaml,n.path)),l=J(()=>o.value?.settings&&i.value.settings?xQ(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function f(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let p=J(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:f(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function m(e){let{id:t,type:i,...a}=e;r(`update:yaml`,oQ(n.yaml,n.path,{id:t,type:i,...a}))}function h(e,t){m({...i.value,[e]:t})}function g(e){h(`retry`,{...i.value.retry,...e})}function _(e,t){m({...i.value,settings:{...s.value,[e]:t}})}let v=M(null);function y(e,t){let n=v.value??p.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;_(n,r?`${r.trimEnd()} ${i}`:i)}let b=M({});function x(e,t){try{_(e,t.trim()?VZ(t):void 0),b.value={...b.value,[e]:``}}catch(t){b.value={...b.value,[e]:String(t.message).split(`
`)[0]}}}let S=e=>e===void 0?``:HZ(e).trimEnd(),C=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),w=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(B(),V(`aside`,NQ,[U(`header`,PQ,[U(`span`,FQ,[(B(),H(ea(N(rQ)(a.value)),{class:`size-4`}))]),U(`div`,IQ,[U(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:N(JZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,LQ),U(`div`,RQ,j(a.value),1)]),W(N(Q),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:P(()=>[W(N(qd))]),_:1})]),U(`div`,zQ,[l.value?(B(),V(`p`,BQ,j(l.value),1)):K(``,!0),p.value.lead?(B(),V(`section`,VQ,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[G(j(C(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,HQ),p.value.lead.kind===`select`?(B(),V(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:w(p.value.lead.key),onChange:t[2]||=e=>_(p.value.lead.key,e.target.value||void 0)},[t[13]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(p.value.lead.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,WQ))),128))],40,UQ)):p.value.lead.kind===`text`?(B(),H(N(Zw),{key:1,"model-value":w(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])):(B(),H(N(CD),{key:2,"model-value":w(p.value.lead.key),onFocus:t[5]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(B(),V(`div`,GQ,[t[14]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(B(!0),V(z,null,L(c.value,e=>(B(),V(z,{key:e},[U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`summary`)},j(e),9,KQ),U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`result`)},j(e)+`.result`,9,qQ)],64))),128))])):K(``,!0)])):K(``,!0),p.value.compact.length?(B(),V(`section`,JQ,[(B(!0),V(z,null,L(p.value.compact,e=>(B(),V(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,YQ),e.kind===`boolean`?(B(),H(N(JD),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>_(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(B(),V(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:w(e.key),onChange:t=>_(e.key,t.target.value||void 0)},[t[15]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(e.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,ZQ))),128))],40,XQ)):e.kind===`number`?(B(),V(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>_(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,QQ)):(B(),V(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:w(e.key),onFocus:t=>v.value=e.key,onInput:t=>_(e.key,t.target.value)},null,40,$Q))]))),128))])):K(``,!0),(B(!0),V(z,null,L(p.value.long,e=>(B(),V(`section`,{key:e.key,class:`space-y-1.5`},[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,e$),e.kind===`text`?(B(),H(N(Zw),{key:0,"model-value":w(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>v.value=e.key,"onUpdate:modelValue":t=>_(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(B(),H(N(Zw),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`)[0]}}}let S=e=>e===void 0?``:HZ(e).trimEnd(),C=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),w=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(B(),V(`aside`,NQ,[U(`header`,PQ,[U(`span`,FQ,[(B(),H(ea(N(rQ)(a.value)),{class:`size-4`}))]),U(`div`,IQ,[U(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:N(JZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,LQ),U(`div`,RQ,j(a.value),1)]),W(N(Q),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:P(()=>[W(N(qd))]),_:1})]),U(`div`,zQ,[l.value?(B(),V(`p`,BQ,j(l.value),1)):K(``,!0),p.value.lead?(B(),V(`section`,VQ,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[G(j(C(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,HQ),p.value.lead.kind===`select`?(B(),V(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:w(p.value.lead.key),onChange:t[2]||=e=>_(p.value.lead.key,e.target.value||void 0)},[t[13]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(p.value.lead.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,WQ))),128))],40,UQ)):p.value.lead.kind===`text`?(B(),H(N(Zw),{key:1,"model-value":w(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])):(B(),H(N(SD),{key:2,"model-value":w(p.value.lead.key),onFocus:t[5]||=e=>v.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>_(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(B(),V(`div`,GQ,[t[14]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(B(!0),V(z,null,L(c.value,e=>(B(),V(z,{key:e},[U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`summary`)},j(e),9,KQ),U(`button`,{type:`button`,class:`rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary`,onClick:t=>y(e,`result`)},j(e)+`.result`,9,qQ)],64))),128))])):K(``,!0)])):K(``,!0),p.value.compact.length?(B(),V(`section`,JQ,[(B(!0),V(z,null,L(p.value.compact,e=>(B(),V(`div`,{key:e.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,YQ),e.kind===`boolean`?(B(),H(N(qD),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>_(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(B(),V(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:w(e.key),onChange:t=>_(e.key,t.target.value||void 0)},[t[15]||=U(`option`,{value:``},`Default`,-1),(B(!0),V(z,null,L(e.schema.enum,e=>(B(),V(`option`,{key:e,value:e},j(e),9,ZQ))),128))],40,XQ)):e.kind===`number`?(B(),V(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>_(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,QQ)):(B(),V(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:w(e.key),onFocus:t=>v.value=e.key,onInput:t=>_(e.key,t.target.value)},null,40,$Q))]))),128))])):K(``,!0),(B(!0),V(z,null,L(p.value.long,e=>(B(),V(`section`,{key:e.key,class:`space-y-1.5`},[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[G(j(C(e.key,e.schema))+` `,1),e.schema.description?(B(),H(N(id),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,e$),e.kind===`text`?(B(),H(N(Zw),{key:0,"model-value":w(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>v.value=e.key,"onUpdate:modelValue":t=>_(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(B(),H(N(Zw),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>_(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(B(),V(z,{key:2},[W(N(Zw),{"model-value":S(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>x(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),b.value[e.key]?(B(),V(`span`,t$,j(b.value[e.key]),1)):K(``,!0)],64))]))),128)),U(`section`,n$,[t[21]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),U(`div`,r$,[U(`label`,i$,[t[16]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),U(`input`,{class:`h-7 w-48 rounded-md border border-input bg-background px-2 font-mono text-xs`,placeholder:`always`,value:i.value.when??``,onInput:t[7]||=e=>h(`when`,e.target.value)},null,40,a$)]),U(`label`,o$,[t[18]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),U(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[17]||=[U(`option`,{value:``},`Park the task`,-1),U(`option`,{value:`continue`},`Continue`,-1)]],40,s$)]),U(`label`,c$,[t[19]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),U(`input`,{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:i.value.retry?.attempts??``,onInput:t[9]||=e=>g({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,l$)]),U(`label`,u$,[t[20]||=U(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),W(N(ID),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>g({backoff:e||void 0})},null,8,[`model-value`])])])])]),U(`footer`,d$,[W(N(Q),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:P(()=>[W(N(Ld)),t[22]||=G(` Delete step`,-1)]),_:1}),W(N(Q),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:P(()=>[...t[23]||=[G(`Done`,-1)]]),_:1})])]))}}),p$=`repository_path`;function m$(e,t,n){let r=[];for(let[n,i]of e){let e=t[n];e?.from===`path`&&e.path.trim()&&r.push({name:n,path:e.path.trim(),type:i.type??`string`,required:i.required===!0})}return n.trim()&&r.push({name:p$,path:n.trim(),type:`string`,required:!0}),r}function h$(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function g$(e,t,n){let r=[];for(let[i,a]of e){let e=t[i],o=a.type??`string`;if(!(e&&(e.from===`path`?e.path.trim():e.value!==``))){a.required&&r.push(`${i} is required`);continue}if(e.from===`path`){let e=n?.failures?.find(e=>e.field_name===i);e&&r.push(`${i}: ${e.reason}`);continue}let s=h$(ON(e.value,o));o!==`any`&&s!==o&&r.push(`${i} is ${o}, but ${JSON.stringify(e.value)} is not`)}return n?.failures?.some(e=>e.field_name===`repository_path`)&&r.push(`the repository path does not resolve`),r}function _$(e,t){let n={};for(let[r,i]of e){let e=t[r];e?.from===`path`&&e.path.trim()?n[r]={param:r}:e?.from===`value`&&e.value!==``&&(n[r]={value:ON(e.value,i.type??`string`)})}return n}function v$(e,t){let n=e=>t.find(t=>t.name===e)?.path??``,r={};for(let[t,i]of Object.entries(e.inputs??{}))r[t]=i.param?{from:`path`,path:n(i.param),value:``}:{from:`value`,path:``,value:typeof i.value==`string`?i.value:JSON.stringify(i.value)};return{rows:r,repositoryPath:n(e.repo_param)}}function y$(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...y$(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...y$(n,r)]}):[]}function b$(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function x$(e){try{let t=JSON.parse(e.headers??`{}`);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]))}catch{return{}}}function S$(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var C$={class:`flex h-full flex-col`},w$={class:`flex items-center gap-2 border-b border-border px-4 py-3`},T$={class:`min-w-0 flex-1 truncate text-sm font-medium`},E$={key:0,class:`flex flex-1 items-center justify-center`},D$={class:`space-y-1.5`},O$=[`disabled`],k$=[`value`],A$={key:1,class:`space-y-1.5`},j$=[`value`],M$=[`title`],N$={class:`space-y-1.5`},P$={id:`bind-paths`},F$=[`value`],I$={class:`divide-y divide-border rounded-md border border-border`},L$={class:`flex items-center gap-1.5 text-xs`},R$={class:`font-mono`},z$={class:`text-fg-subtle`},B$={key:0,class:`text-danger`,title:`Required`},V$=[`title`,`aria-label`,`onClick`],H$=[`onUpdate:modelValue`,`aria-label`],U$=[`onUpdate:modelValue`,`aria-label`],W$={key:2,class:`text-xs text-danger`},G$=[`title`],K$={key:0,class:`space-y-1 px-3 py-2`},q$={key:0,class:`text-xs text-danger`},J$={key:1,class:`truncate font-mono text-xs text-success`},Y$={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},X$={class:`space-y-2`},Z$={key:0,role:`alert`,class:`text-xs text-danger`},Q$={key:1,class:`texLine truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(B(),V(z,{key:2},[W(N(Zw),{"model-value":S(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>x(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),b.value[e.key]?(B(),V(`span`,t$,j(b.value[e.key]),1)):K(``,!0)],64))]))),128)),U(`section`,n$,[t[21]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),U(`div`,r$,[U(`label`,i$,[t[16]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),U(`input`,{class:`h-7 w-48 rounded-md border border-input bg-background px-2 font-mono text-xs`,placeholder:`always`,value:i.value.when??``,onInput:t[7]||=e=>h(`when`,e.target.value)},null,40,a$)]),U(`label`,o$,[t[18]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),U(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[17]||=[U(`option`,{value:``},`Park the task`,-1),U(`option`,{value:`continue`},`Continue`,-1)]],40,s$)]),U(`label`,c$,[t[19]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),U(`input`,{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:i.value.retry?.attempts??``,onInput:t[9]||=e=>g({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,l$)]),U(`label`,u$,[t[20]||=U(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),W(N(FD),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":t[10]||=e=>g({backoff:e||void 0})},null,8,[`model-value`])])])])]),U(`footer`,d$,[W(N(Q),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[11]||=e=>r(`remove`)},{default:P(()=>[W(N(Ld)),t[22]||=G(` Delete step`,-1)]),_:1}),W(N(Q),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[12]||=e=>r(`close`)},{default:P(()=>[...t[23]||=[G(`Done`,-1)]]),_:1})])]))}}),p$=`repository_path`;function m$(e,t,n){let r=[];for(let[n,i]of e){let e=t[n];e?.from===`path`&&e.path.trim()&&r.push({name:n,path:e.path.trim(),type:i.type??`string`,required:i.required===!0})}return n.trim()&&r.push({name:p$,path:n.trim(),type:`string`,required:!0}),r}function h$(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function g$(e,t,n){let r=[];for(let[i,a]of e){let e=t[i],o=a.type??`string`;if(!(e&&(e.from===`path`?e.path.trim():e.value!==``))){a.required&&r.push(`${i} is required`);continue}if(e.from===`path`){let e=n?.failures?.find(e=>e.field_name===i);e&&r.push(`${i}: ${e.reason}`);continue}let s=h$($M(e.value,o));o!==`any`&&s!==o&&r.push(`${i} is ${o}, but ${JSON.stringify(e.value)} is not`)}return n?.failures?.some(e=>e.field_name===`repository_path`)&&r.push(`the repository path does not resolve`),r}function _$(e,t){let n={};for(let[r,i]of e){let e=t[r];e?.from===`path`&&e.path.trim()?n[r]={param:r}:e?.from===`value`&&e.value!==``&&(n[r]={value:$M(e.value,i.type??`string`)})}return n}function v$(e,t){let n=e=>t.find(t=>t.name===e)?.path??``,r={};for(let[t,i]of Object.entries(e.inputs??{}))r[t]=i.param?{from:`path`,path:n(i.param),value:``}:{from:`value`,path:``,value:typeof i.value==`string`?i.value:JSON.stringify(i.value)};return{rows:r,repositoryPath:n(e.repo_param)}}function y$(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...y$(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...y$(n,r)]}):[]}function b$(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function x$(e){try{let t=JSON.parse(e.headers??`{}`);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]))}catch{return{}}}function S$(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var C$={class:`flex h-full flex-col`},w$={class:`flex items-center gap-2 border-b border-border px-4 py-3`},T$={class:`min-w-0 flex-1 truncate text-sm font-medium`},E$={key:0,class:`flex flex-1 items-center justify-center`},D$={class:`space-y-1.5`},O$=[`disabled`],k$=[`value`],A$={key:1,class:`space-y-1.5`},j$=[`value`],M$=[`title`],N$={class:`space-y-1.5`},P$={id:`bind-paths`},F$=[`value`],I$={class:`divide-y divide-border rounded-md border border-border`},L$={class:`flex items-center gap-1.5 text-xs`},R$={class:`font-mono`},z$={class:`text-fg-subtle`},B$={key:0,class:`text-danger`,title:`Required`},V$=[`title`,`aria-label`,`onClick`],H$=[`onUpdate:modelValue`,`aria-label`],U$=[`onUpdate:modelValue`,`aria-label`],W$={key:2,class:`text-xs text-danger`},G$=[`title`],K$={key:0,class:`space-y-1 px-3 py-2`},q$={key:0,class:`text-xs text-danger`},J$={key:1,class:`truncate font-mono text-xs text-success`},Y$={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},X$={class:`space-y-2`},Z$={key:0,role:`alert`,class:`text-xs text-danger`},Q$={key:1,class:`texLine truncated
`).replace(`
`,`
+`).split(`
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function Gne(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Kne(n.code,e);return Array.isArray(e)?e.some(e=>F5(n[r],e,t,n.type===`keyup`)):F5(n[r],e,t,n.type===`keyup`)}}function Kne(e,t){return t.includes(e)?`code`:`key`}function I5(e,t){let n=J(()=>pn(t?.target)??Une),r=ln(pn(e)===!0),i=!1,a=new Set,o=c(pn(e));F(()=>pn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),z0([`blur`,`contextmenu`],s),V0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0,a=pn(t?.preventDefault)??!1;if(i=Wne(e),(!i||i&&!n)&&P5(e))return;let o=e.composedPath?.call(e)?.[0]||e.target,s=o?.nodeName===`BUTTON`||o?.nodeName===`A`;!a&&(i||!s)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),V0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&P5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=pn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Gne(e,a):e}return r}var L5=`vue-flow__node-desc`,R5=`vue-flow__edge-desc`,qne=`vue-flow__aria-live`,z5=[`Enter`,` `,`Escape`],B5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function V5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function H5(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function U5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function W5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function G5(e,t){return{x:W5(e.x,t[0][0],t[1][0]),y:W5(e.y,t[0][1],t[1][1])}}function K5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function q5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function J5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!q5(e)}function Y5(e){return J5(e)&&`computedPosition`in e}function X5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Jne(e){return X5(e.width)&&X5(e.height)&&X5(e.x)&&X5(e.y)}function Yne(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:an({width:0,height:0}),computedPosition:an({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function Z5(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Q5(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function Xne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.source===r).map(e=>n.find(t=>J5(t)&&t.id===e.target))}function Zne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.target===r).map(e=>n.find(t=>J5(t)&&t.id===e.source))}function $5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Qne(e,t){return t.some(t=>q5(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function e7({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function t7({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?P7(s,o):s}function $ne(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function n7({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function ere({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function r7(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=$ne(t,n7({...r.computedPosition,...r.dimensions}))}return ere(t)}function i7(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...t7(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl Line truncated
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function Kne(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=qne(n.code,e);return Array.isArray(e)?e.some(e=>F5(n[r],e,t,n.type===`keyup`)):F5(n[r],e,t,n.type===`keyup`)}}function qne(e,t){return t.includes(e)?`code`:`key`}function I5(e,t){let n=J(()=>pn(t?.target)??Wne),r=ln(pn(e)===!0),i=!1,a=new Set,o=c(pn(e));F(()=>pn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),z0([`blur`,`contextmenu`],s),V0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0,a=pn(t?.preventDefault)??!1;if(i=Gne(e),(!i||i&&!n)&&P5(e))return;let o=e.composedPath?.call(e)?.[0]||e.target,s=o?.nodeName===`BUTTON`||o?.nodeName===`A`;!a&&(i||!s)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),V0((...e)=>o(...e),e=>{let n=pn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&P5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=pn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Kne(e,a):e}return r}var L5=`vue-flow__node-desc`,R5=`vue-flow__edge-desc`,Jne=`vue-flow__aria-live`,z5=[`Enter`,` `,`Escape`],B5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function V5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function H5(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function U5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function W5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function G5(e,t){return{x:W5(e.x,t[0][0],t[1][0]),y:W5(e.y,t[0][1],t[1][1])}}function K5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function q5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function J5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!q5(e)}function Y5(e){return J5(e)&&`computedPosition`in e}function X5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Yne(e){return X5(e.width)&&X5(e.height)&&X5(e.x)&&X5(e.y)}function Xne(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:an({width:0,height:0}),computedPosition:an({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function Z5(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:W7(e.data)?e.data:{},events:an(W7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Q5(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function Zne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.source===r).map(e=>n.find(t=>J5(t)&&t.id===e.target))}function Qne(...e){if(e.length===3){let[t,n,r]=e;return Q5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>q5(e)&&e.target===r).map(e=>n.find(t=>J5(t)&&t.id===e.source))}function $5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function $ne(e,t){return t.some(t=>q5(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function e7({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function t7({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?P7(s,o):s}function ere(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function n7({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function tre({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function r7(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=ere(t,n7({...r.computedPosition,...r.dimensions}))}return tre(t)}function i7(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...t7(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
@@ -153,4 +153,4 @@ Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},A7=class extends Error{constructor(e,...t){super(k7[e]?.call(k7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function j7(e){return`clientX`in e}function ure(e){return`sourceEvent`in e}function M7(e,t){let n=j7(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var N7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function dre(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function P7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var fre=()=>!0;function F7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function pre(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())H5(i,V5(e))>0&&r.push(e);return r}var mre=250;function hre(e,t,n,r){let i=[],a=1/0,o=pre(e,n,t+mre);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=E7(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function I7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=fre},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=M7(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=L7(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===A5.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=R7(t,e,a,p,n,!0)}return b}function L7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function gre(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function _re(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function R7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===A5.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...E7(o,c,c.position,!0)}:c}var z7={[D5.Left]:D5.Right,[D5.Right]:D5.Left,[D5.Top]:D5.Bottom,[D5.Bottom]:D5.Top},vre=[`production`,`prod`];function B7(e,...t){V7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function V7(){return!vre.includes(`production`)}function H7(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...U5(t)}}):null}function U7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),qn(()=>{o.blur()})):n([e])}function W7(e){return N(e)!==void 0}function yre(e,t,n,r){if(!e||!e.source||!e.target)return n(new A7(O7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=q5(e)?e:{...e,id:$5(e)},i=Z5(i,void 0,r),!Qne(i,t)&&i}function bre(e,t,n,r,i){if(!t.source||!t.target)return i(new A7(O7.EDGE_INVALID,e.id)),!1;if(!n)return i(new A7(O7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?$5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function G7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!J5(o)){n(new A7(O7.NODE_INVALID,o?.id));continue}let s=Yne(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new A7(O7.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function K7(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function q7(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;K7(`sourcLine truncated
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},A7=class extends Error{constructor(e,...t){super(k7[e]?.call(k7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function j7(e){return`clientX`in e}function dre(e){return`sourceEvent`in e}function M7(e,t){let n=j7(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var N7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function fre(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function P7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var pre=()=>!0;function F7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function mre(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())H5(i,V5(e))>0&&r.push(e);return r}var hre=250;function gre(e,t,n,r){let i=[],a=1/0,o=mre(e,n,t+hre);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=E7(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function I7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=pre},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=M7(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=L7(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===A5.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=R7(t,e,a,p,n,!0)}return b}function L7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function _re(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function vre(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function R7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===A5.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...E7(o,c,c.position,!0)}:c}var z7={[D5.Left]:D5.Right,[D5.Right]:D5.Left,[D5.Top]:D5.Bottom,[D5.Bottom]:D5.Top},yre=[`production`,`prod`];function B7(e,...t){V7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function V7(){return!yre.includes(`production`)}function H7(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...U5(t)}}):null}function U7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),qn(()=>{o.blur()})):n([e])}function W7(e){return N(e)!==void 0}function bre(e,t,n,r){if(!e||!e.source||!e.target)return n(new A7(O7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=q5(e)?e:{...e,id:$5(e)},i=Z5(i,void 0,r),!$ne(i,t)&&i}function xre(e,t,n,r,i){if(!t.source||!t.target)return i(new A7(O7.EDGE_INVALID,e.id)),!1;if(!n)return i(new A7(O7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?$5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function G7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!J5(o)){n(new A7(O7.NODE_INVALID,o?.id));continue}let s=Xne(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new A7(O7.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function K7(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function q7(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;K7(`sourcLine truncated
-3
View File
@@ -4,7 +4,6 @@ import { onMounted, ref } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import SourcesPanel from "@/sources/SourcesPanel.vue";
import { useLiveResource } from "@/stores/live-updates";
import BindingEditor from "./BindingEditor.vue";
import BindingsTable from "./BindingsTable.vue";
@@ -73,8 +72,6 @@ async function handleDelete(binding: Binding): Promise<void> {
<template>
<div>
<SourcesPanel />
<!-- The tab owns the actions that belong to it. The page's header names the
page, not this panel, so nothing here repeats "Events". -->
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
+1 -17
View File
@@ -1,9 +1,7 @@
<script setup lang="ts">
import { Inbox, TriangleAlert } from "@lucide/vue";
import { ref } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import {
Empty,
EmptyDescription,
@@ -28,16 +26,6 @@ import { captures, enabled, error, loading } from "./state";
* window with nothing in it yet.
*/
// The receiver's path, held as a string rather than typed into the template:
// its source segment is angle-bracketed, which a template parser reads as a
// tag.
const endpoint = "/webhooks/capture/<source>";
const copied = ref(false);
async function copyEndpoint() {
await navigator.clipboard.writeText(`${location.origin}${endpoint}`);
copied.value = true;
setTimeout(() => (copied.value = false), 1500);
}
</script>
<template>
@@ -64,12 +52,8 @@ async function copyEndpoint() {
<EmptyHeader>
<EmptyMedia variant="icon"><Inbox /></EmptyMedia>
<EmptyTitle>No captures yet</EmptyTitle>
<EmptyDescription>Webhooks sent here appear below.</EmptyDescription>
<EmptyDescription>Create a source above and point a sender at its URL.</EmptyDescription>
</EmptyHeader>
<div class="flex items-center gap-2 rounded-md border border-border bg-background py-1 pr-1 pl-3">
<code class="font-mono text-xs">{{ endpoint }}</code>
<Button variant="ghost" size="sm" @click="copyEndpoint">{{ copied ? "Copied" : "Copy" }}</Button>
</div>
</Empty>
<Table v-else>
+2
View File
@@ -3,6 +3,7 @@ import { breakpointsTailwind, useBreakpoints } from "@vueuse/core";
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import SourcesPanel from "@/sources/SourcesPanel.vue";
import CaptureDetail from "./CaptureDetail.vue";
import CapturesCard from "./CapturesCard.vue";
import EventTypesCard from "./EventTypesCard.vue";
@@ -90,6 +91,7 @@ watch(selected, (capture) => {
</script>
<template>
<SourcesPanel />
<!-- Split only when there is a capture to show beside the list. -->
<div
class="grid min-w-0 items-start gap-4"
+8 -6
View File
@@ -36,15 +36,17 @@ async function install(): Promise<void> {
}
}
// The dialog's action closes it before its click handler runs, so the
// target outlives the open flag rather than being cleared on close.
const accepting = ref<Extension | null>(null);
const acceptOpen = ref(false);
async function accept(): Promise<void> {
if (accepting.value) await store.accept(accepting.value.name);
accepting.value = null;
}
const removing = ref<Extension | null>(null);
const removeOpen = ref(false);
async function remove(): Promise<void> {
if (removing.value) await store.remove(removing.value.name);
removing.value = null;
}
const tones = {
@@ -108,7 +110,7 @@ const tones = {
variant="ghost"
size="sm"
:disabled="!!store.busy"
@click="accepting = extension"
@click="(accepting = extension), (acceptOpen = true)"
>Review authority</Button
>
<Switch
@@ -118,7 +120,7 @@ const tones = {
:aria-label="`Enable ${extension.name}`"
@update:model-value="(value: boolean) => store.setEnabled(extension.name, value)"
/>
<Button variant="ghost" size="sm" class="text-danger" :disabled="!!store.busy" @click="removing = extension">Remove</Button>
<Button variant="ghost" size="sm" class="text-danger" :disabled="!!store.busy" @click="(removing = extension), (removeOpen = true)">Remove</Button>
</li>
<li v-if="!store.extensions.length">
<Empty class="py-6">
@@ -131,7 +133,7 @@ const tones = {
<ApplyStatusRows :kind="KIND" class="mt-6 border-t border-border py-4" />
<AlertDialog :open="!!accepting" @update:open="(open) => !open && (accepting = null)">
<AlertDialog v-model:open="acceptOpen">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Accept what {{ accepting?.name }} may use?</AlertDialogTitle>
@@ -150,7 +152,7 @@ const tones = {
</AlertDialogContent>
</AlertDialog>
<AlertDialog :open="!!removing" @update:open="(open) => !open && (removing = null)">
<AlertDialog v-model:open="removeOpen">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Remove {{ removing?.name }}?</AlertDialogTitle>
+2
View File
@@ -2,6 +2,7 @@
import PageHeader from "@/base/PageHeader.vue";
import HealthStatusCard from "./HealthStatusCard.vue";
import ServicesCard from "./ServicesCard.vue";
import UpdateSettingsCard from "./UpdateSettingsCard.vue";
import VersionsCard from "./VersionsCard.vue";
</script>
@@ -12,5 +13,6 @@ import VersionsCard from "./VersionsCard.vue";
<ServicesCard />
<HealthStatusCard />
<VersionsCard class="mt-4" />
<UpdateSettingsCard class="mt-4" />
</div>
</template>
+47
View File
@@ -0,0 +1,47 @@
<script setup lang="ts">
import { computed, onMounted } from "vue";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { SettingRow } from "@/components/ui/setting-row";
import { useControlPlaneStore } from "@/stores/control-plane";
const KIND = "update-settings";
type UpdateSettings = { channel: string; pin: string };
const store = useControlPlaneStore();
onMounted(store.load);
const draft = computed(() => store.drafts[KIND]?.value as UpdateSettings | undefined);
const error = computed(() => store.stateFor(KIND).error);
const channels = [
{ value: "stable", label: "Stable" },
{ value: "next", label: "Prereleases" },
{ value: "exact-pin", label: "Pinned" },
];
const channel = computed({
get: () => draft.value?.channel || "stable",
set: (value: string) => {
if (draft.value) draft.value.channel = value;
},
});
</script>
<template>
<Card v-if="draft">
<CardHeader>
<CardTitle>Updates</CardTitle>
</CardHeader>
<CardContent>
<p v-if="error" class="mb-2 text-sm text-danger" role="alert">{{ error }}</p>
<SettingRow label="Release channel">
<SegmentedControl v-model="channel" label="Release channel" :options="channels" />
</SettingRow>
<SettingRow v-if="channel === 'exact-pin'" label="Version" for="update-pin">
<Input id="update-pin" v-model="draft.pin" class="max-w-40 font-mono" placeholder="1.48.0" />
</SettingRow>
</CardContent>
</Card>
</template>