Compare commits

..
6 Commits
Author SHA1 Message Date
sam 0e8fcf70a0 chore(release): v1.49.0
deploy / gate (push) Failing after 5m18s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-10-07 22:17:00 +11:00
sam 4673b435b7 fix(extension): confine egress only for packages that declare egress hosts 2026-10-07 22:15:06 +11:00
sam 1e062fd7f0 fix(releaseupdate): reuse a found release for ten minutes to stay under GitHub's unauthenticated rate limit 2026-10-07 01:17:21 +11:00
sam 74a3ec925c feat(releaseupdate): archied update check finds releases through go-selfupdate; archie-update-check is deleted 2026-10-07 01:12:11 +11:00
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
27 changed files with 419 additions and 442 deletions

No files matched your search

+13
View File
@@ -5,6 +5,19 @@ release's per-component sections are labelled beneath its heading.
## [Unreleased]
## [1.49.0] - 2026-10-07
### archied
- Extensions that declare no egress hosts (vault, email, gitea) reach the network again; only packages that declare their hosts are confined to them. The Accept dialog shows "network: unrestricted" for the rest.
- The update check finds releases itself, and reuses a found release for ten minutes so repeated checks stay under GitHub's rate limit.
## [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
+2 -2
View File
@@ -16,8 +16,8 @@ func main() {
if archied.IsSetupArgs(args) {
os.Exit(archied.RunSetup(args[1:], os.Stdin, os.Stdout, os.Stderr))
}
if len(args) > 0 && args[0] == "select-release" {
os.Exit(archied.RunReleaseChannel(args[1:], os.Stdin, os.Stdout, os.Stderr))
if len(args) > 0 && args[0] == "update" {
os.Exit(archied.RunUpdate(args[1:], os.Stdout, os.Stderr))
}
if len(args) > 0 && args[0] == "update-image" {
os.Exit(archied.RunUpdateImage(args[1:], os.Stderr))
+5 -5
View File
@@ -92,15 +92,15 @@ an install (or an upgrade across v1.30.0) needs its unit as well -- see
`archie-update-install` downloads the approved release's Linux/amd64 archive
and verifies its `SHA256SUMS` entry before executing or installing it. Releases
must include `release.json`, all host binaries, and the three updater scripts.
must include `release.json`, all host binaries, and the two updater scripts.
Older releases without this contract cannot be installed through the artifact
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`. Both commands are
edited under Settings → Status → Updates, and default to the scripts installed
beside the binaries.
`archied update check` finds the newest GitHub release with a linux-amd64 zip on
the channel chosen under Settings → Status → Updates: stable, next (includes
prereleases) or a pinned version. From a shell it reads
`ARCHIE_UPDATE_RELEASE_CHANNEL` and `ARCHIE_UPDATE_PIN`, or `-channel` and `-pin`.
The notification destination remains separate from the release channel.
For scheduled, unattended runs, `archie-update-install --auto` discovers the
+4
View File
@@ -66,6 +66,8 @@
"/news/archie/1.47.2/": "/news/1.47.2/",
"/news/archie/1.47.3/": "/news/1.47.3/",
"/news/archie/1.48.0/": "/news/1.48.0/",
"/news/archie/1.48.1/": "/news/1.48.1/",
"/news/archie/1.49.0/": "/news/1.49.0/",
"/news/archie/1.5.0/": "/news/1.5.0/",
"/news/archie/1.6.0/": "/news/1.6.0/",
"/news/archie/1.7.0/": "/news/1.7.0/",
@@ -149,6 +151,8 @@
"/news/archied/1.47.2/": "/news/1.47.2/",
"/news/archied/1.47.3/": "/news/1.47.3/",
"/news/archied/1.48.0/": "/news/1.48.0/",
"/news/archied/1.48.1/": "/news/1.48.1/",
"/news/archied/1.49.0/": "/news/1.49.0/",
"/news/archied/1.5.0/": "/news/1.5.0/",
"/news/archied/1.6.0/": "/news/1.6.0/",
"/news/archied/1.7.0/": "/news/1.7.0/",
+10
View File
@@ -1,4 +1,14 @@
[
{
"version": "1.49.0",
"date": "2026-10-07",
"body": "### archied\n\n- Extensions that declare no egress hosts (vault, email, gitea) reach the network again; only packages that declare their hosts are confined to them. The Accept dialog shows \"network: unrestricted\" for the rest.\n- The update check finds releases itself, and reuses a found release for ten minutes so repeated checks stay under GitHub's rate limit."
},
{
"version": "1.48.1",
"date": "2026-10-07",
"body": "### archied\n\n- **Settings → Status → Updates** now chooses only the release channel (stable, prereleases, or a pinned version). Update checks and installs always run the `archie-update-*` scripts installed beside the binaries; the dashboard can no longer set the command that runs."
},
{
"version": "1.48.0",
"date": "2026-10-07",
+13
View File
@@ -4,8 +4,11 @@ go 1.27.0
require (
cel.dev/expr v0.25.3 // indirect
code.gitea.io/sdk/gitea v0.23.2 // indirect
dario.cat/mergo v1.0.2 // indirect
github.com/42wim/httpsig v1.2.4 // indirect
github.com/Azure/go-ansiterm v0.0.0-20260917205352-e937bb47801a // indirect
github.com/Masterminds/semver/v3 v3.5.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.5.1 // indirect
github.com/antithesishq/antithesis-sdk-go v0.8.0 // indirect
@@ -18,6 +21,7 @@ require (
github.com/containerd/log v0.2.0 // indirect
github.com/containerd/platforms v1.0.0-rc.5 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.8.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
@@ -26,6 +30,7 @@ require (
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.19.0 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
github.com/go-fed/httpsig v1.1.0 // indirect
github.com/go-git/gcfg/v2 v2.0.2 // indirect
github.com/go-jose/go-jose/v4 v4.1.5 // indirect
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 // indirect
@@ -33,8 +38,13 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-github/v86 v86.0.0 // indirect
github.com/google/go-querystring v1.2.0 // indirect
github.com/google/go-tpm v0.9.8 // indirect
github.com/google/jsonschema-go v0.4.3 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/hashicorp/go-version v1.9.0 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
@@ -71,8 +81,10 @@ require (
github.com/stretchr/testify v1.12.1 // indirect
github.com/tklauser/go-sysconf v0.4.0 // indirect
github.com/tklauser/numcpus v0.12.0 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
gitlab.com/gitlab-org/api/client-go v1.46.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 // indirect
go.opentelemetry.io/otel v1.46.0 // indirect
@@ -96,6 +108,7 @@ require (
github.com/BurntSushi/toml v1.6.0
github.com/cedar-policy/cedar-go v1.8.0
github.com/coreos/go-oidc/v3 v3.21.0
github.com/creativeprojects/go-selfupdate v1.6.0
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.6
github.com/go-git/go-billy/v6 v6.0.0-alpha.2
github.com/go-git/go-git/v6 v6.0.0-alpha.5
+41
View File
@@ -2,14 +2,20 @@ cel.dev/cel-go v0.32.0 h1:irvpFKr5EuGPyxeME03ERh0rii1TX+BDAnB9eL3IvNk=
cel.dev/cel-go v0.32.0/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU=
cel.dev/expr v0.25.3 h1:A2jO8jwOugrrovveCWfj0KEZOfqiLgAcwjpHPhzIGw0=
cel.dev/expr v0.25.3/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
code.gitea.io/sdk/gitea v0.23.2 h1:iJB1FDmLegwfwjX8gotBDHdPSbk/ZR8V9VmEJaVsJYg=
code.gitea.io/sdk/gitea v0.23.2/go.mod h1:yyF5+GhljqvA30sRDreoyHILruNiy4ASufugzYg0VHM=
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
github.com/42wim/httpsig v1.2.4 h1:mI5bH0nm4xn7K18fo1K3okNDRq8CCJ0KbBYWyA6r8lU=
github.com/42wim/httpsig v1.2.4/go.mod h1:yKsYfSyTBEohkPik224QPFylmzEBtda/kjyIAJjh3ps=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
github.com/Azure/go-ansiterm v0.0.0-20260917205352-e937bb47801a h1:4hxax9ktNjSDoFn1tZSeL6gXMTRMpO0FzjdKfT01jgY=
github.com/Azure/go-ansiterm v0.0.0-20260917205352-e937bb47801a/go.mod h1:3EWSSOZ50kb+arhww0qIaEXHToib/3FjBj9Jj5lcP5g=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE=
github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/ProtonMail/go-crypto v1.5.1 h1:pTrLDQHyOT8y3DFYIpijgPBTw/7E2GLMimutvOlceuE=
@@ -46,8 +52,12 @@ github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GK
github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/creativeprojects/go-selfupdate v1.6.0 h1:Bu3cIgdyfI1Pg8XsL8nbaT2uMjfZ8HIoxnBmPJbN0sw=
github.com/creativeprojects/go-selfupdate v1.6.0/go.mod h1:Ids8O474XGQG0jZ5vpBIhWffcGYjUP6ccOI0mMcvQbI=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/go-connections v0.8.1 h1:JibmG5hULs5qXSr/cp/w3Pw5fZuStt4MOHMUExb29/M=
@@ -69,6 +79,8 @@ github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeO
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI=
github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM=
github.com/go-git/gcfg/v2 v2.0.2 h1:MY5SIIfTGGEMhdA7d7JePuVVxtKL7Hp+ApGDJAJ7dpo=
github.com/go-git/gcfg/v2 v2.0.2/go.mod h1:/lv2NsxvhepuMrldsFilrgct6pxzpGdSRC13ydTLSLs=
github.com/go-git/go-billy/v6 v6.0.0-alpha.2 h1:1Sv5WemXL8CxKrAx1gioJ+uHNb2bZJhiQLfwSZ4Et8c=
@@ -95,18 +107,31 @@ github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63Y
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v86 v86.0.0 h1:S/6aANJhwRm8EQmGKVML3j41yq0h2BsTP8FnDkO7kcA=
github.com/google/go-github/v86 v86.0.0/go.mod h1:zKv1l4SwDXNFMGByi2FWkq71KwSXqj/eQRZuqtmcot8=
github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
github.com/google/go-tpm v0.9.8/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY=
github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0=
github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/graph-gophers/graphql-go v1.9.0 h1:yu0ucKHLc5qGpRwLYKIWtr9bOoxovkWasuBrPQwlHls=
github.com/graph-gophers/graphql-go v1.9.0/go.mod h1:23olKZ7duEvHlF/2ELEoSZaY1aNPfShjP782SOoNTyM=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs=
github.com/hashicorp/go-plugin v1.8.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8=
github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48=
github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw=
github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA=
github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
@@ -238,10 +263,14 @@ github.com/tklauser/go-sysconf v0.4.0 h1:7H0uAN+7RkwWRaxhYXDLqa5V3LPrJeV8wmD9dRU
github.com/tklauser/go-sysconf v0.4.0/go.mod h1:8mTNWyog7H+MpKijp4VmKJAd2bbYQ2zuUwkYRbUArPI=
github.com/tklauser/numcpus v0.12.0 h1:NR85qdvHA9pFse3x3weVZ0r0ST8R6l5RHbZrlRaqob4=
github.com/tklauser/numcpus v0.12.0/go.mod h1:ABHeXzJnr/qqwguhClkZKT1/8VABcYrsyUiUGobwWJg=
github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
gitlab.com/gitlab-org/api/client-go v1.46.0 h1:YxBWFZIFYKcGESCb9fpkwzouo+apyB9pr/XTWzNoL24=
gitlab.com/gitlab-org/api/client-go v1.46.0/go.mod h1:FtgyU6g2HS5+fMhw6nLK96GBEEBx5MzntOiJWfIaiN8=
go.lsp.dev/jsonrpc2 v1.0.1 h1:JZAchpm6RcOuwEOnZ7kF3kA1EpEjdJZ/6rMSfOF3+F4=
go.lsp.dev/jsonrpc2 v1.0.1/go.mod h1:WN+TesqrPumBmUdsuWyn9DHq3zl4i85L/qG0NLdj8qg=
go.lsp.dev/protocol v1.0.1 h1:kLWUIk1v/deXxo1D0VO4avjZnfeuZ82mouJgJd/NbdU=
@@ -266,21 +295,29 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M=
golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA=
golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba h1:Ck8QetSgk912qxWLMCKxd0in+aiyBQyDSMae6e/xmpU=
golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba/go.mod h1:50RgIsmK7OwqzTTeqcSXQW8SswW0o8fRcDxmqGluJ8E=
golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues=
golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -290,12 +327,16 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE=
golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE=
golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU=
golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
-32
View File
@@ -1,32 +0,0 @@
package archied
import (
"flag"
"fmt"
"io"
"strings"
"github.com/samcharles93/archie-core/internal/releaseupdate"
)
func RunReleaseChannel(args []string, in io.Reader, out, stderr io.Writer) int {
flags := flag.NewFlagSet("select-release", flag.ContinueOnError)
flags.SetOutput(stderr)
channel := flags.String("channel", "stable", "stable, next, or exact-pin")
pin := flags.String("pin", "", "exact release version")
if err := flags.Parse(args); err != nil {
return 1
}
data, err := io.ReadAll(in)
if err != nil {
fmt.Fprintln(stderr, err)
return 1
}
version, err := releaseupdate.SelectRelease(strings.Fields(string(data)), *channel, *pin)
if err != nil {
fmt.Fprintln(stderr, err)
return 1
}
fmt.Fprintln(out, version)
return 0
}
+48
View File
@@ -0,0 +1,48 @@
package archied
import (
"context"
"encoding/json"
"flag"
"fmt"
"io"
"os"
"github.com/samcharles93/archie-core/internal/releaseupdate"
)
// RunUpdate serves `archied update check`, printing the release snapshot as
// JSON. The channel defaults to the environment the installer passes on.
func RunUpdate(args []string, out, stderr io.Writer) int {
if len(args) == 0 || args[0] != "check" {
fmt.Fprintln(stderr, "usage: archied update check [-channel stable|next|exact-pin] [-pin version]")
return 2
}
flags := flag.NewFlagSet("update check", flag.ContinueOnError)
flags.SetOutput(stderr)
channel := flags.String("channel", envOr("ARCHIE_UPDATE_RELEASE_CHANNEL", "stable"), "stable, next, or exact-pin")
pin := flags.String("pin", os.Getenv("ARCHIE_UPDATE_PIN"), "exact release version")
if err := flags.Parse(args[1:]); err != nil {
return 2
}
catalog := &releaseupdate.GitHubCatalog{Channel: func(context.Context) (string, string, error) { return *channel, *pin, nil }}
snapshot, err := catalog.Check(context.Background())
if err != nil {
fmt.Fprintln(stderr, err)
return 1
}
encoder := json.NewEncoder(out)
encoder.SetIndent("", " ")
if err := encoder.Encode(snapshot); err != nil {
fmt.Fprintln(stderr, err)
return 1
}
return 0
}
func envOr(key, fallback string) string {
if value := os.Getenv(key); value != "" {
return value
}
return fallback
}
@@ -2,8 +2,6 @@ package controlplane
import (
"fmt"
"os"
"path/filepath"
"strings"
"time"
@@ -63,8 +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 commands afresh.
{Kind: UpdateSettingsKind, Title: "Update settings", ApplyMode: "live", Document: releaseupdate.Commands{}, Seed: seedUpdateCommands, Validate: validateUpdateCommands},
// 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},
}
}
@@ -126,38 +124,9 @@ func validateScheduling(input []byte) error {
})
}
// seedUpdateCommands points at the update scripts a release installs beside
// its binaries, so a zip install can update itself with nothing configured.
func seedUpdateCommands(config.Config) any {
var commands releaseupdate.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}
}
commands.Check = script("archie-update-check")
commands.Install = script("archie-update-install")
return commands
}
// validateUpdateCommands refuses a command with a blank program, and an
// install command without a check to approve its release.
func validateUpdateCommands(input []byte) error {
return validateAs(input, func(doc releaseupdate.Commands) error {
for name, command := range map[string][]string{"check_command": doc.Check, "install_command": doc.Install} {
if len(command) != 0 && strings.TrimSpace(command[0]) == "" {
return fmt.Errorf("%s needs a program", name)
}
}
if len(doc.Install) != 0 && len(doc.Check) == 0 {
return fmt.Errorf("install_command needs a check_command")
}
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)
})
}
@@ -109,24 +109,35 @@ func (d *ChannelDuration) UnmarshalJSON(data []byte) error {
return nil
}
// UpdateSettingsKind holds the commands that check for and install releases.
// UpdateSettingsKind holds which releases the update scripts select.
const UpdateSettingsKind = "update-settings"
// 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()}
// 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."`
}
// updateCommands reads the update-settings resource. An unstored kind is no
// commands.
func updateCommands(reader ResourceReader) func(context.Context) (releaseupdate.Commands, error) {
return func(ctx context.Context) (releaseupdate.Commands, error) {
var commands releaseupdate.Commands
// UpdateService checks GitHub on the stored release channel and installs
// through the script beside this binary. statePath keeps each recipient's
// deferrals; healthURL reaches the installer.
func UpdateService(reader ResourceReader, statePath, healthURL string) *releaseupdate.Service {
return &releaseupdate.Service{
Catalog: &releaseupdate.GitHubCatalog{Channel: updateChannel(reader)},
Installer: releaseupdate.ScriptInstaller{HealthURL: healthURL},
StatePath: statePath,
InstallType: installtype.Type(),
}
}
// updateChannel reads the update-settings resource. An unstored kind is the
// stable channel.
func updateChannel(reader ResourceReader) func(context.Context) (string, string, error) {
return func(ctx context.Context) (string, string, error) {
settings := UpdateSettings{Channel: "stable"}
_, _, err := reader.Query(ctx, UpdateSettingsKind, func(value []byte) error {
return json.Unmarshal(value, &commands)
return json.Unmarshal(value, &settings)
})
return commands, err
return settings.Channel, settings.Pin, err
}
}
@@ -53,6 +53,15 @@ func confinedCommand(ctx context.Context, binary *os.File, socket string) (*exec
return cmd, nil
}
// openCommand runs the verified binary by its open descriptor with the host's
// network, for a package that declares no egress hosts.
func openCommand(ctx context.Context, binary *os.File) *exec.Cmd {
path := fmt.Sprintf("/proc/%d/fd/%d", os.Getpid(), binary.Fd())
cmd := exec.CommandContext(ctx, path) //nolint:gosec // the host-verified binary, by descriptor
cmd.SysProcAttr = &syscall.SysProcAttr{Pdeathsig: syscall.SIGKILL}
return cmd
}
// launch runs inside the namespace: loopback up, relay listening, then the
// extension from descriptor 3 with every capability gone.
func launch(socket string) int {
@@ -14,3 +14,7 @@ import (
func confinedCommand(context.Context, *os.File, string) (*exec.Cmd, error) {
return nil, errors.New("extensions need Linux network namespaces to confine their egress")
}
func openCommand(ctx context.Context, binary *os.File) *exec.Cmd {
return exec.CommandContext(ctx, binary.Name()) //nolint:gosec // the host-verified binary
}
+27 -10
View File
@@ -11,6 +11,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"sync"
"github.com/hashicorp/go-hclog"
@@ -36,9 +37,9 @@ type Spec struct {
// Env names the host environment variables the extension may see. PATH and
// HOME are always passed so a plugin can find the CLI it wraps.
Env []string
// Egress is the accepted egress host list. The extension runs in its own
// network namespace and reaches only these hosts, through a proxy; an
// empty list reaches nothing.
// Egress is the accepted egress host list. When it names hosts, the
// extension runs in its own network namespace and reaches only these,
// through a proxy; an empty list runs it on the host's network.
Egress []string
}
@@ -58,7 +59,28 @@ type proc struct {
func (p *proc) kill() {
p.client.Kill()
p.gate.close()
if p.gate != nil {
p.gate.close()
}
}
// command confines the extension to egress when the package declares hosts.
// A package that declares none opted out of confinement and gets the host's
// network, with no gate.
func command(ctx context.Context, binary *os.File, egress []string) (*exec.Cmd, *gate, error) {
if len(egress) == 0 {
return openCommand(ctx, binary), nil, nil
}
g, err := openGate(ctx, egress)
if err != nil {
return nil, nil, fmt.Errorf("egress: %w", err)
}
cmd, err := confinedCommand(ctx, binary, g.socket)
if err != nil {
g.close()
return nil, nil, err
}
return cmd, g, nil
}
// NewHost returns a Host that reports plugin lifecycle problems to log.
@@ -81,13 +103,8 @@ func (h *Host) Start(ctx context.Context, spec Spec, surface string, impl goplug
return nil, fmt.Errorf("extension %q: %w", spec.Name, err)
}
defer func() { _ = binary.Close() }()
g, err := openGate(ctx, spec.Egress)
cmd, g, err := command(ctx, binary, spec.Egress)
if err != nil {
return nil, fmt.Errorf("extension %q: egress: %w", spec.Name, err)
}
cmd, err := confinedCommand(ctx, binary, g.socket)
if err != nil {
g.close()
return nil, fmt.Errorf("extension %q: %w", spec.Name, err)
}
cmd.Env = passEnv(spec.Env)
@@ -158,10 +158,13 @@ func TestHostLaunch(t *testing.T) {
key string
want string
wantErr string
// open runs the package with no declared egress hosts.
open bool
}{
{name: "an accepted egress host is reachable through the proxy", sha: good, key: "GET:http://" + accepted, want: "reached"},
{name: "a host that was not accepted is refused", sha: good, key: "GET:http://" + other, want: "403 Forbidden"},
{name: "a direct connection bypassing the proxy fails", sha: good, key: "DIAL:" + accepted, want: "dial failed"},
{name: "a package declaring no egress hosts dials directly", sha: good, key: "DIAL:" + accepted, want: "connected", open: true},
{name: "loopback is refused even when accepted", sha: good, key: "GET:http://" + loopback, want: "502 Bad Gateway"},
{name: "settings reach the engine", sha: good, key: "color", want: "blue"},
{name: "an unknown key is not found", sha: good, key: "missing", wantErr: "not found"},
@@ -174,6 +177,9 @@ func TestHostLaunch(t *testing.T) {
host := extension.NewHost(hclog.NewNullLogger())
t.Cleanup(host.Close)
spec := extension.Spec{Name: "echo", Path: os.Args[0], SHA256: tt.sha, Env: []string{"ARCHIE_TEST_PASSED"}, Egress: []string{accepted, loopback}}
if tt.open {
spec.Egress = nil
}
engine, err := Start(context.Background(), host, spec, map[string]string{"color": "blue"})
if tt.sha != good {
if err == nil || !strings.Contains(err.Error(), tt.wantErr) {
+7 -41
View File
@@ -2,53 +2,19 @@ package releaseupdate
import (
"fmt"
"regexp"
"strings"
"golang.org/x/mod/semver"
)
// 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"
}
// 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)
return fmt.Errorf("unknown release channel %q", channel)
}
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 {
tag = strings.TrimPrefix(tag, "refs/tags/")
tag = strings.TrimPrefix(tag, "archied/")
if !fullVersion.MatchString(tag) || !semver.IsValid(tag) {
continue
}
if !releaseMatchesChannel(tag, channel, pin) {
continue
}
if semver.Compare(tag, newest) > 0 {
newest = tag
}
}
if newest == "" {
return "", fmt.Errorf("no release found for channel %s (pin %s)", channel, pin)
}
return strings.TrimPrefix(newest, "v"), nil
}
func releaseMatchesChannel(tag, channel, pin string) bool {
switch channel {
case "stable":
return semver.Prerelease(tag) == ""
case "exact-pin":
return tag == "v"+pin
default:
return true
if channel == "exact-pin" && !semver.IsValid("v"+strings.TrimPrefix(pin, "v")) {
return fmt.Errorf("exact-pin requires a semantic version")
}
return nil
}
-24
View File
@@ -1,24 +0,0 @@
package releaseupdate
import "testing"
func TestSelectRelease(t *testing.T) {
tags := []string{"archied/v1.9.0", "v1.10.0", "archied/v2.0.0-rc.2", "v2.0.0-rc.10", "archie/v9.0.0", "nonsense"}
for _, tc := range []struct{ channel, pin, want string }{
{"stable", "", "1.10.0"},
{"", "", "1.10.0"},
{"next", "", "2.0.0-rc.10"},
{"exact-pin", "1.9.0", "1.9.0"},
{"exact-pin", "2.0.0-rc.2", "2.0.0-rc.2"},
{"exact-pin", "9.0.0", ""},
{"exact-pin", "", ""},
{"invalid", "", ""},
} {
t.Run(tc.channel+tc.pin, func(t *testing.T) {
got, err := SelectRelease(tags, tc.channel, tc.pin)
if got != tc.want || (err != nil) != (tc.want == "") {
t.Fatalf("got %q, %v; want %q", got, err, tc.want)
}
})
}
}
+17 -51
View File
@@ -7,7 +7,9 @@ import (
"encoding/json"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
)
@@ -17,29 +19,6 @@ import (
// as-is.
const updateResultSentinel = "ARCHIE_UPDATE_RESULT "
// CommandCatalog reads a Snapshot JSON document from an explicitly configured
// argv command. It never invokes a shell; deployment tooling remains an
// administrator-owned adapter.
type CommandCatalog struct {
Command []string
}
func (c CommandCatalog) Check(ctx context.Context) (Snapshot, error) {
if len(c.Command) == 0 {
return Snapshot{}, fmt.Errorf("update check command is empty")
}
cmd := exec.CommandContext(ctx, c.Command[0], c.Command[1:]...)
output, err := cmd.Output()
if err != nil {
return Snapshot{}, fmt.Errorf("run update check: %w", err)
}
var snapshot Snapshot
if err := json.Unmarshal(output, &snapshot); err != nil {
return Snapshot{}, fmt.Errorf("decode update check output: %w", err)
}
return snapshot, nil
}
// CommandInstaller runs the deployment's install command. HealthURL is
// passed as ARCHIE_HEALTH_URL when set.
type CommandInstaller struct {
@@ -133,43 +112,30 @@ func componentVersions(snapshot Snapshot) map[string]Component {
// ErrNotConfigured is returned when the step's command is unset.
var ErrNotConfigured = errors.New("updates are not configured")
// Commands is the argv pair a deployment runs to check for and install updates.
type Commands struct {
Check []string `json:"check_command" title:"Check command" doc:"Prints the available releases as JSON."`
Install []string `json:"install_command" title:"Install command" doc:"Installs an approved release."`
}
// 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)
// ScriptInstaller runs the install script a release places beside this binary.
type ScriptInstaller struct {
HealthURL string
}
func (s SettingsCommands) Check(ctx context.Context) (Snapshot, error) {
commands, err := s.Load(ctx)
func (s ScriptInstaller) path() string {
exe, err := os.Executable()
if err != nil {
return Snapshot{}, err
return ""
}
if len(commands.Check) == 0 {
return Snapshot{}, ErrNotConfigured
path := filepath.Join(filepath.Dir(exe), "archie-update-install")
if info, err := os.Stat(path); err != nil || info.Mode()&0o111 == 0 {
return ""
}
return CommandCatalog{Command: commands.Check}.Check(ctx)
return path
}
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 {
func (s ScriptInstaller) Install(ctx context.Context, snapshot Snapshot, meta InstallMeta, progress func(string)) (Result, error) {
path := s.path()
if path == "" {
return Result{}, ErrNotConfigured
}
return CommandInstaller{Command: commands.Install, HealthURL: s.HealthURL}.Install(ctx, snapshot, meta, progress)
return CommandInstaller{Command: []string{path}, 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
}
// Installable reports whether the install script is present.
func (s ScriptInstaller) Installable(context.Context) bool { return s.path() != "" }
+140
View File
@@ -0,0 +1,140 @@
package releaseupdate
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
"sync"
"time"
"github.com/creativeprojects/go-selfupdate"
"github.com/samcharles93/archie-core/internal/buildinfo"
)
// ReleaseSlug is the repository releases are published to.
const ReleaseSlug = "samcharles93/archie-core"
const changelogURL = "https://github.com/" + ReleaseSlug + "/blob/main/CHANGELOG.md"
// buildSuffix is the git-describe tail of an untagged build (1.7.0-4-g0736708).
var buildSuffix = regexp.MustCompile(`-[0-9]+-g[0-9a-f]+$`)
// GitHubCatalog finds the newest release on the selected channel that ships a
// linux-amd64 zip, and reports it against this build. Only one version covers
// every component, so the daemon and agent are offered the same release.
type GitHubCatalog struct {
// Channel returns the release channel and pin in force.
Channel func(context.Context) (channel, pin string, err error)
// A found release is reused for checkTTL: unauthenticated GitHub API
// calls are limited to 60 an hour per address.
mu sync.Mutex
key string
at time.Time
release *selfupdate.Release
}
const checkTTL = 10 * time.Minute
func (c *GitHubCatalog) Check(ctx context.Context) (Snapshot, error) {
channel, pin, err := c.Channel(ctx)
if err != nil {
return Snapshot{}, err
}
if channel == "" {
channel = "stable"
}
release, err := c.detect(ctx, channel, pin)
if err != nil {
return Snapshot{}, err
}
component := func(id, label, installed string) Component {
return Component{
ID: id, Label: label,
Installed: installed, Available: release.Version(),
Reference: release.AssetName, Changelog: changelogURL,
}
}
return Snapshot{Components: []Component{
component("daemon", "Gateway", installedVersion(buildinfo.Version)),
component("agent", "Runtime", installedAgent()),
}}, nil
}
func (c *GitHubCatalog) detect(ctx context.Context, channel, pin string) (*selfupdate.Release, error) {
c.mu.Lock()
defer c.mu.Unlock()
key := channel + "\x00" + pin
if c.release != nil && c.key == key && time.Since(c.at) < checkTTL {
return c.release, nil
}
release, err := detectRelease(ctx, channel, pin)
if err != nil {
return nil, err
}
c.key, c.at, c.release = key, time.Now(), release
return release, nil
}
// detectRelease resolves channel to one published release. A release with no
// zip for this platform is not installable, so it is never offered.
func detectRelease(ctx context.Context, channel, pin string) (*selfupdate.Release, error) {
if err := ValidateChannel(channel, pin); err != nil {
return nil, err
}
updater, err := selfupdate.NewUpdater(selfupdate.Config{
Validator: &selfupdate.ChecksumValidator{UniqueFilename: "SHA256SUMS"},
Filters: []string{`-linux-amd64\.zip$`},
OS: "linux",
Arch: "amd64",
Prerelease: channel == "next",
})
if err != nil {
return nil, err
}
repository := selfupdate.ParseSlug(ReleaseSlug)
var (
release *selfupdate.Release
found bool
)
if channel == "exact-pin" {
release, found, err = updater.DetectVersion(ctx, repository, "v"+strings.TrimPrefix(pin, "v"))
} else {
release, found, err = updater.DetectLatest(ctx, repository)
}
if err != nil {
return nil, fmt.Errorf("find releases: %w", err)
}
if !found {
return nil, errors.New("no published release with a linux-amd64 zip matches the channel")
}
return release, nil
}
func installedVersion(version string) string {
return buildSuffix.ReplaceAllString(version, "")
}
// installedAgent is the image the installer last switched to, recorded in a
// sidecar beside the binaries; without one it is the runtime this release was
// cut with. A malformed sidecar is unknown, not guessed.
func installedAgent() string {
exe, err := os.Executable()
if err != nil {
return installedVersion(buildinfo.Runtime)
}
data, err := os.ReadFile(filepath.Join(filepath.Dir(exe), "archie-agent.version"))
if errors.Is(err, os.ErrNotExist) {
return installedVersion(buildinfo.Runtime)
}
version := strings.TrimSpace(string(data))
if err != nil || strings.ContainsAny(version, " \n") || ValidateChannel("exact-pin", version) != nil {
return ""
}
return installedVersion(version)
}
+1 -1
View File
@@ -161,7 +161,7 @@ func makeUpdateArchive(t *testing.T, root, scripts, scenario string) []byte {
for _, name := range []string{"archied", "archie-state-store", "archie-gateway", "archie-ui", "archie-messaging"} {
files[name] = "#!/bin/bash\n# new\nif [ \"$1\" = -version ]; then echo '" + name + " 2.0.0'; fi\nexit 0\n"
}
for _, name := range []string{"archie-update-install", "archie-update-watchdog", "archie-update-check"} {
for _, name := range []string{"archie-update-install", "archie-update-watchdog"} {
data, err := os.ReadFile(filepath.Join(scripts, name))
if err != nil {
t.Fatal(err)
-186
View File
@@ -1,186 +0,0 @@
#!/usr/bin/env bash
# archie-update-check -- update discovery adapter for archied's /update command.
#
# Writes a releaseupdate.Snapshot JSON document to stdout. archied runs this
# via CommandCatalog (internal/releaseupdate/command.go), which never invokes
# a shell, so this file must be directly executable.
#
# "Installed" for the daemon is the release the running binary was ACTUALLY
# built from, read via `archied -version`. The agent value in that output is
# only the runtime version the daemon release was cut with; it is not the
# managed image that an installer later rebuilt. The installer therefore owns
# a sidecar beside BIN_DIR, archie-agent.version, and that is authoritative.
# Older installations without the sidecar use the agent line as a compatibility
# fallback. An existing malformed sidecar is reported as unknown, not replaced
# by a fabricated version. Build-stamp git-describe suffixes are stripped for
# comparison (1.7.0-4-g0736708 -> 1.7.0).
#
# "Available" is the newest release TAG, resolved without any dependency on a
# local checkout. Two independent sources, in order:
#
# 1. the forge API (tags + releases), which also reports whether the tag has
# a PUBLISHED artifact -- the thing an artifact install path downloads;
# 2. `git ls-remote` against the source remote, which needs no API and no
# working tree.
#
# The tag is the authority for "an update exists"; the artifact is reported
# separately in Reference, so a tagged-but-unpublished release is still
# announced (it is installable via the source-build fallback) instead of being
# silently hidden.
#
# A tag source that fails to resolve is a FAILURE TO CHECK, not an absence.
# An empty Available means "this component is at the newest release we could
# resolve", so it must never be the result of a probe that failed. When no
# authoritative source answers at all, this script exits non-zero and the
# /update command says it could not check -- rather than rendering a failed
# lookup as "Archie is up to date".
set -uo pipefail
readonly REPO_SLUG="${ARCHIE_SOURCE_SLUG:-samcharles93/archie-core}"
readonly API_BASE="${ARCHIE_FORGE_API:-https://api.github.com}"
readonly SOURCE_URL="${ARCHIE_SOURCE_URL:-https://github.com/${REPO_SLUG}.git}"
readonly BIN="${ARCHIE_BIN:-$HOME/.local/bin/archied}"
readonly BIN_DIR="${ARCHIE_BIN_DIR:-$(dirname "$BIN")}"
readonly AGENT_VERSION_FILE="${ARCHIE_AGENT_VERSION_FILE:-$BIN_DIR/archie-agent.version}"
readonly CURL_TIMEOUT="${ARCHIE_FORGE_TIMEOUT:-20}"
readonly TOKEN="${ARCHIE_FORGE_TOKEN:-}"
# base 1.7.0-4-g0736708 -> 1.7.0
base() { printf '%s\n' "$1" | sed -E 's/-[0-9]+-g[0-9a-f]+$//'; }
# installed_for reads the version this binary reports for a named component.
# archied stamps both its own version and the runtime version the release was
# cut with, and -version prints one line per component -- so the installed
# runtime is what THIS RELEASE says it was built against, not a stray binary
# on the host. releaseupdate/service.go documents why a host-side archie-agent
# binary cannot answer this: every archie-agent process is task-scoped and
# ephemeral, observed only through a completed taskrun.Response.
installed_for() {
"$BIN" -version 2>/dev/null | awk -v n="$1" '$1 == n { print $2; exit }'
}
curl_api() {
if [ -n "$TOKEN" ]; then
curl -fsS --max-time "$CURL_TIMEOUT" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github+json" \
"$1" 2>/dev/null
else
curl -fsS --max-time "$CURL_TIMEOUT" \
-H "Accept: application/vnd.github+json" \
"$1" 2>/dev/null
fi
}
RELEASE_CHANNEL="${ARCHIE_UPDATE_RELEASE_CHANNEL:-stable}"
PIN="${ARCHIE_UPDATE_PIN:-}"
while [ "$#" -gt 0 ]; do
case "$1" in
--channel) RELEASE_CHANNEL="$2"; shift 2 ;;
--pin) PIN="$2"; shift 2 ;;
*) echo "unknown option: $1" >&2; exit 1 ;;
esac
done
select_release() { "$BIN" select-release -channel "$RELEASE_CHANNEL" -pin "$PIN"; }
newest_tag_git() {
local tags
tags="$(git ls-remote --tags --refs "$SOURCE_URL" 'archied/v*' 'v*' 2>/dev/null)" || return 1
printf '%s\n' "$tags" | awk '{print $2}' | select_release
}
newest_tag_api() {
local page payload tags=""
for page in $(seq 1 100); do
payload="$(curl_api "${API_BASE}/repos/${REPO_SLUG}/tags?per_page=100&page=${page}")" || return 1
tags+="$(jq -er '.[].name' <<< "$payload")"$'\n'
if [ "$(jq 'length' <<< "$payload")" -lt 100 ]; then
printf '%s' "$tags" | select_release
return $?
fi
done
echo "tag catalog exceeded pagination limit" >&2
return 1
}
# artifact_state reports whether a tagged release is PUBLISHED with assets,
# which decides whether an artifact install can use it or the source-build
# fallback has to. Purely descriptive: a failure here never fabricates a
# state, it reports "unknown-artifact".
artifact_state() {
local tag="$1" payload count
command -v jq >/dev/null 2>&1 || { printf 'unknown-artifact'; return 0; }
payload="$(curl_api "${API_BASE}/repos/${REPO_SLUG}/releases/tags/${tag}")" || { printf 'no-release'; return 0; }
[ -n "$payload" ] || { printf 'no-release'; return 0; }
count="$(printf '%s\n' "$payload" | jq -r '[.assets[] | select(.name != "")] | length' 2>/dev/null)"
case "${count:-}" in
'' | *[!0-9]*) printf 'unknown-artifact' ;;
0) printf 'no-artifact' ;;
*) printf '%s-assets' "$count" ;;
esac
}
esc() { printf '%s' "${1:-}" | sed 's/\\/\\\\/g; s/"/\\"/g'; }
daemon_installed="$(base "$(installed_for archied || true)")"
agent_installed=""
if [ -f "$AGENT_VERSION_FILE" ]; then
# A sidecar is updater state: accept only one released semantic version and
# deliberately do not fall back if it is empty or malformed.
sidecar_version="$(awk 'NF { if (seen++) { bad=1; next } gsub(/^[[:space:]]+|[[:space:]]+$/, "", $0); print } END { if (bad) exit 1 }' "$AGENT_VERSION_FILE" 2>/dev/null || true)"
if [[ "$sidecar_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?$ ]]; then
agent_installed="$(base "$sidecar_version")"
fi
else
# Compatibility for hosts installed before the sidecar existed.
agent_installed="$(base "$(installed_for archie-agent || true)")"
fi
# One version covers every component (RELEASING.md): the runtime image a
# release publishes carries the release's own version, tagged archied/v*.
daemon_available="$(newest_tag_git archied || true)"
tag_source="git-tags"
if [ -z "$daemon_available" ]; then
daemon_available="$(newest_tag_api archied || true)"
tag_source="forge-api-tags"
fi
agent_available="$daemon_available"
if [ -z "$daemon_available" ]; then
# Neither source answered. Report the failure; do not exit 0 with two empty
# components, which the caller renders as "up to date".
echo "archie-update-check: could not resolve any release tag from ${SOURCE_URL} or ${API_BASE}/repos/${REPO_SLUG}/tags" >&2
exit 1
fi
daemon_artifacts=""
[ -n "$daemon_available" ] && daemon_artifacts="$(artifact_state "archied/v${daemon_available}")"
agent_artifacts=""
agent_artifacts="$daemon_artifacts"
reference_for() {
local component="$1" version="$2" artifacts="$3"
[ -z "$version" ] && { printf ''; return 0; }
printf '%s artifact=%s (%s)' "$tag_source" "$artifacts" "$component"
}
cat <<EOF
{
"Components": [
{
"ID": "daemon",
"Label": "Gateway",
"Installed": "$(esc "$daemon_installed")",
"Available": "$(esc "$daemon_available")",
"Reference": "$(esc "$(reference_for archie-core "$daemon_available" "$daemon_artifacts")")",
"Changelog": "https://github.com/${REPO_SLUG}/blob/main/CHANGELOG.md"
},
{
"ID": "agent",
"Label": "Runtime",
"Installed": "$(esc "$agent_installed")",
"Available": "$(esc "$agent_available")",
"Reference": "$(esc "$(reference_for archie-runtime "$agent_available" "$agent_artifacts")")",
"Changelog": "https://github.com/${REPO_SLUG}/blob/main/CHANGELOG.md"
}
],
"Deferred": false
}
EOF
+2 -2
View File
@@ -63,7 +63,7 @@ for arg in "$@"; do
done
if [ "$AUTO" = 1 ] && [ -z "${ARCHIE_UPDATE_DAEMON_VERSION:-}${ARCHIE_UPDATE_AGENT_VERSION:-}" ]; then
snapshot="$("$(dirname "$0")/archie-update-check")"
snapshot="$("$BIN_DIR/archied" update check)"
export ARCHIE_UPDATE_DAEMON_PREVIOUS="$(jq -r '.Components[] | select(.ID == "daemon") | .Installed' <<< "$snapshot")"
export ARCHIE_UPDATE_DAEMON_VERSION="$(jq -r '.Components[] | select(.ID == "daemon") | .Available' <<< "$snapshot")"
export ARCHIE_UPDATE_AGENT_PREVIOUS="$(jq -r '.Components[] | select(.ID == "agent") | .Installed' <<< "$snapshot")"
@@ -226,7 +226,7 @@ if [[ ",$components," == *,daemon,* ]]; then
done
mkdir -p "$(dirname "$DB_SNAPSHOT")"
"$BIN_DIR/archie-state-store" backup -config "$CONFIG_PATH" -out "$DB_SNAPSHOT"
built="$GATEWAY_BINARIES archie-update-install archie-update-watchdog archie-update-check"
built="$GATEWAY_BINARIES archie-update-install archie-update-watchdog"
fi
# Freeze recovery code and every prior file before publishing the intent.
+1 -1
View File
@@ -92,7 +92,7 @@ archied_dirs() {
component_dirs ./cmd/archie-ui
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-install" \
"scripts/archie-update-watchdog" "deployments/INSTRUCTIONS.md"
}
+18 -18
View File
@@ -1,24 +1,24 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HarnessPage.js","assets/HarnessPage.css"])))=>i.map(i=>d[i]);
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
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 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
`)&&(fi(e,0)||ni(),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(li(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&&Qt(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&ls(x,n,t),h&&cr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Vo(()=>{x&&ls(x,n,t),l&&g.enter(e),h&&cr(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]=os(d[t]),g=h.type===Uo;e?(g&&!u&&t+1<p&&os(d[t+1]).type===Uo&&(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,fi(r,1)||ni()),n(null,h,r,null,o,s,ai(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&&oi(f)&&f.data===`]`?a(t.anchor=f):(ni(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(mi(e,t)||ni(),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,ai(d),s),r&&(r.vnode.el=t.el,$a(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&oi(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 ci=new Set([`src`,`srcset`,`href`,`poster`]);function li(e,t,n){return ci.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var ui=`data-allow-mismatch`,di={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function fi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(ui);)e=e.parentElement;return pi(e&&e.getAttribute(ui),t)}function pi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(di[t])}}function mi(e,t){return fi(e.parentElement,1)||hi(e)||gi(t)}function hi(e){return e.nodeType===1&&pi(e.getAttribute(ui),1)}function gi({props:e}){let t=e&&e[ui];return typeof t==`string`&&pi(t,1)}var _i=fe().requestIdleCallback||(e=>setTimeout(e,1)),vi=fe().cancelIdleCallback||(e=>clearTimeout(e)),yi=(e=1e4)=>t=>{let n=_i(t,{timeout:e});return()=>vi(n)};function bi(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 xi=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(bi(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Si=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},Ci=(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 wi(e,t){if(oi(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(oi(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Ti=e=>!!e.type.__asyncLoader;function Ei(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=>wi(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=ps;if(Yr(e),u)return()=>Di(u,e);let t=t=>{l=null,Ln(t,e,13,!r)};if(s&&e.suspense||bs)return p().then(t=>()=>Di(t,e)).catch(e=>(t(e),()=>r?W(r,{error:e}):null));let a=M(!1),c=M(),d=M(!!i),f,m;return Wi(()=>{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&&Oi(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Di(u,e);if(c.value&&r)return W(r,{error:c.value});if(n&&!d Line truncated
`))),e[xl]=vl(i);let a=r||i.props&&i.props.type===`number`;zc(e,t?`change`:`input`,t=>{t.target.composing||e[xl](Cl(e.value,n,a))}),(n||a)&&zc(e,`change`,()=>{e.value=Cl(e.value,n,a)}),t||(zc(e,`compositionstart`,yl),zc(e,`compositionend`,bl),zc(e,`change`,bl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Sl];delete e[Sl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[xl](Cl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[xl]=vl(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)}},Tl={deep:!0,created(e,t,n){e[xl]=vl(n),zc(e,`change`,()=>{let t=e._modelValue,n=Al(e),r=e.checked,i=e[xl];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(jl(e,r))})},mounted:El,beforeUpdate(e,t,n){e[xl]=vl(n),El(e,t,n)}};function El(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,jl(e,!0))}e.checked!==i&&(e.checked=i)}var Dl={created(e,{value:t},n){e.checked=De(t,n.props.value),e[xl]=vl(n),zc(e,`change`,()=>{e[xl](Al(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[xl]=vl(r),t!==n&&(e.checked=De(t,r.props.value))}},Ol={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,zc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?le(Al(e)):Al(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[xl](i)}finally{Kn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[xl]=vl(r)},mounted(e,{value:t}){kl(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[xl]=vl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!bee(t,n[1],n[0]))&&kl(e,t)}};function bee(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 kl(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=Al(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(Al(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Al(e){return`_value`in e?e._value:e.value}function jl(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Ml={created(e,t,n){Pl(e,t,n,null,`created`)},mounted(e,t,n){Pl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){Pl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){Pl(e,t,n,r,`updated`)}};function Nl(e,t){switch(e){case`SELECT`:return Ol;case`TEXTAREA`:return wl;default:switch(t){case`checkbox`:return Tl;case`radio`:return Dl;default:return wl}}}function Pl(e,t,n,r,i){let a=Nl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function xee(){wl.getSSRProps=({value:e})=>({value:e}),Dl.getSSRProps=({value:e},t)=>{if(t.props&&De(t.props.value,e))return{checked:!0}},Tl.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}},Ml.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Nl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var See=[`ctrl`,`shift`,`alt`,`meta`],Cee={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)=>See.some(n=>e[`${n}Key`]&&!t.includes(n))},Fl=(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=Cee[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},wee={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Il=(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||wee[e]===r))return e(n)}))},Ll=l({patchProp:Zc},Zs),Rl,zl=!1;function Bl(){return Rl||=bo(Ll)}function Vl(){return Rl=zl?Rl:xo(Ll),zl=!0,Rl}var Hl=((...e)=>{Bl().render(...e)}),Ul=((...e)=>{Vl().hydrate(...e)}),Wl=((...e)=>{let t=Bl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=ql(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,Kl(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&&(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
`).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(){Bi(()=>{vm().catch(e=>{tm.value=e.message||`Chat unavailable`})}),Wi(()=>{_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(gd),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:A(r(e.open))},[W(N(Kd),{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=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
`))}return()=>i.value||r.value||o.value?Ps(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!==Wo);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?q(t,i.props):t,o=is({...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)?()=>Ps(r,t):r===`template`?()=>Ps(hg,t,{default:n.default}):()=>Ps(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]=jm(`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}=_n(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 Kn();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 Bi(()=>{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=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[Og,kg]=jm(`AccordionRoot`),Ag=I({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
- a positive number
- less than the value passed to \`max\` (or ${sS} if no \`max\` prop is set)
- less than the value passed to \`max\` (or ${cS} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
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
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 Kn(),i.value=t)},{immediate:!0}),F(()=>n.max,e=>{let t=pS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=J(()=>Pm(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){Nm(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}=_n(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:Fl(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]=jm(`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}=_n(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]=jm(`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=Zi(`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(Wu),{"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(Gd),{"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:[Il(Fl(o,[`prevent`]),[`enter`]),Il(Fl(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}=ku(hO()),a=M(`all`),o=J(()=>zA(n.value,a.value)),s=J(()=>BA(o.value.length,a.value)),c=qt(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:[Il(Fl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Il(Fl(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:Fl(t=>u(e.key),[`stop`])},[d(e)?(B(),H(N(Zu),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(B(),H(N(Qu),{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={key:0,class:`text-xs text-fg-muted`},KM={key:1,class:`flex flex-col gap-1 text-xs`},qM={key:1},JM={key:2,class:`text-xs text-fg-muted`},YM=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=Zi(`RouterLink`);return r.value?(B(),V(`p`,GM,`Dispatches unavailable.`)):n.value.length?(B(),V(`ul`,KM,[(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`,qM,j(e.reason||`claimed, no task recorded`),1))],64)),U(`span`,null,j(N(pk)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?K(``,!0):(B(),V(`p`,JM,` No dispatches yet. `))}}}),XM=I({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(B(),H(N(fd),{role:`status`,"aria-label":`Loading`,class:A(N(Y)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}});function ZM(e,t){return t?e.filter(e=>e.event_type_id===t):[]}function QM(e){return(e?.repository??`required`)!==`none`}function $M(e,t){return e.filter(e=>t===`any`||e.type===`any`||e.type===t)}function eN(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 tN={pending_approval:`pending approval`,armed:`armed`,paused:`paused`},nN={pending_approval:`warn`,armed:`ok`,paused:`idle`};function rN(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(`
`)?`
@@ -123,17 +123,17 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){IZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(jZ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=FZ(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(jZ(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(NZ(t.key)&&!jZ(t.sep,`newline`)){let e=FZ(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):jZ(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!jZ(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){IZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||jZ(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.ite Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=FZ(PZ(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=FZ(PZ(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function zZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new AZ||null,prettyErrors:t}}function BZ(e,t={}){let{lineCounter:n,prettyErrors:r}=zZ(t),i=new RZ(n?.addNewLine),a=new gZ(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new MX(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(PX(e,n)),o.warnings.forEach(PX(e,n))),o}function VZ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=BZ(e,n);if(!i)return null;if(i.warnings.forEach(e=>uY(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function HZ(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return aJ(e)&&!r?e.toString(n):new kX(e,r,n).toString(n)}function UZ(e,t){let n=new Map;for(let e of t)n.set(e.name,[...n.get(e.name)??[],e]);return{edges:e.edges,nodes:e.nodes.map(e=>{let{stage:t,occurrence:r}=e.data,i=t===void 0?void 0:n.get(t)?.[r??0];return i?{...e,data:{...e.data,run:i}}:e})}}function WZ(e,t){let n=e=>e.path&&e.path.length>=2?Number(e.path[1]):-1,r=e.nodes.find(e=>JSON.stringify(e.data.path)===JSON.stringify(t))?.data,i=r?.resume??r?.stage;if(!r||!i)return null;let a=Math.max(-1,...e.nodes.filter(e=>e.data.run).map(e=>n(e.data))),o=n(r);if(o<0||o>a)return null;let s=e.nodes.filter(e=>e.data.path?.length===2).sort((e,t)=>n(e.data)-n(t.data)).map(e=>e.data.resume??e.data.stage??``),c=e=>!!e&&s.filter(t=>t===e).length>1;return c(i)||o>0&&c(s[o-1])?{label:`Add an id to resume here`,from:i,blocked:!0}:{label:o===a?`Resume from here`:`Re-run from here`,from:i}}var GZ=140,KZ=280,qZ={"agent.run":`Agent`,"command.run":`Run commands`,"repo.prepare":`Prepare worktree`,"repo.commit":`Commit`,"repo.open-pr":`Open pull request`,"gate.repository":`Repository gate`,"gate.diff-size":`Diff size gate`,"gate.diff-rules":`Diff rules gate`,"forge.comment":`Comment`,"forge.close-issue":`Close issue`,"human.approve":`Human approval`,"workflow.call":`Call workflow`,"workflow.handoff":`Hand off`,"workflow.finish":`Finish`,"review.pr":`Review pull request`,"review.start-round":`Start review round`,"review.reply":`Reply to review`};function JZ(e){return qZ[e]??e}var YZ=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function XZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ZZ(e,t){let n=e=>typeof t[e]==`string`?t[e]:``;switch(e){case`agent.run`:return[n(`role`)||`builder`,t.read_only?`read-only`:n(`gate`)?`gated: ${n(`gate`)}`:``].filter(Boolean).join(` · `);case`repo.commit`:return[n(`message`),t.push?`push`:``].filter(Boolean).join(` · `);case`workflow.call`:case`workflow.handoff`:return n(`workflow`);case`workflow.finish`:return n(`status`)||`completed`;case`human.approve`:return n(`then`)?`then ${n(`then`)}`:``;case`gate.repository`:return n(`expect`)===`test-failure`?`tests must fail`:t.repair?`repair if red`:``}return``}function QZ(e){for(let t of[`mission`,`message`,`body`,`plan`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.replace(/\{\{\s*([^}]+?)\s*\}\}/g,`‹$1›`).split(`
`).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
`).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:qu,command:Pd,repo:ld,gate:jd,forge:_d,human:Vd,review:sd,workflow:Wd},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]]??Wd}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(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(`
`)[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($i(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(Kd))]),_: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(rd),{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(Qw),{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(rd),{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(rd),{key:0,class:`size-3 text-fg-subtle`})):K(``,!0)],8,e$),e.kind===`text`?(B(),H(N(Qw),{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(Qw),{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(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
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(B(),V(z,{key:2},[W(N(Qw),{"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(Id)),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$(eN(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:eN(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 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
`).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(()=>fn(t?.target)??Une),r=cn(fn(e)===!0),i=!1,a=new Set,o=c(fn(e));F(()=>fn(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=fn(t?.actInsideInputWithModifier)??!0,a=fn(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=fn(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=fn(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:rn({width:0,height:0}),computedPosition:rn({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:rn(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:rn(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
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 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
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]),Kn(()=>{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
-1
View File
@@ -143,7 +143,6 @@ const tones = {
</AlertDialogHeader>
<ul class="font-mono text-xs">
<li v-for="line in accepting ? grants(accepting.declared) : []" :key="line">{{ line }}</li>
<li v-if="accepting && !grants(accepting.declared).length">Nothing beyond its own process.</li>
</ul>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
+18 -17
View File
@@ -3,29 +3,30 @@ 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 Commands = { check_command: string[] | null; install_command: string[] | null };
type UpdateSettings = { channel: string; pin: string };
const store = useControlPlaneStore();
onMounted(store.load);
const draft = computed(() => store.drafts[KIND]?.value as Commands | undefined);
const draft = computed(() => store.drafts[KIND]?.value as UpdateSettings | undefined);
const error = computed(() => store.stateFor(KIND).error);
// Each command is an argv array, edited as one line split on whitespace.
function argv(field: keyof Commands) {
return computed({
get: () => (draft.value?.[field] ?? []).join(" "),
set: (line: string) => {
if (draft.value) draft.value[field] = line.split(/\s+/).filter(Boolean);
},
});
}
const check = argv("check_command");
const install = argv("install_command");
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>
@@ -35,11 +36,11 @@ const install = argv("install_command");
</CardHeader>
<CardContent>
<p v-if="error" class="mb-2 text-sm text-danger" role="alert">{{ error }}</p>
<SettingRow label="Check command" for="update-check" hint="Prints the available releases as JSON.">
<Input id="update-check" v-model="check" class="font-mono" placeholder="archie-update-check" />
<SettingRow label="Release channel">
<SegmentedControl v-model="channel" label="Release channel" :options="channels" />
</SettingRow>
<SettingRow label="Install command" for="update-install" hint="Installs the release you approve. Empty hides Install.">
<Input id="update-install" v-model="install" class="font-mono" placeholder="archie-update-install" />
<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>
+3 -1
View File
@@ -58,7 +58,9 @@ export function grants(authority: Authority): string[] {
["tool", authority.tools],
["env", authority.env],
];
return labelled.flatMap(([label, values]) => values.map((value) => `${label}: ${value}`));
const lines = labelled.flatMap(([label, values]) => values.map((value) => `${label}: ${value}`));
// A package that declares no egress hosts runs on the host's network.
return authority.egress_hosts.length ? lines : ["network: unrestricted", ...lines];
}
/** What an extension needs from the operator next, in the order it happens. */