feat(workflow): resume a parked run from a chosen step

Each finished stage records the run's step results; a retry may name a resume
point, and the next attempt skips the steps before it with their results
loaded. A run with a repository resumes only on its pushed branch. The canvas
offers Resume/Re-run from here on parked runs.
This commit is contained in:
sam committed 2026-10-05 13:06:30 +11:00
1 parent 317d3782fa
commit 2d2cf28b2d
37 files changed
+606 -88

No files matched your search

+7
View File
@@ -114,6 +114,13 @@ A run ends at the first step that sets an outcome: `workflow.finish`,
completes, with the last step's summary as its detail. A step that fails parks
the run unless it continues on failure.
A parked run can be retried from a top-level step instead of from the start.
The steps before it are skipped and their results stay available to
references. The resume point is named by the step's id (else its type), so
give an id to any step whose type appears twice. A run with a repository
resumes only on its pushed branch: work an earlier step did not push is not
there.
## Step types
### `agent.run`
+14 -3
View File
@@ -1732,7 +1732,9 @@ type ApplyOperatorTaskActionRequest struct {
// (taskstate.RetryMode): refresh onto the base branch or continue the work
// already pushed on the task's branch. It is empty for every other action,
// and chat carries no mode syntax -- an empty value means refresh_onto_base.
RetryMode string `protobuf:"bytes,8,opt,name=retry_mode,json=retryMode,proto3" json:"retry_mode,omitempty"`
RetryMode string `protobuf:"bytes,8,opt,name=retry_mode,json=retryMode,proto3" json:"retry_mode,omitempty"`
// resume_from is the stage a retry starts at; empty runs every stage.
ResumeFrom string `protobuf:"bytes,9,opt,name=resume_from,json=resumeFrom,proto3" json:"resume_from,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1823,6 +1825,13 @@ func (x *ApplyOperatorTaskActionRequest) GetRetryMode() string {
return ""
}
func (x *ApplyOperatorTaskActionRequest) GetResumeFrom() string {
if x != nil {
return x.ResumeFrom
}
return ""
}
type ApplyOperatorTaskActionResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
@@ -3056,7 +3065,7 @@ const file_gateway_v1_chat_proto_rawDesc = "" +
"\x17ApplyTaskActionResponse\x12\x17\n" +
"\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x16\n" +
"\x06action\x18\x02 \x01(\tR\x06action\x12\x18\n" +
"\amessage\x18\x03 \x01(\tR\amessage\"\x8d\x02\n" +
"\amessage\x18\x03 \x01(\tR\amessage\"\xae\x02\n" +
"\x1eApplyOperatorTaskActionRequest\x12\x17\n" +
"\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x16\n" +
"\x06action\x18\x02 \x01(\tR\x06action\x12\x19\n" +
@@ -3067,7 +3076,9 @@ const file_gateway_v1_chat_proto_rawDesc = "" +
"\finstructions\x18\x06 \x01(\tR\finstructions\x12\x1a\n" +
"\bfindings\x18\a \x03(\tR\bfindings\x12\x1d\n" +
"\n" +
"retry_mode\x18\b \x01(\tR\tretryMode\"l\n" +
"retry_mode\x18\b \x01(\tR\tretryMode\x12\x1f\n" +
"\vresume_from\x18\t \x01(\tR\n" +
"resumeFrom\"l\n" +
"\x1fApplyOperatorTaskActionResponse\x12\x17\n" +
"\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x16\n" +
"\x06action\x18\x02 \x01(\tR\x06action\x12\x18\n" +
+67 -15
View File
@@ -1743,7 +1743,11 @@ type Task struct {
// action writes it and the daemon's prepareWorkspace reads it, so it must
// cross the wire for a retry to land on the source the operator chose. The
// empty string reads as refresh_onto_base.
RetryMode string `protobuf:"bytes,41,opt,name=retry_mode,json=retryMode,proto3" json:"retry_mode,omitempty"`
RetryMode string `protobuf:"bytes,41,opt,name=retry_mode,json=retryMode,proto3" json:"retry_mode,omitempty"`
// resume_from is the stage the next attempt starts at; empty runs every
// stage. resume_results are the step results (JSON) it starts with.
ResumeFrom string `protobuf:"bytes,42,opt,name=resume_from,json=resumeFrom,proto3" json:"resume_from,omitempty"`
ResumeResults []byte `protobuf:"bytes,43,opt,name=resume_results,json=resumeResults,proto3" json:"resume_results,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -2066,6 +2070,20 @@ func (x *Task) GetRetryMode() string {
return ""
}
func (x *Task) GetResumeFrom() string {
if x != nil {
return x.ResumeFrom
}
return ""
}
func (x *Task) GetResumeResults() []byte {
if x != nil {
return x.ResumeResults
}
return nil
}
// Event mirrors internal/events.Event. Data is carried as a JSON object
// string (matching the store's own on-disk representation) rather than
// google.protobuf.Struct, to stay a direct mirror of the existing column.
@@ -3995,12 +4013,15 @@ type FinishStepRequest struct {
// execution_id names the run the step belongs to. The grant check verifies
// it against the credential, and the store verifies the step really is that
// execution's, so a caller cannot move another run's step by naming it.
ExecutionId int64 `protobuf:"varint,1,opt,name=execution_id,json=executionId,proto3" json:"execution_id,omitempty"`
StepId int64 `protobuf:"varint,2,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"`
From string `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"`
To string `protobuf:"bytes,4,opt,name=to,proto3" json:"to,omitempty"`
Detail string `protobuf:"bytes,5,opt,name=detail,proto3" json:"detail,omitempty"`
TokensUsed int64 `protobuf:"varint,6,opt,name=tokens_used,json=tokensUsed,proto3" json:"tokens_used,omitempty"`
ExecutionId int64 `protobuf:"varint,1,opt,name=execution_id,json=executionId,proto3" json:"execution_id,omitempty"`
StepId int64 `protobuf:"varint,2,opt,name=step_id,json=stepId,proto3" json:"step_id,omitempty"`
From string `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"`
To string `protobuf:"bytes,4,opt,name=to,proto3" json:"to,omitempty"`
Detail string `protobuf:"bytes,5,opt,name=detail,proto3" json:"detail,omitempty"`
TokensUsed int64 `protobuf:"varint,6,opt,name=tokens_used,json=tokensUsed,proto3" json:"tokens_used,omitempty"`
// results is the run's step results (JSON, by step id) after a stage the
// run moves past; empty otherwise. A resumed attempt starts from them.
Results []byte `protobuf:"bytes,7,opt,name=results,proto3" json:"results,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -4077,6 +4098,13 @@ func (x *FinishStepRequest) GetTokensUsed() int64 {
return 0
}
func (x *FinishStepRequest) GetResults() []byte {
if x != nil {
return x.Results
}
return nil
}
type FinishStepResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// event is the transition's stage_finish row, already persisted.
@@ -5214,7 +5242,11 @@ type RetryTaskRequest struct {
Workflow string `protobuf:"bytes,3,opt,name=workflow,proto3" json:"workflow,omitempty"`
// retry_mode is the operator's worktree choice (taskstate.RetryMode) the
// requeue persists. Empty reads as refresh_onto_base.
RetryMode string `protobuf:"bytes,4,opt,name=retry_mode,json=retryMode,proto3" json:"retry_mode,omitempty"`
RetryMode string `protobuf:"bytes,4,opt,name=retry_mode,json=retryMode,proto3" json:"retry_mode,omitempty"`
// resume_from is the stage the attempt starts at, and resume_after the
// stage before it whose recorded results it starts with (task.Resume).
ResumeFrom string `protobuf:"bytes,5,opt,name=resume_from,json=resumeFrom,proto3" json:"resume_from,omitempty"`
ResumeAfter string `protobuf:"bytes,6,opt,name=resume_after,json=resumeAfter,proto3" json:"resume_after,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -5277,6 +5309,20 @@ func (x *RetryTaskRequest) GetRetryMode() string {
return ""
}
func (x *RetryTaskRequest) GetResumeFrom() string {
if x != nil {
return x.ResumeFrom
}
return ""
}
func (x *RetryTaskRequest) GetResumeAfter() string {
if x != nil {
return x.ResumeAfter
}
return ""
}
type RetryTaskResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
@@ -13008,8 +13054,7 @@ const file_state_v1_state_proto_rawDesc = "" +
"\x06tokens\x18\x01 \x03(\v2\x17.state.v1.PersonalTokenR\x06tokens\",\n" +
"\x1aRevokePersonalTokenRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"\x1d\n" +
"\x1bRevokePersonalTokenResponse\"\xea\n" +
"\n" +
"\x1bRevokePersonalTokenResponse\"\xb2\v\n" +
"\x04Task\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x14\n" +
"\x05owner\x18\x02 \x01(\tR\x05owner\x12\x12\n" +
@@ -13065,7 +13110,10 @@ const file_state_v1_state_proto_rawDesc = "" +
"reviewGate\x12'\n" +
"\x0frereview_rounds\x18( \x01(\x03R\x0erereviewRounds\x12\x1d\n" +
"\n" +
"retry_mode\x18) \x01(\tR\tretryMode\"\xf8\x02\n" +
"retry_mode\x18) \x01(\tR\tretryMode\x12\x1f\n" +
"\vresume_from\x18* \x01(\tR\n" +
"resumeFrom\x12%\n" +
"\x0eresume_results\x18+ \x01(\fR\rresumeResults\"\xf8\x02\n" +
"\x05Event\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12*\n" +
"\x02at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x02at\x12\x12\n" +
@@ -13237,7 +13285,7 @@ const file_state_v1_state_proto_rawDesc = "" +
"\x13called_execution_id\x18\x06 \x01(\x03R\x11calledExecutionId\"S\n" +
"\x11StartStepResponse\x12\x17\n" +
"\astep_id\x18\x01 \x01(\x03R\x06stepId\x12%\n" +
"\x05event\x18\x02 \x01(\v2\x0f.state.v1.EventR\x05event\"\xac\x01\n" +
"\x05event\x18\x02 \x01(\v2\x0f.state.v1.EventR\x05event\"\xc6\x01\n" +
"\x11FinishStepRequest\x12!\n" +
"\fexecution_id\x18\x01 \x01(\x03R\vexecutionId\x12\x17\n" +
"\astep_id\x18\x02 \x01(\x03R\x06stepId\x12\x12\n" +
@@ -13245,7 +13293,8 @@ const file_state_v1_state_proto_rawDesc = "" +
"\x02to\x18\x04 \x01(\tR\x02to\x12\x16\n" +
"\x06detail\x18\x05 \x01(\tR\x06detail\x12\x1f\n" +
"\vtokens_used\x18\x06 \x01(\x03R\n" +
"tokensUsed\";\n" +
"tokensUsed\x12\x18\n" +
"\aresults\x18\a \x01(\fR\aresults\";\n" +
"\x12FinishStepResponse\x12%\n" +
"\x05event\x18\x01 \x01(\v2\x0f.state.v1.EventR\x05event\"Y\n" +
"\x16CancelExecutionRequest\x12\x17\n" +
@@ -13320,14 +13369,17 @@ const file_state_v1_state_proto_rawDesc = "" +
"fromStatus\x12%\n" +
"\x05audit\x18\x03 \x01(\v2\x0f.state.v1.EventR\x05audit\"0\n" +
"\x13ArchiveTaskResponse\x12\x19\n" +
"\bevent_id\x18\x01 \x01(\x03R\aeventId\"\x87\x01\n" +
"\bevent_id\x18\x01 \x01(\x03R\aeventId\"\xcb\x01\n" +
"\x10RetryTaskRequest\x12\x17\n" +
"\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x1f\n" +
"\vfrom_status\x18\x02 \x01(\tR\n" +
"fromStatus\x12\x1a\n" +
"\bworkflow\x18\x03 \x01(\tR\bworkflow\x12\x1d\n" +
"\n" +
"retry_mode\x18\x04 \x01(\tR\tretryMode\"\x13\n" +
"retry_mode\x18\x04 \x01(\tR\tretryMode\x12\x1f\n" +
"\vresume_from\x18\x05 \x01(\tR\n" +
"resumeFrom\x12!\n" +
"\fresume_after\x18\x06 \x01(\tR\vresumeAfter\"\x13\n" +
"\x11RetryTaskResponse\"\x96\x01\n" +
"\x18RespondReviewGateRequest\x12\x17\n" +
"\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x1f\n" +
@@ -86,9 +86,11 @@ type TaskArchiver interface {
// TaskRetryer atomically requeues recoverable work and accounts for the new
// attempt so a partial write cannot evade the retry cap. retryMode is the
// operator's worktree choice for the next dispatch (taskstate.RetryMode),
// persisted on the row so the daemon reads it instead of inferring it.
// persisted on the row so the daemon reads it instead of inferring it. resume
// is where the attempt starts; a resume whose After stage did not complete in
// its last run is refused with ErrResumeIncomplete.
type TaskRetryer interface {
RetryTask(ctx context.Context, taskID int64, fromStatus, workflow, retryMode string) error
RetryTask(ctx context.Context, taskID int64, fromStatus, workflow, retryMode string, resume task.Resume) error
}
// ReviewGateResponder records the operator's review-gate answer. A re-review
@@ -401,6 +403,9 @@ var (
// store does not record or a step whose identifying fields do not resolve.
// Distinct from the transition sentinels, which cover a row's state.
ErrInvalidStep = errors.New("store: invalid step execution request")
// ErrResumeIncomplete is returned when a retry resumes after a stage whose
// last run did not complete, so there are no results to start from.
ErrResumeIncomplete = errors.New("store: the step before the resume point did not complete in its last run")
// ErrBindingNotFound is returned when a binding ID does not exist.
ErrBindingNotFound = errors.New("store: binding not found")
// ErrBindingOverlap is returned when a binding's matcher overlaps an
+60 -2
View File
@@ -5,9 +5,11 @@ import (
"context"
"errors"
"fmt"
"slices"
"strings"
"github.com/samcharles93/archie-core/internal/domain/identity"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
workflowtask "github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/taskstate"
@@ -43,6 +45,9 @@ type Task struct {
// service reads it to refuse a re-review at the cap before the guarded
// write, and the write itself re-checks it in the row.
RereviewRounds int
// Stages are the pinned definition's stage names in order, the resume
// points a retry may name.
Stages []string
// Attempt is the run the operator acted on. It is stamped onto the event
// this action records so an intervention is attributable to the run it
// changed course -- without it a retry or a stop is indistinguishable
@@ -66,6 +71,9 @@ type ActionPayload struct {
// task's branch. It is empty -- the explicit default, refresh -- for every
// other action.
RetryMode taskstate.RetryMode
// ResumeFrom is the stage a retry starts at, keeping the results of the
// stages before it. Empty runs every stage.
ResumeFrom string
}
// Actor is who performed an action and the principal whose authority allowed
@@ -169,7 +177,7 @@ type Store interface {
Requeue(context.Context, int64, string, string) error
// RetryTask requeues a parked task, records the operator's worktree mode
// for the next dispatch and increments retry_count in one guarded write.
RetryTask(context.Context, int64, string, string, string) error
RetryTask(context.Context, int64, string, string, string, workflowtask.Resume) error
// RespondReviewGate is the guarded review gate response write
// (internal/domain/storecontract.ReviewGateResponder): it records the
// answered document, and for a re-review increments rereview_rounds and
@@ -376,6 +384,17 @@ func (s Service) applyRetry(ctx context.Context, task *Task, actor Actor, o outc
if !ok {
return o, fmt.Errorf("unknown retry mode %q: %w", requested, ErrConflict)
}
resume, err := resumePoint(task.Stages, payload.ResumeFrom)
if err != nil {
return o, fmt.Errorf("%w: %w", err, ErrConflict)
}
// The skipped steps' work must be on the branch the attempt continues.
if resume.From != "" && task.Owner != "" {
if strings.TrimSpace(task.Branch) == "" {
return o, fmt.Errorf("resuming from %q needs the earlier steps' work pushed, and task %d has no pushed branch: %w", resume.From, task.ID, ErrConflict)
}
mode = taskstate.RetryContinuePushedWork
}
if mode == taskstate.RetryContinuePushedWork && strings.TrimSpace(task.Branch) == "" {
return o, fmt.Errorf("task %d has no pushed branch to continue: %w", task.ID, ErrConflict)
}
@@ -393,12 +412,51 @@ func (s Service) applyRetry(ctx context.Context, task *Task, actor Actor, o outc
}
return o, fmt.Errorf("%w: %s", ErrConflict, reason)
}
err := s.Store.RetryTask(ctx, task.ID, "parked", "", string(mode))
err = s.Store.RetryTask(ctx, task.ID, "parked", "", string(mode), resume)
if errors.Is(err, storecontract.ErrResumeIncomplete) {
err = fmt.Errorf("%q did not complete in its last run, so there is nothing to resume from: %w", resume.After, ErrConflict)
}
o.event.Kind, o.event.Detail = events.KindTaskRetried, actor.describe("retried")
o.event.Data = map[string]any{"retry_count": task.RetryCount + 1, "previous_reason": task.ParkReason, "retry_mode": string(mode)}
if resume.From != "" {
o.event.Data["resume_from"] = resume.From
}
return o, err
}
// resumePoint resolves a resume stage against the pinned definition's stages.
// Stage names are how runs are recorded, so a name two stages share cannot
// say which one to resume.
func resumePoint(stages []string, from string) (workflowtask.Resume, error) {
if from == "" {
return workflowtask.Resume{}, nil
}
at := slices.Index(stages, from)
if at < 0 {
return workflowtask.Resume{}, fmt.Errorf("the pinned workflow has no step %q", from)
}
resume := workflowtask.Resume{From: from}
if at > 0 {
resume.After = stages[at-1]
}
for _, name := range []string{resume.From, resume.After} {
if name != "" && countOf(stages, name) > 1 {
return workflowtask.Resume{}, fmt.Errorf("several steps run as %q; give each an id to resume there", name)
}
}
return resume, nil
}
func countOf(stages []string, name string) int {
n := 0
for _, stage := range stages {
if stage == name {
n++
}
}
return n
}
func (s Service) applyStop(ctx context.Context, task *Task, actor Actor, o outcome) (outcome, error) {
if s.CancelTask == nil {
return o, ErrUnavailable
+14
View File
@@ -96,6 +96,20 @@ func ParseDefinition(src string, registry StepRegistry) (YAMLDefinition, error)
return definition, nil
}
// StageNames returns the names a definition's steps run under, in order. It
// reads a definition already pinned, so it decodes without validating.
func StageNames(src string) ([]string, error) {
var definition YAMLDefinition
if err := yaml.Unmarshal([]byte(src), &definition); err != nil {
return nil, fmt.Errorf("parse workflow YAML: %w", err)
}
names := make([]string, len(definition.Steps))
for i, step := range definition.Steps {
names[i] = step.StageName()
}
return names, nil
}
// ParseAndCompile validates and compiles one definition in a single operation.
func ParseAndCompile(src string, registry StepRegistry) (Workflow, error) {
definition, err := ParseDefinition(src, registry)
+4 -2
View File
@@ -33,7 +33,8 @@ steps:
type: gate.repository
settings:
expect: test-failure
- type: repo.commit
- id: commit-repro
type: repo.commit
settings:
message: "test: failing repro"
reference: Refs
@@ -53,7 +54,8 @@ steps:
</analysis>
The full quality gate must pass. Make the smallest fix that makes the repro tests pass without changing them. Call finish with status "passed" and a summary for the PR reviewer: root cause, the fix, and verification.
- type: repo.commit
- id: commit-fix
type: repo.commit
settings:
message: "fix: {{ task.title }} (archie)"
reference: Fixes
+16 -6
View File
@@ -171,7 +171,7 @@ func compileStep(step StepRecord, registry StepRegistry) (Stage, error) {
return Stage{}, fmt.Errorf("build workflow step %q: %w", step.Type, err)
}
// Settings are built per run, with every reference resolved.
return wrapStep(step, step.Type, func(ctx context.Context, tc *TaskContext) error {
return wrapStep(step, func(ctx context.Context, tc *TaskContext) error {
stage, err := factory(renderSettings(step.Settings, tc))
if err != nil {
return fmt.Errorf("step %q settings: %w", step.Type, err)
@@ -180,12 +180,22 @@ func compileStep(step StepRecord, registry StepRegistry) (Stage, error) {
}), nil
}
// StageName is the name a step runs and is recorded under: its id, else its
// type, else "parallel".
func (step StepRecord) StageName() string {
switch {
case step.ID != "":
return step.ID
case step.Parallel != nil:
return "parallel"
}
return step.Type
}
// wrapStep applies the controls every step shares around its body: when,
// retry, and recording its result under its id.
func wrapStep(step StepRecord, name string, body func(context.Context, *TaskContext) error) Stage {
if step.ID != "" {
name = step.ID
}
func wrapStep(step StepRecord, body func(context.Context, *TaskContext) error) Stage {
name := step.StageName()
// ParseDefinition has already refused a condition or backoff that does
// not parse.
when, _ := parseCondition(step.When)
@@ -241,7 +251,7 @@ func compileParallel(step StepRecord, registry StepRegistry) (Stage, error) {
branches[i] = append(branches[i], stage)
}
}
return wrapStep(step, "parallel", func(ctx context.Context, tc *TaskContext) error {
return wrapStep(step, func(ctx context.Context, tc *TaskContext) error {
clones := make([]*TaskContext, len(branches))
errs := make([]error, len(branches))
var wg sync.WaitGroup
+11
View File
@@ -60,6 +60,17 @@ type StepFinish struct {
// TokensUsed is the usage the step itself accounted. Stages record none;
// the agent runtime records its own calls' usage.
TokensUsed int64
// Results is the run's step results as JSON after a stage the run moves
// past; nil otherwise. A resumed attempt starts from them.
Results []byte
}
// Resume is where a retried attempt starts: at stage From, with the results
// recorded after stage After, the one before it. After is empty when From is
// the first stage. An empty From runs the workflow from its first stage.
type Resume struct {
From string
After string
}
// StepExecution is one recorded step: ListSteps' read, the dashboard run
+5
View File
@@ -64,6 +64,11 @@ type Task struct {
// RetryMode is the worktree mode for the next dispatch; empty means
// RefreshOntoBase.
RetryMode string `json:"retry_mode"`
// ResumeFrom is the stage this attempt starts at; empty runs every stage.
// ResumeResults are the step results (JSON, by step id) the attempt starts
// with, so steps it skips still answer their references.
ResumeFrom string `json:"resume_from,omitempty"`
ResumeResults json.RawMessage `json:"resume_results,omitempty"`
// WatchCommentID is the poll backstop's high-water mark over forge
// review-comment IDs for this task (pr-review-remediation.md decision
// 2's persisted per-task cursor; the comment-watch design it was
+41 -2
View File
@@ -3,10 +3,12 @@ package workflow
import (
"context"
"encoding/json"
"fmt"
"log/slog"
"maps"
"regexp"
"slices"
"strings"
"time"
"unicode/utf8"
@@ -301,7 +303,12 @@ func Run(ctx context.Context, wf Workflow, tc *TaskContext) {
tc.runInterface, tc.runInterfaceSet = wf.Interface, true
log := tc.Log.With("workflow", wf.Name, "repo", tc.Repo.FullName(), "issue", t.IssueNumber)
for _, stage := range wf.Stages {
stages, err := tc.resumeStages(wf.Stages)
if err != nil {
park(ctx, tc, err.Error())
return
}
for _, stage := range stages {
tc.Stage = stage.Name
if err := tc.Store.Update(ctx, t); err != nil {
park(ctx, tc, fmt.Sprintf("persist task before stage %s: %v", stage.Name, err))
@@ -359,7 +366,7 @@ func Run(ctx context.Context, wf Workflow, tc *TaskContext) {
// failed recording write parks the execution, like a failed start.
finishEvent, recordErr := tc.Store.FinishStep(ctx, StepFinish{
StepID: stepID, ExecutionID: t.ID,
From: taskstate.StepRunning, To: finishTo, Detail: finishDetail,
From: taskstate.StepRunning, To: finishTo, Detail: finishDetail, Results: tc.resultsAfter(stage, err),
})
if recordErr != nil {
stageLog.Error("stage finish could not be recorded", "stage", stage.Name, "err", recordErr)
@@ -377,6 +384,38 @@ func Run(ctx context.Context, wf Workflow, tc *TaskContext) {
finish(ctx, tc, log)
}
// resultsAfter is what a stage records for a later attempt resumed after it:
// the results so far when the run moves past the stage, else nothing.
func (tc *TaskContext) resultsAfter(stage Stage, err error) []byte {
if err != nil && !stage.ContinueOnFailure {
return nil
}
// StepResult holds strings and decoded JSON values, which always marshal.
results, _ := json.Marshal(tc.stepResults)
return results
}
// resumeStages returns the stages this attempt runs: all of them, or those
// from the task's resume point on, with the results the stages before it
// recorded loaded so their references still resolve.
func (tc *TaskContext) resumeStages(stages []Stage) ([]Stage, error) {
from := tc.Task.ResumeFrom
if from == "" {
return stages, nil
}
at := slices.IndexFunc(stages, func(s Stage) bool { return s.Name == from })
if at < 0 {
return nil, fmt.Errorf("resume point %q is not a step of this workflow", from)
}
if len(tc.Task.ResumeResults) > 0 {
if err := json.Unmarshal(tc.Task.ResumeResults, &tc.stepResults); err != nil {
return nil, fmt.Errorf("resume results: %w", err)
}
}
tc.Log.Info("resuming", "from", from, "skipped", at)
return stages[at:], nil
}
// endsRun applies a recorded stage's result: a failure parks unless the stage
// continues on failure, and an outcome finishes the run.
func endsRun(ctx context.Context, tc *TaskContext, stage Stage, err error, log, stageLog *slog.Logger) bool {
@@ -103,6 +103,7 @@ func (c *Client) ApplyOperatorTaskAction(ctx context.Context, actor taskactions.
Instructions: res.Instructions,
Findings: res.Findings,
RetryMode: string(res.RetryMode),
ResumeFrom: res.ResumeFrom,
})
if err != nil {
return messaging.TaskActionResult{}, taskActionError(err)
@@ -112,6 +112,7 @@ func (s *server) ApplyOperatorTaskAction(ctx context.Context, r *pb.ApplyOperato
Instructions: r.Instructions,
Findings: r.Findings,
RetryMode: taskstate.RetryMode(r.RetryMode),
ResumeFrom: r.ResumeFrom,
})
if err != nil {
return nil, taskActionStatus(err)
@@ -0,0 +1,21 @@
-- step_executions.results is the run's step results (summary and structured
-- result, by step id) after a stage the run moved past. A resumed attempt
-- starts from the results of the stage before its resume point, so steps it
-- skips still answer {{ steps.<id>.* }}. NULL means the run did not move past
-- the stage.
--
-- tasks.resume_from names the stage the next attempt starts at, and
-- tasks.resume_results the results it starts with. A retry writes both; an
-- empty resume_from runs the workflow from its first stage.
-- +goose Up
ALTER TABLE step_executions ADD COLUMN results jsonb;
ALTER TABLE tasks ADD COLUMN resume_from text NOT NULL DEFAULT '';
ALTER TABLE tasks ADD COLUMN resume_results jsonb NOT NULL DEFAULT '{}';
-- +goose Down
ALTER TABLE tasks DROP COLUMN resume_results;
ALTER TABLE tasks DROP COLUMN resume_from;
ALTER TABLE step_executions DROP COLUMN results;
@@ -24,7 +24,7 @@ func (q *Queries) CallStatusDetail(ctx context.Context, taskID int64) (string, e
const enqueueCallTask = `-- name: EnqueueCallTask :one
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 FROM tasks t WHERE t.id = $1 FOR UPDATE
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 FROM tasks t WHERE t.id = $1 FOR UPDATE
)
INSERT INTO tasks (owner, repo, issue_number, title, body, labels, workflow, source, identity, org_id, workspace_id, inputs, call_parent_task_id, call_depth)
SELECT
@@ -41,7 +41,7 @@ SELECT
caller.id, caller.call_depth + 1
FROM caller
WHERE caller.status = 'running' AND caller.call_depth + 1 <= $7::int
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
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
`
type EnqueueCallTaskParams struct {
@@ -108,6 +108,8 @@ func (q *Queries) EnqueueCallTask(ctx context.Context, arg EnqueueCallTaskParams
&i.ReviewGate,
&i.RereviewRounds,
&i.RetryMode,
&i.ResumeFrom,
&i.ResumeResults,
)
return i, err
}
@@ -361,6 +361,7 @@ type StepExecution struct {
TokensUsed int64
StartedAt pgtype.Timestamptz
FinishedAt pgtype.Timestamptz
Results []byte
}
type SysAudit struct {
@@ -419,6 +420,8 @@ type Task struct {
ReviewGate string
RereviewRounds int64
RetryMode string
ResumeFrom string
ResumeResults []byte
}
type ToolCall struct {
@@ -54,7 +54,7 @@ func (q *Queries) CancelAttemptSteps(ctx context.Context, arg CancelAttemptSteps
const finishStepExecution = `-- name: FinishStepExecution :execrows
UPDATE step_executions
SET status = $1, detail = $2, tokens_used = $3, finished_at = now()
SET status = $1, detail = $2, tokens_used = $3, results = $6, finished_at = now()
WHERE id = $4 AND status = $5
`
@@ -64,6 +64,7 @@ type FinishStepExecutionParams struct {
TokensUsed int64
ID int64
Status_2 string
Results []byte
}
func (q *Queries) FinishStepExecution(ctx context.Context, arg FinishStepExecutionParams) (int64, error) {
@@ -73,6 +74,7 @@ func (q *Queries) FinishStepExecution(ctx context.Context, arg FinishStepExecuti
arg.TokensUsed,
arg.ID,
arg.Status_2,
arg.Results,
)
if err != nil {
return 0, err
@@ -157,6 +159,35 @@ func (q *Queries) InterruptAttemptSteps(ctx context.Context, arg InterruptAttemp
return items, nil
}
const latestStageResults = `-- name: LatestStageResults :one
SELECT status, results FROM step_executions
WHERE execution_id = $1 AND depth = 0 AND kind = 'stage' AND name = $2
AND status IN ('succeeded', 'failed')
ORDER BY attempt DESC, id DESC
LIMIT 1
`
type LatestStageResultsParams struct {
ExecutionID int64
Name string
}
type LatestStageResultsRow struct {
Status string
Results []byte
}
// The most recent finished run of a root stage, across attempts: a resumed
// attempt skips the stages before its resume point, so the last attempt that
// ran this stage may be an earlier one. NULL results mean that run did not
// move past the stage.
func (q *Queries) LatestStageResults(ctx context.Context, arg LatestStageResultsParams) (LatestStageResultsRow, error) {
row := q.db.QueryRow(ctx, latestStageResults, arg.ExecutionID, arg.Name)
var i LatestStageResultsRow
err := row.Scan(&i.Status, &i.Results)
return i, err
}
const listStepExecutions = `-- name: ListStepExecutions :many
SELECT id, execution_id, attempt, parent_id, depth, kind, name, status, detail, tokens_used, started_at, finished_at
FROM step_executions
@@ -316,12 +347,30 @@ SELECT id, org_id, workspace_id, execution_id, attempt, parent_id, depth, kind,
FROM step_executions WHERE id = $1 FOR UPDATE
`
type LockStepExecutionRow struct {
ID int64
OrgID string
WorkspaceID string
ExecutionID int64
Attempt int64
ParentID pgtype.Int8
Depth int32
Kind string
Name string
CalledExecutionID int64
Status string
Detail string
TokensUsed int64
StartedAt pgtype.Timestamptz
FinishedAt pgtype.Timestamptz
}
// FOR UPDATE, shared by a start's parent check and a finish's guarded write:
// the row is held for the caller's transaction, so the state a check reads is
// the state the guarded write sees.
func (q *Queries) LockStepExecution(ctx context.Context, id int64) (StepExecution, error) {
func (q *Queries) LockStepExecution(ctx context.Context, id int64) (LockStepExecutionRow, error) {
row := q.db.QueryRow(ctx, lockStepExecution, id)
var i StepExecution
var i LockStepExecutionRow
err := row.Scan(
&i.ID,
&i.OrgID,
@@ -28,7 +28,7 @@ func (q *Queries) ArchiveTaskDelete(ctx context.Context, arg ArchiveTaskDeletePa
}
const beginRemediationTask = `-- name: BeginRemediationTask :execrows
UPDATE tasks SET status = 'queued', workflow = 'remediate', park_reason = '', park_class = 'needs_human', review_payload = $2, retry_mode = 'continue_pushed_work', updated_at = now()
UPDATE tasks SET status = 'queued', workflow = 'remediate', park_reason = '', park_class = 'needs_human', review_payload = $2, retry_mode = 'continue_pushed_work', resume_from = '', resume_results = '{}', updated_at = now()
WHERE id = $1 AND status = 'pr_open'
`
@@ -51,7 +51,7 @@ func (q *Queries) BeginRemediationTask(ctx context.Context, arg BeginRemediation
const claimByIssue = `-- name: ClaimByIssue :one
UPDATE tasks SET status = 'running', attempt = attempt + 1, outputs = '', updated_at = now()
WHERE owner = $1 AND repo = $2 AND issue_number = $3 AND status = 'queued'
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
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
`
type ClaimByIssueParams struct {
@@ -107,6 +107,8 @@ func (q *Queries) ClaimByIssue(ctx context.Context, arg ClaimByIssueParams) (Tas
&i.ReviewGate,
&i.RereviewRounds,
&i.RetryMode,
&i.ResumeFrom,
&i.ResumeResults,
)
return i, err
}
@@ -121,7 +123,7 @@ WHERE id = (
FOR UPDATE SKIP LOCKED
LIMIT 1
)
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
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
`
// FOR UPDATE SKIP LOCKED replaces the SQLite single-writer assumption: two
@@ -175,6 +177,8 @@ func (q *Queries) ClaimNextTask(ctx context.Context) (Task, error) {
&i.ReviewGate,
&i.RereviewRounds,
&i.RetryMode,
&i.ResumeFrom,
&i.ResumeResults,
)
return i, err
}
@@ -285,7 +289,7 @@ VALUES (
),
$8
)
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
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
`
type InsertChatTaskParams struct {
@@ -360,6 +364,8 @@ func (q *Queries) InsertChatTask(ctx context.Context, arg InsertChatTaskParams)
&i.ReviewGate,
&i.RereviewRounds,
&i.RetryMode,
&i.ResumeFrom,
&i.ResumeResults,
)
return i, err
}
@@ -654,21 +660,26 @@ const retryTask = `-- name: RetryTask :execrows
UPDATE tasks SET status = 'queued', retry_count = retry_count + 1,
workflow = CASE WHEN $1::text = '' THEN workflow ELSE $1::text END,
retry_mode = $2::text,
resume_from = $3::text, resume_results = $4::jsonb,
park_reason = '', park_class = 'needs_human', updated_at = now()
WHERE id = $3 AND status = $4
WHERE id = $5 AND status = $6
`
type RetryTaskParams struct {
Workflow string
RetryMode string
ID int64
FromStatus string
Workflow string
RetryMode string
ResumeFrom string
ResumeResults []byte
ID int64
FromStatus string
}
func (q *Queries) RetryTask(ctx context.Context, arg RetryTaskParams) (int64, error) {
result, err := q.db.Exec(ctx, retryTask,
arg.Workflow,
arg.RetryMode,
arg.ResumeFrom,
arg.ResumeResults,
arg.ID,
arg.FromStatus,
)
@@ -713,7 +724,7 @@ func (q *Queries) StampTaskBinding(ctx context.Context, arg StampTaskBindingPara
}
const taskByID = `-- name: TaskByID :one
SELECT 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 FROM tasks WHERE id = $1
SELECT 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 FROM tasks WHERE id = $1
`
func (q *Queries) TaskByID(ctx context.Context, id int64) (Task, error) {
@@ -761,12 +772,14 @@ func (q *Queries) TaskByID(ctx context.Context, id int64) (Task, error) {
&i.ReviewGate,
&i.RereviewRounds,
&i.RetryMode,
&i.ResumeFrom,
&i.ResumeResults,
)
return i, err
}
const taskByIssue = `-- name: TaskByIssue :one
SELECT 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 FROM tasks WHERE owner = $1 AND repo = $2 AND issue_number = $3
SELECT 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 FROM tasks WHERE owner = $1 AND repo = $2 AND issue_number = $3
`
type TaskByIssueParams struct {
@@ -820,12 +833,14 @@ func (q *Queries) TaskByIssue(ctx context.Context, arg TaskByIssueParams) (Task,
&i.ReviewGate,
&i.RereviewRounds,
&i.RetryMode,
&i.ResumeFrom,
&i.ResumeResults,
)
return i, err
}
const taskByPR = `-- name: TaskByPR :one
SELECT 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 FROM tasks WHERE owner = $1 AND repo = $2 AND pr_number = $3 AND status = $4
SELECT 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 FROM tasks WHERE owner = $1 AND repo = $2 AND pr_number = $3 AND status = $4
`
type TaskByPRParams struct {
@@ -888,6 +903,8 @@ func (q *Queries) TaskByPR(ctx context.Context, arg TaskByPRParams) (Task, error
&i.ReviewGate,
&i.RereviewRounds,
&i.RetryMode,
&i.ResumeFrom,
&i.ResumeResults,
)
return i, err
}
@@ -40,7 +40,7 @@ FROM step_executions WHERE id = $1 FOR UPDATE;
-- name: FinishStepExecution :execrows
UPDATE step_executions
SET status = $1, detail = $2, tokens_used = $3, finished_at = now()
SET status = $1, detail = $2, tokens_used = $3, results = $6, finished_at = now()
WHERE id = $4 AND status = $5;
-- name: CancelAttemptSteps :many
-- The half of CancelExecution that cancels the current attempt's
@@ -87,3 +87,14 @@ ORDER BY attempt, id;
SELECT id, called_execution_id FROM step_executions
WHERE execution_id = $1 AND attempt = $2
AND kind = 'call' AND status IN ('pending', 'running') AND called_execution_id <> 0;
-- name: LatestStageResults :one
-- The most recent finished run of a root stage, across attempts: a resumed
-- attempt skips the stages before its resume point, so the last attempt that
-- ran this stage may be an earlier one. NULL results mean that run did not
-- move past the stage.
SELECT status, results FROM step_executions
WHERE execution_id = $1 AND depth = 0 AND kind = 'stage' AND name = $2
AND status IN ('succeeded', 'failed')
ORDER BY attempt DESC, id DESC
LIMIT 1;
@@ -155,7 +155,7 @@ RETURNING *;
-- A remediation must continue the branch its pull request lives on, so it
-- records that dispatch mode explicitly (taskstate.RetryContinuePushedWork)
-- rather than leaving prepareWorkspace to infer it from the workflow.
UPDATE tasks SET status = 'queued', workflow = 'remediate', park_reason = '', park_class = 'needs_human', review_payload = $2, retry_mode = 'continue_pushed_work', updated_at = now()
UPDATE tasks SET status = 'queued', workflow = 'remediate', park_reason = '', park_class = 'needs_human', review_payload = $2, retry_mode = 'continue_pushed_work', resume_from = '', resume_results = '{}', updated_at = now()
WHERE id = $1 AND status = 'pr_open';
-- name: UpdateReviewPayloadTask :execrows
@@ -176,6 +176,7 @@ WHERE id = @id AND status = @from_status;
UPDATE tasks SET status = 'queued', retry_count = retry_count + 1,
workflow = CASE WHEN @workflow::text = '' THEN workflow ELSE @workflow::text END,
retry_mode = @retry_mode::text,
resume_from = @resume_from::text, resume_results = @resume_results::jsonb,
park_reason = '', park_class = 'needs_human', updated_at = now()
WHERE id = @id AND status = @from_status;
@@ -0,0 +1,93 @@
package postgres_test
import (
"encoding/json"
"errors"
"os"
"testing"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgtest"
"github.com/samcharles93/archie-core/internal/taskstate"
)
func TestMain(m *testing.M) { os.Exit(pgtest.Main(m)) }
// A retry that resumes starts from the results its After stage recorded in
// its last run, and is refused when that run did not move past the stage.
func TestRetryTaskResume(t *testing.T) {
cases := []struct {
name string
resume task.Resume
want string
wantErr error
}{
{name: "after a completed stage", resume: task.Resume{From: "check", After: "analyse"}, want: `{"analyse":{"summary":"found it"}}`},
{name: "from the first stage", resume: task.Resume{From: "analyse"}, want: `{}`},
{name: "after a stage that failed", resume: task.Resume{From: "publish", After: "check"}, wantErr: storecontract.ErrResumeIncomplete},
{name: "after a stage that never ran", resume: task.Resume{From: "publish", After: "nowhere"}, wantErr: storecontract.ErrResumeIncomplete},
{name: "plain retry", want: `{}`},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
ctx := t.Context()
db := pgstore.Open(t)
if _, err := db.EnqueueChatTask(ctx, "", "", "resume", "", "tdd", "", nil); err != nil {
t.Fatal(err)
}
run, err := db.ClaimNext(ctx)
if err != nil || run == nil {
t.Fatalf("claim: %v", err)
}
finish := func(name string, to taskstate.StepStatus, results string) {
id, _, err := db.StartStep(ctx, task.StepStart{ExecutionID: run.ID, Attempt: run.Attempt, Kind: task.StepKindStage, Name: name})
if err != nil {
t.Fatal(err)
}
var raw []byte
if results != "" {
raw = []byte(results)
}
if _, err := db.FinishStep(ctx, task.StepFinish{StepID: id, ExecutionID: run.ID, From: taskstate.StepRunning, To: to, Results: raw}); err != nil {
t.Fatal(err)
}
}
finish("analyse", taskstate.StepSucceeded, `{"analyse":{"summary":"found it"}}`)
finish("check", taskstate.StepFailed, "")
if err := db.ParkTask(ctx, run.ID, taskstate.Running, "stage check failed", taskstate.ParkNeedsHuman); err != nil {
t.Fatal(err)
}
err = db.RetryTask(ctx, run.ID, taskstate.Parked, "", string(taskstate.RetryRefreshOntoBase), tc.resume)
if !errors.Is(err, tc.wantErr) {
t.Fatalf("RetryTask error = %v, want %v", err, tc.wantErr)
}
got, err := db.TaskByID(ctx, run.ID)
if err != nil {
t.Fatal(err)
}
if tc.wantErr != nil {
if got.Status != taskstate.Parked {
t.Fatalf("refused retry left the task %s, want parked", got.Status)
}
return
}
if got.ResumeFrom != tc.resume.From || !sameJSON(t, got.ResumeResults, tc.want) {
t.Fatalf("resume = %q %s, want %q %s", got.ResumeFrom, got.ResumeResults, tc.resume.From, tc.want)
}
})
}
}
func sameJSON(t *testing.T, got []byte, want string) bool {
t.Helper()
var a, b any
if json.Unmarshal(got, &a) != nil || json.Unmarshal([]byte(want), &b) != nil {
return false
}
ga, _ := json.Marshal(a)
gb, _ := json.Marshal(b)
return string(ga) == string(gb)
}
@@ -187,6 +187,7 @@ func (s *Store) FinishStep(ctx context.Context, finish task.StepFinish) (events.
n, err := q.FinishStepExecution(ctx, postgresdb.FinishStepExecutionParams{
Status: string(finish.To), Detail: clip(finish.Detail, 4000), TokensUsed: finish.TokensUsed,
ID: finish.StepID, Status_2: string(finish.From),
Results: finish.Results,
})
if err != nil {
return events.Event{}, err
+26 -1
View File
@@ -99,6 +99,8 @@ func taskFromRow(t postgresdb.Task) *workflow.Task {
ParkReason: t.ParkReason,
RetryCount: int(t.RetryCount),
RetryMode: t.RetryMode,
ResumeFrom: t.ResumeFrom,
ResumeResults: t.ResumeResults,
WatchCommentID: t.WatchCommentID,
ReviewCursor: t.ReviewCursor,
Source: t.Source,
@@ -384,14 +386,37 @@ func (s *Store) Requeue(ctx context.Context, taskID int64, fromStatus, wf string
// transaction, under the same table check Requeue applies. retryMode is the
// operator's worktree choice for the next dispatch; the store persists it
// unread so the daemon's prepareWorkspace reads the mode the operator set.
func (s *Store) RetryTask(ctx context.Context, taskID int64, fromStatus, wf, retryMode string) error {
// A resume copies the results recorded after its After stage onto the row, in
// the same transaction, so the attempt starts from what that stage left.
func (s *Store) RetryTask(ctx context.Context, taskID int64, fromStatus, wf, retryMode string, resume task.Resume) error {
return s.requeue(ctx, taskID, fromStatus, wf, "retried "+wf, func(q *postgresdb.Queries) (int64, error) {
results, err := resumeResults(ctx, q, taskID, resume)
if err != nil {
return 0, err
}
return q.RetryTask(ctx, postgresdb.RetryTaskParams{
ID: taskID, Workflow: wf, FromStatus: fromStatus, RetryMode: retryMode,
ResumeFrom: resume.From, ResumeResults: results,
})
})
}
// resumeResults reads the results a resumed attempt starts with: those of the
// After stage's most recent finished run, which must have completed.
func resumeResults(ctx context.Context, q *postgresdb.Queries, taskID int64, resume task.Resume) ([]byte, error) {
if resume.From == "" || resume.After == "" {
return []byte("{}"), nil
}
row, err := q.LatestStageResults(ctx, postgresdb.LatestStageResultsParams{ExecutionID: taskID, Name: resume.After})
if errors.Is(err, pgx.ErrNoRows) || (err == nil && row.Results == nil) {
return nil, fmt.Errorf("%w: %q", storecontract.ErrResumeIncomplete, resume.After)
}
if err != nil {
return nil, err
}
return row.Results, nil
}
// RespondReviewGate records the operator's gate answer and requeues, counting
// re-reviews against the cap under the row lock.
func (s *Store) RespondReviewGate(ctx context.Context, taskID int64, fromStatus, gate string, rereview bool, maxRounds int) error {
+6 -3
View File
@@ -150,7 +150,7 @@ func (c *Client) CancelExecution(ctx context.Context, taskID int64, reason, to s
func (c *Client) FinishStep(ctx context.Context, s task.StepFinish) (events.Event, error) {
r, err := c.client.FinishStep(ctx, &pb.FinishStepRequest{
ExecutionId: s.ExecutionID, StepId: s.StepID,
From: string(s.From), To: string(s.To), Detail: s.Detail, TokensUsed: s.TokensUsed,
From: string(s.From), To: string(s.To), Detail: s.Detail, TokensUsed: s.TokensUsed, Results: s.Results,
})
if err != nil {
return events.Event{}, unmapError(err)
@@ -207,8 +207,11 @@ func (c *Client) ArchiveTask(ctx context.Context, taskID int64, fromStatus strin
return r.EventId, nil
}
func (c *Client) RetryTask(ctx context.Context, taskID int64, fromStatus, wf, retryMode string) error {
_, err := c.client.RetryTask(ctx, &pb.RetryTaskRequest{TaskId: taskID, FromStatus: fromStatus, Workflow: wf, RetryMode: retryMode})
func (c *Client) RetryTask(ctx context.Context, taskID int64, fromStatus, wf, retryMode string, resume task.Resume) error {
_, err := c.client.RetryTask(ctx, &pb.RetryTaskRequest{
TaskId: taskID, FromStatus: fromStatus, Workflow: wf, RetryMode: retryMode,
ResumeFrom: resume.From, ResumeAfter: resume.After,
})
return unmapError(err)
}
+2 -2
View File
@@ -252,7 +252,7 @@ func (s *server) FinishStep(ctx context.Context, r *pb.FinishStepRequest) (*pb.F
event, err := s.deps.Steps.FinishStep(ctx, task.StepFinish{
StepID: r.StepId, ExecutionID: r.ExecutionId,
From: taskstate.StepStatus(r.From), To: taskstate.StepStatus(r.To),
Detail: r.Detail, TokensUsed: r.TokensUsed,
Detail: r.Detail, TokensUsed: r.TokensUsed, Results: r.Results,
})
if err != nil {
return nil, s.logErr("FinishStep", err)
@@ -335,7 +335,7 @@ func (s *server) ArchiveTask(ctx context.Context, r *pb.ArchiveTaskRequest) (*pb
}
func (s *server) RetryTask(ctx context.Context, r *pb.RetryTaskRequest) (*pb.RetryTaskResponse, error) {
if err := s.deps.Tasks.RetryTask(ctx, r.TaskId, r.FromStatus, r.Workflow, r.RetryMode); err != nil {
if err := s.deps.Tasks.RetryTask(ctx, r.TaskId, r.FromStatus, r.Workflow, r.RetryMode, task.Resume{From: r.ResumeFrom, After: r.ResumeAfter}); err != nil {
return nil, s.logErr("RetryTask", err)
}
return &pb.RetryTaskResponse{}, nil
+5 -2
View File
@@ -64,7 +64,8 @@ func taskProto(t *task.Task) *pb.Task { //nolint:dupl // mirror-image field-by-f
Workflow: t.Workflow, Branch: t.Branch, Plan: t.Plan, Notes: t.Notes,
PrNumber: int64(t.PRNumber), TokensUsed: int64(t.TokensUsed), Iterations: int64(t.Iterations),
Attempt: int64(t.Attempt), ParkReason: t.ParkReason, RetryCount: int64(t.RetryCount),
RetryMode: t.RetryMode,
RetryMode: t.RetryMode,
ResumeFrom: t.ResumeFrom, ResumeResults: t.ResumeResults,
WatchCommentId: t.WatchCommentID, Source: t.Source, Identity: t.Identity,
BindingId: t.BindingID, BindingVersion: int64(t.BindingVersion),
InputsJson: inputsJSON(t.Inputs),
@@ -95,7 +96,8 @@ func taskValue(t *pb.Task) *task.Task { //nolint:dupl // see taskProto above
Workflow: t.Workflow, Branch: t.Branch, Plan: t.Plan, Notes: t.Notes,
PRNumber: int(t.PrNumber), TokensUsed: int(t.TokensUsed), Iterations: int(t.Iterations),
Attempt: int(t.Attempt), ParkReason: t.ParkReason, RetryCount: int(t.RetryCount),
RetryMode: t.RetryMode,
RetryMode: t.RetryMode,
ResumeFrom: t.ResumeFrom, ResumeResults: t.ResumeResults,
WatchCommentID: t.WatchCommentId, Source: t.Source, Identity: t.Identity,
BindingID: t.BindingId, BindingVersion: int(t.BindingVersion),
Inputs: inputsValue(t.InputsJson),
@@ -482,6 +484,7 @@ var wireErrors = []struct {
{access.ErrPolicyLockout, codes.FailedPrecondition, access.ErrPolicyLockout.Error()},
{storecontract.ErrIllegalTransition, codes.FailedPrecondition, msgIllegalTransition},
{storecontract.ErrInvalidStep, codes.InvalidArgument, msgInvalidStep},
{storecontract.ErrResumeIncomplete, codes.FailedPrecondition, storecontract.ErrResumeIncomplete.Error()},
{storecontract.ErrBindingOverlap, codes.FailedPrecondition, msgBindingOverlap},
{storecontract.ErrBindingTransition, codes.FailedPrecondition, msgBindingTransition},
{storecontract.ErrSourceSigningStale, codes.FailedPrecondition, msgSourceSigning},
@@ -35,6 +35,7 @@ type actionRequest struct {
Instructions string `json:"instructions,omitempty"`
Findings []string `json:"findings,omitempty"`
RetryMode taskstate.RetryMode `json:"retry_mode,omitempty"`
ResumeFrom string `json:"resume_from,omitempty"`
}
type actorPayload struct {
@@ -120,6 +121,7 @@ func Register(nc *nats.Conn, service taskactions.Service, log *slog.Logger) (fun
Instructions: req.Instructions,
Findings: req.Findings,
RetryMode: req.RetryMode,
ResumeFrom: req.ResumeFrom,
})
natsrpc.Respond(msg, log, "taskactions", actionResponse{
Envelope: natsrpc.NewEnvelope(err),
@@ -153,6 +155,7 @@ func (c Client) ApplyChatTaskAction(ctx context.Context, scope *string, actor ta
Instructions: res.Instructions,
Findings: res.Findings,
RetryMode: res.RetryMode,
ResumeFrom: res.ResumeFrom,
Actor: &actorPayload{
ID: string(actor.Identity),
Kind: string(actor.Kind),
+4 -1
View File
@@ -8,6 +8,7 @@ import (
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/taskactions"
"github.com/samcharles93/archie-core/internal/domain/workflow"
)
type Store struct{ storecontract.TaskStore }
@@ -17,7 +18,9 @@ func (s Store) TaskByID(ctx context.Context, id int64) (*taskactions.Task, error
if err != nil || t == nil {
return nil, err
}
return &taskactions.Task{ID: t.ID, Owner: t.Owner, Repo: t.Repo, Identity: t.Identity, Status: t.Status, ParkReason: t.ParkReason, IssueNumber: t.IssueNumber, RetryCount: t.RetryCount, Attempt: t.Attempt, Branch: t.Branch, RetryMode: t.RetryMode, ForgeBacked: t.IsForgeBacked(), ReviewGate: t.ReviewGate, RereviewRounds: t.RereviewRounds}, nil
// A pinned definition that no longer parses offers no resume points.
stages, _ := workflow.StageNames(t.WorkflowDefinitionYAML)
return &taskactions.Task{ID: t.ID, Owner: t.Owner, Repo: t.Repo, Identity: t.Identity, Status: t.Status, ParkReason: t.ParkReason, IssueNumber: t.IssueNumber, RetryCount: t.RetryCount, Attempt: t.Attempt, Branch: t.Branch, RetryMode: t.RetryMode, ForgeBacked: t.IsForgeBacked(), ReviewGate: t.ReviewGate, RereviewRounds: t.RereviewRounds, Stages: stages}, nil
}
// CancelExecution delegates to the store.
+3 -1
View File
@@ -188,6 +188,8 @@ type taskActionRequest struct {
Findings []string `json:"findings"`
// RetryMode is the worktree mode for a retry; empty means refresh_onto_base.
RetryMode string `json:"retry_mode"`
// ResumeFrom is the step a retry starts at; empty runs every step.
ResumeFrom string `json:"resume_from"`
}
func (s *Server) handleTaskAction(w http.ResponseWriter, r *http.Request) {
@@ -251,7 +253,7 @@ func decodeTaskAction(w http.ResponseWriter, r *http.Request) (taskstate.Action,
http.Error(w, "a re-review needs instructions", http.StatusBadRequest)
return "", taskactions.ActionPayload{}, false
}
return action, taskactions.ActionPayload{Instructions: req.Instructions, Findings: req.Findings, RetryMode: taskstate.RetryMode(req.RetryMode)}, true
return action, taskactions.ActionPayload{Instructions: req.Instructions, Findings: req.Findings, RetryMode: taskstate.RetryMode(req.RetryMode), ResumeFrom: req.ResumeFrom}, true
}
func taskMutation(action taskstate.Action) bool {
+2
View File
@@ -187,6 +187,8 @@ message ApplyOperatorTaskActionRequest {
// already pushed on the task's branch. It is empty for every other action,
// and chat carries no mode syntax -- an empty value means refresh_onto_base.
string retry_mode = 8;
// resume_from is the stage a retry starts at; empty runs every stage.
string resume_from = 9;
}
message ApplyOperatorTaskActionResponse { int64 task_id = 1; string action = 2; string message = 3; }
message SaveSessionResponse {}
+11
View File
@@ -399,6 +399,10 @@ message Task {
// cross the wire for a retry to land on the source the operator chose. The
// empty string reads as refresh_onto_base.
string retry_mode = 41;
// resume_from is the stage the next attempt starts at; empty runs every
// stage. resume_results are the step results (JSON) it starts with.
string resume_from = 42;
bytes resume_results = 43;
}
// Event mirrors internal/events.Event. Data is carried as a JSON object
@@ -646,6 +650,9 @@ message FinishStepRequest {
string to = 4;
string detail = 5;
int64 tokens_used = 6;
// results is the run's step results (JSON, by step id) after a stage the
// run moves past; empty otherwise. A resumed attempt starts from them.
bytes results = 7;
}
message FinishStepResponse {
// event is the transition's stage_finish row, already persisted.
@@ -750,6 +757,10 @@ message RetryTaskRequest {
// retry_mode is the operator's worktree choice (taskstate.RetryMode) the
// requeue persists. Empty reads as refresh_onto_base.
string retry_mode = 4;
// resume_from is the stage the attempt starts at, and resume_after the
// stage before it whose recorded results it starts with (task.Resume).
string resume_from = 5;
string resume_after = 6;
}
message RetryTaskResponse {}
+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-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)))){:root,:host{--shimmer-angle:20deg}*,: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-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--twLine 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-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)))){:root,:host{--shimmer-angle:20deg}*,: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-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--twLine truncated
+21 -21
View File
@@ -1,24 +1,24 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HarnessPage.js","assets/HarnessPage.css"])))=>i.map(i=>d[i]);
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),E=e=>w(e)===`[object Object]`,D=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,O=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,k=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),ne=/\B([A-Z])/g,re=ee(e=>e.replace(ne,`-$1`).toLowerCase()),ie=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),ae=ee(e=>e?`on${ie(e)}`:``),A=(e,t)=>!Object.is(e,t),oe=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},se=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ce=e=>{let t=parseFloat(e);return isNaN(t)?e:t},le=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},ue,de=()=>ue||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},fe=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function pe(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?_e(r):pe(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var me=/;(?![^(]*\))/g,he=/:([^]+)/,ge=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function _e(e){let t={};return e.replace(ge,e=>e.startsWith(`/*`)?``:e).split(me).forEach(e=>{if(e){let n=e.split(he);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function j(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=j(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function ve(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=j(t)),n&&(e.style=pe(n)),e}var ye=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,be=n(ye);ye+``;function xe(e){return!!e||e===``}function Se(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=Ee(e[i],t[i],n);return r}function Ce(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&Ee(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function we(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Ce(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!Ee(e[r],t[r],n))return!1}return String(e)===String(t)}function Te(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function Ee(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Te(e,t,n,Se):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Te(e,t,n,we):String(e)===String(t))))}function De(e,t){return e.findIndex(e=>Ee(e,t))}var Oe=e=>!!(e&&e.__v_isRef===!0),M=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?Oe(e)?M(e.value):JSON.stringify(e,ke,2):String(e),ke=(e,t)=>Oe(t)?ke(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ae(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ae(e))}:b(t)?Ae(t):x(t)&&!p(t)&&!E(t)?String(t):t,Ae=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function je(e){return e==null?`initial`:typeof eLine truncated
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),T=e=>w(e).slice(8,-1),E=e=>w(e)===`[object Object]`,D=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,O=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ee=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},te=/-\w/g,k=ee(e=>e.replace(te,e=>e.slice(1).toUpperCase())),ne=/\B([A-Z])/g,re=ee(e=>e.replace(ne,`-$1`).toLowerCase()),ie=ee(e=>e.charAt(0).toUpperCase()+e.slice(1)),ae=ee(e=>e?`on${ie(e)}`:``),A=(e,t)=>!Object.is(e,t),oe=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},se=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ce=e=>{let t=parseFloat(e);return isNaN(t)?e:t},le=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},ue,de=()=>ue||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},fe=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function pe(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?_e(r):pe(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var me=/;(?![^(]*\))/g,he=/:([^]+)/,ge=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function _e(e){let t={};return e.replace(ge,e=>e.startsWith(`/*`)?``:e).split(me).forEach(e=>{if(e){let n=e.split(he);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function j(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=j(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function ve(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=j(t)),n&&(e.style=pe(n)),e}var ye=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,be=n(ye);ye+``;function xe(e){return!!e||e===``}function Se(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=Ee(e[i],t[i],n);return r}function Ce(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&Ee(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function we(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Ce(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!Ee(e[r],t[r],n))return!1}return String(e)===String(t)}function Te(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function Ee(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Te(e,t,n,Se):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Te(e,t,n,we):String(e)===String(t))))}function De(e,t){return e.findIndex(e=>Ee(e,t))}var Oe=e=>!!(e&&e.__v_isRef===!0),M=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?Oe(e)?M(e.value):JSON.stringify(e,ke,2):String(e),ke=(e,t)=>Oe(t)?ke(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ae(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ae(e))}:b(t)?Ae(t):x(t)&&!p(t)&&!E(t)?String(t):t,Ae=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function je(e){return e==null?`initial`:typeof eLine truncated
`&&(e.tagName===`PRE`||e.tagName===`TEXTAREA`)&&(n=n.slice(1));let{textContent:r}=e;r!==n&&r!==n.replace(/\r\n|\r/g,`
`)&&(pi(e,0)||ri(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!O(a)||a[0]===`.`||t&&!O(a)||u&&u.includes(a)){if(ui(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&Qt(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&ms(x,n,t),h&&cr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Go(()=>{x&&ms(x,n,t),l&&g.enter(e),h&&cr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=ds(d[t]),g=h.type===qo;e?(g&&!u&&t+1<p&&ds(d[t+1]).type===qo&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,pi(r,1)||ri()),n(null,h,r,null,o,s,oi(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&si(f)&&f.data===`]`?a(t.anchor=f):(ri(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(hi(e,t)||ri(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,oi(d),s),r&&(r.vnode.el=t.el,ro(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&si(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var li=new Set([`src`,`srcset`,`href`,`poster`]);function ui(e,t,n){return li.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var di=`data-allow-mismatch`,fi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function pi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(di);)e=e.parentElement;return mi(e&&e.getAttribute(di),t)}function mi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(fi[t])}}function hi(e,t){return pi(e.parentElement,1)||gi(e)||_i(t)}function gi(e){return e.nodeType===1&&mi(e.getAttribute(di),1)}function _i({props:e}){let t=e&&e[di];return typeof t==`string`&&mi(t,1)}var vi=de().requestIdleCallback||(e=>setTimeout(e,1)),yi=de().cancelIdleCallback||(e=>clearTimeout(e)),bi=(e=1e4)=>t=>{let n=vi(t,{timeout:e});return()=>yi(n)};function xi(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Si=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(xi(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Ci=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},wi=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Ti(e,t){if(si(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(si(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Ei=e=>!!e.type.__asyncLoader;function Di(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return L({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Ti(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=vs;if(Xr(e),u)return()=>Oi(u,e);let t=t=>{l=null,Ln(t,e,13,!r)};if(s&&e.suspense||Ts)return p().then(t=>()=>Oi(t,e)).catch(e=>(t(e),()=>r?G(r,{error:e}):null));let a=N(!1),c=N(),d=N(!!i),f,m;return Gi(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&ki(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Oi(u,e);if(c.value&&r)return G(r,{error:c.value});if(n&&!d Line truncated
`))),e[El]=Cl(i);let a=r||i.props&&i.props.type===`number`;Wc(e,t?`change`:`input`,t=>{t.target.composing||e[El](Ol(e.value,n,a))}),(n||a)&&Wc(e,`change`,()=>{e.value=Ol(e.value,n,a)}),t||(Wc(e,`compositionstart`,wl),Wc(e,`compositionend`,Tl),Wc(e,`change`,Tl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Dl];delete e[Dl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[El](Ol(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[El]=Cl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?ce(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Al={deep:!0,created(e,t,n){e[El]=Cl(n),Wc(e,`change`,()=>{let t=e._modelValue,n=Fl(e),r=e.checked,i=e[El];if(p(t)){let e=De(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Il(e,r))})},mounted:jl,beforeUpdate(e,t,n){e[El]=Cl(n),jl(e,t,n)}};function jl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=De(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=Ee(t,Il(e,!0))}e.checked!==i&&(e.checked=i)}var Ml={created(e,{value:t},n){e.checked=Ee(t,n.props.value),e[El]=Cl(n),Wc(e,`change`,()=>{e[El](Fl(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[El]=Cl(r),t!==n&&(e.checked=Ee(t,r.props.value))}},Nl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Wc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?ce(Fl(e)):Fl(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[El](i)}finally{Kn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[El]=Cl(r)},mounted(e,{value:t}){Pl(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[El]=Cl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!mee(t,n[1],n[0]))&&Pl(e,t)}};function mee(e,t,n){if(!n||p(e))return Ee(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Pl(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Fl(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):De(t,o)>-1}else a.selected=t.has(o)}else if(Ee(Fl(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Fl(e){return`_value`in e?e._value:e.value}function Il(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Ll={created(e,t,n){zl(e,t,n,null,`created`)},mounted(e,t,n){zl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){zl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){zl(e,t,n,r,`updated`)}};function Rl(e,t){switch(e){case`SELECT`:return Nl;case`TEXTAREA`:return kl;default:switch(t){case`checkbox`:return Al;case`radio`:return Ml;default:return kl}}}function zl(e,t,n,r,i){let a=Rl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function hee(){kl.getSSRProps=({value:e})=>({value:e}),Ml.getSSRProps=({value:e},t)=>{if(t.props&&Ee(t.props.value,e))return{checked:!0}},Al.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&De(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Ll.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=Rl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var Bl=[`ctrl`,`shift`,`alt`,`meta`],Vl={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Bl.some(n=>e[`${n}Key`]&&!t.includes(n))},Hl=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=Vl[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Ul={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Wl=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=re(n.key);if(t.some(e=>e===r||Ul[e]===r))return e(n)}))},Gl=l({patchProp:nl},nc),Kl,ql=!1;function Jl(){return Kl||=wo(Gl)}function Yl(){return Kl=ql?Kl:To(Gl),ql=!0,Kl}var Xl=((...e)=>{Jl().render(...e)}),Zl=((...e)=>{Yl().hydrate(...e)}),Ql=((...e)=>{let t=Jl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=tu(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,eu(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}),$l Line truncated
`)&&(pi(e,0)||ri(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!O(a)||a[0]===`.`||t&&!O(a)||u&&u.includes(a)){if(ui(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&Qt(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&hs(x,n,t),h&&cr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&Go(()=>{x&&hs(x,n,t),l&&g.enter(e),h&&cr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=fs(d[t]),g=h.type===Jo;e?(g&&!u&&t+1<p&&fs(d[t+1]).type===Jo&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,pi(r,1)||ri()),n(null,h,r,null,o,s,oi(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&si(f)&&f.data===`]`?a(t.anchor=f):(ri(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(hi(e,t)||ri(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,oi(d),s),r&&(r.vnode.el=t.el,ro(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&si(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var li=new Set([`src`,`srcset`,`href`,`poster`]);function ui(e,t,n){return li.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var di=`data-allow-mismatch`,fi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function pi(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(di);)e=e.parentElement;return mi(e&&e.getAttribute(di),t)}function mi(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(fi[t])}}function hi(e,t){return pi(e.parentElement,1)||gi(e)||_i(t)}function gi(e){return e.nodeType===1&&mi(e.getAttribute(di),1)}function _i({props:e}){let t=e&&e[di];return typeof t==`string`&&mi(t,1)}var vi=de().requestIdleCallback||(e=>setTimeout(e,1)),yi=de().cancelIdleCallback||(e=>clearTimeout(e)),bi=(e=1e4)=>t=>{let n=vi(t,{timeout:e});return()=>yi(n)};function xi(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Si=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(xi(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},Ci=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},wi=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Ti(e,t){if(si(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(si(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Ei=e=>!!e.type.__asyncLoader;function Di(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return L({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Ti(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=ys;if(Xr(e),u)return()=>Oi(u,e);let t=t=>{l=null,Ln(t,e,13,!r)};if(s&&e.suspense||Es)return p().then(t=>()=>Oi(t,e)).catch(e=>(t(e),()=>r?G(r,{error:e}):null));let a=N(!1),c=N(),d=N(!!i),f,m;return Gi(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&ki(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Oi(u,e);if(c.value&&r)return G(r,{error:c.value});if(n&&!d Line truncated
`))),e[Dl]=wl(i);let a=r||i.props&&i.props.type===`number`;Gc(e,t?`change`:`input`,t=>{t.target.composing||e[Dl](kl(e.value,n,a))}),(n||a)&&Gc(e,`change`,()=>{e.value=kl(e.value,n,a)}),t||(Gc(e,`compositionstart`,Tl),Gc(e,`compositionend`,El),Gc(e,`change`,El))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Ol];delete e[Ol],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Dl](kl(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Dl]=wl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?ce(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},jl={deep:!0,created(e,t,n){e[Dl]=wl(n),Gc(e,`change`,()=>{let t=e._modelValue,n=Il(e),r=e.checked,i=e[Dl];if(p(t)){let e=De(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Ll(e,r))})},mounted:Ml,beforeUpdate(e,t,n){e[Dl]=wl(n),Ml(e,t,n)}};function Ml(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=De(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=Ee(t,Ll(e,!0))}e.checked!==i&&(e.checked=i)}var Nl={created(e,{value:t},n){e.checked=Ee(t,n.props.value),e[Dl]=wl(n),Gc(e,`change`,()=>{e[Dl](Il(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Dl]=wl(r),t!==n&&(e.checked=Ee(t,r.props.value))}},Pl={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Gc(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?ce(Il(e)):Il(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Dl](i)}finally{Kn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Dl]=wl(r)},mounted(e,{value:t}){Fl(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Dl]=wl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!pee(t,n[1],n[0]))&&Fl(e,t)}};function pee(e,t,n){if(!n||p(e))return Ee(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Fl(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Il(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):De(t,o)>-1}else a.selected=t.has(o)}else if(Ee(Il(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Il(e){return`_value`in e?e._value:e.value}function Ll(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Rl={created(e,t,n){Bl(e,t,n,null,`created`)},mounted(e,t,n){Bl(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){Bl(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){Bl(e,t,n,r,`updated`)}};function zl(e,t){switch(e){case`SELECT`:return Pl;case`TEXTAREA`:return Al;default:switch(t){case`checkbox`:return jl;case`radio`:return Nl;default:return Al}}}function Bl(e,t,n,r,i){let a=zl(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function mee(){Al.getSSRProps=({value:e})=>({value:e}),Nl.getSSRProps=({value:e},t)=>{if(t.props&&Ee(t.props.value,e))return{checked:!0}},jl.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&De(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Rl.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=zl(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var hee=[`ctrl`,`shift`,`alt`,`meta`],Vl={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>hee.some(n=>e[`${n}Key`]&&!t.includes(n))},Hl=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=Vl[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Ul={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Wl=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=re(n.key);if(t.some(e=>e===r||Ul[e]===r))return e(n)}))},Gl=l({patchProp:rl},rc),Kl,ql=!1;function Jl(){return Kl||=wo(Gl)}function Yl(){return Kl=ql?Kl:To(Gl),ql=!0,Kl}var Xl=((...e)=>{Jl().render(...e)}),Zl=((...e)=>{Yl().hydrate(...e)}),Ql=((...e)=>{let t=Jl().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=tu(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,eu(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}), Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Lp;function Rp(e){Lp=e}var zp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Bp(e){let t=e instanceof zp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Vp(e,t){let n=await fetch(e,t);if(Lp?.(n.status===401),!n.ok)throw new zp(await Ip(n),n.status);return n}async function Hp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Pp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Vp(e,s);return a?await c.json():void 0}var Z={health:()=>Hp(`/health/detailed`),services:()=>Hp(`/api/services`),policies:()=>Hp(`/api/access/policies`),putPolicy:e=>Hp(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Hp(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),summary:()=>Hp(`/api/summary`),tasks:()=>Hp(`/api/tasks`),taskMeta:()=>Hp(`/api/task-meta`),task:e=>Hp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Hp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Hp(`/api/tasks/${encodeURIComponent(e)}/changes`+Fp(t)),taskDebug:(e,t)=>Hp(`/api/tasks/${encodeURIComponent(e)}/debug`+Fp(t)),taskAction:(e,t,n)=>Hp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Hp(`/api/setup`),capabilities:()=>Hp(`/api/capabilities`),workflows:()=>Hp(`/api/workflows`),workflowEnabled:(e,t)=>Hp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Hp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Hp(`/api/skills`),channels:()=>Hp(`/api/channels`),curators:()=>Hp(`/api/curators`),channelReload:e=>Hp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Hp(`/api/config`),logs:e=>Hp(`/api/logs`+Fp(e)),taskLogs:(e,t)=>Hp(`/api/tasks/${encodeURIComponent(e)}/logs`+Fp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Hp(`/api/version`),updateSnapshot:()=>Hp(`/api/chat/update`),updateInstall:e=>Hp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Hp(`/api/captures`+Fp({limit:e})),eventTypes:()=>Hp(`/api/event-types`),eventTypeCreate:e=>Hp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Hp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Hp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Hp(`/api/mappings`),mappingCreate:e=>Hp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Hp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Hp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Hp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Hp(`/api/bindings`),bindingCreate:e=>Hp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Hp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Hp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Hp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),harnessBindings:()=>Hp(`/api/harness/bindings`),sources:()=>Hp(`/api/sources`),sourceCreate:e=>Hp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Hp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Hp(`/api/sources/${encodeURIComponent(e)}/approve-unsigned`,{method:`POST`}),sourceSecret:e=>Hp(`/api/sources/${encodeURIComponent(e)}/secret`,{method:`POST`}),chatSessions:()=>Hp(`/api/chat/sessions`),chatMessages:e=>Hp(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>Hp(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>Hp(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>Hp(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:Np(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>Hp(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>Hp(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>Hp(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>Hp(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>Vp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Up(e,t,n=``,r=!1){let i=new EventSource(Mp(n,r));return i.onopen=()=>t(`liLine truncated
`);u=r.pop()||``;for(let e of r){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(im.value=n.session_id),n.type===`delta`&&(o+=n.text,lm.value=lm.value?{...lm.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],lm.value=lm.value?{...lm.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);am.value=[...am.value,{from:`assistant`,text:o,tool_calls:a}],lm.value=null,sm.value=`Ready`,await wm()}catch(e){let t=e;t.name===`AbortError`&&!c?(lm.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},sm.value=`Stopped`):(lm.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?$p(r):void 0,isRetry:i},sm.value=`Error — retry available`)}finally{clearTimeout(l),Sm=null,cm.value=!1}}function vee(){sm.value=`Stopping…`,im.value&&Z.chatCancel(im.value).catch(()=>{}),Cm()}function yee(){Vi(()=>{wm().catch(e=>{sm.value=e.message||`Chat unavailable`})}),Gi(()=>{Cm()})}var bee=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],xee=L({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return X(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(V(),H(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":P(tm),onClick:i[0]||=e=>n(`toggle`)},[W(`span`,{"aria-hidden":`true`,class:j(r(!e.open))},[G(P(Cd),{size:22})],2),W(`span`,{"aria-hidden":`true`,class:j(r(e.open))},[G(P(Qd),{size:22})],2)],8,bee))}});function Im(e){return typeof e==`string`?`'${e}'`:new Cee().serialize(e)}var See=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Lm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[See.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Rm(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Lm[n]?Lm[n]:n+128,s=a<128&&Lm[a]?Lm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Cee=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Rm(e,t):n===`number`&&r===`number`?e-t:Rm(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Rm),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`FloatLine truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(im.value=n.session_id),n.type===`delta`&&(o+=n.text,lm.value=lm.value?{...lm.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],lm.value=lm.value?{...lm.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);am.value=[...am.value,{from:`assistant`,text:o,tool_calls:a}],lm.value=null,sm.value=`Ready`,await wm()}catch(e){let t=e;t.name===`AbortError`&&!c?(lm.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},sm.value=`Stopped`):(lm.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?$p(r):void 0,isRetry:i},sm.value=`Error — retry available`)}finally{clearTimeout(l),Sm=null,cm.value=!1}}function vee(){sm.value=`Stopping…`,im.value&&Z.chatCancel(im.value).catch(()=>{}),Cm()}function yee(){Vi(()=>{wm().catch(e=>{sm.value=e.message||`Chat unavailable`})}),Gi(()=>{Cm()})}var bee=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],xee=L({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return X(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(V(),H(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":P(tm),onClick:i[0]||=e=>n(`toggle`)},[W(`span`,{"aria-hidden":`true`,class:j(r(!e.open))},[G(P(Cd),{size:22})],2),W(`span`,{"aria-hidden":`true`,class:j(r(e.open))},[G(P(Qd),{size:22})],2)],8,bee))}});function Im(e){return typeof e==`string`?`'${e}'`:new Cee().serialize(e)}var See=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Lm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[See.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Rm(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Lm[n]?Lm[n]:n+128,s=a<128&&Lm[a]?Lm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Cee=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Rm(e,t):n===`number`&&r===`number`?e-t:Rm(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Rm),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`FloatLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?zs(t.default({present:o.value})[0],{ref:e=>{let t=gh(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),Pg=L({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=Mh(n.default()),r=e.findIndex(e=>e.type!==Jo);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?J(t,i.props):t,o=ls({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),Fg=[`area`,`img`,`input`],Ig=L({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&Fg.includes(r)?()=>zs(r,t):r===`template`?()=>zs(Pg,t,{default:n.default}):()=>zs(e.as,t,{default:n.default})}});function Lg(){let e=N();return{primitiveElement:e,currentElement:Y(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:gh(e))}}var[Rg,zg]=Um(`CollapsibleRoot`),Bg=L({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=jh(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=_n(r);return zg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Q(),(e,t)=>(V(),U(P(Ig),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:F(()=>[z(e.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Vg=L({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=Rg();i.contentId||=Cg(void 0,`reka-collapsible-content`);let a=N(),{forwardRef:o,currentElement:s}=Q(),c=N(0),l=N(0),u=Y(()=>i.open.value),d=N(u.value),f=N();I(()=>[u.value,a.value?.present],async()=>{await Kn();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=Y(()=>d.value&&i.open.value);return Vi(()=>{requestAnimationFrame(()=>{d.value=!1})}),_h(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(V(),U(P(Ng),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:F(({present:t})=>[G(P(Ig),J(e.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:F(()=>[!P(i).unmountOnHide.value||t?z(e.$slots,`default`,{key:0}):q(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Hg=L({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Q();let n=Rg();return(e,r)=>(V(),U(P(Ig),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:F(()=>[z(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Ug({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Wg({type:e,defaultValue:t,modelValue:n}){return e||Ug({type:e,defaultValue:t,modelValue:n})}function Gg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Kg(e,t){let n=Y(()=>Wg(e)),r=jh(e,`modelValue`,t,{defaultValue:Gg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=zm(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(qm(t,e)){let n=t.findIndex(t=>zm(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:Y(()=>n.value===`single`)}}var[qg,Jg]=Um(`AccordionRoot`),Yg=L({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
`))}return()=>i.value||r.value||o.value?Bs(t.default({present:o.value})[0],{ref:e=>{let t=gh(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),Pg=L({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=Mh(n.default()),r=e.findIndex(e=>e.type!==Yo);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?J(t,i.props):t,o=us({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),Fg=[`area`,`img`,`input`],Ig=L({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&Fg.includes(r)?()=>Bs(r,t):r===`template`?()=>Bs(Pg,t,{default:n.default}):()=>Bs(e.as,t,{default:n.default})}});function Lg(){let e=N();return{primitiveElement:e,currentElement:Y(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:gh(e))}}var[Rg,zg]=Um(`CollapsibleRoot`),Bg=L({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=jh(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=_n(r);return zg({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Q(),(e,t)=>(V(),U(P(Ig),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:F(()=>[z(e.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),Vg=L({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=Rg();i.contentId||=Cg(void 0,`reka-collapsible-content`);let a=N(),{forwardRef:o,currentElement:s}=Q(),c=N(0),l=N(0),u=Y(()=>i.open.value),d=N(u.value),f=N();I(()=>[u.value,a.value?.present],async()=>{await Kn();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=Y(()=>d.value&&i.open.value);return Vi(()=>{requestAnimationFrame(()=>{d.value=!1})}),_h(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(e,t)=>(V(),U(P(Ng),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:F(({present:t})=>[G(P(Ig),J(e.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:t?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:F(()=>[!P(i).unmountOnHide.value||t?z(e.$slots,`default`,{key:0}):q(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Hg=L({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Q();let n=Rg();return(e,r)=>(V(),U(P(Ig),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:F(()=>[z(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Ug({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Wg({type:e,defaultValue:t,modelValue:n}){return e||Ug({type:e,defaultValue:t,modelValue:n})}function Gg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Kg(e,t){let n=Y(()=>Wg(e)),r=jh(e,`modelValue`,t,{defaultValue:Gg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=zm(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(qm(t,e)){let n=t.findIndex(t=>zm(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:Y(()=>n.value===`single`)}}var[qg,Jg]=Um(`AccordionRoot`),Yg=L({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:! Line truncated
- a positive number
- less than the value passed to \`max\` (or ${DS} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`),null)}function MS(e){return AS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${DS}\`.`),DS)}var NS=L({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:DS},getValueLabel:{type:Function,required:!1,default:(e,t)=>AS(e)?`${Math.round(e/t*DS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Q();let i=jh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=jh(n,`max`,r,{passive:n.max===void 0});I(()=>i.value,async e=>{let t=jS(e,n.max);t!==e&&(await Kn(),i.value=t)},{immediate:!0}),I(()=>n.max,e=>{let t=MS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=Y(()=>Km(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return kS({modelValue:i,max:a,progressState:o}),(e,t)=>(V(),U(P(Ig),{"as-child":e.asChild,as:e.as,"aria-valuemax":P(a),"aria-valuemin":0,"aria-valuenow":AS(P(i))?P(i):void 0,"aria-valuetext":e.getValueText?.(P(i),P(a)),"aria-label":e.getValueLabel(P(i),P(a)),role:`progressbar`,"data-state":o.value,"data-value":P(i)??void 0,"data-max":P(a)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),PS=L({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=OS();return Q(),(e,r)=>(V(),U(P(Ig),J(t,{"data-state":P(n).progressState.value,"data-value":P(n).modelValue?.value??void 0,"data-max":P(n).max.value}),{default:F(()=>[z(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),FS=`radio.select`;function IS(e,t,n){Gm(FS,n,{originalEvent:e,value:t})}var LS=L({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=jh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=_n(n),{forwardRef:o,currentElement:s}=Q(),c=tg(s),l=ig(),u=Y(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||IS(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(V(),H(B,null,[G(P(Ig),J({id:e.id,ref:P(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":P(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":P(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:P(a),required:e.required,name:e.name},{...P(l),...e.$attrs},{onClick:Hl(d,[`stop`])}),{default:F(()=>[z(e.$slots,`default`,{checked:P(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),P(c)&&e.name?(V(),U(P(dv),J({key:0,type:`radio`,tabindex:`-1`,value:P(a),checked:!!P(i),name:e.name,disabled:e.disabled,required:e.required},P(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):q(`v-if`,!0)],64))}}),[RS,zS]=Um(`RadioGroupRoot`),BS=L({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Q(),o=jh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=_n(n),p=Xh(f),m=tg(a);return zS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(V(),U(P(qb),{"as-child":``,orientation:P(l),dir:P(p),loop:P(c)},{default:F(()=>[G(P(Ig),{ref:P(i),role:`radiogroup`,"data-disabled":P(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":P(l),"aria-required":P(d),dir:P(p)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(o)}),P(m)&&P(u)?(V(),U(P(dv),{key:0,required:P(d),disabled:P(s),value:P(o),name:P(u)},null,8,[`required`,`disabled`,`value`,`name`])):q(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Dee,VS]=Um(`RadioGroupItem`),HS=L({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
Defaulting to \`null\`.`),null)}function MS(e){return AS(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${DS}\`.`),DS)}var NS=L({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:DS},getValueLabel:{type:Function,required:!1,default:(e,t)=>AS(e)?`${Math.round(e/t*DS)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;Q();let i=jh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=jh(n,`max`,r,{passive:n.max===void 0});I(()=>i.value,async e=>{let t=jS(e,n.max);t!==e&&(await Kn(),i.value=t)},{immediate:!0}),I(()=>n.max,e=>{let t=MS(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=Y(()=>Km(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return kS({modelValue:i,max:a,progressState:o}),(e,t)=>(V(),U(P(Ig),{"as-child":e.asChild,as:e.as,"aria-valuemax":P(a),"aria-valuemin":0,"aria-valuenow":AS(P(i))?P(i):void 0,"aria-valuetext":e.getValueText?.(P(i),P(a)),"aria-label":e.getValueLabel(P(i),P(a)),role:`progressbar`,"data-state":o.value,"data-value":P(i)??void 0,"data-max":P(a)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),PS=L({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=OS();return Q(),(e,r)=>(V(),U(P(Ig),J(t,{"data-state":P(n).progressState.value,"data-value":P(n).modelValue?.value??void 0,"data-max":P(n).max.value}),{default:F(()=>[z(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),FS=`radio.select`;function IS(e,t,n){Gm(FS,n,{originalEvent:e,value:t})}var LS=L({inheritAttrs:!1,__name:`Radio`,props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:checked`,`select`],setup(e,{emit:t}){let n=e,r=t,i=jh(n,`checked`,r,{passive:n.checked===void 0}),{value:a}=_n(n),{forwardRef:o,currentElement:s}=Q(),c=tg(s),l=ig(),u=Y(()=>n.id&&s.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0);function d(e){n.disabled||IS(e,n.value,e=>{r(`select`,e),!e?.defaultPrevented&&(i.value=!0,c.value&&e.stopPropagation())})}return(e,t)=>(V(),H(B,null,[G(P(Ig),J({id:e.id,ref:P(o),role:`radio`,type:e.as===`button`?`button`:void 0,as:e.as,"aria-checked":P(i)??!1,"aria-label":u.value,"as-child":e.asChild,disabled:e.disabled?``:void 0,"data-state":P(i)?`checked`:`unchecked`,"data-disabled":e.disabled?``:void 0,value:P(a),required:e.required,name:e.name},{...P(l),...e.$attrs},{onClick:Hl(d,[`stop`])}),{default:F(()=>[z(e.$slots,`default`,{checked:P(i)})]),_:3},16,[`id`,`type`,`as`,`aria-checked`,`aria-label`,`as-child`,`disabled`,`data-state`,`data-disabled`,`value`,`required`,`name`]),P(c)&&e.name?(V(),U(P(dv),J({key:0,type:`radio`,tabindex:`-1`,value:P(a),checked:!!P(i),name:e.name,disabled:e.disabled,required:e.required},P(l)),null,16,[`value`,`checked`,`name`,`disabled`,`required`])):q(`v-if`,!0)],64))}}),[RS,zS]=Um(`RadioGroupRoot`),BS=L({__name:`RadioGroupRoot`,props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Q(),o=jh(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{disabled:s,loop:c,orientation:l,name:u,required:d,dir:f}=_n(n),p=Xh(f),m=tg(a);return zS({modelValue:o,changeModelValue:e=>{o.value=e},disabled:s,loop:c,orientation:l,name:u?.value,required:d}),(e,t)=>(V(),U(P(qb),{"as-child":``,orientation:P(l),dir:P(p),loop:P(c)},{default:F(()=>[G(P(Ig),{ref:P(i),role:`radiogroup`,"data-disabled":P(s)?``:void 0,"as-child":e.asChild,as:e.as,"aria-orientation":P(l),"aria-required":P(d),dir:P(p)},{default:F(()=>[z(e.$slots,`default`,{modelValue:P(o)}),P(m)&&P(u)?(V(),U(P(dv),{key:0,required:P(d),disabled:P(s),value:P(o),name:P(u)},null,8,[`required`,`disabled`,`value`,`name`])):q(`v-if`,!0)]),_:3},8,[`data-disabled`,`as-child`,`as`,`aria-orientation`,`aria-required`,`dir`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),[Dee,VS]=Um(`RadioGroupItem`),HS=L({inheritAttrs:!1,__name:`RadioGroupItem`,props:{id:{type:String,required:!1},value:{type:nuLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:IE(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>IE(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=RE(c),u=e+1<n.length?RE(n[e+1]):null;if(l&&u&&zE(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=RE(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>IE(e)),rows:r.map(e=>e.map(e=>IE(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:IE(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:IE(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function RE(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 zE(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var BE={class:`[overflow-wrap:anywhere]`},VE={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},HE={class:`font-mono text-[0.85em]`},UE={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},WE={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},GE={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},KE={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},qE={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},JE={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},YE={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},XE={key:8,class:`mb-2.5 last:mb-0`},ZE=L({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>LE(t.text));return(e,t)=>(V(),H(`div`,BE,[(V(!0),H(B,null,R(n.value,(e,t)=>(V(),H(B,{key:t},[e.kind===`pre`?(V(),H(`pre`,VE,[W(`code`,HE,M(e.code),1)])):e.kind===`table`?(V(),H(`table`,UE,[W(`thead`,null,[W(`tr`,null,[(V(!0),H(B,null,R(e.head,(e,t)=>(V(),H(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[G(PE,{inline:e},null,8,[`inline`])]))),128))])]),W(`tbody`,null,[(V(!0),H(B,null,R(e.rows,(e,t)=>(V(),H(`tr`,{key:t},[(V(!0),H(B,null,R(e,(e,t)=>(V(),H(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[G(PE,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(V(),H(`blockquote`,WE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(V(),H(`h1`,GE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(V(),H(`h2`,KE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(V(),H(`h3`,qE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(V(),H(`ul`,JE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(PE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(V(),H(`ol`,YE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(PE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(V(),H(`p`,XE,[G(PE,{inline:e.inline},null,8,[`inline`])])):q(``,!0)],64))),128))]))}}),QE={class:`truncate`},$E=L({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Qi(`RouterLink`);return V(),U(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:F(()=>[G(P(Qu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),W(`span`,QE,M(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),eD={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},tD={class:`font-semibold text-foreground`},nD={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},rD=L({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>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?(V(),U($E,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(V(),H(`div`,eD,[G(P(Zd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),W(`span`,tD,M(n.value),1),r.value?(V(),H(`code`,nD,M(r.value),1)):q(``,!0),W(`span`,{class:j(P(X)(`text-fg-muted`,i.value&&`text-danger`))},M(a.value),3)]))}}),iD={key:0,class:`mb-2 grid gap-0.5 text-xs`},aD={key:1,class:`mb-2 flex flex-wrap gap-1.5`},oD={key:3,class:`whitespace-pre-wrap`},sD=L({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(V(),H(`div`,{class:j([`flex`,e.assistant?`justify-start`:`justify-end`])},[W(`div`,{class:j(P(X)(`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?(V(),H(`div`,iD,[(V(!0),H(B,null,R(e.tools,(t,n)=>(V(),U(rD,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):q(``,!0),e.media.length?(V(),H(`div`,aD,[(V(!0),H(B,null,R(e.media,(e,t)=>(V(),U(DE,{key:t,attachment:e},null,8,[`attachment`]))),128))])):q(``,!0),e.assistant?(V(),U(ZE,{key:2,text:e.text},null,8,[`text`])):(V(),H(`div`,oD,M(e.text),1)),z(t.$slots,`default`)],2)],2))}}),cD={class:`w-full self-center justify-self-center py-6 text-center`},lD={class:`grid gap-2`},uD=[`onClick`],dD=L({__name:`ChatEmptyState`,emits:[`proLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>yM?`${n.slice(0,yM).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var xM=[`title`],SM=L({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>Gj(n.event)),a=Y(()=>bM(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=Y(()=>n.event.at?$A(n.event.at):`—`);return(e,t)=>(V(),U(P(gM),{class:j(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:[Wl(Hl(o,[`prevent`]),[`enter`]),Wl(Hl(o,[`prevent`]),[`space`])]},{default:F(()=>[G(P(hM),{class:`font-medium`},{default:F(()=>[K(M(n.event.kind||n.event.type||`event`),1)]),_:1}),G(P(hM),{class:`font-mono`},{default:F(()=>[K(M(i.value>0?`#${i.value}`:`—`),1)]),_:1}),G(P(hM),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},M(a.value.text),9,xM)]),_:1}),G(P(hM),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),CM=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function wM(e){return(Number(e?.task_id)||0)>0}function TM(e,t){return t===`tasks`?wM(e):t!==`system`||!wM(e)}function EM(e,t){return e.filter(e=>TM(e,t))}function DM(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function OM(e,t){return`${e}:${t??0}`}function kM(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=OM(bM(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var AM={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},jM={class:`max-h-[28rem] overflow-y-auto`},MM=[`aria-expanded`,`aria-label`,`onClick`],NM=[`title`],PM=L({__name:`LiveActivityCard`,setup(e){let t=ND(),{activity:n,streamKind:r,streamState:i}=Lu(nA()),a=N(`all`),o=Y(()=>EM(n.value,a.value)),s=Y(()=>DM(o.value.length,a.value)),c=qt(new Set),l=Y(()=>kM(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 bM(e.representative)}function p(e){return e.representative.at?$A(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(V(),U(P(KA),null,{default:F(()=>[G(P(ZA),null,{default:F(()=>[G(P(QA),null,{default:F(()=>[...t[1]||=[K(`Live activity`,-1)]]),_:1}),G(P(qA),{class:`flex items-center gap-2`},{default:F(()=>[G(P(dM),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:P(CM)},null,8,[`modelValue`,`options`]),G(P(UA),{variant:P(r)},{default:F(()=>[K(M(P(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),G(P(JA),null,{default:F(()=>[W(`div`,AM,[W(`div`,jM,[G(P(pM),null,{default:F(()=>[G(P(vM),{class:`sticky top-0 z-10 bg-card`},{default:F(()=>[G(P(gM),null,{default:F(()=>[G(P(_M),null,{default:F(()=>[...t[2]||=[K(`Event`,-1)]]),_:1}),G(P(_M),null,{default:F(()=>[...t[3]||=[K(`Task`,-1)]]),_:1}),G(P(_M),null,{default:F(()=>[...t[4]||=[K(`Detail`,-1)]]),_:1}),G(P(_M),null,{default:F(()=>[...t[5]||=[K(`When`,-1)]]),_:1})]),_:1})]),_:1}),G(P(mM),null,{default:F(()=>[o.value.length?q(``,!0):(V(),U(P(gM),{key:0},{default:F(()=>[G(P(hM),{colspan:`4`},{default:F(()=>[G(P(FA),null,{default:F(()=>[G(P(RA),null,{default:F(()=>[G(P(VA),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(V(!0),H(B,{key:1},R(l.value,e=>(V(),H(B,{key:e.key},[e.count===1?(V(),U(SM,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(V(),H(B,{key:1},[G(P(gM),{class:j(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:[Wl(Hl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Wl(Hl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:F(()=>[G(P(hM),{class:`font-medium`},{default:F(()=>[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:Hl(t=>u(e.key),[`stop`])},[d(e)?(V(),U(P(id),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(V(),U(P(ad),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),K(` `+M(e.label)+` `,1),G(P(UA),{variant:`idle`},{default:F(()=>[K(`×`+M(e.count),1)]),_:2},1024)],8,MM)]),_:2},1024),G(P(hM),{class:`font-mono`},{default:F(()=>[K(M(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),G(P(hM),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},M(f(e).text),9,NM)]),_:2},1024),G(P(hM),null,{default:F(()=>[K(M(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(V(!0),H(B,{key:0},R(e.events,(t,n)=>(V(),U(SM,{key:`${e.key}:${n}`,ev 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 eP(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 tP(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 nP(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 rP(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 iP=N([]),aP=N([]),oP=N(!0),sP=N(null),cP=N(null),lP=N(!1),uP=N(null);async function dP(){try{let e=await Z.eventTypes();oP.value=e.enabled!==!1,iP.value=e.event_types||[],aP.value=e.proposals||[],sP.value=null}catch(e){sP.value=e.message||String(e)}}function fP(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function pP(e){uP.value=null,cP.value=e}function mP(e){let t=SP.value.find(t=>String(t.id)===e.sample_id);pP({mode:`proposal`,id:null,source:e.source,name:``,rule:fP(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function hP(e=``){pP({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function gP(e){pP({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:fP(e.rule),headersText:``,body:``,exampleHeaders:{}})}function _P(){cP.value=null}async function vP(){let e=cP.value;if(e){lP.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:rP(e.rule)});else{let t=e.mode===`paste`?$N(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:rP(e.rule),example:{headers:t,body:e.body}})}cP.value=null,await dP()}catch(e){uP.value=e.message||String(e)}finally{lP.value=!1}}}var yP=N(null);async function bP(){let e=yP.value;if(yP.value=null,e)try{await Z.eventTypeDelete(e.id),await dP()}catch(e){sP.value=e.message||String(e)}}var xP=100,SP=N([]),CP=N(!0),wP=N(null),TP=N(!0),EP=N(null);async function DP(){try{let e=await Z.captures(xP);CP.value=e.enabled!==!1,SP.value=e.captures||[],wP.value=null}catch(e){wP.value=e.message||String(e)}finally{TP.value=!1}}function OP(e){let t=SP.value.find(t=>t.id===e);return t&&(EP.value=t),!!t}function kP(){SP.value.length&&(EP.value=SP.value[0])}function AP(){rA(`captures`,()=>{DP(),dP()})}var jP=`archie.theme`,MP=`archie.density`,NP=`archie.motion`,PP=`archie.tooltips`;function FP(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function IP(e,t){try{localStorage.setItem(e,t)}catch{}}function LP(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var RP=Iu(`appearance`,()=>{let e=N(FP(jP,[`system`,`dark`,`light`],`dark`)),t=N(FP(MP,[`comfortable`,`compact`],`comfortable`)),n=N(FP(NP,[`system`,`reduced`],`system`)),r=N(FP(PP,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=LP(e.value)}function o(t){e.value=t,a(),IP(jP,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,IP(MP,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,IP(NP,e)}function l(e){r.value=e,IP(PP,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),zP=L({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=rg(n,t),{tooltipsEnabled:i}=Lu(RP());return(e,t)=>(V(),U(P(iw),J({"data-slot":`tooltip`},P(r),{disabled:n.disabled||!P(i)}),{default:F(t=>[z(e.$slots,`default`,ve(cs(t)))]),_:3},16,[`disabled`]))}}),BP=L({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=rg(ww(n,`class`),r);return(e,t)=>(V(),U(P(cw),null,{default:F( Line truncated
`)}),t}function RE(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 zE(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var BE={class:`[overflow-wrap:anywhere]`},VE={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},HE={class:`font-mono text-[0.85em]`},UE={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},WE={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},GE={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},KE={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},qE={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},JE={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},YE={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},XE={key:8,class:`mb-2.5 last:mb-0`},ZE=L({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>LE(t.text));return(e,t)=>(V(),H(`div`,BE,[(V(!0),H(B,null,R(n.value,(e,t)=>(V(),H(B,{key:t},[e.kind===`pre`?(V(),H(`pre`,VE,[W(`code`,HE,M(e.code),1)])):e.kind===`table`?(V(),H(`table`,UE,[W(`thead`,null,[W(`tr`,null,[(V(!0),H(B,null,R(e.head,(e,t)=>(V(),H(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[G(PE,{inline:e},null,8,[`inline`])]))),128))])]),W(`tbody`,null,[(V(!0),H(B,null,R(e.rows,(e,t)=>(V(),H(`tr`,{key:t},[(V(!0),H(B,null,R(e,(e,t)=>(V(),H(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[G(PE,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(V(),H(`blockquote`,WE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(V(),H(`h1`,GE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(V(),H(`h2`,KE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(V(),H(`h3`,qE,[G(PE,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(V(),H(`ul`,JE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(PE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(V(),H(`ol`,YE,[(V(!0),H(B,null,R(e.items,(e,t)=>(V(),H(`li`,{key:t},[G(PE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(V(),H(`p`,XE,[G(PE,{inline:e.inline},null,8,[`inline`])])):q(``,!0)],64))),128))]))}}),QE={class:`truncate`},$E=L({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Qi(`RouterLink`);return V(),U(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:F(()=>[G(P(Qu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),W(`span`,QE,M(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),eD={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},tD={class:`font-semibold text-foreground`},nD={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},rD=L({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>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?(V(),U($E,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(V(),H(`div`,eD,[G(P(Zd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),W(`span`,tD,M(n.value),1),r.value?(V(),H(`code`,nD,M(r.value),1)):q(``,!0),W(`span`,{class:j(P(X)(`text-fg-muted`,i.value&&`text-danger`))},M(a.value),3)]))}}),iD={key:0,class:`mb-2 grid gap-0.5 text-xs`},aD={key:1,class:`mb-2 flex flex-wrap gap-1.5`},oD={key:3,class:`whitespace-pre-wrap`},sD=L({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(V(),H(`div`,{class:j([`flex`,e.assistant?`justify-start`:`justify-end`])},[W(`div`,{class:j(P(X)(`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?(V(),H(`div`,iD,[(V(!0),H(B,null,R(e.tools,(t,n)=>(V(),U(rD,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):q(``,!0),e.media.length?(V(),H(`div`,aD,[(V(!0),H(B,null,R(e.media,(e,t)=>(V(),U(DE,{key:t,attachment:e},null,8,[`attachment`]))),128))])):q(``,!0),e.assistant?(V(),U(ZE,{key:2,text:e.text},null,8,[`text`])):(V(),H(`div`,oD,M(e.text),1)),z(t.$slots,`default`)],2)],2))}}),cD={class:`w-full self-center justify-self-center py-6 text-center`},lD={class:`grid gap-2`},uD=[`onClick`],dD=L({__name:`ChatEmptyState`,emits:[`proLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>yM?`${n.slice(0,yM).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var xM=[`title`],SM=L({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>Gj(n.event)),a=Y(()=>bM(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=Y(()=>n.event.at?$A(n.event.at):`—`);return(e,t)=>(V(),U(P(gM),{class:j(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:[Wl(Hl(o,[`prevent`]),[`enter`]),Wl(Hl(o,[`prevent`]),[`space`])]},{default:F(()=>[G(P(hM),{class:`font-medium`},{default:F(()=>[K(M(n.event.kind||n.event.type||`event`),1)]),_:1}),G(P(hM),{class:`font-mono`},{default:F(()=>[K(M(i.value>0?`#${i.value}`:`—`),1)]),_:1}),G(P(hM),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},M(a.value.text),9,xM)]),_:1}),G(P(hM),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),CM=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function wM(e){return(Number(e?.task_id)||0)>0}function TM(e,t){return t===`tasks`?wM(e):t!==`system`||!wM(e)}function EM(e,t){return e.filter(e=>TM(e,t))}function DM(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function OM(e,t){return`${e}:${t??0}`}function kM(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=OM(bM(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var AM={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},jM={class:`max-h-[28rem] overflow-y-auto`},MM=[`aria-expanded`,`aria-label`,`onClick`],NM=[`title`],PM=L({__name:`LiveActivityCard`,setup(e){let t=ND(),{activity:n,streamKind:r,streamState:i}=Lu(nA()),a=N(`all`),o=Y(()=>EM(n.value,a.value)),s=Y(()=>DM(o.value.length,a.value)),c=qt(new Set),l=Y(()=>kM(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 bM(e.representative)}function p(e){return e.representative.at?$A(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(V(),U(P(KA),null,{default:F(()=>[G(P(ZA),null,{default:F(()=>[G(P(QA),null,{default:F(()=>[...t[1]||=[K(`Live activity`,-1)]]),_:1}),G(P(qA),{class:`flex items-center gap-2`},{default:F(()=>[G(P(dM),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:P(CM)},null,8,[`modelValue`,`options`]),G(P(UA),{variant:P(r)},{default:F(()=>[K(M(P(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),G(P(JA),null,{default:F(()=>[W(`div`,AM,[W(`div`,jM,[G(P(pM),null,{default:F(()=>[G(P(vM),{class:`sticky top-0 z-10 bg-card`},{default:F(()=>[G(P(gM),null,{default:F(()=>[G(P(_M),null,{default:F(()=>[...t[2]||=[K(`Event`,-1)]]),_:1}),G(P(_M),null,{default:F(()=>[...t[3]||=[K(`Task`,-1)]]),_:1}),G(P(_M),null,{default:F(()=>[...t[4]||=[K(`Detail`,-1)]]),_:1}),G(P(_M),null,{default:F(()=>[...t[5]||=[K(`When`,-1)]]),_:1})]),_:1})]),_:1}),G(P(mM),null,{default:F(()=>[o.value.length?q(``,!0):(V(),U(P(gM),{key:0},{default:F(()=>[G(P(hM),{colspan:`4`},{default:F(()=>[G(P(FA),null,{default:F(()=>[G(P(RA),null,{default:F(()=>[G(P(VA),null,{default:F(()=>[K(M(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(V(!0),H(B,{key:1},R(l.value,e=>(V(),H(B,{key:e.key},[e.count===1?(V(),U(SM,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(V(),H(B,{key:1},[G(P(gM),{class:j(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:[Wl(Hl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),Wl(Hl(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:F(()=>[G(P(hM),{class:`font-medium`},{default:F(()=>[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:Hl(t=>u(e.key),[`stop`])},[d(e)?(V(),U(P(id),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(V(),U(P(ad),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),K(` `+M(e.label)+` `,1),G(P(UA),{variant:`idle`},{default:F(()=>[K(`×`+M(e.count),1)]),_:2},1024)],8,MM)]),_:2},1024),G(P(hM),{class:`font-mono`},{default:F(()=>[K(M(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),G(P(hM),{class:`w-[55%] max-w-0`},{default:F(()=>[W(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},M(f(e).text),9,NM)]),_:2},1024),G(P(hM),null,{default:F(()=>[K(M(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(V(!0),H(B,{key:0},R(e.events,(t,n)=>(V(),U(SM,{key:`${e.key}:${n}`,ev 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 eP(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 tP(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 nP(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 rP(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 iP=N([]),aP=N([]),oP=N(!0),sP=N(null),cP=N(null),lP=N(!1),uP=N(null);async function dP(){try{let e=await Z.eventTypes();oP.value=e.enabled!==!1,iP.value=e.event_types||[],aP.value=e.proposals||[],sP.value=null}catch(e){sP.value=e.message||String(e)}}function fP(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function pP(e){uP.value=null,cP.value=e}function mP(e){let t=SP.value.find(t=>String(t.id)===e.sample_id);pP({mode:`proposal`,id:null,source:e.source,name:``,rule:fP(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function hP(e=``){pP({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function gP(e){pP({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:fP(e.rule),headersText:``,body:``,exampleHeaders:{}})}function _P(){cP.value=null}async function vP(){let e=cP.value;if(e){lP.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:rP(e.rule)});else{let t=e.mode===`paste`?$N(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:rP(e.rule),example:{headers:t,body:e.body}})}cP.value=null,await dP()}catch(e){uP.value=e.message||String(e)}finally{lP.value=!1}}}var yP=N(null);async function bP(){let e=yP.value;if(yP.value=null,e)try{await Z.eventTypeDelete(e.id),await dP()}catch(e){sP.value=e.message||String(e)}}var xP=100,SP=N([]),CP=N(!0),wP=N(null),TP=N(!0),EP=N(null);async function DP(){try{let e=await Z.captures(xP);CP.value=e.enabled!==!1,SP.value=e.captures||[],wP.value=null}catch(e){wP.value=e.message||String(e)}finally{TP.value=!1}}function OP(e){let t=SP.value.find(t=>t.id===e);return t&&(EP.value=t),!!t}function kP(){SP.value.length&&(EP.value=SP.value[0])}function AP(){rA(`captures`,()=>{DP(),dP()})}var jP=`archie.theme`,MP=`archie.density`,NP=`archie.motion`,PP=`archie.tooltips`;function FP(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function IP(e,t){try{localStorage.setItem(e,t)}catch{}}function LP(e){if(e!==`system`)return e;try{return matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}catch{return`dark`}}var RP=Iu(`appearance`,()=>{let e=N(FP(jP,[`system`,`dark`,`light`],`dark`)),t=N(FP(MP,[`comfortable`,`compact`],`comfortable`)),n=N(FP(NP,[`system`,`reduced`],`system`)),r=N(FP(PP,[`on`,`off`],`on`)===`on`),i=!1;function a(){document.documentElement.dataset.theme=LP(e.value)}function o(t){e.value=t,a(),IP(jP,t)}function s(e){t.value=e,document.documentElement.dataset.density=e,IP(MP,e)}function c(e){n.value=e,document.documentElement.dataset.motion=e,IP(NP,e)}function l(e){r.value=e,IP(PP,e?`on`:`off`)}function u(){if(!i){i=!0,a(),document.documentElement.dataset.density=t.value,document.documentElement.dataset.motion=n.value;try{matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{e.value===`system`&&a()})}catch{}}}return{theme:e,density:t,motion:n,tooltipsEnabled:r,initialize:u,setTheme:o,setDensity:s,setMotion:c,setTooltips:l}}),zP=L({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=rg(n,t),{tooltipsEnabled:i}=Lu(RP());return(e,t)=>(V(),U(P(iw),J({"data-slot":`tooltip`},P(r),{disabled:n.disabled||!P(i)}),{default:F(t=>[z(e.$slots,`default`,ve(ls(t)))]),_:3},16,[`disabled`]))}}),BP=L({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:0},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=rg(ww(n,`class`),r);return(e,t)=>(V(),U(P(cw),null,{default:F( Line truncated
`)}};_J.defaultYaml={explicit:!1,version:`1.2`},_J.defaultTags={"!!":`tag:yaml.org,2002:`};function vJ(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 yJ(e){let t=new Set;return uJ(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function bJ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function xJ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=yJ(e);let a=bJ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(nJ(t.node)||iJ(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 SJ(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=SJ(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=SJ(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=SJ(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=SJ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function CJ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>CJ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!oJ(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 wJ=class{constructor(e){Object.defineProperty(this,Zq,{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(!$q(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=CJ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?SJ(i,{"":o},``,o):o}},TJ=class extends wJ{constructor(e){super(Gq),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=[],uJ(e,{Node:(e,t)=>{(Qq(t)||oJ(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||=(CJ(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=EJ(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(vJ(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 EJ(e,t,n){if(Qq(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(iJ(t)){let r=0;for(let i of t.items){let t=EJ(e,i,n);t>r&&(r=t)}return r}if(tJ(t)){let r=EJ(e,t.key,n),i=EJ(e,t.value,n);return Math.max(r,i)}return 1}var DJ=e=>!e||typeof e!=`function`&&typeof e!=`object`,OJ=class extends wJ{constructor(e){super(Yq),this.value=e}toJSON(e,t){return t?.keep?this.value:CJ(this.value,e,t)}toString(){return String(this.value)}};OJ.BLOCK_FOLDED=`BLOCK_FOLDED`,OJ.BLOCK_LITERAL=`BLOCK_LITERAL`,OJ.PLAIN=`PLAIN`,OJ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,OJ.QUOTE_SINGLE=`QUOTE_SINGLE`;var kJ=`tag:yaml.org,2002:`;function AJ(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 jJ(e,t,n){if($q(e)&&(e=e.contents),aJ(e))return e;if(tJ(e)){let t=n.schema[qq].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 TJ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=kJ+t.slice(2));let l=AJ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new OJ(e);return c&&(c.node=t),t Line truncated
`)?IJ(n,t):n.includes(`
`)?`
@@ -85,16 +85,16 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`?a+=o:o=`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function YX(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`){if(i===`
`){let{fold:t,offset:i}=XX(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Kee[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=XX(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=ZX[i];if(a)n+=a;else if(i===`
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=ZX(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Kee(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`&&(a!==`\r`||e[r+2]!==`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function XX(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
`);)r===`
`&&(n+=`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Kee={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function ZX(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function QX(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?HX(e,t,r):GX(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Yq]:c?$X(e.schema,i,c,n,r):t.type===`scalar`?eZ(e,i,t,r):e.schema[Yq];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=nJ(a)?a:new OJ(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new OJ(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function $X(e,t,n,r,i){if(n===`!`)return e[Yq];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Yq])}function eZ({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Yq];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Yq];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function tZ(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var nZ={composeNode:rZ,composeEmptyNode:iZ};function rZ(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=aZ(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=QX(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=VX(nZ,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=iZ(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!nJ(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function iZ(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=QX(e,{type:`scalar`,offset:tZ(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function aZ({options:e},{offset:t,source:n,end:r},i){let a=new TJ(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=IX(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function oZ(e,t,{offset:n,start:r,value:i,end:a},o){let s=new CX(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=kX(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?rZ(c,i,l,o):iZ(c,l.end,r,null,l,o);let u=s.contents.range[2],d=IX(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function sZ(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function cZ(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var ZX={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Kee(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function QX(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?HX(e,t,r):GX(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Yq]:c?$X(e.schema,i,c,n,r):t.type===`scalar`?eZ(e,i,t,r):e.schema[Yq];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=nJ(a)?a:new OJ(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new OJ(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function $X(e,t,n,r,i){if(n===`!`)return e[Yq];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Yq])}function eZ({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Yq];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Yq];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function tZ(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var nZ={composeNode:rZ,composeEmptyNode:iZ};function rZ(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=aZ(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=QX(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=VX(nZ,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=iZ(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!nJ(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function iZ(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=QX(e,{type:`scalar`,offset:tZ(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function aZ({options:e},{offset:t,source:n,end:r},i){let a=new TJ(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=IX(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function oZ(e,t,{offset:n,start:r,value:i,end:a},o){let s=new CX(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=kX(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?rZ(c,i,l,o):iZ(c,l.end,r,null,l,o);let u=s.contents.range[2],d=IX(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function sZ(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function cZ(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`:`
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var lZ=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=sZ(e);r?this.warnings.push(new DX(i,t,n)):this.errors.push(new EX(i,t,n))},this.directives=new _J({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=cZ(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(iJ(i)&&!i.flow&&i.items.length>0){let e=i.items[0];tJ(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:cZ(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=sZ(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=oZ(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new EX(sZ(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new EX(sZ(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=IX(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new EX(sZ(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new CX(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},uZ=Symbol(`break visit`),dZ=Symbol(`skip children`),fZ=Symbol(`remove item`);function pZ(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),mZ(Object.freeze([]),e,t)}pZ.BREAK=uZ,pZ.SKIP=dZ,pZ.REMOVE=fZ,pZ.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},pZ.parentCollection=(e,t)=>{let n=pZ.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function mZ(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=mZ(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===uZ)return uZ;else r===fZ&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function hZ(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
@@ -122,18 +122,18 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){kZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(wZ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=OZ(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(wZ(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(EZ(t.key)&&!wZ(t.sep,`newline`)){let e=OZ(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):wZ(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!wZ(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){kZ(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||wZ(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.ite Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=OZ(DZ(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=OZ(DZ(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function MZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new CZ||null,prettyErrors:t}}function NZ(e,t={}){let{lineCounter:n,prettyErrors:r}=MZ(t),i=new jZ(n?.addNewLine),a=new lZ(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new EX(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(OX(e,n)),o.warnings.forEach(OX(e,n))),o}function PZ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=NZ(e,n);if(!i)return null;if(i.warnings.forEach(e=>iY(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function FZ(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return $q(e)&&!r?e.toString(n):new CX(e,r,n).toString(n)}function IZ(e,t){let n=new Map;for(let e of t)n.set(e.name,[...n.get(e.name)??[],e]);return{edges:e.edges,nodes:e.nodes.map(e=>{let{stage:t,occurrence:r}=e.data,i=t===void 0?void 0:n.get(t)?.[r??0];return i?{...e,data:{...e.data,run:i}}:e})}}var LZ=140,RZ=280,zZ={"agent.run":`Agent`,"command.run":`Run commands`,"repo.prepare":`Prepare worktree`,"repo.commit":`Commit`,"repo.open-pr":`Open pull request`,"gate.repository":`Repository gate`,"gate.diff-size":`Diff size gate`,"gate.diff-rules":`Diff rules gate`,"forge.comment":`Comment`,"forge.close-issue":`Close issue`,"human.approve":`Human approval`,"workflow.call":`Call workflow`,"workflow.handoff":`Hand off`,"workflow.finish":`Finish`,"review.pr":`Review pull request`,"review.start-round":`Start review round`,"review.reply":`Reply to review`};function BZ(e){return zZ[e]??e}var VZ=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function HZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function UZ(e,t){let n=e=>typeof t[e]==`string`?t[e]:``;switch(e){case`agent.run`:return[n(`role`)||`builder`,t.read_only?`read-only`:n(`gate`)?`gated: ${n(`gate`)}`:``].filter(Boolean).join(` · `);case`repo.commit`:return[n(`message`),t.push?`push`:``].filter(Boolean).join(` · `);case`workflow.call`:case`workflow.handoff`:return n(`workflow`);case`workflow.finish`:return n(`status`)||`completed`;case`human.approve`:return n(`then`)?`then ${n(`then`)}`:``;case`gate.repository`:return n(`expect`)===`test-failure`?`tests must fail`:t.repair?`repair if red`:``}return``}function WZ(e){for(let t of[`mission`,`message`,`body`,`plan`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.replace(/\{\{\s*([^}]+?)\s*\}\}/g,`‹$1›`).split(`
`).find(e=>e.trim())?.trim()}}function GZ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(VZ)].map(e=>e[1]))]}function KZ(e){let t=NZ(e).toJS(),n=HZ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=`start`;r.push({id:s,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let c=[s],l=1,u=new Map,d=e=>{let t=u.get(e)??0;return u.set(e,t+1),t},f=(e,t,n,i,s,c,l)=>{let u=HZ(e)?e:{},f=typeof u.type==`string`?u.type:``,p=HZ(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||BZ(f),type:f,detail:UZ(f,p),summary:WZ(p),when:typeof u.when==`string`?u.when:void 0,retry:HZ(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,...c??{stage:m||f,occurrence:d(m||f)}}}),m&&a.set(m,h);for(let e of GZ(u.settings,u.when))o.push({from:e,to:h});return h},p=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){if(HZ(t)&&HZ(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i={stage:r,occurrence:d(r)},a=[],o=0;n.forEach(([t,r],s)=>{let u=(s-(n.length-1)/2)*RZ,d=c,m=c;(Array.isArray(r)?r:[]).forEach((r,a)=>{let c=f(r,`${e+1}-${t}-${a+1}`,u,(l+a)*LZ,t,i,[`steps`,e,`parallel`,t,a]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],o=Math.max(o,a+1)}),a.push(...d)}),c=a,l+=Math.max(o,1);continue}let n=f(t,String(e+1),0,l*LZ,void 0,void 0,[`steps`,e]);p(c,n,e-1),c=[n],l++}r.push({id:`add-end`,type:`add`,position:{x:104,y:l*LZ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``}}),p(c,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var qZ={agent:td,command:Vd,repo:gd,gate:Rd,forge:wd,human:qd,review:md,workflow:Xd},JZ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function YZ(e){return qZ[e.split(`.`)[0]]??Xd}function XZ(e){return Object.keys(JZ).map(t=>({title:JZ[t],icon:qZ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function ZZ(e,t){let n=NZ(e).getIn(t,!0);if(eJ(n))return n.toJSON()}function QZ(e,t,n){let r=NZ(e);return r.setIn(t,r.createNode(iQ(n))),r.toString()}function $Z(e,t,n){let r=NZ(e),i=r.get(`steps`,!0);if(rJ(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!rJ(i))return{source:e,path:[]};let a=Math.min(Math.max(t+1,0),i.items.length);return i.items.splice(a,0,r.createNode({type:n})),{source:r.toString(),path:[`steps`,a]}}function eQ(e,t){let n=NZ(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!rJ(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return eJ(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function tQ(e,t){let n=NZ(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);rJ(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function nQ(e,t,n){let r=NZ(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!rJ(i)||typeof a!=`number`)return{source:e,path:t};let o=a+n;if(o<0||o>=i.items.length)return{source:e,path:t};let[s]=i.items.splice(a,1);return i.items.splice(o,0,s),{source:r.toString(),path:[...t.slice(0,-1),o]}}function rQ(e,t){let n=NZ(e).toJS(),r=Array.isArray(n?.steps)?n.steps:[],i=typeof t[1]==`number`?t[1]:r.length,a=[],o=e=>{if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id==`string`&&a.push(t.id),typeof t.parallel==`object`&&t.parallel!==null)for(let e of Object.values(t.parallel))Array.isArray(e)&&e.forEach(o)};if(r.slice(0,i).forEach(o),t.length===5){let e=r[i]?.parallel?.[t[3]];Array.isArray(e)&&e.slice(0,t[4]).forEach(o)}return a}function iQ(e){if(Array.isArray(e))return e.map(iQ);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){if(r===void 0||r===``||r===null)continue;let e=iQ(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function aQ(e,t){let n=NZ(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():NZ(e).get(t)}function oQ(e,t,n){let r=NZ(e),i=iQ({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function sQ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function cQ(e,t=[]){let n=NZ(e),r=n.errors[0];if(r)return{ok:!1,message:SQ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!CQ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:vQ(e)}))}var gQ=/^(\s*)(-\s+)?/,_Q=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function vQ(e){let{code:t,comment:n}=yQ(e),r=bQ(t);return n&&r.push({text:n,kind:`comment`}),r}function yQ(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&(t=``);continue}if(r===`"`||r===`'`){t=r;continue}if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function bQ(e){if(!e)return[];let t=[],n=gQ.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=_Q.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...xQ(i[4]??``)]):[...t,...xQ(r)]}function xQ(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function SQ(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function CQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wQ(e){return typeof e==`string`&&e.trim()!==``}var TQ={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},EQ={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},DQ={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},OQ={class:`min-w-0 flex-1`},kQ=[`value`,`placeholder`],AQ={class:`truncate font-mono text-[11px] text-fg-subtle`},jQ={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},MQ={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},NQ={key:1,class:`space-y-1.5`},PQ=[`title`],FQ=[`value`],IQ=[`value`],LQ={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},RQ=[`onClick`],zQ=[`onClick`],BQ={key:2,class:`divide-y divide-border rounded-md border border-border`},VQ=[`title`],HQ=[`value`,`onChange`],UQ=[`value`],WQ=[`value`,`onInput`],GQ=[`value`,`onFocus`,`onInput`],KQ=[`title`],qQ={key:0,class:`text-xs text-danger`},JQ={class:`space-y-2`},YQ={class:`divide-y divide-border rounded-md border border-border`},XQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},ZQ=[`value`],QQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},$Q=[`value`],e$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},t$=[`value`],n$={class:`flex items-center border-t border-border px-4 py-2.5`},r$=L({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>ZZ(n.yaml,n.path)??{}),a=Y(()=>typeof i.value.type==`string`?i.value.type:``),o=Y(()=>n.vocabulary.find(e=>e.name===a.value)),s=Y(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=Y(()=>rQ(n.yaml,n.path)),l=Y(()=>o.value?.settings&&i.value.settings?pQ(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function f(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let p=Y(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:f(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function m(e){let{id:t,type:i,...a}=e;r(`update:yaml`,QZ(n.yaml,n.path,{id:t,type:i,...a}))}function h(e,t){m({...i.value,[e]:t})}function g(e,t){m({...i.value,settings:{...s.value,[e]:t}})}let _=N(null);function v(e,t){let n=_.value??p.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;g(n,r?`${r.trimEnd()} ${i}`:i)}let y=N({});function b(e,t){try{g(e,t.trim()?PZ(t):void 0),y.value={...y.value,[e]:``}}catch(t){y.value={...y.value,[e]:String(t.message).split(`
`)[0]}}}let x=e=>e===void 0?``:FZ(e).trimEnd(),S=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),C=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(V(),H(`aside`,TQ,[W(`header`,EQ,[W(`span`,DQ,[(V(),U(ea(P(YZ)(a.value)),{class:`size-4`}))]),W(`div`,OQ,[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:P(BZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,kQ),W(`div`,AQ,M(a.value),1)]),G(P($),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:F(()=>[G(P(Qd))]),_:1})]),W(`div`,jQ,[l.value?(V(),H(`p`,MQ,M(l.value),1)):q(``,!0),p.value.lead?(V(),H(`section`,NQ,[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[K(M(S(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(V(),U(P(ud),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,PQ),p.value.lead.kind===`select`?(V(),H(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:C(p.value.lead.key),onChange:t[2]||=e=>g(p.value.lead.key,e.target.value||void 0)},[t[12]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(p.value.lead.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,IQ))),128))],40,FQ)):p.value.lead.kind===`text`?(V(),U(P(_T),{key:1,"model-value":C(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])):(V(),U(P(uk),{key:2,"model-value":C(p.value.lead.key),onFocus:t[5]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(V(),H(`div`,LQ,[t[13]||=W(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(V(!0),H(B,null,R(c.value,e=>(V(),H(B,{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=>v(e,`summary`)},M(e),9,RQ),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=>v(e,`result`)},M(e)+`.result`,9,zQ)],64))),128))])):q(``,!0)])):q(``,!0),p.value.compact.length?(V(),H(`section`,BQ,[(V(!0),H(B,null,R(p.value.compact,e=>(V(),H(`div`,{key:e.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:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(ud),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,VQ),e.kind===`boolean`?(V(),U(P(Fk),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>g(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(V(),H(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:C(e.key),onChange:t=>g(e.key,t.target.value||void 0)},[t[14]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(e.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,UQ))),128))],40,HQ)):e.kind===`number`?(V(),H(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>g(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,WQ)):(V(),H(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:C(e.key),onFocus:t=>_.value=e.key,onInput:t=>g(e.key,t.target.value)},null,40,GQ))]))),128))])):q(``,!0),(V(!0),H(B,null,R(p.value.long,e=>(V(),H(`section`,{key:e.key,class:`space-y-1.5`},[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(ud),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,KQ),e.kind===`text`?(V(),U(P(_T),{key:0,"model-value":C(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>_.value=e.key,"onUpdate:modelValue":t=>g(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(V(),U(P(_T),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=OZ(DZ(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=OZ(DZ(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function MZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new CZ||null,prettyErrors:t}}function NZ(e,t={}){let{lineCounter:n,prettyErrors:r}=MZ(t),i=new jZ(n?.addNewLine),a=new lZ(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new EX(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(OX(e,n)),o.warnings.forEach(OX(e,n))),o}function PZ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=NZ(e,n);if(!i)return null;if(i.warnings.forEach(e=>iY(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function FZ(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return $q(e)&&!r?e.toString(n):new CX(e,r,n).toString(n)}function IZ(e,t){let n=new Map;for(let e of t)n.set(e.name,[...n.get(e.name)??[],e]);return{edges:e.edges,nodes:e.nodes.map(e=>{let{stage:t,occurrence:r}=e.data,i=t===void 0?void 0:n.get(t)?.[r??0];return i?{...e,data:{...e.data,run:i}}:e})}}function LZ(e,t){let n=e=>e.path&&e.path.length>=2?Number(e.path[1]):-1,r=e.nodes.find(e=>JSON.stringify(e.data.path)===JSON.stringify(t))?.data;if(!r?.stage)return null;let i=Math.max(-1,...e.nodes.filter(e=>e.data.run).map(e=>n(e.data))),a=n(r);return a<0||a>i?null:{label:a===i?`Resume from here`:`Re-run from here`,from:r.stage}}var RZ=140,zZ=280,BZ={"agent.run":`Agent`,"command.run":`Run commands`,"repo.prepare":`Prepare worktree`,"repo.commit":`Commit`,"repo.open-pr":`Open pull request`,"gate.repository":`Repository gate`,"gate.diff-size":`Diff size gate`,"gate.diff-rules":`Diff rules gate`,"forge.comment":`Comment`,"forge.close-issue":`Close issue`,"human.approve":`Human approval`,"workflow.call":`Call workflow`,"workflow.handoff":`Hand off`,"workflow.finish":`Finish`,"review.pr":`Review pull request`,"review.start-round":`Start review round`,"review.reply":`Reply to review`};function VZ(e){return BZ[e]??e}var HZ=/\{\{\s*steps\.([A-Za-z0-9_-]+)\.[^}]*\}\}/g;function UZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function WZ(e,t){let n=e=>typeof t[e]==`string`?t[e]:``;switch(e){case`agent.run`:return[n(`role`)||`builder`,t.read_only?`read-only`:n(`gate`)?`gated: ${n(`gate`)}`:``].filter(Boolean).join(` · `);case`repo.commit`:return[n(`message`),t.push?`push`:``].filter(Boolean).join(` · `);case`workflow.call`:case`workflow.handoff`:return n(`workflow`);case`workflow.finish`:return n(`status`)||`completed`;case`human.approve`:return n(`then`)?`then ${n(`then`)}`:``;case`gate.repository`:return n(`expect`)===`test-failure`?`tests must fail`:t.repair?`repair if red`:``}return``}function GZ(e){for(let t of[`mission`,`message`,`body`,`plan`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.replace(/\{\{\s*([^}]+?)\s*\}\}/g,`‹$1›`).split(`
`).find(e=>e.trim())?.trim()}}function KZ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(HZ)].map(e=>e[1]))]}function qZ(e){let t=NZ(e).toJS(),n=UZ(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=`start`;r.push({id:s,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let c=[s],l=1,u=new Map,d=e=>{let t=u.get(e)??0;return u.set(e,t+1),t},f=(e,t,n,i,s,c,l)=>{let u=UZ(e)?e:{},f=typeof u.type==`string`?u.type:``,p=UZ(u.settings)?u.settings:{},m=typeof u.id==`string`?u.id:``,h=`step-${t}`;r.push({id:h,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:m||t,title:m||VZ(f),type:f,detail:WZ(f,p),summary:GZ(p),when:typeof u.when==`string`?u.when:void 0,retry:UZ(u.retry)&&typeof u.retry.attempts==`number`?u.retry.attempts:void 0,continues:u.on_failure===`continue`,branch:s,path:l,...c??{stage:m||f,occurrence:d(m||f)}}}),m&&a.set(m,h);for(let e of KZ(u.settings,u.when))o.push({from:e,to:h});return h},p=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){if(UZ(t)&&UZ(t.parallel)){let n=Object.entries(t.parallel),r=typeof t.id==`string`?t.id:`parallel`,i={stage:r,occurrence:d(r)},a=[],o=0;n.forEach(([t,r],s)=>{let u=(s-(n.length-1)/2)*zZ,d=c,m=c;(Array.isArray(r)?r:[]).forEach((r,a)=>{let c=f(r,`${e+1}-${t}-${a+1}`,u,(l+a)*RZ,t,i,[`steps`,e,`parallel`,t,a]);p(d,c,d===m&&s===n.length-1?e-1:void 0),d=[c],o=Math.max(o,a+1)}),a.push(...d)}),c=a,l+=Math.max(o,1);continue}let n=f(t,String(e+1),0,l*RZ,void 0,void 0,[`steps`,e]);p(c,n,e-1),c=[n],l++}r.push({id:`add-end`,type:`add`,position:{x:104,y:l*RZ-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``}}),p(c,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var JZ={agent:td,command:Vd,repo:gd,gate:Rd,forge:wd,human:qd,review:md,workflow:Xd},YZ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function XZ(e){return JZ[e.split(`.`)[0]]??Xd}function ZZ(e){return Object.keys(YZ).map(t=>({title:YZ[t],icon:JZ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}function QZ(e,t){let n=NZ(e).getIn(t,!0);if(eJ(n))return n.toJSON()}function $Z(e,t,n){let r=NZ(e);return r.setIn(t,r.createNode(aQ(n))),r.toString()}function eQ(e,t,n){let r=NZ(e),i=r.get(`steps`,!0);if(rJ(i)||(r.set(`steps`,r.createNode([])),i=r.get(`steps`,!0)),!rJ(i))return{source:e,path:[]};let a=Math.min(Math.max(t+1,0),i.items.length);return i.items.splice(a,0,r.createNode({type:n})),{source:r.toString(),path:[`steps`,a]}}function tQ(e,t){let n=NZ(e),r=n.getIn(t.slice(0,-1),!0),i=t.at(-1);if(!rJ(r)||typeof i!=`number`)return{source:e,path:t};let a=n.createNode(n.getIn(t));return eJ(a)&&a.delete(`id`),r.items.splice(i+1,0,a),{source:n.toString(),path:[...t.slice(0,-1),i+1]}}function nQ(e,t){let n=NZ(e);n.deleteIn(t);let r=t.slice(0,-1);if(r.length>2){let e=n.getIn(r,!0);rJ(e)&&e.items.length===0&&n.deleteIn(r)}return n.toString()}function rQ(e,t,n){let r=NZ(e),i=r.getIn(t.slice(0,-1),!0),a=t.at(-1);if(!rJ(i)||typeof a!=`number`)return{source:e,path:t};let o=a+n;if(o<0||o>=i.items.length)return{source:e,path:t};let[s]=i.items.splice(a,1);return i.items.splice(o,0,s),{source:r.toString(),path:[...t.slice(0,-1),o]}}function iQ(e,t){let n=NZ(e).toJS(),r=Array.isArray(n?.steps)?n.steps:[],i=typeof t[1]==`number`?t[1]:r.length,a=[],o=e=>{if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id==`string`&&a.push(t.id),typeof t.parallel==`object`&&t.parallel!==null)for(let e of Object.values(t.parallel))Array.isArray(e)&&e.forEach(o)};if(r.slice(0,i).forEach(o),t.length===5){let e=r[i]?.parallel?.[t[3]];Array.isArray(e)&&e.slice(0,t[4]).forEach(o)}return a}function aQ(e){if(Array.isArray(e))return e.map(aQ);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e)){if(r===void 0||r===``||r===null)continue;let e=aQ(r);(typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length!==0)&&(t[n]=e)}return t}function oQ(e,t){let n=NZ(e).get(t,!0);return n&&typeof n==`object`&&`toJSON`in n?n.toJSON():NZ(e).get(t)}function sQ(e,t,n){let r=NZ(e),i=aQ({[t]:n})[t];return i===void 0?r.delete(t):r.set(t,r.createNode(i)),r.toString()}function cQ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function lQ(e,t=[]){let n=NZ(e),r=n.errors[0];if(r)return{ok:!1,message:CQ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!wQ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:yQ(e)}))}var _Q=/^(\s*)(-\s+)?/,vQ=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function yQ(e){let{code:t,comment:n}=bQ(e),r=xQ(t);return n&&r.push({text:n,kind:`comment`}),r}function bQ(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&(t=``);continue}if(r===`"`||r===`'`){t=r;continue}if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function xQ(e){if(!e)return[];let t=[],n=_Q.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=vQ.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...SQ(i[4]??``)]):[...t,...SQ(r)]}function SQ(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function CQ(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function wQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function TQ(e){return typeof e==`string`&&e.trim()!==``}var EQ={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},DQ={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},OQ={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},kQ={class:`min-w-0 flex-1`},AQ=[`value`,`placeholder`],jQ={class:`truncate font-mono text-[11px] text-fg-subtle`},MQ={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},NQ={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},PQ={key:1,class:`space-y-1.5`},FQ=[`title`],IQ=[`value`],LQ=[`value`],RQ={key:3,class:`flex flex-wrap items-center gap-1 pt-0.5`},zQ=[`onClick`],BQ=[`onClick`],VQ={key:2,class:`divide-y divide-border rounded-md border border-border`},HQ=[`title`],UQ=[`value`,`onChange`],WQ=[`value`],GQ=[`value`,`onInput`],KQ=[`value`,`onFocus`,`onInput`],qQ=[`title`],JQ={key:0,class:`text-xs text-danger`},YQ={class:`space-y-2`},XQ={class:`divide-y divide-border rounded-md border border-border`},ZQ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},QQ=[`value`],$Q={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},e$=[`value`],t$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},n$=[`value`],r$={class:`flex items-center border-t border-border px-4 py-2.5`},i$=L({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>QZ(n.yaml,n.path)??{}),a=Y(()=>typeof i.value.type==`string`?i.value.type:``),o=Y(()=>n.vocabulary.find(e=>e.name===a.value)),s=Y(()=>typeof i.value.settings==`object`&&i.value.settings!==null?i.value.settings:{}),c=Y(()=>iQ(n.yaml,n.path)),l=Y(()=>o.value?.settings&&i.value.settings?mQ(i.value.settings,o.value.settings,`settings`):``),u=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],d=/mission|body|detail|plan|rules/;function f(e,t){return t.type===`string`?t.enum?`select`:d.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let p=Y(()=>{let e=Object.entries(o.value?.settings?.properties??{}).map(([e,t])=>({key:e,schema:t,kind:f(e,t)})),t=e.filter(e=>u.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>u.indexOf(e.key)-u.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function m(e){let{id:t,type:i,...a}=e;r(`update:yaml`,$Z(n.yaml,n.path,{id:t,type:i,...a}))}function h(e,t){m({...i.value,[e]:t})}function g(e,t){m({...i.value,settings:{...s.value,[e]:t}})}let _=N(null);function v(e,t){let n=_.value??p.value.lead?.key;if(!n)return;let r=typeof s.value[n]==`string`?s.value[n]:``,i=`{{ steps.${e}.${t} }}`;g(n,r?`${r.trimEnd()} ${i}`:i)}let y=N({});function b(e,t){try{g(e,t.trim()?PZ(t):void 0),y.value={...y.value,[e]:``}}catch(t){y.value={...y.value,[e]:String(t.message).split(`
`)[0]}}}let x=e=>e===void 0?``:FZ(e).trimEnd(),S=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),C=e=>typeof s.value[e]==`string`?s.value[e]:``;return(e,t)=>(V(),H(`aside`,EQ,[W(`header`,DQ,[W(`span`,OQ,[(V(),U(ea(P(XZ)(a.value)),{class:`size-4`}))]),W(`div`,kQ,[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:P(VZ)(a.value),"aria-label":`Step id`,onInput:t[0]||=e=>h(`id`,e.target.value)},null,40,AQ),W(`div`,jQ,M(a.value),1)]),G(P($),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:t[1]||=e=>r(`close`)},{default:F(()=>[G(P(Qd))]),_:1})]),W(`div`,MQ,[l.value?(V(),H(`p`,NQ,M(l.value),1)):q(``,!0),p.value.lead?(V(),H(`section`,PQ,[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:p.value.lead.schema.description},[K(M(S(p.value.lead.key,p.value.lead.schema))+` `,1),p.value.lead.schema.description?(V(),U(P(ud),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,FQ),p.value.lead.kind===`select`?(V(),H(`select`,{key:0,class:`h-9 w-full rounded-md border border-input bg-background px-2`,value:C(p.value.lead.key),onChange:t[2]||=e=>g(p.value.lead.key,e.target.value||void 0)},[t[12]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(p.value.lead.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,LQ))),128))],40,IQ)):p.value.lead.kind===`text`?(V(),U(P(_T),{key:1,"model-value":C(p.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:t[3]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[4]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])):(V(),U(P(uk),{key:2,"model-value":C(p.value.lead.key),onFocus:t[5]||=e=>_.value=p.value.lead.key,"onUpdate:modelValue":t[6]||=e=>g(p.value.lead.key,String(e))},null,8,[`model-value`])),c.value.length&&p.value.lead.kind!==`select`?(V(),H(`div`,RQ,[t[13]||=W(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(V(!0),H(B,null,R(c.value,e=>(V(),H(B,{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=>v(e,`summary`)},M(e),9,zQ),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=>v(e,`result`)},M(e)+`.result`,9,BQ)],64))),128))])):q(``,!0)])):q(``,!0),p.value.compact.length?(V(),H(`section`,VQ,[(V(!0),H(B,null,R(p.value.compact,e=>(V(),H(`div`,{key:e.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:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(ud),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,HQ),e.kind===`boolean`?(V(),U(P(Fk),{key:0,"model-value":s.value[e.key]===!0,"onUpdate:modelValue":t=>g(e.key,t||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):e.kind===`select`?(V(),H(`select`,{key:1,class:`h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]`,value:C(e.key),onChange:t=>g(e.key,t.target.value||void 0)},[t[14]||=W(`option`,{value:``},`Default`,-1),(V(!0),H(B,null,R(e.schema.enum,e=>(V(),H(`option`,{key:e,value:e},M(e),9,WQ))),128))],40,UQ)):e.kind===`number`?(V(),H(`input`,{key:2,type:`number`,class:`h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]`,value:s.value[e.key]??``,onInput:t=>g(e.key,t.target.value===``?void 0:Number(t.target.value))},null,40,GQ)):(V(),H(`input`,{key:3,class:`h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]`,value:C(e.key),onFocus:t=>_.value=e.key,onInput:t=>g(e.key,t.target.value)},null,40,KQ))]))),128))])):q(``,!0),(V(!0),H(B,null,R(p.value.long,e=>(V(),H(`section`,{key:e.key,class:`space-y-1.5`},[W(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:e.schema.description},[K(M(S(e.key,e.schema))+` `,1),e.schema.description?(V(),U(P(ud),{key:0,class:`size-3 text-fg-subtle`})):q(``,!0)],8,qQ),e.kind===`text`?(V(),U(P(_T),{key:0,"model-value":C(e.key),class:`min-h-20 text-[13px]`,onFocus:t=>_.value=e.key,"onUpdate:modelValue":t=>g(e.key,String(t))},null,8,[`model-value`,`onFocus`,`onUpdate:modelValue`])):e.kind===`lines`?(V(),U(P(_T),{key:1,"model-value":Array.isArray(s.value[e.key])?s.value[e.key].join(`
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>g(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(V(),H(B,{key:2},[G(P(_T),{"model-value":x(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>b(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),y.value[e.key]?(V(),H(`span`,qQ,M(y.value[e.key]),1)):q(``,!0)],64))]))),128)),W(`section`,JQ,[t[19]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),W(`div`,YQ,[W(`label`,XQ,[t[15]||=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:t[7]||=e=>h(`when`,e.target.value)},null,40,ZQ)]),W(`label`,QQ,[t[17]||=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:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[16]||=[W(`option`,{value:``},`Park the task`,-1),W(`option`,{value:`continue`},`Continue`,-1)]],40,$Q)]),W(`label`,e$,[t[18]||=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:t[9]||=e=>h(`retry`,e.target.value===``?void 0:{...i.value.retry,attempts:Number(e.target.value)})},null,40,t$)])])])]),W(`footer`,n$,[G(P($),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[10]||=e=>r(`remove`)},{default:F(()=>[G(P(Ud)),t[20]||=K(` Delete step`,-1)]),_:1}),G(P($),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[11]||=e=>r(`close`)},{default:F(()=>[...t[21]||=[K(`Done`,-1)]]),_:1})])]))}}),i$={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},a$={class:`flex items-center gap-2 border-b border-border px-4 py-3`},o$={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},s$={class:`space-y-1.5`},c$={class:`grid grid-cols-3 gap-1 rounded-md bg-secondary p-1`},l$=[`title`,`onClick`],u$={class:`flex items-center text-xs font-medium text-muted-foreground`},d$=[`onClick`],f$={key:0,class:`divide-y divide-border rounded-md border border-border`},p$=[`value`,`aria-label`,`onChange`],m$=[`value`,`onChange`],h$=[`value`],g$=[`aria-label`,`onClick`],_$={key:1,class:`text-xs text-fg-subtle`},v$={class:`space-y-1.5`},y$={class:`divide-y divide-border rounded-md border border-border`},b$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},x$=[`value`],S$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},C$=[`value`],w$={class:`space-y-1.5`},T$={class:`flex items-center text-xs font-medium text-muted-foreground`},E$={key:0,class:`divide-y divide-border rounded-md border border-border`},D$={class:`truncate`},O$={key:0,class:`ml-auto truncate text-xs text-fg-subtle`},k$={key:1,class:`text-xs text-fg-subtle`},A$=L({__name:`WorkflowSettings`,props:{yaml:{},triggers:{}},emits:[`update:yaml`,`close`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`],a={inputs:`Takes none. Steps read declared inputs as {{ inputs.name }}.`,outputs:`Writes none. A calling workflow can read declared outputs.`},o=e=>{let t=aQ(n.yaml,e);return typeof t==`string`?t:``},s=e=>Y(()=>Object.entries(aQ(n.yaml,e)??{})),c=s(`inputs`),l=s(`outputs`);function u(e,t){r(`update:yaml`,oQ(n.yaml,e,t))}function d(e,t){u(e,Object.fromEntries(t.filter(([e])=>e)))}function f(e,t,n,r,i){d(e,t.map((e,t)=>t===n?[r,i]:e))}function p(e,t){let n=t.length+1;for(;t.some(([t])=>t===`${e.slice(0,-1)}_${n}`);)n++;d(e,[...t,[`${e.slice(0,-1)}_${n}`,{type:`string`}]])}let m=[{value:`required`,label:`Repository`,hint:`Clones the task's repository`},{value:`optional`,label:`If given`,hint:`Clones one when the run names it`},{value:`none`,label:`None`,hint:`Scratch workspace, no clone`}],h=Y(()=>o(`repository`)||`required`);return(t,n)=>{let s=Qi(`RouterLink`);return V(),H(`aside`,i$,[W(`header`,a$,[n[3]||=W(`div`,{class:`min-w-0 flex-1`},[W(`div`,{class:`text-sm font-medium`},`Workflow settings`),W(`div`,{class:`text-[11px] text-fg-subtle`},`What it takes, where it works, and what starts it`)],-1),G(P($),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:n[0]||=e=>r(`close`)},{default:F(()=>[G(P(Qd))]),_:1})]),W(`div`,o$,[W(`section`,s$,[n[4]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Works on`,-1),W(`div`,c$,[(V(),H(B,null,R(m,e=>W(`button`,{key:e.value,type:`button`,class:j([`rounded px-2 py-1.5 text-[13px] transition-colors`,h.value===e.value?`bg-card shadow-sm`:`text-muted-foreground hover:text-foreground`]),title:e.hint,onClick:t=>u(`repository`,e.value===`required`?void 0:e.value)},M(e.label),11,l$)),64))])]),(V(!0),H(B,null,R([[`inputs`,P(c)],[`outputs`,P(l)]],([e,t])=>(V(),H(`section`,{key:e,class:`space-y-1.5`},[W(`div`,u$,[K(M(e===`inputs`?`Inputs`:`Outputs`)+` `,1),W(`button`,{type:`button`,class:`ml-Line truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(V(),H(B,{key:2},[G(P(_T),{"model-value":x(s.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>b(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),y.value[e.key]?(V(),H(`span`,JQ,M(y.value[e.key]),1)):q(``,!0)],64))]))),128)),W(`section`,YQ,[t[19]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),W(`div`,XQ,[W(`label`,ZQ,[t[15]||=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:t[7]||=e=>h(`when`,e.target.value)},null,40,QQ)]),W(`label`,$Q,[t[17]||=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:t[8]||=e=>h(`on_failure`,e.target.value||void 0)},[...t[16]||=[W(`option`,{value:``},`Park the task`,-1),W(`option`,{value:`continue`},`Continue`,-1)]],40,e$)]),W(`label`,t$,[t[18]||=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:t[9]||=e=>h(`retry`,e.target.value===``?void 0:{...i.value.retry,attempts:Number(e.target.value)})},null,40,n$)])])])]),W(`footer`,r$,[G(P($),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:t[10]||=e=>r(`remove`)},{default:F(()=>[G(P(Ud)),t[20]||=K(` Delete step`,-1)]),_:1}),G(P($),{type:`button`,size:`sm`,class:`ml-auto`,onClick:t[11]||=e=>r(`close`)},{default:F(()=>[...t[21]||=[K(`Done`,-1)]]),_:1})])]))}}),a$={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},o$={class:`flex items-center gap-2 border-b border-border px-4 py-3`},s$={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},c$={class:`space-y-1.5`},l$={class:`grid grid-cols-3 gap-1 rounded-md bg-secondary p-1`},u$=[`title`,`onClick`],d$={class:`flex items-center text-xs font-medium text-muted-foreground`},f$=[`onClick`],p$={key:0,class:`divide-y divide-border rounded-md border border-border`},m$=[`value`,`aria-label`,`onChange`],h$=[`value`,`onChange`],g$=[`value`],_$=[`aria-label`,`onClick`],v$={key:1,class:`text-xs text-fg-subtle`},y$={class:`space-y-1.5`},b$={class:`divide-y divide-border rounded-md border border-border`},x$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},S$=[`value`],C$={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},w$=[`value`],T$={class:`space-y-1.5`},E$={class:`flex items-center text-xs font-medium text-muted-foreground`},D$={key:0,class:`divide-y divide-border rounded-md border border-border`},O$={class:`truncate`},k$={key:0,class:`ml-auto truncate text-xs text-fg-subtle`},A$={key:1,class:`text-xs text-fg-subtle`},j$=L({__name:`WorkflowSettings`,props:{yaml:{},triggers:{}},emits:[`update:yaml`,`close`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`],a={inputs:`Takes none. Steps read declared inputs as {{ inputs.name }}.`,outputs:`Writes none. A calling workflow can read declared outputs.`},o=e=>{let t=oQ(n.yaml,e);return typeof t==`string`?t:``},s=e=>Y(()=>Object.entries(oQ(n.yaml,e)??{})),c=s(`inputs`),l=s(`outputs`);function u(e,t){r(`update:yaml`,sQ(n.yaml,e,t))}function d(e,t){u(e,Object.fromEntries(t.filter(([e])=>e)))}function f(e,t,n,r,i){d(e,t.map((e,t)=>t===n?[r,i]:e))}function p(e,t){let n=t.length+1;for(;t.some(([t])=>t===`${e.slice(0,-1)}_${n}`);)n++;d(e,[...t,[`${e.slice(0,-1)}_${n}`,{type:`string`}]])}let m=[{value:`required`,label:`Repository`,hint:`Clones the task's repository`},{value:`optional`,label:`If given`,hint:`Clones one when the run names it`},{value:`none`,label:`None`,hint:`Scratch workspace, no clone`}],h=Y(()=>o(`repository`)||`required`);return(t,n)=>{let s=Qi(`RouterLink`);return V(),H(`aside`,a$,[W(`header`,o$,[n[3]||=W(`div`,{class:`min-w-0 flex-1`},[W(`div`,{class:`text-sm font-medium`},`Workflow settings`),W(`div`,{class:`text-[11px] text-fg-subtle`},`What it takes, where it works, and what starts it`)],-1),G(P($),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:n[0]||=e=>r(`close`)},{default:F(()=>[G(P(Qd))]),_:1})]),W(`div`,s$,[W(`section`,c$,[n[4]||=W(`div`,{class:`text-xs font-medium text-muted-foreground`},`Works on`,-1),W(`div`,l$,[(V(),H(B,null,R(m,e=>W(`button`,{key:e.value,type:`button`,class:j([`rounded px-2 py-1.5 text-[13px] transition-colors`,h.value===e.value?`bg-card shadow-sm`:`text-muted-foreground hover:text-foreground`]),title:e.hint,onClick:t=>u(`repository`,e.value===`required`?void 0:e.value)},M(e.label),11,u$)),64))])]),(V(!0),H(B,null,R([[`inputs`,P(c)],[`outputs`,P(l)]],([e,t])=>(V(),H(`section`,{key:e,class:`space-y-1.5`},[W(`div`,d$,[K(M(e===`inputs`?`Inputs`:`Outputs`)+` `,1),W(`button`,{type:`button`,class:`ml-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 L8(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=R8(n.code,e);return Array.isArray(e)?e.some(e=>I8(n[r],e,t,n.type===`keyup`)):I8(n[r],e,t,n.type===`keyup`)}}function R8(e,t){return t.includes(e)?`code`:`key`}function z8(e,t){let n=Y(()=>fn(t?.target)??N8),r=cn(fn(e)===!0),i=!1,a=new Set,o=c(fn(e));I(()=>fn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),j1([`blur`,`contextmenu`],s),N1((...e)=>o(...e),e=>{let n=fn(t?.actInsideInputWithModifier)??!0,a=fn(t?.preventDefault)??!1;if(i=F8(e),(!i||i&&!n)&&P8(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}),N1((...e)=>o(...e),e=>{let n=fn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&P8(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=fn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?L8(e,a):e}return r}var B8=`vue-flow__node-desc`,V8=`vue-flow__edge-desc`,H8=`vue-flow__aria-live`,U8=[`Enter`,` `,`Escape`],W8={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function G8(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function K8(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 q8(e){return{width:e.offsetWidth,height:e.offsetHeight}}function J8(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Y8(e,t){return{x:J8(e.x,t[0][0],t[1][0]),y:J8(e.y,t[0][1],t[1][1])}}function X8(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function Z8(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function Q8(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!Z8(e)}function $8(e){return Q8(e)&&`computedPosition`in e}function e5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function t5(e){return e5(e.width)&&e5(e.height)&&e5(e.x)&&e5(e.y)}function n5(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:rn({width:0,height:0}),computedPosition:rn({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:y7(e.data)?e.data:{},events:rn(y7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function r5(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:y7(e.data)?e.data:{},events:rn(y7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function i5(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 a5(...e){if(e.length===3){let[t,n,r]=e;return i5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>Z8(e)&&e.source===r).map(e=>n.find(t=>Q8(t)&&t.id===e.target))}function o5(...e){if(e.length===3){let[t,n,r]=e;return i5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>Z8(e)&&e.target===r).map(e=>n.find(t=>Q8(t)&&t.id===e.source))}function s5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function c5(e,t){return t.some(t=>Z8(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 l5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function u5({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?n7(s,o):s}function d5(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 f5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function p5({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function m5(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=d5(t,f5({...r.computedPosition,...r.dimensions}))}return p5(t)}function h5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...u5(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 R8(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=z8(n.code,e);return Array.isArray(e)?e.some(e=>L8(n[r],e,t,n.type===`keyup`)):L8(n[r],e,t,n.type===`keyup`)}}function z8(e,t){return t.includes(e)?`code`:`key`}function B8(e,t){let n=Y(()=>fn(t?.target)??P8),r=cn(fn(e)===!0),i=!1,a=new Set,o=c(fn(e));I(()=>fn(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),M1([`blur`,`contextmenu`],s),P1((...e)=>o(...e),e=>{let n=fn(t?.actInsideInputWithModifier)??!0,a=fn(t?.preventDefault)??!1;if(i=I8(e),(!i||i&&!n)&&F8(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}),P1((...e)=>o(...e),e=>{let n=fn(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&F8(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=fn(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?R8(e,a):e}return r}var V8=`vue-flow__node-desc`,H8=`vue-flow__edge-desc`,U8=`vue-flow__aria-live`,W8=[`Enter`,` `,`Escape`],G8={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function K8(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function q8(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 J8(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Y8(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function X8(e,t){return{x:Y8(e.x,t[0][0],t[1][0]),y:Y8(e.y,t[0][1],t[1][1])}}function Z8(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function Q8(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function $8(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!Q8(e)}function e5(e){return $8(e)&&`computedPosition`in e}function t5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function n5(e){return t5(e.width)&&t5(e.height)&&t5(e.x)&&t5(e.y)}function r5(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:rn({width:0,height:0}),computedPosition:rn({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:b7(e.data)?e.data:{},events:rn(b7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function i5(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:b7(e.data)?e.data:{},events:rn(b7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function a5(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 o5(...e){if(e.length===3){let[t,n,r]=e;return a5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>Q8(e)&&e.source===r).map(e=>n.find(t=>$8(t)&&t.id===e.target))}function s5(...e){if(e.length===3){let[t,n,r]=e;return a5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>Q8(e)&&e.target===r).map(e=>n.find(t=>$8(t)&&t.id===e.source))}function c5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function l5(e,t){return t.some(t=>Q8(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 u5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function d5({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?r7(s,o):s}function f5(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 p5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function m5({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function h5(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=f5(t,p5({...r.computedPosition,...r.dimensions}))}return m5(t)}function g5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...d5(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}
@@ -153,4 +153,4 @@ Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},X5=class extends Error{constructor(e,...t){super(Y5[e]?.call(Y5,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function Z5(e){return`clientX`in e}function Q5(e){return`sourceEvent`in e}function $5(e,t){let n=Z5(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 e7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function t7(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function n7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var r7=()=>!0;function i7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function a7(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())K8(i,G8(e))>0&&r.push(e);return r}var o7=250;function s7(e,t,n,r){let i=[],a=1/0,o=a7(e,n,t+o7);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}=W5(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 c7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=r7},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:_}=$5(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=l7(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===O8.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=f7(t,e,a,p,n,!0)}return b}function l7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function u7(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function d7(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function f7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===O8.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,...W5(o,c,c.position,!0)}:c}var p7={[T8.Left]:T8.Right,[T8.Right]:T8.Left,[T8.Top]:T8.Bottom,[T8.Bottom]:T8.Top},m7=[`production`,`prod`];function h7(e,...t){g7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function g7(){return!m7.includes(`production`)}function _7(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,...q8(t)}}):null}function v7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),Kn(()=>{o.blur()})):n([e])}function y7(e){return P(e)!==void 0}function b7(e,t,n,r){if(!e||!e.source||!e.target)return n(new X5(J5.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=Z8(e)?e:{...e,id:s5(e)},i=r5(i,void 0,r),!c5(i,t)&&i}function x7(e,t,n,r,i){if(!t.source||!t.target)return i(new X5(J5.EDGE_INVALID,e.id)),!1;if(!n)return i(new X5(J5.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?s5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function S7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!Q8(o)){n(new X5(J5.NODE_INVALID,o?.id));continue}let s=n5(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 X5(J5.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 C7(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 w7(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}`;C7(`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`},Z5=class extends Error{constructor(e,...t){super(X5[e]?.call(X5,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function Q5(e){return`clientX`in e}function $5(e){return`sourceEvent`in e}function e7(e,t){let n=Q5(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 t7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function n7(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function r7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var i7=()=>!0;function a7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function o7(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())q8(i,K8(e))>0&&r.push(e);return r}var s7=250;function c7(e,t,n,r){let i=[],a=1/0,o=o7(e,n,t+s7);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}=G5(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 l7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=i7},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:_}=e7(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=u7(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===k8.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=p7(t,e,a,p,n,!0)}return b}function u7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function d7(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function f7(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function p7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===k8.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,...G5(o,c,c.position,!0)}:c}var m7={[E8.Left]:E8.Right,[E8.Right]:E8.Left,[E8.Top]:E8.Bottom,[E8.Bottom]:E8.Top},h7=[`production`,`prod`];function g7(e,...t){_7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function _7(){return!h7.includes(`production`)}function v7(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,...J8(t)}}):null}function y7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),Kn(()=>{o.blur()})):n([e])}function b7(e){return P(e)!==void 0}function x7(e,t,n,r){if(!e||!e.source||!e.target)return n(new Z5(Y5.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=Q8(e)?e:{...e,id:c5(e)},i=i5(i,void 0,r),!l5(i,t)&&i}function S7(e,t,n,r,i){if(!t.source||!t.target)return i(new Z5(Y5.EDGE_INVALID,e.id)),!1;if(!n)return i(new Z5(Y5.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?c5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function C7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!$8(o)){n(new Z5(Y5.NODE_INVALID,o?.id));continue}let s=r5(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 Z5(Y5.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 w7(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 T7(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}`;w7(`source`,o,`${r}-${a}--Line truncated
+3 -1
View File
@@ -159,7 +159,8 @@ export const api = {
// taskAction posts an operator action. A review-gate answer may carry a
// payload: the instructions a rereview requires, and the finding keys an
// approve posts (an absent selection means every offered finding). A retry
// carries the worktree mode the operator chose. Every other action sends
// carries the worktree mode the operator chose, and may name the step it
// resumes from. Every other action sends
// none.
taskAction: <T = unknown>(
id: string,
@@ -168,6 +169,7 @@ export const api = {
instructions?: string;
findings?: string[];
retry_mode?: string;
resume_from?: string;
},
) =>
request<T>(`/api/tasks/${encodeURIComponent(id)}/action`, {
+10 -2
View File
@@ -3,7 +3,7 @@ import { computed, ref, watch } from "vue";
import { VueFlow, type NodeMouseEvent, type VueFlowStore } from "@vue-flow/core";
import { Background } from "@vue-flow/background";
import { Controls } from "@vue-flow/controls";
import { ArrowDown, ArrowUp, Copy, Pencil, Trash2 } from "@lucide/vue";
import { ArrowDown, ArrowUp, Copy, Pencil, RotateCcw, Trash2 } from "@lucide/vue";
import "@vue-flow/core/dist/style.css";
import "@vue-flow/controls/dist/style.css";
@@ -23,7 +23,7 @@ import InsertEdge from "./InsertEdge.vue";
import StepNode from "./StepNode.vue";
import StepTypeItems from "./StepTypeItems.vue";
import type { StepPath } from "./workflow-edit";
import { stepTitle, withRuns, workflowGraph, type StageRun, type StepNodeData } from "./workflow-graph";
import { restartAt, stepTitle, withRuns, workflowGraph, type StageRun, type StepNodeData } from "./workflow-graph";
import type { WorkflowTrigger } from "./workflow-triggers";
const props = defineProps<{
@@ -33,6 +33,8 @@ const props = defineProps<{
triggers?: WorkflowTrigger[];
/** Step type names; when given, the canvas offers editing. */
types?: string[];
/** The watched run is parked, so its steps offer to restart it. */
restartable?: boolean;
}>();
const emit = defineEmits<{
edit: [StepPath];
@@ -41,6 +43,7 @@ const emit = defineEmits<{
duplicate: [StepPath];
move: [StepPath, -1 | 1];
remove: [StepPath];
restart: [from: string];
}>();
const NODE_WIDTH = 240;
@@ -122,6 +125,7 @@ function onNodeClick({ node }: NodeMouseEvent): void {
if (editable.value && path) emit("edit", path);
}
const menuPath = computed(() => menu.value.step?.path);
const restart = computed(() => (props.restartable && menuPath.value ? restartAt(graph.value, menuPath.value) : null));
const topIndex = computed(() => (menuPath.value?.length === 2 ? Number(menuPath.value[1]) : undefined));
</script>
@@ -162,6 +166,10 @@ const topIndex = computed(() => (menuPath.value?.length === 2 ? Number(menuPath.
<DropdownMenuContent class="w-56" align="start">
<template v-if="menu.step?.kind === 'step' && menuPath">
<DropdownMenuLabel class="truncate">{{ menu.step.title || stepTitle(menu.step.type) }}</DropdownMenuLabel>
<template v-if="restart">
<DropdownMenuItem @select="emit('restart', restart.from)"><RotateCcw /> {{ restart.label }}</DropdownMenuItem>
<DropdownMenuSeparator />
</template>
<DropdownMenuItem @select="emit('edit', menuPath)"><Pencil /> Edit</DropdownMenuItem>
<template v-if="topIndex !== undefined">
<DropdownMenuSub>
+26 -2
View File
@@ -14,7 +14,8 @@ import { Spinner } from "@/components/ui/spinner";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Textarea } from "@/components/ui/textarea";
import StepRun from "./StepRun.vue";
import { withRuns, workflowGraph } from "./workflow-graph";
import { restartAt, withRuns, workflowGraph } from "./workflow-graph";
import { api } from "@/lib/api";
import StepEditor from "./StepEditor.vue";
import WorkflowSettings from "./WorkflowSettings.vue";
import RunWorkflowButton from "./RunWorkflowButton.vue";
@@ -67,7 +68,26 @@ function openStep(path: StepPath): void {
selectedStep.value = path;
stepTab.value = selectedNode.value?.run && watchedRun.value ? "run" : "definition";
}
watch(watched, () => { selectedStep.value = null; });
watch(watched, () => { selectedStep.value = null; restartError.value = ""; });
// A parked run restarts at a step through the retry action, keeping the
// results of the steps before it.
const restartable = computed(() => watchedRun.value?.status === "parked");
const selectedRestart = computed(() => restartable.value && selectedStep.value ? restartAt(withRuns(workflowGraph(yaml.value), stages.value), selectedStep.value) : null);
const restarting = ref(false);
const restartError = ref("");
async function restartFrom(from: string): Promise<void> {
restartError.value = "";
restarting.value = true;
try {
await api.taskAction(watched.value, "retry", { resume_from: from });
await refresh();
} catch (err) {
restartError.value = err instanceof Error ? err.message : "Restart failed";
} finally {
restarting.value = false;
}
}
const triggers = useWorkflowTriggers(selected);
// Canvas edits are edits to the YAML; a newly placed step opens for editing.
@@ -229,13 +249,16 @@ function syncScroll(event: Event): void {
<!-- The canvas takes the height the viewport has left, so the page
itself does not scroll; the canvas pans. -->
<div class="relative h-[calc(100dvh-20.5rem)] min-h-[26rem]">
<p v-if="restartError" role="alert" class="absolute bottom-3 left-14 z-10 max-w-xl rounded-md border border-danger/40 bg-card px-3 py-2 text-sm text-danger shadow-lg">{{ restartError }}</p>
<WorkflowCanvas
:yaml="yaml"
:stages="stages"
:selected="selectedStep"
:triggers="triggers"
:types="stepTypeNames"
:restartable="restartable"
@edit="openStep"
@restart="restartFrom"
@settings="selectedStep = null; settingsOpen = true"
@insert="insertAt"
@duplicate="duplicateAt"
@@ -263,6 +286,7 @@ function syncScroll(event: Event): void {
<div class="flex items-center gap-2 border-b border-border px-3 py-2">
<Tabs v-model="stepTab"><TabsList><TabsTrigger value="run">Run</TabsTrigger><TabsTrigger value="definition">Definition</TabsTrigger></TabsList></Tabs>
<span class="min-w-0 flex-1 truncate text-xs" :title="selectedNode.run.name">{{ selectedNode.run.name }}</span>
<Button v-if="selectedRestart" type="button" size="sm" variant="outline" :disabled="restarting" @click="restartFrom(selectedRestart.from)"><RotateCcw /> {{ selectedRestart.label }}</Button>
<Button type="button" variant="ghost" size="icon-sm" aria-label="Close step details" @click="selectedStep = null"><X /></Button>
</div>
<div v-if="stepTab === 'run'" class="min-h-0 w-[32rem] max-w-[calc(100vw-3rem)] flex-1 overflow-y-auto">
+18
View File
@@ -68,6 +68,24 @@ export function withRuns(graph: WorkflowGraph, stages: StageRun[]): WorkflowGrap
};
}
/** How a parked run can restart at a step: the top-level step it stopped at
* resumes, earlier ones re-run. Later steps, and runs that are not parked,
* offer nothing. */
export interface Restart {
label: "Resume from here" | "Re-run from here";
from: string;
}
export function restartAt(graph: WorkflowGraph, path: (string | number)[]): Restart | null {
const top = (data: StepNodeData) => (data.path && data.path.length >= 2 ? Number(data.path[1]) : -1);
const node = graph.nodes.find((candidate) => JSON.stringify(candidate.data.path) === JSON.stringify(path))?.data;
if (!node?.stage) return null;
const stopped = Math.max(-1, ...graph.nodes.filter((candidate) => candidate.data.run).map((candidate) => top(candidate.data)));
const at = top(node);
if (at < 0 || at > stopped) return null;
return { label: at === stopped ? "Resume from here" : "Re-run from here", from: node.stage };
}
export interface GraphNode {
id: string;
type: "step" | "add";