Merge pull request #1602 from samcharles93/feat/workflow-runs-as

Feat/workflow runs as
This commit is contained in:
sam authored and GitHub committed 2026-10-12 02:08:30 +11:00
commit 58fecdf16b
18 files changed
+172 -79

No files matched your search

+6 -9
View File
@@ -704,7 +704,7 @@ func (d *Daemon) dispatchOneBinding(ctx context.Context, b binding.Binding, c st
d.recordDispatchFailure(ctx, b, c, reason, nil)
return
}
// The chain decides dispatch: the workflow's identity may `run` this
// The chain decides dispatch: the binding's principal may `run` this
// workflow in its workspace, and the event's signature result and address
// travel with the request. A denial is terminal; an unavailable principal
// leaves the capture listed for the next cycle.
@@ -737,20 +737,17 @@ func (d *Daemon) claimAndEnqueue(ctx context.Context, b binding.Binding, c store
d.markBindingStart(ctx, task.ID, b, c)
}
// authorizeDispatch checks the identity may run the workflow. A denial is
// recorded and reported as a binding_dispatch_failure.
// authorizeDispatch checks the binding's principal, its org's dispatching
// identity, may start the workflow. A denial is recorded and reported as a
// binding_dispatch_failure. The run itself acts as the workflow's declared
// identity, which adoptWorkflowIdentity checks when the task is processed.
func (d *Daemon) authorizeDispatch(ctx context.Context, b binding.Binding, c storecontract.CapturedEvent, target bindingTarget) bool {
if d.Access == nil || d.Principals == nil {
return true
}
principal, ok := access.PrincipalFromContext(ctx)
var err error
if !ok {
principal, err = d.Principals.PrincipalFor(ctx, d.RootIdentityID)
}
if err != nil {
d.Log.Warn("binding dispatch: principal unavailable; dispatch parked for the next cycle",
"binding", b.ID, "capture", c.ID, "error", err)
d.Log.Warn("binding dispatch: no principal; dispatch left for the next cycle", "binding", b.ID, "capture", c.ID)
return false
}
resource := access.Resource{
+50 -31
View File
@@ -10,11 +10,15 @@ import (
"github.com/samcharles93/archie-core/internal/taskstate"
)
// adoptWorkflowIdentity pins the task's workflow and, when the workflow names
// an identity, makes the run act as it. The identity that dispatched the run
// (a binding's, a poll's, or a calling workflow's) needs run on the workflow.
// It runs before anything that depends on the identity, and reports whether
// processing may continue; a refusal parks the task.
// adoptWorkflowIdentity pins the task's workflow and makes the run act as the
// identity the workflow declares. Two checks guard it, on every attempt: the
// stored identity that started the task (a binding's principal, a chat user,
// a poller, or a calling workflow's declared identity) must be permitted run
// on the workflow, and so must the identity the run acts as. A workflow that
// declares no identity is refused: it neither inherits its starter's nor
// falls back to the root's. It runs before anything that depends on the
// identity, and reports whether processing may continue; a refusal parks the
// task.
func (d *Daemon) adoptWorkflowIdentity(ctx context.Context, task *workflow.Task) bool {
if err := d.pinWorkflowDefinition(ctx, task); err != nil {
d.Log.Error("pin workflow definition failed", "task", task.ID, "err", err)
@@ -22,40 +26,64 @@ func (d *Daemon) adoptWorkflowIdentity(ctx context.Context, task *workflow.Task)
return false
}
iface, err := workflowtask.ParseWorkflowInterface(task.WorkflowDefinitionYAML)
if err != nil || iface.Identity == "" || iface.Identity == task.Identity {
// A malformed definition is pinTaskProfile's to report.
return true
if err != nil {
d.parkRunningTask(ctx, task.ID, "workflow "+task.Workflow+": "+err.Error(), taskstate.ParkNeedsHuman)
return false
}
runner := d.identityFor(&workflow.Task{Identity: iface.Identity})
if runner == nil {
if iface.Identity == "" {
d.parkRunningTask(ctx, task.ID, "workflow "+task.Workflow+" declares no identity to run as; set one in its settings", taskstate.ParkNeedsHuman)
return false
}
runsAs, runnerName, ok := d.declaredIdentity(iface.Identity)
if !ok {
d.parkRunningTask(ctx, task.ID, "workflow "+task.Workflow+" runs as identity "+iface.Identity+", which is not configured", taskstate.ParkNeedsHuman)
return false
}
if !d.mayRunWorkflow(ctx, task) {
d.parkRunningTask(ctx, task.ID, "the dispatching identity may not run workflow "+task.Workflow, taskstate.ParkNeedsHuman)
if !d.mayRunWorkflow(ctx, task, d.publisherIdentity(task.Identity)) {
d.parkRunningTask(ctx, task.ID, "the identity that started it may not run workflow "+task.Workflow, taskstate.ParkNeedsHuman)
return false
}
task.Identity = runner.Name
if err := d.Store.Update(ctx, task); err != nil {
d.parkRunningTask(ctx, task.ID, "persist workflow identity: "+err.Error(), taskstate.ParkTransient)
if !d.mayRunWorkflow(ctx, task, runsAs) {
d.parkRunningTask(ctx, task.ID, "identity "+iface.Identity+" may not run workflow "+task.Workflow, taskstate.ParkNeedsHuman)
return false
}
// In memory only: the stored identity stays the starter's, so every
// attempt re-applies both checks.
task.Identity = runnerName
return true
}
// mayRunWorkflow asks the policy chain whether the task's current identity
// may run its workflow, recording a denial. No chain allows it, as every
// other check on an install that has not built one.
func (d *Daemon) mayRunWorkflow(ctx context.Context, task *workflow.Task) bool {
// declaredIdentity resolves a workflow's declared identity to the ID it is
// authorized as and the name the task carries while it runs: a configured
// identity's name, or empty for the root identity of a single-identity
// install. RootRef names the instance root, whose name differs per install,
// so the shipped workflows can declare it.
func (d *Daemon) declaredIdentity(ref string) (identity.IdentityID, string, bool) {
if runner := d.identityFor(&workflow.Task{Identity: ref}); runner != nil {
return runner.ID, runner.Name, true
}
if ref == workflow.RootRef || identity.IdentityID(ref) == d.RootIdentityID || identity.StableID(ref) == d.RootIdentityID {
return d.RootIdentityID, "", true
}
return "", "", false
}
// mayRunWorkflow asks the policy chain whether id may run the task's
// workflow, recording a denial. No chain allows it, as every other check on
// an install that has not built one.
func (d *Daemon) mayRunWorkflow(ctx context.Context, task *workflow.Task, id identity.IdentityID) bool {
if d.Access == nil || d.Principals == nil {
return true
}
principal, err := d.Principals.PrincipalFor(ctx, d.dispatcherID(task))
principal, err := d.Principals.PrincipalFor(ctx, id)
if err != nil {
d.Log.Warn("workflow identity: principal unavailable", "task", task.ID, "err", err)
d.Log.Warn("workflow identity: principal unavailable", "task", task.ID, "identity", id, "err", err)
return false
}
resource := access.Resource{Kind: access.KindWorkflow, ID: task.Workflow, Org: principal.Org}
resource := access.Resource{Kind: access.KindWorkflow, ID: task.Workflow, Org: task.Org}
if resource.Org == "" {
resource.Org = principal.Org
}
decision := d.Access.Authorize(principal, access.ActionRun, resource, access.Context{})
if decision.Allowed {
return true
@@ -71,12 +99,3 @@ func (d *Daemon) mayRunWorkflow(ctx context.Context, task *workflow.Task) bool {
}
return false
}
// dispatcherID is the identity ID the task currently acts as: its configured
// identity's, else the root's.
func (d *Daemon) dispatcherID(task *workflow.Task) identity.IdentityID {
if runner := d.identityFor(task); runner != nil {
return runner.ID
}
return d.RootIdentityID
}
+32 -14
View File
@@ -51,47 +51,65 @@ func (e enablementOf) WorkflowEnablement(context.Context) (workflowtask.Workflow
return workflowtask.WorkflowEnablement(e), nil
}
// TestWorkflowIdentity pins that a workflow naming an identity runs as it
// only when the dispatcher may run the workflow, and that a workflow naming
// none runs as the dispatcher. A workflow its org disabled is parked whatever
// started it.
// denials records the principals refused.
type denials []identity.IdentityID
func (d *denials) RecordDenial(_ context.Context, denial access.Denial) error {
*d = append(*d, denial.Principal)
return nil
}
// TestWorkflowIdentity pins that a run acts as the identity its workflow
// declares only when both the identity that started it and the declared one
// may run the workflow, that a refusal is recorded, and that a workflow
// naming no identity is refused rather than inheriting one. A called
// workflow is started by its caller's declared identity and runs as its own.
func TestWorkflowIdentity(t *testing.T) {
const named = "id: deploy\nidentity: deployer\n"
const plain = "id: deploy\n"
const deploy = "id: deploy\nidentity: deployer\n"
const callee = "id: deploy\nidentity: bot\n"
tests := []struct {
name string
yaml string
dispatcher string
starter string
allowed runAllowed
wantIdentity string
wantParked bool
wantDenied []identity.IdentityID
disabled bool
}{
{"allowed dispatcher runs as the workflow's identity", named, "", runAllowed{"root": true}, "deployer", false, false},
{"refused dispatcher is parked", named, "", runAllowed{}, "", true, false},
{"unconfigured identity is parked", "id: deploy\nidentity: ghost\n", "", runAllowed{"root": true}, "", true, false},
{"no named identity runs as the dispatcher", plain, "bot", runAllowed{}, "bot", false, false},
{"disabled workflow is parked", plain, "bot", runAllowed{}, "", true, true},
{"allowed dispatch runs as the workflow's identity", deploy, "", runAllowed{"root": true, "id-deployer": true}, "deployer", false, nil, false},
{"refused invocation is parked", deploy, "", runAllowed{"id-deployer": true}, "", true, []identity.IdentityID{"root"}, false},
{"refused execution is parked", deploy, "", runAllowed{"root": true}, "", true, []identity.IdentityID{"id-deployer"}, false},
{"called workflow runs as its own identity, not its caller's", callee, "deployer", runAllowed{"id-deployer": true, "id-bot": true}, "bot", false, nil, false},
{"caller refused the called workflow is parked", callee, "deployer", runAllowed{"id-bot": true}, "", true, []identity.IdentityID{"id-deployer"}, false},
{"workflow naming the root runs as the root", "id: deploy\nidentity: root\n", "bot", runAllowed{"root": true, "id-bot": true}, "", false, nil, false},
{"no declared identity is refused", "id: deploy\n", "bot", runAllowed{"root": true, "id-bot": true}, "", true, nil, false},
{"unconfigured identity is parked", "id: deploy\nidentity: ghost\n", "", runAllowed{"root": true}, "", true, nil, false},
{"disabled workflow is parked", deploy, "bot", runAllowed{"id-bot": true, "id-deployer": true}, "", true, nil, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
store := &identityStore{}
var denied denials
d := &Daemon{
Store: store, Log: slog.New(slog.DiscardHandler), RootIdentityID: "root",
Access: tt.allowed, Principals: principalOf{},
Access: tt.allowed, Principals: principalOf{}, Denials: &denied,
Identities: []*IdentityRunner{{ID: "id-deployer", Name: "deployer"}, {ID: "id-bot", Name: "bot"}},
}
if tt.disabled {
d.WorkflowEnablement = enablementOf(workflowtask.WorkflowEnablement{}.SetEnabled("", "deploy", false))
}
task := &workflow.Task{
ID: 1, Identity: tt.dispatcher, Workflow: "deploy",
ID: 1, Identity: tt.starter, Workflow: "deploy",
WorkflowDefinitionYAML: tt.yaml, WorkflowDefinitionDigest: workflow.DigestDefinition(tt.yaml),
}
ok := d.adoptWorkflowIdentity(context.Background(), task)
if ok == tt.wantParked || store.parked != tt.wantParked || (ok && task.Identity != tt.wantIdentity) {
t.Fatalf("ok %v parked %v identity %q, want parked %v identity %q", ok, store.parked, task.Identity, tt.wantParked, tt.wantIdentity)
}
if !reflect.DeepEqual([]identity.IdentityID(denied), tt.wantDenied) {
t.Fatalf("denied %v, want %v", denied, tt.wantDenied)
}
})
}
}
+3
View File
@@ -69,6 +69,9 @@ type SwitchStep struct {
Cases map[string][]StepRecord `yaml:"cases" json:"cases"`
}
// RootRef is the identity a workflow declares to run as the instance root.
const RootRef = "root"
const switchDefault = "default"
// RetryPolicy is how often a failed step runs again, and how long it waits
@@ -1,4 +1,5 @@
id: feasibility
identity: root
steps:
- type: repo.prepare
- id: assess
@@ -1,4 +1,5 @@
id: implement
identity: root
steps:
- type: repo.prepare
- type: gate.repository
@@ -1,4 +1,5 @@
id: pr-review
identity: root
inputs:
pr_number:
type: number
@@ -1,4 +1,5 @@
id: remediate
identity: root
steps:
- type: review.start-round
- type: repo.prepare
@@ -1,4 +1,5 @@
id: tdd
identity: root
steps:
- type: repo.prepare
- type: gate.repository
@@ -1,4 +1,5 @@
id: triage
identity: root
steps:
- type: repo.prepare
- id: classify
+2 -2
View File
@@ -57,8 +57,8 @@ type WorkflowInterface struct {
// is dispatched, not when the workflow is saved.
Profile string `yaml:"profile,omitempty" json:"profile,omitempty"`
// Identity names the identity every run of this workflow acts as,
// whatever dispatched it; the dispatcher needs run on the workflow. Empty
// runs as the dispatcher.
// whatever started it. Both it and the starter need run on the workflow.
// A workflow that names none is refused when it runs.
Identity string `yaml:"identity,omitempty" json:"identity,omitempty"`
// DeclaredNeeds is what the definition's needs: block declares. Read
// Needs, not this, when deciding a harness requirement: a declared output
+6 -4
View File
@@ -83,10 +83,12 @@ type Task struct {
// Source is "forge" or "chat". Chat tasks have a synthetic IssueNumber and
// skip forge operations.
Source string `json:"source"`
// Identity is the archie identity that owns this task (chat-spawned
// tasks only; empty for forge-sourced tasks and single-identity
// deployments). Used to scope /approve and /cancel authorization so
// one identity cannot control another's chat-spawned tasks.
// Identity is the identity that started this task: a chat user, a
// binding's or poller's identity, or a calling workflow's declared
// identity; empty is the root identity. Used to scope /approve and
// /cancel authorization so one identity cannot control another's
// chat-spawned tasks. While the daemon processes the task it holds the
// identity the workflow declares, which is never stored here.
Identity string `json:"identity"`
// Origin names the conversation that created the task, so its outcome and
// /stop find it; empty for a task no conversation started.
@@ -27,7 +27,7 @@ WITH caller AS (
SELECT t.id, t.owner, t.repo, t.issue_number, t.title, t.body, t.labels, t.status, t.workflow, t.branch, t.plan, t.notes, t.pr_number, t.tokens_used, t.iterations, t.attempt, t.park_reason, t.watch_comment_id, t.park_class, t.remediation_rounds, t.retry_count, t.source, t.identity, t.binding_id, t.binding_version, t.review_payload, t.workflow_definition_version, t.workflow_definition_digest, t.workflow_definition_yaml, t.created_at, t.updated_at, t.review_cursor, t.inputs, t.org_id, t.workspace_id, t.call_parent_task_id, t.call_depth, t.outputs, t.review_gate, t.rereview_rounds, t.retry_mode, t.resume_from, t.resume_results, t.pending_reviews, t.origin, t.call_key, t.outcome_posted FROM tasks t WHERE t.id = $1 FOR UPDATE
), number AS (
INSERT INTO chat_issue_numbers (owner, repo, last_number)
SELECT caller.owner, caller.repo, $8::bigint + 1 FROM caller
SELECT caller.owner, caller.repo, $9::bigint + 1 FROM caller
ON CONFLICT (owner, repo) DO UPDATE SET last_number = chat_issue_numbers.last_number + 1
RETURNING last_number
)
@@ -36,11 +36,11 @@ SELECT
caller.owner,
caller.repo,
number.last_number,
$2, $3, 'chat', $4, 'chat', caller.identity,
caller.org_id, caller.workspace_id, $5,
caller.id, caller.call_depth + 1, $6
$2, $3, 'chat', $4, 'chat', $5,
caller.org_id, caller.workspace_id, $6,
caller.id, caller.call_depth + 1, $7
FROM caller, number
WHERE caller.status = 'running' AND caller.call_depth + 1 <= $7::int
WHERE caller.status = 'running' AND caller.call_depth + 1 <= $8::int
ON CONFLICT (call_parent_task_id, call_key) WHERE call_key <> '' AND status NOT IN ('dead', 'closed_wont_do') DO UPDATE SET call_key = EXCLUDED.call_key
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, outcome_posted
`
@@ -50,6 +50,7 @@ type EnqueueCallTaskParams struct {
Title string
Body string
Workflow string
Identity string
Inputs string
CallKey string
MaxDepth int32
@@ -65,13 +66,17 @@ type EnqueueCallTaskParams struct {
// still decides whether the caller may call at all: a caller that is missing,
// not running or past the depth limit inserts nothing and returns no row,
// conflict or not. The issue number comes from chat_issue_numbers, as for
// InsertChatTask.
// InsertChatTask. The callee is started by the identity the caller's
// workflow declares, read from its pinned definition: a callee never inherits the
// identity that started its caller, and runs as the one its own workflow
// declares.
func (q *Queries) EnqueueCallTask(ctx context.Context, arg EnqueueCallTaskParams) (Task, error) {
row := q.db.QueryRow(ctx, enqueueCallTask,
arg.ID,
arg.Title,
arg.Body,
arg.Workflow,
arg.Identity,
arg.Inputs,
arg.CallKey,
arg.MaxDepth,
@@ -8,7 +8,10 @@
-- still decides whether the caller may call at all: a caller that is missing,
-- not running or past the depth limit inserts nothing and returns no row,
-- conflict or not. The issue number comes from chat_issue_numbers, as for
-- InsertChatTask.
-- InsertChatTask. The callee is started by the identity the caller's
-- workflow declares, read from its pinned definition: a callee never inherits the
-- identity that started its caller, and runs as the one its own workflow
-- declares.
WITH caller AS (
SELECT t.* FROM tasks t WHERE t.id = $1 FOR UPDATE
), number AS (
@@ -22,7 +25,7 @@ SELECT
caller.owner,
caller.repo,
number.last_number,
sqlc.arg(title), sqlc.arg(body), 'chat', sqlc.arg(workflow), 'chat', caller.identity,
sqlc.arg(title), sqlc.arg(body), 'chat', sqlc.arg(workflow), 'chat', sqlc.arg(identity),
caller.org_id, caller.workspace_id, sqlc.arg(inputs),
caller.id, caller.call_depth + 1, sqlc.arg('call_key')
FROM caller, number
+31 -4
View File
@@ -818,17 +818,23 @@ func (s *Store) TaskByID(ctx context.Context, taskID int64) (*workflow.Task, err
}
// StartCall enqueues a workflow.call callee inheriting the caller's org,
// workspace, identity and repo, and returns the callee already started under
// callerTaskID and callKey when there is one. A child that ended dead or
// declined freed its key, so such a call starts a fresh child. The caller must
// be running and within workflow.MaxCallDepth.
// workspace and repo, started by the identity the caller's workflow declares,
// and returns the callee already started under callerTaskID and callKey when
// there is one. A child that ended dead or declined freed its key, so such a
// call starts a fresh child. The caller must be running and within
// workflow.MaxCallDepth.
func (s *Store) StartCall(ctx context.Context, callerTaskID int64, callKey, wf string, inputs map[string]any) (*workflow.Task, error) {
encoded, err := task.EncodeInputs(inputs)
if err != nil {
return nil, err
}
starter, err := s.callerIdentity(ctx, callerTaskID)
if err != nil {
return nil, err
}
callee, err := s.queries().EnqueueCallTask(ctx, postgresdb.EnqueueCallTaskParams{
ID: callerTaskID,
Identity: starter,
FallbackIssueNumber: syntheticIssueNumberBase - 1,
Title: fmt.Sprintf("workflow.call %s from task %d", wf, callerTaskID),
Body: fmt.Sprintf("Started by a workflow.call step from task %d (workflow %q); the call's inputs travel with the task.", callerTaskID, wf),
@@ -849,6 +855,27 @@ func (s *Store) StartCall(ctx context.Context, callerTaskID int64, callKey, wf s
return taskFromRow(callee), nil
}
// callerIdentity is the identity the caller's pinned workflow declares, the
// one its callees are started by. The pin does not change while the caller's
// call step runs.
func (s *Store) callerIdentity(ctx context.Context, callerTaskID int64) (string, error) {
caller, err := s.queries().TaskByID(ctx, postgresdb.TaskByIDParams{ID: callerTaskID, ScopeOrg: scopeOrg(ctx)})
if errors.Is(err, pgx.ErrNoRows) {
return "", fmt.Errorf("store: workflow.call caller task %d does not exist: %w", callerTaskID, storecontract.ErrCallNotYours)
}
if err != nil {
return "", err
}
iface, err := task.ParseWorkflowInterface(caller.WorkflowDefinitionYaml)
if err != nil {
return "", fmt.Errorf("store: workflow.call caller task %d: %w", callerTaskID, err)
}
if iface.Identity == "" {
return "", fmt.Errorf("store: workflow.call caller task %d runs a workflow that declares no identity", callerTaskID)
}
return iface.Identity, nil
}
// callRefusal explains why EnqueueCallTask inserted nothing.
func (s *Store) callRefusal(ctx context.Context, callerTaskID int64) error {
caller, err := s.queries().TaskByID(ctx, postgresdb.TaskByIDParams{ID: callerTaskID, ScopeOrg: scopeOrg(ctx)})
+1 -1
View File
@@ -1 +1 @@
.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharray:none;animation:none}.vue-flow__edge.inactive{pointer-events:none}.vue-flow__edge.selected,.vue-flow__edge:focus,.vue-flow__edge:focus-visible{outline:none}.vue-flow__edge.selected .vue-flow__edge-path,.vue-flow__edge:focus .vue-flow__edge-path,.vue-flow__edge:focus-visible .vue-flow__edge-path{stroke:#555}.vue-flow__edge-textwrapper{pointer-events:all}.vue-flow__edge-textbg{fill:#fff}.vue-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.vue-flow__connection{pointer-events:none}.vue-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__connectionline{z-index:1001}.vue-flow__nodes{pointer-events:none;transform-origin:0 0}.vue-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.vue-flow__node.draggable{cursor:grab;pointer-events:all}.vue-flow__node.draggable.dragging{cursor:grabbing}.vue-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.vue-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.vue-flow__nodesselection-rect.dragging{cursor:grabbing}.vue-flow__handle{pointer-events:none;min-width:5px;min-height:5px;position:absolute}.vue-flow__handle.connectable{pointer-events:all;cursor:crosshair}.vue-flow__handle-bottom{bottom:0;left:50%;transform:translate(-50%,50%)}.vue-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.vue-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.vue-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.vue-flow__edgeupdater{cursor:move;pointer-events:all}.vue-flow__panel{z-index:5;margin:15px;position:absolute}.vue-flow__panel.top{top:0}.vue-flow__panel.bottom{bottom:0}.vue-flow__panel.left{left:0}.vue-flow__panel.right{right:0}.vue-flow__panel.center{left:50%;transform:translate(-50%)}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.vue-flow__controls{box-shadow:0 0 2px 1px #00000014}.vue-flow__controls-button{box-sizing:content-box;cursor:pointer;-webkit-user-select:none;user-select:none;background:#fefefe;border:none;border-bottom:1px solid #eee;justify-content:center;align-items:center;width:16px;height:16px;padding:5px;display:flex}.vue-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.vue-flow__controls-button:hover{background:#f4f4f4}.vue-flow__controls-button:disabled{pointer-events:none}.vue-flow__controls-button:disabled svg{fill-opacity:.4}.workflow-flow-edge path{stroke:var(--color-muted-foreground);stroke-width:1.5px}.workflow-flow-edge.trace-ok path{stroke:var(--color-ok)}.workflow-flow-edge.trace-failed path{stroke:var(--color-danger)}.workflow-flow-edge.trace-interrupted path{stroke:var(--color-warn)}.workflow-flow-edge.trace-running path{stroke:var(--color-info);stroke-dasharray:6 4;animation:.8s linear infinite edge-trace}@keyframes edge-trace{to{stroke-dashoffset:-10px}}@media (prefers-reduced-motion:reduce){.workflow-flow-edge.trace-running path,.step-running{animation:none}}.workflow-data-edge path{stroke:var(--color-primary);stroke-dasharray:5 4;stroke-width:1.25px}@keyframes step-running{50%{box-shadow:0 0 0 4px color-mix(in oklab, var(--color-info) 30%, transparent)}}.step-running{animation:1.6s ease-in-out infinite step-running}.workflow-canvas .vue-flow__controls{box-shadow:none}.workflow-canvas .vue-flow__controls-button{background:var(--color-card);border-color:var(--color-border);fill:var(--color-foreground)}.workflow-canvas .vue-flow__controls-button:hover{background:var(--color-secondary)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reLine truncated
.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharray:none;animation:none}.vue-flow__edge.inactive{pointer-events:none}.vue-flow__edge.selected,.vue-flow__edge:focus,.vue-flow__edge:focus-visible{outline:none}.vue-flow__edge.selected .vue-flow__edge-path,.vue-flow__edge:focus .vue-flow__edge-path,.vue-flow__edge:focus-visible .vue-flow__edge-path{stroke:#555}.vue-flow__edge-textwrapper{pointer-events:all}.vue-flow__edge-textbg{fill:#fff}.vue-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.vue-flow__connection{pointer-events:none}.vue-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__connectionline{z-index:1001}.vue-flow__nodes{pointer-events:none;transform-origin:0 0}.vue-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.vue-flow__node.draggable{cursor:grab;pointer-events:all}.vue-flow__node.draggable.dragging{cursor:grabbing}.vue-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.vue-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.vue-flow__nodesselection-rect.dragging{cursor:grabbing}.vue-flow__handle{pointer-events:none;min-width:5px;min-height:5px;position:absolute}.vue-flow__handle.connectable{pointer-events:all;cursor:crosshair}.vue-flow__handle-bottom{bottom:0;left:50%;transform:translate(-50%,50%)}.vue-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.vue-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.vue-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.vue-flow__edgeupdater{cursor:move;pointer-events:all}.vue-flow__panel{z-index:5;margin:15px;position:absolute}.vue-flow__panel.top{top:0}.vue-flow__panel.bottom{bottom:0}.vue-flow__panel.left{left:0}.vue-flow__panel.right{right:0}.vue-flow__panel.center{left:50%;transform:translate(-50%)}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.vue-flow__controls{box-shadow:0 0 2px 1px #00000014}.vue-flow__controls-button{box-sizing:content-box;cursor:pointer;-webkit-user-select:none;user-select:none;background:#fefefe;border:none;border-bottom:1px solid #eee;justify-content:center;align-items:center;width:16px;height:16px;padding:5px;display:flex}.vue-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.vue-flow__controls-button:hover{background:#f4f4f4}.vue-flow__controls-button:disabled{pointer-events:none}.vue-flow__controls-button:disabled svg{fill-opacity:.4}.workflow-flow-edge path{stroke:var(--color-muted-foreground);stroke-width:1.5px}.workflow-flow-edge.trace-ok path{stroke:var(--color-ok)}.workflow-flow-edge.trace-failed path{stroke:var(--color-danger)}.workflow-flow-edge.trace-interrupted path{stroke:var(--color-warn)}.workflow-flow-edge.trace-running path{stroke:var(--color-info);stroke-dasharray:6 4;animation:.8s linear infinite edge-trace}@keyframes edge-trace{to{stroke-dashoffset:-10px}}@media (prefers-reduced-motion:reduce){.workflow-flow-edge.trace-running path,.step-running{animation:none}}.workflow-data-edge path{stroke:var(--color-primary);stroke-dasharray:5 4;stroke-width:1.25px}@keyframes step-running{50%{box-shadow:0 0 0 4px color-mix(in oklab, var(--color-info) 30%, transparent)}}.step-running{animation:1.6s ease-in-out infinite step-running}.workflow-canvas .vue-flow__controls{box-shadow:none}.workflow-canvas .vue-flow__controls-button{background:var(--color-card);border-color:var(--color-border);fill:var(--color-foreground)}.workflow-canvas .vue-flow__controls-button:hover{background:var(--color-secondary)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reLine truncated
+4 -4
View File
@@ -12,7 +12,7 @@ Defaulting to \`null\`.`),null)}function Ps(e){return Ms(e)&&!Number.isNaN(e)&&e
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=hd(c),u=e+1<n.length?hd(n[e+1]):null;if(l&&u&&gd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=hd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>pd(e)),rows:r.map(e=>e.map(e=>pd(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:pd(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])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:pd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function hd(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 gd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var _d={class:`[overflow-wrap:anywhere]`},vd={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},yd={class:`font-mono text-[0.85em]`},bd={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},xd={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Sd={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Cd={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},wd={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Td={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Ed={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Dd={key:8,class:`mb-2.5 last:mb-0`},Od=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>md(t.text));return(e,t)=>(R(),G(`div`,_d,[(R(!0),G(H,null,K(n.value,(e,t)=>(R(),G(H,{key:t},[e.kind===`pre`?(R(),G(`pre`,vd,[W(`code`,yd,V(e.code),1)])):e.kind===`table`?(R(),G(`table`,bd,[W(`thead`,null,[W(`tr`,null,[(R(!0),G(H,null,K(e.head,(e,t)=>(R(),G(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(dd,{inline:e},null,8,[`inline`])]))),128))])]),W(`tbody`,null,[(R(!0),G(H,null,K(e.rows,(e,t)=>(R(),G(`tr`,{key:t},[(R(!0),G(H,null,K(e,(e,t)=>(R(),G(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(dd,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),G(`blockquote`,xd,[M(dd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),G(`h1`,Sd,[M(dd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),G(`h2`,Cd,[M(dd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),G(`h3`,wd,[M(dd,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),G(`ul`,Td,[(R(!0),G(H,null,K(e.items,(e,t)=>(R(),G(`li`,{key:t},[M(dd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),G(`ol`,Ed,[(R(!0),G(H,null,K(e.items,(e,t)=>(R(),G(`li`,{key:t},[M(dd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),G(`p`,Dd,[M(dd,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),kd={class:`truncate`},Ad=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Re(`RouterLink`);return R(),q(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:j(()=>[M(z(Wt),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),W(`span`,kd,V(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),jd={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Md={class:`font-semibold text-foreground`},Nd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Pd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>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?(R(),q(Ad,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),G(`div`,jd,[M(z(qn),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),W(`span`,Md,V(n.value),1),r.value?(R(),G(`code`,Nd,V(r.value),1)):L(``,!0),W(`span`,{class:N(z(Y)(`text-fg-muted`,i.value&&`text-danger`))},V(a.value),3)]))}}),Fd={key:0,class:`mb-2 grid gap-0.5 text-xs`},Id={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Ld={key:3,class:`whitespace-pre-wrap`},Rd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),G(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[W(`div`,{class:N(z(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?(R(),G(`div`,Fd,[(R(!0),G(H,null,K(e.tools,(t,n)=>(R(),q(Pd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),G(`div`,Id,[(R(!0),G(H,null,K(e.media,(e,t)=>(R(),q(id,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),q(Od,{key:2,text:e.text},null,8,[`text`])):(R(),G(`div`,Ld,V(e.text),1)),P(t.$slots,`default`)],2)],2))}}),zd={class:`text-sm`},Bd={class:`font-medium`},Vd={key:0,class:`mt-1 text-fg-muted`},Hd={key:1,class:`mt-2 flex flex-wrap gap-2`},Ud=k({__name:`ChatChLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>Qg?`${n.slice(0,Qg).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var e_=[`title`],t_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>Tg(n.event)),a=I(()=>$g(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=I(()=>n.event.at?Dh(n.event.at):`—`);return(e,t)=>(R(),q(z(Yg),{class:N(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:[Ot(Dt(o,[`prevent`]),[`enter`]),Ot(Dt(o,[`prevent`]),[`space`])]},{default:j(()=>[M(z($),{class:`font-medium`},{default:j(()=>[A(V(n.event.kind||n.event.type||`event`),1)]),_:1}),M(z($),{class:`font-mono`},{default:j(()=>[A(V(i.value>0?`#${i.value}`:`—`),1)]),_:1}),M(z($),{class:`w-[55%] max-w-0`},{default:j(()=>[W(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},V(a.value.text),9,e_)]),_:1}),M(z($),null,{default:j(()=>[A(V(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),n_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function r_(e){return(Number(e?.task_id)||0)>0}function i_(e,t){return t===`tasks`?r_(e):t!==`system`||!r_(e)}function a_(e,t){return e.filter(e=>i_(e,t))}function o_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function s_(e,t){return`${e}:${t??0}`}function c_(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=s_($g(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var l_={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},u_={class:`max-h-[28rem] overflow-y-auto`},d_=[`aria-expanded`,`aria-label`,`onClick`],f_=[`title`],p_=k({__name:`LiveActivityCard`,setup(e){let t=Af(),{activity:n,streamKind:r,streamState:i}=Ae(ee()),a=J(`all`),o=I(()=>a_(n.value,a.value)),s=I(()=>o_(o.value.length,a.value)),c=tt(new Set),l=I(()=>c_(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 $g(e.representative)}function p(e){return e.representative.at?Dh(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(R(),q(z(bh),null,{default:j(()=>[M(z(Th),null,{default:j(()=>[M(z(Eh),null,{default:j(()=>[...t[1]||=[A(`Live activity`,-1)]]),_:1}),M(z(xh),{class:`flex items-center gap-2`},{default:j(()=>[M(z(Gg),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:z(n_)},null,8,[`modelValue`,`options`]),M(z(It),{variant:z(r)},{default:j(()=>[A(V(z(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),M(z(Sh),null,{default:j(()=>[W(`div`,l_,[W(`div`,u_,[M(z(qg),null,{default:j(()=>[M(z(Zg),{class:`sticky top-0 z-10 bg-card`},{default:j(()=>[M(z(Yg),null,{default:j(()=>[M(z(Xg),null,{default:j(()=>[...t[2]||=[A(`Event`,-1)]]),_:1}),M(z(Xg),null,{default:j(()=>[...t[3]||=[A(`Task`,-1)]]),_:1}),M(z(Xg),null,{default:j(()=>[...t[4]||=[A(`Detail`,-1)]]),_:1}),M(z(Xg),null,{default:j(()=>[...t[5]||=[A(`When`,-1)]]),_:1})]),_:1})]),_:1}),M(z(Jg),null,{default:j(()=>[o.value.length?L(``,!0):(R(),q(z(Yg),{key:0},{default:j(()=>[M(z($),{colspan:`4`},{default:j(()=>[M(z(dh),null,{default:j(()=>[M(z(mh),null,{default:j(()=>[M(z(_h),null,{default:j(()=>[A(V(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(R(!0),G(H,{key:1},K(l.value,e=>(R(),G(H,{key:e.key},[e.count===1?(R(),q(t_,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(R(),G(H,{key:1},[M(z(Yg),{class:N(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:[Ot(Dt(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Ot(Dt(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:j(()=>[M(z($),{class:`font-medium`},{default:j(()=>[W(`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:Dt(t=>u(e.key),[`stop`])},[d(e)?(R(),q(z(Zt),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(R(),q(z(Qt),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),A(` `+V(e.label)+` `,1),M(z(It),{variant:`idle`},{default:j(()=>[A(`×`+V(e.count),1)]),_:2},1024)],8,d_)]),_:2},1024),M(z($),{class:`font-mono`},{default:j(()=>[A(V(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),M(z($),{class:`w-[55%] max-w-0`},{default:j(()=>[W(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},V(f(e).text),9,f_)]),_:2},1024),M(z($),null,{default:j(()=>[A(V(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(R(!0),G(H,{key:0},K(e.events,(t,n)=>(R(),q(t_,{key:`${e.key}:${n}`,event:t,onOpen:m},null 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 Nv(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 Pv(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 Fv(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 Iv(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 Lv=J([]),Rv=J([]),zv=J(!0),Bv=J(null),Vv=J(null),Hv=J(!1),Uv=J(null);async function Wv(){try{let e=await X.eventTypes();zv.value=e.enabled!==!1,Lv.value=e.event_types||[],Rv.value=e.proposals||[],Bv.value=null}catch(e){Bv.value=e.message||String(e)}}function Gv(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Kv(e){Uv.value=null,Vv.value=e}function qv(e){let t=ty.value.find(t=>String(t.id)===e.sample_id);Kv({mode:`proposal`,id:null,source:e.source,name:``,rule:Gv(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Jv(e=``){Kv({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Yv(e){Kv({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Gv(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Xv(){Vv.value=null}async function Zv(){let e=Vv.value;if(e){Hv.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:Iv(e.rule)});else{let t=e.mode===`paste`?Mv(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:Iv(e.rule),example:{headers:t,body:e.body}})}Vv.value=null,await Wv()}catch(e){Uv.value=e.message||String(e)}finally{Hv.value=!1}}}var Qv=J(null);async function $v(){let e=Qv.value;if(Qv.value=null,e)try{await X.eventTypeDelete(e.id),await Wv()}catch(e){Bv.value=e.message||String(e)}}var ey=100,ty=J([]),ny=J(!0),ry=J(null),iy=J(!0),ay=J(null);async function oy(){try{let e=await X.captures(ey);ny.value=e.enabled!==!1,ty.value=e.captures||[],ry.value=null}catch(e){ry.value=e.message||String(e)}finally{iy.value=!1}}function sy(e){let t=ty.value.find(t=>t.id===e);return t&&(ay.value=t),!!t}function cy(){ty.value.length&&(ay.value=ty.value[0])}function ly(){ce(`captures`,()=>{oy(),Wv()})}var uy={key:0,class:`text-xs text-fg-muted`},dy={key:1,class:`flex flex-col gap-1 text-xs`},fy={key:1},py={key:2,class:`text-xs text-fg-muted`},my=k({__name:`DispatchLinks`,props:{kind:{},id:{}},setup(e){let t=e,n=J([]),r=J(!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=Re(`RouterLink`);return r.value?(R(),G(`p`,uy,`Dispatches unavailable.`)):n.value.length?(R(),G(`ul`,dy,[(R(!0),G(H,null,K(n.value,e=>(R(),G(`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`?L(``,!0):(R(),q(o,{key:0,to:{path:`/events`,query:{tab:`bindings`}},class:`hover:text-foreground`},{default:j(()=>[A(`binding `+V(e.binding_id.slice(0,8))+` v`+V(e.binding_version),1)]),_:2},1024)),t.kind===`captures`?L(``,!0):(R(),q(o,{key:1,to:i(e.capture_id),class:`hover:text-foreground`},{default:j(()=>[A(`capture `+V(e.capture_id.slice(0,8)),1)]),_:2},1032,[`to`])),t.kind===`tasks`?L(``,!0):(R(),G(H,{key:2},[e.task_id?(R(),q(o,{key:0,to:`/tasks/${e.task_id}`,class:`text-foreground hover:underline`},{default:j(()=>[A(`task #`+V(e.task_id),1)]),_:2},1032,[`to`])):(R(),G(`span`,fy,V(e.reason||`claimed, no task recorded`),1))],64)),W(`span`,null,V(z(Dh)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?L(``,!0):(R(),G(`p`,py,` No dispatches yet. `))}}}),hy=k({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(R(),q(z(pn),{role:`status`,"aria-label":`Loading`,class:N(z(Y)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}});function gy(e,t){return t?e.filter(e=>e.event_type_id===t):[]}function _y(e){return(e?.repository??`required`)!==`none`}function vy(e,t){return e.filter(e=>t===`any`||e.type===`any`||e.type===t)}function yy(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 by={pending_approval:`pending approval`,armed:`armed`,paused:`paused`},xy={pending_approval:`warn`,armed:`ok`,paused:`idle`};function Sy(e) 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 Nv(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 Pv(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 Fv(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 Iv(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 Lv=J([]),Rv=J([]),zv=J(!0),Bv=J(null),Vv=J(null),Hv=J(!1),Uv=J(null);async function Wv(){try{let e=await X.eventTypes();zv.value=e.enabled!==!1,Lv.value=e.event_types||[],Rv.value=e.proposals||[],Bv.value=null}catch(e){Bv.value=e.message||String(e)}}function Gv(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Kv(e){Uv.value=null,Vv.value=e}function qv(e){let t=ty.value.find(t=>String(t.id)===e.sample_id);Kv({mode:`proposal`,id:null,source:e.source,name:``,rule:Gv(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Jv(e=``){Kv({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Yv(e){Kv({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Gv(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Xv(){Vv.value=null}async function Zv(){let e=Vv.value;if(e){Hv.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:Iv(e.rule)});else{let t=e.mode===`paste`?Mv(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:Iv(e.rule),example:{headers:t,body:e.body}})}Vv.value=null,await Wv()}catch(e){Uv.value=e.message||String(e)}finally{Hv.value=!1}}}var Qv=J(null);async function $v(){let e=Qv.value;if(Qv.value=null,e)try{await X.eventTypeDelete(e.id),await Wv()}catch(e){Bv.value=e.message||String(e)}}var ey=100,ty=J([]),ny=J(!0),ry=J(null),iy=J(!0),ay=J(null);async function oy(){try{let e=await X.captures(ey);ny.value=e.enabled!==!1,ty.value=e.captures||[],ry.value=null}catch(e){ry.value=e.message||String(e)}finally{iy.value=!1}}function sy(e){let t=ty.value.find(t=>t.id===e);return t&&(ay.value=t),!!t}function cy(){ty.value.length&&(ay.value=ty.value[0])}function ly(){ce(`captures`,()=>{oy(),Wv()})}var uy={key:0,class:`text-xs text-fg-muted`},dy={key:1,class:`flex flex-col gap-1 text-xs`},fy={key:1},py={key:2,class:`text-xs text-fg-muted`},my=k({__name:`DispatchLinks`,props:{kind:{},id:{}},setup(e){let t=e,n=J([]),r=J(!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=Re(`RouterLink`);return r.value?(R(),G(`p`,uy,`Dispatches unavailable.`)):n.value.length?(R(),G(`ul`,dy,[(R(!0),G(H,null,K(n.value,e=>(R(),G(`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`?L(``,!0):(R(),q(o,{key:0,to:{path:`/events`,query:{tab:`bindings`}},class:`hover:text-foreground`},{default:j(()=>[A(`binding `+V(e.binding_id.slice(0,8))+` v`+V(e.binding_version),1)]),_:2},1024)),t.kind===`captures`?L(``,!0):(R(),q(o,{key:1,to:i(e.capture_id),class:`hover:text-foreground`},{default:j(()=>[A(`capture `+V(e.capture_id.slice(0,8)),1)]),_:2},1032,[`to`])),t.kind===`tasks`?L(``,!0):(R(),G(H,{key:2},[e.task_id?(R(),q(o,{key:0,to:`/tasks/${e.task_id}`,class:`text-foreground hover:underline`},{default:j(()=>[A(`task #`+V(e.task_id),1)]),_:2},1032,[`to`])):(R(),G(`span`,fy,V(e.reason||`claimed, no task recorded`),1))],64)),W(`span`,null,V(z(Dh)(e.dispatched_at)),1)]))),128))])):t.kind===`tasks`?L(``,!0):(R(),G(`p`,py,` No dispatches yet. `))}}}),hy=k({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(R(),q(z(pn),{role:`status`,"aria-label":`Loading`,class:N(z(Y)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}});function gy(e,t){return t?e.filter(e=>e.event_type_id===t):[]}function _y(e){return(e?.repository??`required`)!==`none`}function vy(e,t){return e.filter(e=>t===`any`||e.type===`any`||e.type===t)}function yy(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 by={pending_approval:`pending approval`,armed:`armed`,paused:`paused`},xy={pending_approval:`warn`,armed:`ok`,paused:`idle`};function Sy(e) Line truncated
`)}};nR.defaultYaml={explicit:!1,version:`1.2`},nR.defaultTags={"!!":`tag:yaml.org,2002:`};function rR(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 iR(e){let t=new Set;return YL(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function aR(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function oR(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=iR(e);let a=aR(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(VL(t.node)||UL(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 sR(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=sR(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=sR(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=sR(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=sR(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function cR(e,t,n){if(Array.isArray(e))return e.map((e,t)=>cR(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!GL(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 lR=class{constructor(e){Object.defineProperty(this,IL,{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(!RL(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=cR(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?sR(i,{"":o},``,o):o}},uR=class extends lR{constructor(e){super(AL),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=[],YL(e,{Node:(e,t)=>{(LL(t)||GL(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||=(cR(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=dR(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(rR(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 dR(e,t,n){if(LL(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(UL(t)){let r=0;for(let i of t.items){let t=dR(e,i,n);t>r&&(r=t)}return r}if(BL(t)){let r=dR(e,t.key,n),i=dR(e,t.value,n);return Math.max(r,i)}return 1}var fR=e=>!e||typeof e!=`function`&&typeof e!=`object`,pR=class extends lR{constructor(e){super(PL),this.value=e}toJSON(e,t){return t?.keep?this.value:cR(this.value,e,t)}toString(){return String(this.value)}};pR.BLOCK_FOLDED=`BLOCK_FOLDED`,pR.BLOCK_LITERAL=`BLOCK_LITERAL`,pR.PLAIN=`PLAIN`,pR.QUOTE_DOUBLE=`QUOTE_DOUBLE`,pR.QUOTE_SINGLE=`QUOTE_SINGLE`;var mR=`tag:yaml.org,2002:`;function hR(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 gR(e,t,n){if(RL(e)&&(e=e.contents),WL(e))return e;if(BL(e)){let t=n.schema[ML].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 uR(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=mR+t.slice(2));let l=hR(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new pR(e);return c&&(c.node=t),t Line truncated
`)?xR(n,t):n.includes(`
`)?`
@@ -122,12 +122,12 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`)[0]?.trim()||`invalid YAML`}function TH(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function EH(e){return typeof e==`string`&&e.trim()!==``}var DH={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},OH={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},kH={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},AH={class:`min-w-0 flex-1`},jH=[`value`,`placeholder`],MH={class:`truncate font-mono text-[11px] text-fg-subtle`},NH={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},PH={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},FH={key:1,class:`space-y-3`},IH={key:0,class:`block space-y-1.5`},LH={id:`switch-on`},RH=[`value`],zH={class:`text-xs font-medium text-muted-foreground`},BH={class:`flex items-center gap-2`},VH={key:1,role:`alert`,class:`text-xs text-danger`},HH={key:2,class:`space-y-1.5`},UH=[`title`],WH=[`value`],GH=[`value`],KH={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},qH=[`onClick`],JH=[`onClick`],YH={key:3,class:`divide-y divide-border rounded-md border border-border`},XH=[`title`],ZH=[`value`,`onChange`],QH=[`value`],$H=[`value`,`onInput`],eU=[`value`,`onFocus`,`onInput`],tU={key:0,class:`space-y-3`},nU={class:`text-[13px]`},rU={key:0,class:`text-danger`},iU={class:`ml-2 text-xs text-fg-subtle`},aU=[`aria-label`,`value`,`onChange`],oU={key:0,value:`value`},sU=[`aria-label`,`value`,`onChange`],cU=[`value`],lU=[`aria-label`,`value`,`onChange`],uU={key:1,class:`space-y-3`},dU={class:`text-[13px]`},fU={class:`ml-2 text-xs text-fg-subtle`},pU=[`aria-label`,`disabled`,`value`,`onChange`],mU=[`value`],hU=[`title`],gU={key:0,class:`text-xs text-danger`},_U={class:`space-y-2`},vU={class:`divide-y divide-border rounded-md border border-border`},yU={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},bU=[`value`],xU={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},SU=[`value`],CU={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},wU=[`value`],TU={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},EU={class:`flex items-center border-t border-border px-4 py-2.5`},DU=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>EV(n.yaml,n.path)??{}),a=I(()=>wV(i.value)),o=I(()=>a.value?.kind??(typeof i.value.type==`string`?i.value.type:``)),s=I(()=>a.value?.branches.map(([e])=>e)??[]),c=I(()=>o.value===`parallel`?2:1);function l(e){r(`update:yaml`,DV(n.yaml,n.path,{...i.value,switch:{...i.value.switch,on:e}}))}let u=J(``),d=J(``);function f(e,t,i=``){try{let a=e===`add`?jV(n.yaml,n.path,t):e===`rename`?MV(n.yaml,n.path,t,i):NV(n.yaml,n.path,t);r(`update:yaml`,a),u.value=``,d.value=``}catch(e){d.value=String(e.message)}}let p=I(()=>n.vocabulary.find(e=>e.name===o.value)),m=I(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),h=I(()=>LV(n.yaml,n.path)),g=I(()=>p.value?.settings&&i.value.settings?hH(i.value.settings,p.value.settings,`settings`):``),_=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],v=/mission|body|detail|plan|rules/;function y(e,t){return[`workflow.call`,`workflow.handoff`].includes(o.value)&&e===`workflow`||o.value===`human.approve`&&e===`then`?`workflow`:o.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:v.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 b=I(()=>{let e=Object.entries(p.value?.settings?.properties??{}).filter(([e])=>o.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:y(e,t),options:o.value===`agent.run`&&e===`model`?n.modelAliases:t.enum??[]})),t=e.filter(e=>_.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>_.indexOf(e.key)-_.indexOf(t.key))[0],r=e.filter(e=>e!==t);return{lead:t,compact:r.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:r.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function x(e){let{id:t,type:i,...a}=e;r(`update:yaml`,DV(n.yaml,n.path,{id:t,type:i,...a}))}function S(e,t){x({...i.value,[e]:t})}function C(e){S(`retry`,{...i.value.retry,...e})}function w(e,t){let n={...m.value,[e]:t};o.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,x({...i.value,settings:n})}function T(e,t){let n={...m.value,[e]:t};o.value===`workflow.call`&&t!==m.value[e]&&(delete n.inputs,delete n.outputs),x({...i.value,settings:n})}let E=I(()=>n.workflows.find(e=>e.id===m.value.workflow)),ee=I(()=>Object.entries(zV(E.value?.yaml??``,`inputs`)??{})),D=I(()=>Object.entries(zV(E.value?.yaml??``,`outputs`)??{})),te=I(()=>Object.entries(zV(n.yaml,`inputs`)??{})),ne=I(()=>Object.entries(zV(n.yaml,`outputs`)??{})),re=I(()=>m.value.inputs??{}),ie=I(()=>m.value.outputs??{}),ae=e=>typeof e==`string`&&e.startsWith(`inputs.`),oe=e Line truncated
`)[0]}}}let fe=e=>e===void 0?``:xV(e).trimEnd(),pe=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),me=e=>typeof m.value[e]==`string`?m.value[e]:``;return(t,n)=>(R(),G(`aside`,DH,[W(`header`,OH,[W(`span`,kH,[(R(),q(Ye(z(nH)(o.value)),{class:`size-4`}))]),W(`div`,AH,[W(`input`,{value:i.value.id??``,class:`w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline`,placeholder:z(qV)(o.value),"aria-label":`Step id`,onInput:n[0]||=e=>S(`id`,e.target.value)},null,40,jH),W(`div`,MH,V(o.value),1)]),M(z(Z),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:n[1]||=e=>r(`close`)},{default:j(()=>[M(z(Jn))]),_:1})]),W(`div`,NH,[g.value?(R(),G(`p`,PH,V(g.value),1)):L(``,!0),a.value?(R(),G(`section`,FH,[o.value===`switch`?(R(),G(`label`,IH,[n[18]||=W(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(O),{"model-value":a.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:n[2]||=e=>l(e.target.value.trim())},null,8,[`model-value`]),W(`datalist`,LH,[(R(!0),G(H,null,K(h.value,e=>(R(),G(`option`,{key:e,value:`steps.${e}.result.`},null,8,RH))),128))])])):L(``,!0),W(`div`,zH,V(o.value===`switch`?`Cases`:`Branches`),1),(R(!0),G(H,null,K(s.value,e=>(R(),G(`div`,{key:e,class:`flex items-center gap-2`},[M(z(O),{"model-value":e,class:N(o.value===`switch`&&`font-mono`),"aria-label":`${o.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>f(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),M(z(Z),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:s.value.length<=c.value,onClick:t=>f(`delete`,e)},{default:j(()=>[M(z(Rn))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),W(`div`,BH,[M(z(O),{modelValue:u.value,"onUpdate:modelValue":n[3]||=e=>u.value=e,"aria-label":o.value===`switch`?`New case value`:`New branch name`,placeholder:o.value===`switch`?`Value, or default`:`Branch name`,onKeydown:n[4]||=Ot(Dt(e=>f(`add`,u.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Z),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":o.value===`switch`?`Add case`:`Add branch`,disabled:!u.value.trim(),onClick:n[5]||=e=>f(`add`,u.value.trim())},{default:j(()=>[M(z(Tn))]),_:1},8,[`aria-label`,`disabled`])]),d.value?(R(),G(`p`,VH,V(d.value),1)):L(``,!0)])):L(``,!0),b.value.lead?(R(),G(`section`,HH,[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:b.value.lead.schema.description},[A(V(pe(b.value.lead.key,b.value.lead.schema))+` `,1),b.value.lead.schema.description?(R(),q(z(rn),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,UH),b.value.lead.kind===`workflow`?(R(),q(cH,{key:0,value:me(b.value.lead.key),workflows:e.workflows,label:pe(b.value.lead.key,b.value.lead.schema),onPick:n[6]||=e=>T(b.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):b.value.lead.kind===`select`?(R(),G(`select`,{key:1,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:me(b.value.lead.key),onChange:n[7]||=e=>w(b.value.lead.key,e.target.value||void 0)},[n[19]||=W(`option`,{value:``},`Default`,-1),(R(!0),G(H,null,K(b.value.lead.options,e=>(R(),G(`option`,{key:e,value:e},V(e),9,GH))),128))],40,WH)):b.value.lead.kind===`text`?(R(),q(z(zl),{key:2,"model-value":me(b.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:n[8]||=e=>ce.value=b.value.lead.key,"onUpdate:modelValue":n[9]||=e=>w(b.value.lead.key,String(e))},null,8,[`model-value`])):(R(),q(z(O),{key:3,"model-value":me(b.value.lead.key),onFocus:n[10]||=e=>ce.value=b.value.lead.key,"onUpdate:modelValue":n[11]||=e=>w(b.value.lead.key,String(e))},null,8,[`model-value`])),h.value.length&&b.value.lead.kind!==`select`?(R(),G(`div`,KH,[n[20]||=W(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),G(H,null,K(h.value,e=>(R(),G(H,{key:e},[W(`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=>le(e,`summary`)},V(e),9,qH),W(`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=>le(e,`result`)},V(e)+`.result`,9,JH)],64))),128))])):L(``,!0)])):L(``,!0),b.value.compact.length?(R(),G(`section`,YH,[(R(!0),G(H,null,K(b.value.compact,t=>(R(),G(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[W(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(V(pe(t.key,t.schema))+` `,1),t.schema.description?(R(),q(z(rn),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,XH),t.kind===`workflow`?(R(),q(cH,{key:0,class:`max-w-48`,value:me(t.key),workflows:e.workflows,label:pe(t.key,t.schema),onPick:e=>T(t.key,e)},null,8,[`value`,`workflows`,`label`,`onPicLine truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>w(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),G(H,{key:2},[M(z(zl),{"model-value":fe(m.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>de(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),ue.value[e.key]?(R(),G(`span`,gU,V(ue.value[e.key]),1)):L(``,!0)],64))]))),128)),W(`section`,_U,[n[33]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),W(`div`,vU,[W(`label`,yU,[n[28]||=W(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),W(`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:n[12]||=e=>S(`when`,e.target.value)},null,40,bU)]),W(`label`,xU,[n[30]||=W(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),W(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:n[13]||=e=>S(`on_failure`,e.target.value||void 0)},[...n[29]||=[W(`option`,{value:``},`Park the task`,-1),W(`option`,{value:`continue`},`Continue`,-1)]],40,SU)]),W(`label`,CU,[n[31]||=W(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),W(`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:n[14]||=e=>C({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,wU)]),W(`label`,TU,[n[32]||=W(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),M(z(wm),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":n[15]||=e=>C({backoff:e||void 0})},null,8,[`model-value`])])])])]),W(`footer`,EU,[M(z(Z),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:n[16]||=e=>r(`remove`)},{default:j(()=>[M(z(Rn)),n[34]||=A(`Delete step`,-1)]),_:1}),M(z(Z),{type:`button`,size:`sm`,class:`ml-auto`,onClick:n[17]||=e=>r(`close`)},{default:j(()=>[...n[35]||=[A(`Done`,-1)]]),_:1})])]))}}),OU=`repository_path`;function kU(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:OU,path:n.trim(),type:`string`,required:!0}),r}function AU(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function jU(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=AU(yy(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 MU(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:yy(e.value,i.type??`string`)})}return n}function NU(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 PU(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...PU(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...PU(n,r)]}):[]}function FU(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function IU(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 LU(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var RU={class:`flex h-full flex-col`},zU={class:`flex items-center gap-2 border-b border-border px-4 py-3`},BU={class:`min-w-0 flex-1 truncate text-sm font-medium`},VU={key:0,class:`flex flex-1 items-center justify-center`},HU={class:`space-y-1.5`},UU=[`disabled`],WU=[`value`],GU={key:1,class:`space-y-1.5`},KU=[`value`],qU=[`title`],JU={class:`space-y-1.5`},YU={id:`bind-paths`},XU=[`value`],ZU={class:`divide-y divide-border rounded-md border border-border`},QU={class:`flex items-center gap-1.5 text-xs`},$U={class:`font-mono`},eW={class:`text-fg-subtle`},tW={key:0,class:`text-danger`,title:`Required`},nW=[`title`,`aria-label`,`onClick`],rW=[`onUpdate:modelValue`,`aria-label`],iW=[`onUpdate:modelValue`,`aria-label`],aW={key:2,class:`text-xs text-danger`},oW=[`title`],sW={key:0,class:`space-y-1 px-3 py-2`},cW={key:0,class:`text-xs text-danger`},lW={key:1,class:`truncate font-mono text-xs text-success`},uW={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},dW={class:`space-y-2`},fW={key:0,role:`alert`,class:`text-xs text-danger`},pW={key:1,clas Line truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),G(H,{key:2},[M(z(zl),{"model-value":fe(m.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>de(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),ue.value[e.key]?(R(),G(`span`,gU,V(ue.value[e.key]),1)):L(``,!0)],64))]))),128)),W(`section`,_U,[n[33]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),W(`div`,vU,[W(`label`,yU,[n[28]||=W(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),W(`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:n[12]||=e=>S(`when`,e.target.value)},null,40,bU)]),W(`label`,xU,[n[30]||=W(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),W(`select`,{class:`h-7 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:i.value.on_failure??``,onChange:n[13]||=e=>S(`on_failure`,e.target.value||void 0)},[...n[29]||=[W(`option`,{value:``},`Park the task`,-1),W(`option`,{value:`continue`},`Continue`,-1)]],40,SU)]),W(`label`,CU,[n[31]||=W(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),W(`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:n[14]||=e=>C({attempts:e.target.value===``?void 0:Number(e.target.value)})},null,40,wU)]),W(`label`,TU,[n[32]||=W(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),M(z(wm),{"model-value":i.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":n[15]||=e=>C({backoff:e||void 0})},null,8,[`model-value`])])])])]),W(`footer`,EU,[M(z(Z),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:n[16]||=e=>r(`remove`)},{default:j(()=>[M(z(Rn)),n[34]||=A(`Delete step`,-1)]),_:1}),M(z(Z),{type:`button`,size:`sm`,class:`ml-auto`,onClick:n[17]||=e=>r(`close`)},{default:j(()=>[...n[35]||=[A(`Done`,-1)]]),_:1})])]))}}),OU=`repository_path`;function kU(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:OU,path:n.trim(),type:`string`,required:!0}),r}function AU(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function jU(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=AU(yy(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 MU(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:yy(e.value,i.type??`string`)})}return n}function NU(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 PU(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...PU(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...PU(n,r)]}):[]}function FU(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function IU(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 LU(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var RU={class:`flex h-full flex-col`},zU={class:`flex items-center gap-2 border-b border-border px-4 py-3`},BU={class:`min-w-0 flex-1 truncate text-sm font-medium`},VU={key:0,class:`flex flex-1 items-center justify-center`},HU={class:`space-y-1.5`},UU=[`disabled`],WU=[`value`],GU={key:1,class:`space-y-1.5`},KU=[`value`],qU=[`title`],JU={class:`space-y-1.5`},YU={id:`bind-paths`},XU=[`value`],ZU={class:`divide-y divide-border rounded-md border border-border`},QU={class:`flex items-center gap-1.5 text-xs`},$U={class:`font-mono`},eW={class:`text-fg-subtle`},tW={key:0,class:`text-danger`,title:`Required`},nW=[`title`,`aria-label`,`onClick`],rW=[`onUpdate:modelValue`,`aria-label`],iW=[`onUpdate:modelValue`,`aria-label`],aW={key:2,class:`text-xs text-danger`},oW=[`title`],sW={key:0,class:`space-y-1 px-3 py-2`},cW={key:0,class:`text-xs text-danger`},lW={key:1,class:`truncate font-mono text-xs text-success`},uW={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},dW={class:`space-y-2`},fW={key:0,role:`alert`,class:`text-xs text-danger`},pW={key:1,clas Line 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 nQ(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=rQ(n.code,e);return Array.isArray(e)?e.some(e=>tQ(n[r],e,t,n.type===`keyup`)):tQ(n[r],e,t,n.type===`keyup`)}}function rQ(e,t){return t.includes(e)?`code`:`key`}function iQ(e,t){let n=I(()=>ze(t?.target)??QZ),r=qe(ze(e)===!0),i=!1,a=new Set,o=c(ze(e));F(()=>ze(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),XG([`blur`,`contextmenu`],s),QG((...e)=>o(...e),e=>{let n=ze(t?.actInsideInputWithModifier)??!0,a=ze(t?.preventDefault)??!1;if(i=eQ(e),(!i||i&&!n)&&$Z(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}),QG((...e)=>o(...e),e=>{let n=ze(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&$Z(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=ze(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?nQ(e,a):e}return r}var aQ=`vue-flow__node-desc`,oQ=`vue-flow__edge-desc`,sQ=`vue-flow__aria-live`,cQ=[`Enter`,` `,`Escape`],lQ={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function uQ(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function dQ(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 fQ(e){return{width:e.offsetWidth,height:e.offsetHeight}}function pQ(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function mQ(e,t){return{x:pQ(e.x,t[0][0],t[1][0]),y:pQ(e.y,t[0][1],t[1][1])}}function hQ(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function gQ(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function _Q(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!gQ(e)}function vQ(e){return _Q(e)&&`computedPosition`in e}function yQ(e){return!Number.isNaN(e)&&Number.isFinite(e)}function bQ(e){return yQ(e.width)&&yQ(e.height)&&yQ(e.x)&&yQ(e.y)}function xQ(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:mt({width:0,height:0}),computedPosition:mt({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:R$(e.data)?e.data:{},events:mt(R$(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function SQ(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:R$(e.data)?e.data:{},events:mt(R$(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function CQ(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 wQ(...e){if(e.length===3){let[t,n,r]=e;return CQ(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>gQ(e)&&e.source===r).map(e=>n.find(t=>_Q(t)&&t.id===e.target))}function TQ(...e){if(e.length===3){let[t,n,r]=e;return CQ(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>gQ(e)&&e.target===r).map(e=>n.find(t=>_Q(t)&&t.id===e.source))}function EQ({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function DQ(e,t){return t.some(t=>gQ(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 OQ({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function kQ({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?x$(s,o):s}function AQ(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 jQ({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function MQ({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function NQ(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=AQ(t,jQ({...r.computedPosition,...r.dimensions}))}return MQ(t)}function PQ(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...kQ(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= 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 iQ(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=aQ(n.code,e);return Array.isArray(e)?e.some(e=>rQ(n[r],e,t,n.type===`keyup`)):rQ(n[r],e,t,n.type===`keyup`)}}function aQ(e,t){return t.includes(e)?`code`:`key`}function oQ(e,t){let n=I(()=>ze(t?.target)??eQ),r=qe(ze(e)===!0),i=!1,a=new Set,o=c(ze(e));F(()=>ze(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),QG([`blur`,`contextmenu`],s),eK((...e)=>o(...e),e=>{let n=ze(t?.actInsideInputWithModifier)??!0,a=ze(t?.preventDefault)??!1;if(i=nQ(e),(!i||i&&!n)&&tQ(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}),eK((...e)=>o(...e),e=>{let n=ze(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&tQ(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=ze(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?iQ(e,a):e}return r}var sQ=`vue-flow__node-desc`,cQ=`vue-flow__edge-desc`,lQ=`vue-flow__aria-live`,uQ=[`Enter`,` `,`Escape`],dQ={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function fQ(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function pQ(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 mQ(e){return{width:e.offsetWidth,height:e.offsetHeight}}function hQ(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function gQ(e,t){return{x:hQ(e.x,t[0][0],t[1][0]),y:hQ(e.y,t[0][1],t[1][1])}}function _Q(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function vQ(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function yQ(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!vQ(e)}function bQ(e){return yQ(e)&&`computedPosition`in e}function xQ(e){return!Number.isNaN(e)&&Number.isFinite(e)}function SQ(e){return xQ(e.width)&&xQ(e.height)&&xQ(e.x)&&xQ(e.y)}function CQ(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:mt({width:0,height:0}),computedPosition:mt({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:B$(e.data)?e.data:{},events:mt(B$(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function wQ(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:B$(e.data)?e.data:{},events:mt(B$(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function TQ(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 EQ(...e){if(e.length===3){let[t,n,r]=e;return TQ(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>vQ(e)&&e.source===r).map(e=>n.find(t=>yQ(t)&&t.id===e.target))}function DQ(...e){if(e.length===3){let[t,n,r]=e;return TQ(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>vQ(e)&&e.target===r).map(e=>n.find(t=>yQ(t)&&t.id===e.source))}function OQ({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function kQ(e,t){return t.some(t=>vQ(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 AQ({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function jQ({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?C$(s,o):s}function MQ(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 NQ({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function PQ({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function FQ(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=MQ(t,NQ({...r.computedPosition,...r.dimensions}))}return PQ(t)}function IQ(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...jQ(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= 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}
@@ -147,4 +147,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`},h$=class extends Error{constructor(e,...t){super(m$[e]?.call(m$,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function g$(e){return`clientX`in e}function _$(e){return`sourceEvent`in e}function v$(e,t){let n=g$(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 y$=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function b$(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function x$(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var S$=()=>!0;function C$(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function w$(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())dQ(i,uQ(e))>0&&r.push(e);return r}var T$=250;function E$(e,t,n,r){let i=[],a=1/0,o=w$(e,n,t+T$);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}=l$(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 D$(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=S$},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:_}=v$(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=O$(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===qZ.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=j$(t,e,a,p,n,!0)}return b}function O$(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function k$(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function A$(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function j$(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===qZ.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,...l$(o,c,c.position,!0)}:c}var M$={[WZ.Left]:WZ.Right,[WZ.Right]:WZ.Left,[WZ.Top]:WZ.Bottom,[WZ.Bottom]:WZ.Top},N$=[`production`,`prod`];function P$(e,...t){F$()&&console.warn(`[Vue Flow]: ${e}`,...t)}function F$(){return!N$.includes(`production`)}function I$(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,...fQ(t)}}):null}function L$(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ft(()=>{o.blur()})):n([e])}function R$(e){return z(e)!==void 0}function z$(e,t,n,r){if(!e||!e.source||!e.target)return n(new h$(p$.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=gQ(e)?e:{...e,id:EQ(e)},i=SQ(i,void 0,r),!DQ(i,t)&&i}function B$(e,t,n,r,i){if(!t.source||!t.target)return i(new h$(p$.EDGE_INVALID,e.id)),!1;if(!n)return i(new h$(p$.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?EQ(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function V$(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!_Q(o)){n(new h$(p$.NODE_INVALID,o?.id));continue}let s=xQ(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 h$(p$.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 H$(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 U$(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}`;H$(`source`,o,`${r}-${a}--Line 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`},_$=class extends Error{constructor(e,...t){super(g$[e]?.call(g$,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function v$(e){return`clientX`in e}function y$(e){return`sourceEvent`in e}function b$(e,t){let n=v$(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 x$=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function S$(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function C$(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var w$=()=>!0;function T$(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function E$(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())pQ(i,fQ(e))>0&&r.push(e);return r}var D$=250;function O$(e,t,n,r){let i=[],a=1/0,o=E$(e,n,t+D$);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}=d$(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 k$(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=w$},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:_}=b$(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=A$(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===YZ.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=N$(t,e,a,p,n,!0)}return b}function A$(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function j$(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function M$(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function N$(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===YZ.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,...d$(o,c,c.position,!0)}:c}var P$={[KZ.Left]:KZ.Right,[KZ.Right]:KZ.Left,[KZ.Top]:KZ.Bottom,[KZ.Bottom]:KZ.Top},F$=[`production`,`prod`];function I$(e,...t){L$()&&console.warn(`[Vue Flow]: ${e}`,...t)}function L$(){return!F$.includes(`production`)}function R$(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,...mQ(t)}}):null}function z$(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ft(()=>{o.blur()})):n([e])}function B$(e){return z(e)!==void 0}function V$(e,t,n,r){if(!e||!e.source||!e.target)return n(new _$(h$.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=vQ(e)?e:{...e,id:OQ(e)},i=wQ(i,void 0,r),!kQ(i,t)&&i}function H$(e,t,n,r,i){if(!t.source||!t.target)return i(new _$(h$.EDGE_INVALID,e.id)),!1;if(!n)return i(new _$(h$.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?OQ(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function U$(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!yQ(o)){n(new _$(h$.NODE_INVALID,o?.id));continue}let s=CQ(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 _$(h$.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 W$(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 G$(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}`;W$(`source`,o,`${r}-${a}--Line truncated
+15 -2
View File
@@ -5,7 +5,9 @@ import { Plus, Trash2, X } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/ui/switch";
import { cn } from "@/lib/utils";
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
import { useIdentitiesStore } from "@/stores/identities";
import BindEvent from "./BindEvent.vue";
import { setWorkflowField, workflowField } from "./workflow-edit";
import type { WorkflowTrigger } from "./workflow-triggers";
@@ -53,6 +55,12 @@ function addSpec(key: "inputs" | "outputs", list: [string, Spec][]): void {
setSpec(key, [...list, [`${key.slice(0, -1)}_${n}`, { type: "string" }]]);
}
// The identity a run acts as must be an agent, never a person; a workflow
// naming none is refused when it runs.
const identities = useIdentitiesStore();
identities.watch();
const agents = computed(() => identities.identities.filter((i) => i.kind !== "user" && i.lifecycle === "active"));
const MODES = [
{ value: "required", label: "Repository", hint: "Clones the task's repository" },
{ value: "optional", label: "If given", hint: "Clones one when the run names it" },
@@ -145,10 +153,15 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
<span class="flex-1 text-[13px]">Identity</span>
<input
:value="text('identity')"
placeholder="whoever starts it"
class="h-7 w-44 rounded-md border border-input bg-background px-2 text-[13px]"
list="workflow-identities"
placeholder="required"
title="Every run acts as this identity; a workflow naming none is refused."
:class="cn('h-7 w-44 rounded-md border border-input bg-background px-2 text-[13px]', !text('identity') && 'border-danger/60')"
@change="set('identity', ($event.target as HTMLInputElement).value.trim())"
/>
<datalist id="workflow-identities">
<option v-for="agent in agents" :key="agent.id" :value="agent.id">{{ agent.display_name }}</option>
</datalist>
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Container profile</span>