feat(egress): record a test run's deliveries instead of sending them

A test run used to suppress only forge and push writes, which named one
destination among many. Deliveries now have one seam: TaskContext.Deliveries
records each as "would ..." and performs none, and a recording egress
session does the same for a Kit run's HTTP writes and central tool calls,
answering them synthetically. Provider hosts stay live, since model traffic
is how a test run reads. Native containers have no proxy (archie-core-n8d3).
This commit is contained in:
sam committed 2026-10-25 16:01:06 +11:00
1 parent 7cd62232ef
commit 958561d255
18 files changed
+273 -58

No files matched your search

+3 -3
View File
@@ -278,11 +278,11 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
}
// configureTaskContext applies what the task's kind changes about its context:
// a test run writes nothing to a forge, and pr-review reads the PR data the
// daemon prefetched into workDir.
// a test run records every outward delivery and performs none, and pr-review
// reads the PR data the daemon prefetched into workDir.
func configureTaskContext(tc *workflow.TaskContext, workDir string) {
if tc.Task.IsTestRun() {
workflow.SuppressForgeWrites(tc)
workflow.RecordDeliveries(tc)
}
if tc.Task.Workflow == "pr-review" {
tc.PRSource = prsource.NewFromMount(filepath.Join(workDir, prsource.PrefetchDirName))
+11 -1
View File
@@ -16,6 +16,7 @@ import (
"github.com/samcharles93/archie-core/internal/app/servicekit"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/presence"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
"github.com/samcharles93/archie-core/internal/infrastructure/kitrun"
"github.com/samcharles93/archie-core/internal/infrastructure/tasktools"
@@ -70,7 +71,16 @@ func (b *boot) setupKitLauncher(ctx context.Context) {
return
}
b.addCleanup(cleanup)
proxy := egress.NewProxy(ca, egress.ProxyOptions{Resolver: resolver, OAuthStore: oauthStore, TaskTools: gateway})
proxy := egress.NewProxy(ca, egress.ProxyOptions{
Resolver: resolver, OAuthStore: oauthStore, TaskTools: gateway,
// A test run's recorded deliveries land on the task's timeline through
// the same bus every other event uses.
Events: func(event events.Event) {
if b.bus != nil {
b.bus.Publish(event)
}
},
})
srv := &http.Server{Handler: proxy, ReadHeaderTimeout: 30 * time.Second}
go func() {
if err := srv.Serve(ln); err != nil && !errors.Is(err, http.ErrServerClosed) {
+4
View File
@@ -67,6 +67,10 @@ func (m modelEgress) Open(token, org string, providers map[string]config.Provide
hosts = append(hosts, host)
env = append(env, keyed[name]+"="+egress.SentinelFor(name))
}
// A model session never records, whatever its task is: this is the one
// session that must carry provider traffic for real, and it carries nothing
// else because its network policy allows only provider hosts. A test run's
// recordings happen on the Kit session that carries the rest of the run.
session, err := m.proxy.Register(egress.SessionOptions{
Token: token, Org: org, Substitutions: subs, Secrets: secrets,
Network: &spec.PhasedNetwork{Runtime: &spec.NetworkRules{Allow: hosts}},
+25
View File
@@ -9,6 +9,7 @@ import (
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/workflow"
workflowtask "github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
"github.com/samcharles93/archie-core/internal/infrastructure/kit"
"github.com/samcharles93/archie-core/internal/infrastructure/kitrun"
"github.com/samcharles93/archie-core/internal/storage"
@@ -68,6 +69,10 @@ func (d *Daemon) runKitTask(ctx context.Context, task *workflow.Task, repo confi
// override (Forge, Budgets, ...).
taskCfg := d.configFor(task)
credentialOrg, grantedServices := taskCfg.CredentialAccess("")
var record *egress.RecordOptions
if task.IsTestRun() {
record = &egress.RecordOptions{TaskID: task.ID, ModelHosts: modelHosts(d.Cfg.Get().Providers)}
}
run, err := d.KitLauncher.Launch(ctx, kitrun.Request{
TaskID: task.ID,
Attempt: task.Attempt,
@@ -79,6 +84,7 @@ func (d *Daemon) runKitTask(ctx context.Context, task *workflow.Task, repo confi
Org: credentialOrg,
GrantedServices: grantedServices,
RunCredential: credential,
Record: record,
})
if err != nil {
park("kit launch failed", err)
@@ -186,3 +192,22 @@ func (d *Daemon) openModelEgress(ctx context.Context, task *workflow.Task, crede
}
return session, func() { d.ModelEgress.Close(ctx, credential) }, nil
}
// modelHosts is every host a configured provider is reached at. A test run
// records its deliveries, but a model call is how the run reads, so these hosts
// are let through whatever their method: this errs broad on purpose, because a
// provider left out would silently swallow the run's model calls, and no
// provider host is a delivery destination.
func modelHosts(providers map[string]config.Provider) []string {
seen := make(map[string]bool, len(providers))
hosts := make([]string, 0, len(providers))
for _, p := range providers {
host, err := egress.ProviderHost(p.Class, p.BaseURL)
if err != nil || seen[host] {
continue
}
seen[host] = true
hosts = append(hosts, host)
}
return hosts
}
+3 -3
View File
@@ -153,7 +153,7 @@ type Task struct {
// SourceForge, SourceChat and SourceTest are the valid values for Task.Source.
// A test run is a chat-shaped task that runs an unsaved draft definition and
// writes nothing to a forge.
// records every outward delivery instead of performing it.
// Legacy rows and forge-polled tasks have Source == SourceForge (the
// zero value defaults there via the SQLite column default).
const (
@@ -169,8 +169,8 @@ func (t Task) IsForgeBacked() bool {
return t.Source != SourceChat && t.Source != SourceTest
}
// IsTestRun reports whether t runs an operator's draft with forge writes
// suppressed.
// IsTestRun reports whether t runs an operator's draft with every outward
// delivery recorded and none performed.
func (t Task) IsTestRun() bool {
return t.Source == SourceTest
}
+47 -27
View File
@@ -7,60 +7,80 @@ import (
"github.com/samcharles93/archie-core/internal/events"
)
// SuppressForgeWrites makes tc skip every forge and push write, recording
// each as a forge_suppressed event on the step that attempted it. A test run
// uses it so an operator's draft cannot touch a repository.
func SuppressForgeWrites(tc *TaskContext) {
tc.Forge = suppressedForge{Forger: tc.Forge, tc: tc}
tc.Trees = suppressedTrees{Trees: tc.Trees, tc: tc}
// Deliveries is the one door a run's outward effects pass through: a forge
// write, a push, an HTTP post. There is one implementation, recordDeliveries,
// because a live run needs none -- a nil TaskContext.Deliveries performs.
type Deliveries interface {
// Record records one effect the run must not perform: what it would have
// done, phrased without the leading "would". The caller returns success as
// though it had been delivered, so the rest of the step runs as it would
// have.
Record(ctx context.Context, detail string)
}
// suppress records one skipped write.
func (tc *TaskContext) suppress(action string) {
tc.Emit(events.KindForgeSuppressed, tc.Stage, action, nil)
// RecordDeliveries makes tc record every outward delivery its steps ask for
// and perform none of them, so an operator can run a draft workflow and see
// what it would do without it reaching anyone. The forge and push writes are
// wrapped here; a Kit run's network traffic and central tool calls are
// recorded by the egress proxy (egress.RecordOptions), which is also why a
// recording command.run still executes: only its network egress is recorded. A
// native container's own network has no proxy in front of it, so nothing it
// sends is recorded.
func RecordDeliveries(tc *TaskContext) {
tc.Deliveries = recordDeliveries{tc: tc}
tc.Forge = recordedForge{Forger: tc.Forge, deliveries: tc.Deliveries}
tc.Trees = recordedTrees{Trees: tc.Trees, deliveries: tc.Deliveries}
}
type suppressedForge struct {
type recordDeliveries struct {
tc *TaskContext
}
func (r recordDeliveries) Record(_ context.Context, detail string) {
r.tc.Emit(events.KindDeliveryRecorded, r.tc.Stage, "would "+detail, nil)
}
type recordedForge struct {
Forger
tc *TaskContext
deliveries Deliveries
}
func (f suppressedForge) CloseIssue(_ context.Context, owner, repo string, number int, _ string) error {
f.tc.suppress(fmt.Sprintf("Would close issue %s/%s#%d", owner, repo, number))
func (f recordedForge) CloseIssue(ctx context.Context, owner, repo string, number int, _ string) error {
f.deliveries.Record(ctx, fmt.Sprintf("close issue %s/%s#%d", owner, repo, number))
return nil
}
func (f suppressedForge) CreatePR(_ context.Context, owner, repo, title, head, base, _ string) (int, error) {
f.tc.suppress(fmt.Sprintf("Would open PR %q in %s/%s from %s into %s", title, owner, repo, head, base))
func (f recordedForge) CreatePR(ctx context.Context, owner, repo, title, head, base, _ string) (int, error) {
f.deliveries.Record(ctx, fmt.Sprintf("open PR %q in %s/%s from %s into %s", title, owner, repo, head, base))
return 0, nil
}
func (f suppressedForge) LinkBranch(_ context.Context, owner, repo string, number int, branch string) error {
f.tc.suppress(fmt.Sprintf("Would link %s to %s/%s#%d", branch, owner, repo, number))
func (f recordedForge) LinkBranch(ctx context.Context, owner, repo string, number int, branch string) error {
f.deliveries.Record(ctx, fmt.Sprintf("link %s to %s/%s#%d", branch, owner, repo, number))
return nil
}
func (f suppressedForge) CreateReviewComments(_ context.Context, owner, repo string, number int, _ string, review Review) error {
f.tc.suppress(fmt.Sprintf("Would post a %s review with %d comments on %s/%s#%d", review.Event, len(review.Comments), owner, repo, number))
func (f recordedForge) CreateReviewComments(ctx context.Context, owner, repo string, number int, _ string, review Review) error {
f.deliveries.Record(ctx, fmt.Sprintf("post a %s review with %d comments on %s/%s#%d", review.Event, len(review.Comments), owner, repo, number))
return nil
}
func (f suppressedForge) Comment(_ context.Context, owner, repo string, number int, body string) (int64, error) {
f.tc.suppress(fmt.Sprintf("Would comment on %s/%s#%d: %s", owner, repo, number, body))
func (f recordedForge) Comment(ctx context.Context, owner, repo string, number int, body string) (int64, error) {
f.deliveries.Record(ctx, fmt.Sprintf("comment on %s/%s#%d: %s", owner, repo, number, body))
return 0, nil
}
func (f suppressedForge) ReplyToReview(_ context.Context, owner, repo string, number int, _ int64, body string) error {
f.tc.suppress(fmt.Sprintf("Would reply to a review on %s/%s#%d: %s", owner, repo, number, body))
func (f recordedForge) ReplyToReview(ctx context.Context, owner, repo string, number int, _ int64, body string) error {
f.deliveries.Record(ctx, fmt.Sprintf("reply to a review on %s/%s#%d: %s", owner, repo, number, body))
return nil
}
type suppressedTrees struct {
type recordedTrees struct {
Trees
tc *TaskContext
deliveries Deliveries
}
func (t suppressedTrees) Push(_ context.Context, _, branch string) error {
t.tc.suppress(fmt.Sprintf("Would push branch %s", branch))
func (t recordedTrees) Push(ctx context.Context, _, branch string) error {
t.deliveries.Record(ctx, fmt.Sprintf("push branch %s", branch))
return nil
}
+7 -5
View File
@@ -2,20 +2,22 @@ package workflow
import (
"context"
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/events"
)
// TestSuppressForgeWritesSkipsEveryWrite pins that a test run reaches neither
// TestRecordDeliveriesRecordsEveryWrite pins that a test run reaches neither
// the forge nor a push: the embedded nil Forger and Trees panic if any call
// falls through, and each skipped write is recorded as an event.
func TestSuppressForgeWritesSkipsEveryWrite(t *testing.T) {
// falls through, and each one is recorded on the step that asked for it as
// "would ...".
func TestRecordDeliveriesRecordsEveryWrite(t *testing.T) {
bus := events.NewBus()
sub := bus.Subscribe(16)
defer sub.Close()
tc := &TaskContext{Task: &Task{Source: SourceTest, Owner: "o", Repo: "r"}, Bus: bus, Stage: "open-pr"}
SuppressForgeWrites(tc)
RecordDeliveries(tc)
ctx := context.Background()
writes := map[string]func() error{
@@ -33,7 +35,7 @@ func TestSuppressForgeWritesSkipsEveryWrite(t *testing.T) {
}
select {
case event := <-sub.C:
if event.Kind != events.KindForgeSuppressed || event.Stage != "open-pr" || event.Detail == "" {
if event.Kind != events.KindDeliveryRecorded || event.Stage != "open-pr" || !strings.HasPrefix(event.Detail, "would ") {
t.Fatalf("%s recorded %+v", name, event)
}
default:
+3
View File
@@ -102,6 +102,9 @@ type TaskContext struct {
Store Store
Trees Trees
Agent agentrun.Runner
// Deliveries records the run's outward effects instead of performing them.
// Nil performs them; a test run's RecordDeliveries sets it.
Deliveries Deliveries
// Calls starts workflow.call callees and reads them back while a
// wait:true caller waits. Nil is only safe for a workflow with no
// workflow.call step: such a step in a runner with no capability
+6 -5
View File
@@ -23,11 +23,12 @@ const (
// run. Only emitted for runners that execute in the same process as their
// tools; see agentexec.ToolCallReporter.
KindToolCall = "tool_call" // data: tool, failed
// KindForgeSuppressed records a forge or push write a test run skipped.
// detail: what it would have done.
KindForgeSuppressed = "forge_suppressed"
KindParked = "parked" // data: reason
KindOutcome = "outcome" // data: status, detail
// KindDeliveryRecorded records one outward delivery a test run did not
// perform: a forge write, a push, an HTTP request, a central tool call.
// detail: what it would have done, phrased "would ...".
KindDeliveryRecorded = "delivery_recorded"
KindParked = "parked" // data: reason
KindOutcome = "outcome" // data: status, detail
// KindChatOutcome records a finished task's outcome posted to the chat
// that started it.
KindChatOutcome = "chat_outcome"
+1 -1
View File
@@ -194,7 +194,7 @@ func (s *Server) authorize(identity string, target Target, permission string) er
return errors.New("forge request is outside its run's repository")
}
if task.IsTestRun() {
return errors.New("forge writes are suppressed in a test run")
return errors.New("a test run records deliveries instead of performing them")
}
name := workflow.PackageOf(task.WorkflowDefinitionYAML)
if name == "" {
+70 -3
View File
@@ -7,6 +7,7 @@ import (
"crypto/x509"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"net"
@@ -20,8 +21,10 @@ import (
"time"
"github.com/docker/sandbox-kit-spec/v3/spec"
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/samcharles93/archie-core/internal/domain/access"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/infrastructure/tasktools"
)
@@ -52,6 +55,7 @@ type Session struct {
substitutions []substitution
secrets map[string]string
oauth []oauthRule
record *RecordOptions
atRun atomic.Bool
}
@@ -89,6 +93,20 @@ type ProxyOptions struct {
// one, Register refuses a session with a required OAuth credential.
OAuthStore OAuthStore
TaskTools tasktools.Backend
// Events publishes a recorded delivery on the daemon's event stream, so it
// lands on the task's timeline like every other event. Nil records nowhere.
Events func(events.Event)
}
// RecordOptions make a session a test run's: what its container attempts is
// recorded on TaskID's timeline as "would ..." and answered with a synthetic
// success instead of being forwarded.
type RecordOptions struct {
TaskID int64
// ModelHosts are the hosts the run's model calls go to. They are never
// recorded or swallowed whatever their method: a provider request is how
// the run reads, and a recorded one leaves an operator nothing to look at.
ModelHosts []string
}
// SessionOptions describe one container's run: the run credential it acts
@@ -114,6 +132,9 @@ type SessionOptions struct {
// substitution prefers them over the Resolver, so a run-supplied key needs
// no credential binding.
Secrets map[string]string
// Record makes this a test run's session. Nil forwards everything, which is
// what a live run and a setup session get.
Record *RecordOptions
}
// Proxy is the egress proxy sandbox containers reach through their relay.
@@ -127,6 +148,7 @@ type Proxy struct {
resolver Resolver
oauth OAuthStore
taskTools tasktools.Backend
events func(events.Event)
mu sync.RWMutex
sessions map[string]*Session
@@ -135,7 +157,7 @@ type Proxy struct {
type sessionKey struct{}
func NewProxy(ca *CA, opts ProxyOptions) *Proxy {
p := &Proxy{ca: ca, dial: opts.Dial, resolver: opts.Resolver, oauth: opts.OAuthStore, taskTools: opts.TaskTools, sessions: map[string]*Session{}}
p := &Proxy{ca: ca, dial: opts.Dial, resolver: opts.Resolver, oauth: opts.OAuthStore, taskTools: opts.TaskTools, events: opts.Events, sessions: map[string]*Session{}}
p.transport = &http.Transport{
DialContext: p.dialUpstream,
TLSClientConfig: &tls.Config{RootCAs: opts.UpstreamRoots, MinVersion: tls.VersionTLS12},
@@ -154,7 +176,7 @@ func (p *Proxy) Register(opts SessionOptions) (*Session, error) {
s := &Session{
token: opts.Token, org: opts.Org, runCredential: opts.RunCredential, principal: opts.Principal,
injections: compileInjections(opts.Credentials, opts.Bound), oauth: compileOAuthRules(opts.Credentials, opts.Bound),
substitutions: compileSubstitutions(opts.Substitutions), secrets: opts.Secrets,
substitutions: compileSubstitutions(opts.Substitutions), secrets: opts.Secrets, record: opts.Record,
}
if opts.RunCredential != "" && p.taskTools != nil {
var token [32]byte
@@ -302,6 +324,13 @@ func (p *Proxy) serveConnect(w http.ResponseWriter, r *http.Request, s *Session)
func (p *Proxy) forward(ctx context.Context, w http.ResponseWriter, r *http.Request, s *Session, scheme, host string, port int) {
target := net.JoinHostPort(host, strconv.Itoa(port))
if s.records(r.Method, host) {
// Recorded, never forwarded: an empty 2xx is all the client needs to
// carry on, and it must not learn which destinations are real.
p.recordDelivery(s, r.Method+" "+host+r.URL.Path)
w.WriteHeader(http.StatusOK)
return
}
if rule, ok := tokenEndpointRule(s, r, host, port); ok {
if !slices.Contains(rule.phases, s.phase()) {
http.Error(w, "credential "+rule.service+" is not available in this phase", http.StatusForbidden)
@@ -354,6 +383,26 @@ func (p *Proxy) forward(ctx context.Context, w http.ResponseWriter, r *http.Requ
rp.ServeHTTP(w, r)
}
// records reports whether this request is a delivery a recording session must
// record instead of perform: a write, to a host the run's model traffic does
// not go to. Reads are never deliveries.
func (s *Session) records(method, host string) bool {
switch method {
case http.MethodGet, http.MethodHead, http.MethodOptions:
return false
}
return s.record != nil && !slices.Contains(s.record.ModelHosts, host)
}
// recordDelivery reports one delivery a recording session never made, as
// "would ..." on the task's timeline.
func (p *Proxy) recordDelivery(s *Session, detail string) {
if p.events == nil || s.record == nil {
return
}
p.events(events.Event{Kind: events.KindDeliveryRecorded, TaskID: s.record.TaskID, Detail: "would " + detail})
}
// dialUpstream resolves and dials an upstream, refusing addresses that
// would turn the proxy into a path back into the host or its networks.
func (p *Proxy) dialUpstream(ctx context.Context, network, addr string) (net.Conn, error) {
@@ -484,7 +533,25 @@ func (p *Proxy) serveTaskTools(parent context.Context, w http.ResponseWriter, r
defer cancel()
stop := context.AfterFunc(s.lifetime, cancel) //nolint:contextcheck // Session revocation is an additional cancellation source.
defer stop()
tasktools.ServeHTTP(ctx, w, r, p.taskTools, s.runCredential, s.gatewayToken)
backend := p.taskTools
if s.record != nil {
// A central tool call is a delivery too. Discovery still runs: an agent
// that cannot list its tools cannot use any.
backend = recordedTools{Backend: backend, proxy: p, session: s}
}
tasktools.ServeHTTP(ctx, w, r, backend, s.runCredential, s.gatewayToken)
}
// recordedTools records each central tool call instead of making it.
type recordedTools struct {
tasktools.Backend
proxy *Proxy
session *Session
}
func (t recordedTools) Call(_ context.Context, _, tool string, _ json.RawMessage) (*mcp.CallToolResult, error) {
t.proxy.recordDelivery(t.session, "call "+tool)
return &mcp.CallToolResult{Content: []mcp.Content{&mcp.TextContent{Text: "would call " + tool}}}, nil
}
// credential is the host-held task grant, or a setup session's own grant.
@@ -0,0 +1,80 @@
package egress
import (
"context"
"net"
"net/http"
"net/http/httptest"
"sync/atomic"
"testing"
"github.com/samcharles93/archie-core/internal/events"
)
// A recording session forwards none of the run's deliveries: each is answered
// with a synthetic success and reported on the task, so an operator sees what
// the draft would have sent. Reads still pass, and so do model calls whatever
// their method -- a recorded one would leave the run nothing to read.
func TestRecordedSessionRecordsDeliveries(t *testing.T) {
t.Parallel()
cases := []struct {
name string
method string
host string
modelHosts []string
wantDetail string // empty means the request must be forwarded
}{
{name: "a write is recorded and not forwarded", method: http.MethodPost, host: "hooks.example", wantDetail: "would POST hooks.example/hook"},
{name: "a read is forwarded", method: http.MethodGet, host: "hooks.example"},
{name: "a write to a model host is forwarded", method: http.MethodPost, host: "api.model.example", modelHosts: []string{"api.model.example"}},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
var forwarded atomic.Bool
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
forwarded.Store(true)
w.WriteHeader(http.StatusNoContent)
}))
defer upstream.Close()
var recorded []events.Event
proxy := NewProxy(nil, ProxyOptions{
Dial: func(ctx context.Context, _, _ string) (net.Conn, error) {
return (&net.Dialer{}).DialContext(ctx, "tcp", upstream.Listener.Addr().String())
},
Events: func(event events.Event) { recorded = append(recorded, event) },
})
session, err := proxy.Register(SessionOptions{Token: "proxy-password", Record: &RecordOptions{TaskID: 7, ModelHosts: tc.modelHosts}})
if err != nil {
t.Fatalf("register session: %v", err)
}
req := httptest.NewRequestWithContext(context.Background(), tc.method, "http://"+tc.host+"/hook", nil)
rec := httptest.NewRecorder()
proxy.forward(context.Background(), rec, req, session, "http", tc.host, 80)
if tc.wantDetail == "" {
if !forwarded.Load() {
t.Fatalf("%s was not forwarded: %d %q", tc.method, rec.Code, rec.Body.String())
}
if len(recorded) != 0 {
t.Fatalf("a forwarded request was recorded: %+v", recorded)
}
return
}
if forwarded.Load() {
t.Fatalf("%s reached the upstream", tc.method)
}
if rec.Code != http.StatusOK || rec.Body.Len() != 0 {
t.Fatalf("recorded request answered %d %q, want an empty 200", rec.Code, rec.Body.String())
}
if len(recorded) != 1 || recorded[0].Kind != events.KindDeliveryRecorded ||
recorded[0].TaskID != 7 || recorded[0].Detail != tc.wantDetail {
t.Fatalf("recorded %+v, want one %q on task 7", recorded, tc.wantDetail)
}
})
}
}
+4 -1
View File
@@ -111,6 +111,9 @@ type Request struct {
// RunCredential is the worker grant, retained only on the host and in the
// worker environment. The harness gets a separate proxy password.
RunCredential string
// Record is set for a test run: every delivery its container attempts is
// recorded on the task's timeline and performed none of.
Record *egress.RecordOptions
}
// Run is a started Kit task.
@@ -520,5 +523,5 @@ func (l *Launcher) taskSession(req Request, k kitNeeds, kinds map[string]egress.
if err != nil {
return nil, err
}
return l.Proxy.Register(egress.SessionOptions{RunCredential: req.RunCredential, Token: token, Org: req.Org, Network: k.network, Credentials: k.creds, Bound: kinds})
return l.Proxy.Register(egress.SessionOptions{RunCredential: req.RunCredential, Token: token, Org: req.Org, Network: k.network, Credentials: k.creds, Bound: kinds, Record: req.Record})
}
+1 -1
View File
@@ -62,7 +62,7 @@ func publishable(ctx context.Context, runs Runs, token, identity string) (*workf
return nil, errors.New("worktree publication grant is invalid")
}
if task.IsTestRun() {
return nil, errors.New("pushes are suppressed in a test run")
return nil, errors.New("a test run records deliveries instead of performing them")
}
return task, nil
}
+2 -2
View File
@@ -184,7 +184,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),SG&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=GG(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=oG(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-KG),KG),t/=KG,t/Math.abs(t)+Math.round(t*(qG-1)))}shouldForceSelection(e){return vG?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),JG)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(vG&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active Line truncated
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(xU(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(FV(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Jq+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Jq+1&&(this._liveRegion.textContent+=EB.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return wB.get()},set promptLabel(e){wB.set(e)},get tooMuchOutput(){return EB.get()},set tooMuchOutput(e){EB.set(e)}}}_verifyIntegers(...e){for(sJ of e)if(sJ===1/0||isNaN(sJ)||sJ%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(sJ of e)if(sJ&&(sJ===1/0||isNaN(sJ)||sJ%1!=0||sJ<0))throw Error(`This API only accepts positive integers`)}},lJ=2,uJ=1,dJ=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(lJ,Math.floor(u/e.css.cell.width)),rows:Math.max(uJ,Math.floor(l/e.css.cell.height))}}},fJ={class:`flex h-[32rem] min-h-0 flex-col gap-2`},pJ={key:0,class:`text-sm text-fg-muted`,role:`status`},mJ=P({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=J(null),r=J(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Be(()=>{let e=n.value;if(!e)return;i=new cJ({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new dJ,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),nt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(L(),j(`div`,fJ,[r.value===`open`?F(``,!0):(L(),j(`p`,pJ,[r.value===`connecting`?(L(),j(U,{key:0},[H(`Connecting…`)],64)):r.value===`closed`?(L(),j(U,{key:1},[H(`The sandbox ended.`)],64)):(L(),j(U,{key:2},[H(`Sandbox unavailable.`)],64))])),R(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),hJ={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},gJ={class:`inline-flex items-center gap-2`},_J={class:`inline-flex items-center gap-2`},vJ=`__all__`,yJ=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>LM.map(e=>({value:e.value||vJ,label:e.label}))),a=Y(()=>n.filters.level||vJ),o=Y(()=>n.filters.stage||vJ);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===vJ?``:String(e)})}function l(e){s({stage:String(e)===vJ?``:String(e)})}return(t,n)=>(L(),j(`div`,hJ,[R(`div`,gJ,[A(V(Vu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Gu),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Uu),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Wu),{key:e.value,value:e.value},{default:I(()=>[H(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),R(`div`,_J,[A(V(Vu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Gu),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Uu),null,{default:I(()=>[A(V(Wu),{value:vJ},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(Wu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),bJ={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},xJ={key:2,class:`flex flex-col items-start gap-2 py-3`},SJ={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return wB.get()},set promptLabel(e){wB.set(e)},get tooMuchOutput(){return EB.get()},set tooMuchOutput(e){EB.set(e)}}}_verifyIntegers(...e){for(sJ of e)if(sJ===1/0||isNaN(sJ)||sJ%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(sJ of e)if(sJ&&(sJ===1/0||isNaN(sJ)||sJ%1!=0||sJ<0))throw Error(`This API only accepts positive integers`)}},lJ=2,uJ=1,dJ=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(lJ,Math.floor(u/e.css.cell.width)),rows:Math.max(uJ,Math.floor(l/e.css.cell.height))}}},fJ={class:`flex h-[32rem] min-h-0 flex-col gap-2`},pJ={key:0,class:`text-sm text-fg-muted`,role:`status`},mJ=P({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=J(null),r=J(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Be(()=>{let e=n.value;if(!e)return;i=new cJ({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new dJ,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),nt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(L(),j(`div`,fJ,[r.value===`open`?F(``,!0):(L(),j(`p`,pJ,[r.value===`connecting`?(L(),j(U,{key:0},[H(`Connecting…`)],64)):r.value===`closed`?(L(),j(U,{key:1},[H(`The sandbox ended.`)],64)):(L(),j(U,{key:2},[H(`Sandbox unavailable.`)],64))])),R(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),hJ={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},gJ={class:`inline-flex items-center gap-2`},_J={class:`inline-flex items-center gap-2`},vJ=`__all__`,yJ=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>LM.map(e=>({value:e.value||vJ,label:e.label}))),a=Y(()=>n.filters.level||vJ),o=Y(()=>n.filters.stage||vJ);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===vJ?``:String(e)})}function l(e){s({stage:String(e)===vJ?``:String(e)})}return(t,n)=>(L(),j(`div`,hJ,[R(`div`,gJ,[A(V(Vu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Gu),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Uu),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Wu),{key:e.value,value:e.value},{default:I(()=>[H(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),R(`div`,_J,[A(V(Vu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Gu),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Uu),null,{default:I(()=>[A(V(Wu),{value:vJ},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(Wu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),bJ={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},xJ={key:2,class:`flex flex-col items-start gap-2 py-3`},SJ={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};FX.defaultYaml={explicit:!1,version:`1.2`},FX.defaultTags={"!!":`tag:yaml.org,2002:`};function IX(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 LX(e){let t=new Set;return OX(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function RX(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function zX(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=LX(e);let a=RX(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(bX(t.node)||SX(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 BX(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=BX(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=BX(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=BX(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=BX(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function VX(e,t,n){if(Array.isArray(e))return e.map((e,t)=>VX(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!wX(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 HX=class{constructor(e){Object.defineProperty(this,hX,{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(!_X(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=VX(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?BX(i,{"":o},``,o):o}},UX=class extends HX{constructor(e){super(lX),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=[],OX(e,{Node:(e,t)=>{(gX(t)||wX(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||=(VX(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=WX(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(IX(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 WX(e,t,n){if(gX(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(SX(t)){let r=0;for(let i of t.items){let t=WX(e,i,n);t>r&&(r=t)}return r}if(yX(t)){let r=WX(e,t.key,n),i=WX(e,t.value,n);return Math.max(r,i)}return 1}var GX=e=>!e||typeof e!=`function`&&typeof e!=`object`,KX=class extends HX{constructor(e){super(pX),this.value=e}toJSON(e,t){return t?.keep?this.value:VX(this.value,e,t)}toString(){return String(this.value)}};KX.BLOCK_FOLDED=`BLOCK_FOLDED`,KX.BLOCK_LITERAL=`BLOCK_LITERAL`,KX.PLAIN=`PLAIN`,KX.QUOTE_DOUBLE=`QUOTE_DOUBLE`,KX.QUOTE_SINGLE=`QUOTE_SINGLE`;var qX=`tag:yaml.org,2002:`;function JX(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 YX(e,t,n){if(_X(e)&&(e=e.contents),CX(e))return e;if(yX(e)){let t=n.schema[dX].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 UX(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=qX+t.slice(2));let l=JX(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new KX(e);return c&&(c.node=t),t Line truncated
`)?eZ(n,t):n.includes(`
`)?`
@@ -294,7 +294,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`)[0]?.trim()||`invalid YAML`}function i0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a0(e){return typeof e==`string`&&e.trim()!==``}var o0={class:`space-y-4 px-3 py-3`},s0={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},c0={key:1,class:`space-y-3`},l0={key:0,class:`block space-y-1.5`},u0=[`id`],d0=[`value`],f0={class:`text-xs font-medium text-fg-muted`},p0={class:`flex items-center gap-2`},m0={key:1,role:`alert`,class:`text-xs text-danger`},h0={key:2,class:`space-y-1.5`},g0=[`title`],_0={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},v0={key:0,class:`divide-y divide-border rounded-md border border-border`},y0=[`title`],b0={key:0,class:`space-y-3`},x0={class:`text-label`},S0={key:0,class:`text-danger`},C0={class:`ml-2 text-xs text-fg-subtle`},w0={key:1,class:`space-y-3`},T0={class:`text-label`},E0={class:`ml-2 text-xs text-fg-subtle`},D0=[`title`],O0={key:0,class:`text-xs text-danger`},k0={class:`space-y-1.5`},A0={key:0,role:`alert`,class:`text-xs text-danger`},j0={class:`divide-y divide-border rounded-md border border-border`},M0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},N0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},P0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},F0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},I0=[`for`],L0=P({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=we(),r=e,i=t,a=Y(()=>i1(r.yaml,r.path)??{}),o=Y(()=>n1(a.value)),s=Y(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=Y(()=>o.value?.branches.map(([e])=>e)??[]),l=Y(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,a1(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=J(``),f=J(``);function p(e,t,n=``){try{let a=e===`add`?l1(r.yaml,r.path,t):e===`rename`?u1(r.yaml,r.path,t,n):d1(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=Y(()=>r.vocabulary.find(e=>e.name===s.value)),h=Y(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=Y(()=>g1(r.yaml,r.path)),_=Y(()=>K1(a.value)),v=Y(()=>m.value?.settings&&a.value.settings?J1(a.value.settings,m.value.settings,`settings`):``),y=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],b=/mission|body|detail|plan|rules/;function x(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:b.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 S=Y(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}}),C=J(!S.value.lead&&!o.value),w=e=>[{value:``,label:`Default`},...e.map(e=>({value:e,label:e}))];function T(e){let{id:t,type:n,...a}=e;i(`update:yaml`,a1(r.yaml,r.path,{id:t,type:n,...a}))}function ee(e,t){T({...a.value,[e]:t})}function E(e){let t={...a.value.retry,...e};ee(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function D(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,T({...a.value,settings:n})}function te(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),T({...a.value,settings:n})}let O=Y(()=>r.workflows.find(e=>e.id===h.value.workflow)),ne=Y(()=>Object.entries(v1(O.value?.yaml??``,`inputs`)??{})),re=Y(()=>Object.entries(v1(O.value?.yaml??``,`outputs`)??{})),ae=Y(()=>Object.entries(v1(r.yaml,`inputs`)??{})),k=Y(()=>Object.entries(v1(r.yaml,`outputs`)??{})),oe=Y(()=>h.value.inputs??{}),se=Y(()=>h.value.outputs??{}),ce=e=>typeof e==`string`&&e.startsWith(`inputs.`),le=e=>[`object`,`array`].includes(e.type??``),ue=e=>oe.value[e]===void 0?``:String(oe.value[e]);function de(e,t,n){D(`inputs`,{...oe.value,[e]:t===``?void 0:ce(t)?t:hD(t,n??`string`)})}let fe=(e,t,n)=>e.filter(([,e])=>e.type===t.type||e.type===`any`||t.type===`any`).map(([e])=>({value:`${n}.${e}`,label:e})),pe=J(null);function me(e){let t=pe.value??S.value.lead?.key;if(!t)return;let n=typeof h.value[t]==`string`?h.value[t]:``,r=`{{ steps.${e}.summary }}`;D(t,n?`${n.trimEnd()} ${r}`:r)}let he=J({});function ge(e,t){try{D(e,t.trim()?Q$(t):void 0),he.value={...he.value,[e]:``}}catch(t){he.value={...he.value,[e]:String(t.messag Line truncated
`)[0]}}}let _e=e=>e===void 0?``:$$(e).trimEnd(),ve=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),ye=e=>typeof h.value[e]==`string`?h.value[e]:``,N=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(L(),j(`div`,o0,[v.value?(L(),j(`p`,s0,B(v.value),1)):F(``,!0),o.value?(L(),j(`section`,c0,[s.value===`switch`?(L(),j(`label`,l0,[r[15]||=R(`span`,{class:`text-xs font-medium text-fg-muted`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),A(V(Q),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${V(n)}-switch-on`,onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`list`]),R(`datalist`,{id:`${V(n)}-switch-on`},[(L(!0),j(U,null,M(g.value,e=>(L(),j(`option`,{key:e,value:`steps.${e}.result.`},null,8,d0))),128))],8,u0)])):F(``,!0),R(`div`,f0,B(s.value===`switch`?`Cases`:`Branches`),1),(L(!0),j(U,null,M(c.value,e=>(L(),j(`div`,{key:e,class:`flex items-center gap-2`},[A(V(Q),{"model-value":e,class:z(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),A(V(X),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:I(()=>[A(V(Mu))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),R(`div`,p0,[A(V(Q),{modelValue:d.value,"onUpdate:modelValue":r[1]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[2]||=gt(pt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),A(V(X),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[3]||=e=>p(`add`,d.value.trim())},{default:I(()=>[A(V(Eu))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(L(),j(`p`,m0,B(f.value),1)):F(``,!0)])):F(``,!0),S.value.lead?(L(),j(`section`,h0,[R(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[H(B(ve(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(L(),q(V(tu),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,g0),S.value.lead.kind===`workflow`?(L(),q(z1,{key:0,editable:s.value!==`workflow.call`,value:ye(S.value.lead.key),workflows:e.workflows,label:ve(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>te(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(L(),q(I1,{key:1,class:`w-full`,"model-value":ye(S.value.lead.key),options:w(S.value.lead.options),"aria-label":ve(S.value.lead.key,S.value.lead.schema),"onUpdate:modelValue":r[5]||=e=>D(S.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):S.value.lead.kind===`text`?(L(),q(V(Jd),{key:2,"model-value":ye(S.value.lead.key),class:`min-h-32 text-label leading-relaxed`,onFocus:r[6]||=e=>pe.value=S.value.lead.key,"onUpdate:modelValue":r[7]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])):(L(),q(V(Q),{key:3,"model-value":ye(S.value.lead.key),onFocus:r[8]||=e=>pe.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(L(),j(`div`,_0,[r[16]||=R(`span`,{class:`text-caption text-fg-subtle`},`Insert`,-1),(L(!0),j(U,null,M(g.value,e=>(L(),q(V(X),{key:e,type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,title:`{{ steps.${e}.summary }}`,onClick:t=>me(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`title`,`onClick`]))),128))])):F(``,!0)])):F(``,!0),A(V(X),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-fg-muted aria-expanded:bg-transparent`,"aria-expanded":C.value,onClick:r[10]||=e=>C.value=!C.value},{default:I(()=>[A(V(ie),{"data-icon":`inline-start`,class:z([`transition-transform`,!C.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=H(`More `,-1)]),_:1},8,[`aria-expanded`]),C.value?(L(),j(U,{key:3},[S.value.compact.length?(L(),j(`section`,v0,[(L(!0),j(U,null,M(S.value.compact,t=>(L(),j(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[R(`span`,{class:`flex flex-1 items-center gap-1 text-label`,title:t.schema.description},[H(B(ve(t.key,t.schema))+` `,1),t.schema.description?(L(),q(V(tu),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,y0),t.kind===`workflow`?(L(),q(z1,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:ye(t.key),workflows:e.workflows,label:ve(t.key,t.schema),onPick:e=>te(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(L(),q(V(iT),{key:1,"model-value":h.value[t.key]===!0,"onUpdate:modelValue":e=>D(t.key,e||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):t.kind===`select`?(L(),q(I1,{key:2,class:`w-40`,"model-va Line truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>D(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(L(),j(U,{key:2},[A(V(Jd),{"model-value":_e(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>ge(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),he.value[e.key]?(L(),j(`span`,O0,B(he.value[e.key]),1)):F(``,!0)],64))]))),128)),R(`section`,k0,[_.value?(L(),j(`p`,A0,B(_.value),1)):F(``,!0),R(`div`,j0,[R(`label`,M0,[r[20]||=R(`span`,{class:`flex-1 text-label`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),A(V(Q),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[11]||=e=>ee(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),R(`label`,N0,[r[21]||=R(`span`,{class:`flex-1 text-label`},`If it fails`,-1),A(I1,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:N,"onUpdate:modelValue":r[12]||=e=>ee(`on_failure`,e||void 0)},null,8,[`model-value`])]),R(`label`,P0,[r[22]||=R(`span`,{class:`flex-1 text-label`},`Attempts`,-1),A(V(Q),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-label`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>E({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),R(`div`,F0,[R(`label`,{for:`${V(n)}-backoff`,class:`flex-1 text-label`},`Retry backoff`,8,I0),A(V(Zw),{id:`${V(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>E({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):F(``,!0)]))}}),R0={class:`space-y-1.5`},z0={class:`flex items-center text-xs font-medium text-fg-muted`},B0={key:0,class:`divide-y divide-border rounded-md border border-border`},V0=P({__name:`SpecList`,props:{yaml:{},field:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`].map(e=>({value:e,label:e})),a=Y(()=>Object.entries(v1(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,y1(n.yaml,n.field,Object.fromEntries(e.filter(([e])=>e))))}function s(e,t,n){o(a.value.map((r,i)=>i===e?[t,n]:r))}function c(){let e=n.field.slice(0,-1),t=a.value.length+1;for(;a.value.some(([n])=>n===`${e}_${t}`);)t++;o([...a.value,[`${e}_${t}`,{type:`string`}]])}return(t,n)=>(L(),j(`section`,R0,[R(`div`,z0,[H(B(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),A(V(X),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:I(()=>[A(V(Eu),{"data-icon":`inline-start`}),n[0]||=H(`Add`,-1)]),_:1})]),a.value.length?(L(),j(`div`,B0,[(L(!0),j(U,null,M(a.value,([t,n],r)=>(L(),j(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[A(V(Q),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>s(r,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),A(I1,{"model-value":n.type??`string`,options:V(i),class:`w-24`,"aria-label":`${t} type`,"onUpdate:modelValue":e=>s(r,t,{...n,type:e})},null,8,[`model-value`,`options`,`aria-label`,`onUpdate:modelValue`]),A(V(iT),{"model-value":n.required===!0,title:n.required?`Required`:`Optional`,"aria-label":`${t} required`,"onUpdate:modelValue":e=>s(r,t,{...n,required:e||void 0})},null,8,[`model-value`,`title`,`aria-label`,`onUpdate:modelValue`]),A(V(X),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:I(()=>[A(V(Mu))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):F(``,!0)]))}}),H0={class:`space-y-4 px-3 py-3`},U0={class:`divide-y divide-border rounded-md border border-border`},W0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},G0={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},K0={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},q0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},J0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Y0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},X0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Z0={class:`space-y-1.5`},Q0=`6f129e29-0e26-5246-99bd-74cb4496203b`,$0=P({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=v1(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,y1(n.yaml,e,t))}let o=MT(),s=J([]),c=J(!0),l=J(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await Z.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===Q0)&&a(`identity`,Q0)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Be(u);let d=Y(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!c.value&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=qw(),p=Y(()=>{let e=Object.keys(f.stateFor(`agent-profilesLine truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(L(),j(U,{key:2},[A(V(Jd),{"model-value":_e(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>ge(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),he.value[e.key]?(L(),j(`span`,O0,B(he.value[e.key]),1)):F(``,!0)],64))]))),128)),R(`section`,k0,[_.value?(L(),j(`p`,A0,B(_.value),1)):F(``,!0),R(`div`,j0,[R(`label`,M0,[r[20]||=R(`span`,{class:`flex-1 text-label`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),A(V(Q),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[11]||=e=>ee(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),R(`label`,N0,[r[21]||=R(`span`,{class:`flex-1 text-label`},`If it fails`,-1),A(I1,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:N,"onUpdate:modelValue":r[12]||=e=>ee(`on_failure`,e||void 0)},null,8,[`model-value`])]),R(`label`,P0,[r[22]||=R(`span`,{class:`flex-1 text-label`},`Attempts`,-1),A(V(Q),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-label`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>E({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),R(`div`,F0,[R(`label`,{for:`${V(n)}-backoff`,class:`flex-1 text-label`},`Retry backoff`,8,I0),A(V(Zw),{id:`${V(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>E({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):F(``,!0)]))}}),R0={class:`space-y-1.5`},z0={class:`flex items-center text-xs font-medium text-fg-muted`},B0={key:0,class:`divide-y divide-border rounded-md border border-border`},V0=P({__name:`SpecList`,props:{yaml:{},field:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`].map(e=>({value:e,label:e})),a=Y(()=>Object.entries(v1(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,y1(n.yaml,n.field,Object.fromEntries(e.filter(([e])=>e))))}function s(e,t,n){o(a.value.map((r,i)=>i===e?[t,n]:r))}function c(){let e=n.field.slice(0,-1),t=a.value.length+1;for(;a.value.some(([n])=>n===`${e}_${t}`);)t++;o([...a.value,[`${e}_${t}`,{type:`string`}]])}return(t,n)=>(L(),j(`section`,R0,[R(`div`,z0,[H(B(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),A(V(X),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:I(()=>[A(V(Eu),{"data-icon":`inline-start`}),n[0]||=H(`Add`,-1)]),_:1})]),a.value.length?(L(),j(`div`,B0,[(L(!0),j(U,null,M(a.value,([t,n],r)=>(L(),j(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[A(V(Q),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>s(r,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),A(I1,{"model-value":n.type??`string`,options:V(i),class:`w-24`,"aria-label":`${t} type`,"onUpdate:modelValue":e=>s(r,t,{...n,type:e})},null,8,[`model-value`,`options`,`aria-label`,`onUpdate:modelValue`]),A(V(iT),{"model-value":n.required===!0,title:n.required?`Required`:`Optional`,"aria-label":`${t} required`,"onUpdate:modelValue":e=>s(r,t,{...n,required:e||void 0})},null,8,[`model-value`,`title`,`aria-label`,`onUpdate:modelValue`]),A(V(X),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:I(()=>[A(V(Mu))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):F(``,!0)]))}}),H0={class:`space-y-4 px-3 py-3`},U0={class:`divide-y divide-border rounded-md border border-border`},W0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},G0={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},K0={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},q0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},J0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Y0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},X0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Z0={class:`space-y-1.5`},Q0=`6f129e29-0e26-5246-99bd-74cb4496203b`,$0=P({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=v1(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,y1(n.yaml,e,t))}let o=MT(),s=J([]),c=J(!0),l=J(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await Z.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===Q0)&&a(`identity`,Q0)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Be(u);let d=Y(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!c.value&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=qw(),p=Y(()=>{let e=Object.keys(f.stateFor(`agent-profilesLine truncated
`).replace(`
`,`
+1 -1
View File
@@ -92,7 +92,7 @@ const issueHref = (task: Task) => (forgeIssue(task) && task.issue_url && task.is
<!-- The floor belongs on the link: a table cell ignores min-width. -->
<template #cell-title="{ row }">
<RouterLink class="inline-block min-w-40 hover:underline" :to="`/tasks/${row.id}`" @click.stop @keydown.stop>{{ title(row) }}</RouterLink>
<Badge v-if="row.source === 'test'" variant="outline" class="ml-2" title="Ran an unsaved draft; forge writes were skipped">Test</Badge>
<Badge v-if="row.source === 'test'" variant="outline" class="ml-2" title="Ran an unsaved draft; its deliveries were recorded, not sent">Test</Badge>
</template>
<template #cell-status="{ row }">
<span class="inline-flex items-center gap-1">
+1 -1
View File
@@ -31,7 +31,7 @@ function started(taskId: number): void {
variant="outline"
:aria-label="`${draft !== undefined ? 'Test' : 'Run'} ${workflow}`"
:disabled="disabled"
:title="draft !== undefined ? 'Runs this draft once. Forge writes and pushes are skipped, including in called workflows; commands and tools still run' : disabled ? 'Save first' : undefined"
:title="draft !== undefined ? 'Runs this draft once. Every delivery is recorded as what it would have sent and none is sent, including in called workflows; reads, model calls and commands still run' : disabled ? 'Save first' : undefined"
>
<component :is="draft !== undefined ? FlaskConical : Play" data-icon="inline-start" /> <span>{{ draft !== undefined ? "Test" : "Run" }}</span></Button>
</DialogTrigger>
+4 -4
View File
@@ -81,7 +81,7 @@ const activity = computed(() => events.value.filter((event) => {
if (event.data?.step_id != null) return Number(event.data.step_id) === props.stage.id;
return names.value.has(event.stage ?? "") && inWindow(event.at);
}).sort((a, b) => String(a.at ?? "").localeCompare(String(b.at ?? ""))));
const suppressed = computed(() => activity.value.filter((event) => event.kind === "forge_suppressed"));
const recorded = computed(() => activity.value.filter((event) => event.kind === "delivery_recorded"));
const groups = computed(() => {
const agents = props.stage.agents ?? [];
const branches = new Set(["", ...agents.map((agent) => agent.name.includes("/") ? agent.name.split("/")[0]! : ""), ...activity.value.map((event) => String(event.data?.branch ?? ""))]);
@@ -129,10 +129,10 @@ const scopedLogs = computed(() => logs.value ? { ...logs.value, entries: (logs.v
<p v-if="group.reports.length" class="text-xs text-fg-muted">{{ group.reports.map((report) => describeTimelineEvent(report).detail).filter(Boolean).join(' · ') }}</p>
<p v-else-if="group.agents.length" class="text-xs text-fg-muted">{{ group.agents.reduce((sum, agent) => sum + agent.tokens_used, 0).toLocaleString() }} tokens recorded</p>
</section>
<section v-if="suppressed.length" class="space-y-1">
<h3 class="text-caption font-medium uppercase text-fg-muted">Skipped in test run</h3>
<section v-if="recorded.length" class="space-y-1">
<h3 class="text-caption font-medium uppercase text-fg-muted">Not delivered in a test run</h3>
<ul class="divide-y divide-border rounded-md border border-border">
<li v-for="(event, i) in suppressed" :key="i" class="px-3 py-2 text-xs break-words whitespace-pre-wrap">{{ event.detail }}</li>
<li v-for="(event, i) in recorded" :key="i" class="px-3 py-2 text-xs break-words whitespace-pre-wrap">{{ event.detail }}</li>
</ul>
</section>
<section class="space-y-3">