feat(webui): park model credential failures with a recovery link, add Model setup step, readiness badges, and move audit to the organisation

This commit is contained in:
sam committed 2026-10-27 11:06:18 +11:00
1 parent 2fb0084d2c
commit 1a8b442acd
28 files changed
+131 -61

No files matched your search

+4 -4
View File
@@ -6,7 +6,7 @@ const { trackAudit } = require('./helpers/audit-helpers.cjs');
module.exports = async ({ page, go, shot, fail }) => {
const { requestMatching, waitForUrl } = trackAudit(page);
await go('/settings/audit');
await go('/org/audit');
const status = await page.evaluate(async () => (await fetch('/api/auth/status')).json());
const actor = status?.user?.id;
assert.ok(actor, 'signed-in identity has no id');
@@ -20,7 +20,7 @@ module.exports = async ({ page, go, shot, fail }) => {
await waitForUrl((u) => u.searchParams.get('q') === 'repository');
assert.equal((await search.inputValue()), 'repository');
await go('/settings/audit');
await go('/org/audit');
request = await requestMatching(
() => page.getByRole('button', { name: 'Runtime', exact: true }).click(),
(u) => u.searchParams.get('categories') === 'runtime',
@@ -73,7 +73,7 @@ module.exports = async ({ page, go, shot, fail }) => {
// Denied reaches the server through the same URL contract as the other
// filters. It must both update the URL and issue a request.
await go('/settings/audit');
await go('/org/audit');
const denied = page.getByRole('button', { name: 'Denied', exact: true });
request = await requestMatching(
() => denied.click(),
@@ -92,7 +92,7 @@ module.exports = async ({ page, go, shot, fail }) => {
}
// Advanced actor filter: server-evaluated, in the URL, shown as a chip.
await go('/settings/audit');
await go('/org/audit');
await page.getByRole('button', { name: 'Filters', exact: true }).click();
const actorInput = page.getByLabel('Actor', { exact: true });
request = await requestMatching(
+1 -1
View File
@@ -7,7 +7,7 @@ module.exports = async ({ page, go, shot, fail, settled }) => {
trackAudit(page);
await page.setViewportSize({ width: 390, height: 844 });
await go('/settings/audit');
await go('/org/audit');
const assertNoOverflow = async (label) => {
const { scrollWidth, innerWidth } = await page.evaluate(() => ({
scrollWidth: document.documentElement.scrollWidth,
+3 -3
View File
@@ -6,14 +6,14 @@ const { trackAudit } = require('./helpers/audit-helpers.cjs');
module.exports = async ({ page, go, shot, fail }) => {
const { lastRequest } = trackAudit(page);
await go('/settings/audit');
await go('/org/audit');
const status = await page.evaluate(async () => (await fetch('/api/auth/status')).json());
const actor = status?.user?.id;
assert.ok(actor, 'signed-in identity has no id');
const deepLink = `/settings/history?section=container-runtime-policies&actor=${encodeURIComponent(actor)}&since=30d#deep`;
await go(deepLink);
assert.match(page.url(), /\/settings\/audit\?/, 'history did not redirect to the audit route');
assert.match(page.url(), /\/org\/audit\?/, 'history did not redirect to the audit route');
assert.match(page.url(), /section=container-runtime-policies/, 'redirect dropped section');
assert.match(page.url(), new RegExp(`actor=${encodeURIComponent(actor)}`), 'redirect dropped actor');
assert.match(page.url(), /since=30d/, 'redirect dropped since');
@@ -44,7 +44,7 @@ module.exports = async ({ page, go, shot, fail }) => {
'actor chip missing',
);
await shot('redirect');
await go('/settings/audit');
await go('/org/audit');
await page.locator('[data-row-key]').first().waitFor();
await shot('desktop');
};
+3 -3
View File
@@ -7,7 +7,7 @@ const { trackAudit } = require('./helpers/audit-helpers.cjs');
module.exports = async ({ page, go, shot, fail, settled }) => {
const { loadCount } = trackAudit(page);
await go('/settings/audit');
await go('/org/audit');
const resourceResponse = await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`);
assert.equal(resourceResponse.status(), 200, 'audit-retention resource is unreadable');
const retentionResource = await resourceResponse.json();
@@ -38,7 +38,7 @@ module.exports = async ({ page, go, shot, fail, settled }) => {
assert.ok(!(await retentionDialog.isVisible().catch(() => false)), 'Cancel left the retention dialog open');
// ---- live tail -----------------------------------------------------------
await go('/settings/audit');
await go('/org/audit');
await page.evaluate(() => window.scrollTo(0, 0));
await settled();
const topKey = await page.locator('[data-row-key]').first().getAttribute('data-row-key');
@@ -126,7 +126,7 @@ module.exports = async ({ page, go, shot, fail, settled }) => {
// ---- retention: save -----------------------------------------------------
// Kept last: the page error this currently raises must not stop the rest.
await go('/settings/audit');
await go('/org/audit');
retentionDialog = await openRetention();
const hoursField = retentionDialog.getByLabel('Runtime event retention (hours)', { exact: true });
const beforeSave = await (await page.request.get(`${new URL(page.url()).origin}/api/control-plane/resources/audit-retention`)).json();
+1 -1
View File
@@ -6,7 +6,7 @@ const { DEFAULT_WINDOW_MS, trackAudit } = require('./helpers/audit-helpers.cjs')
module.exports = async ({ page, go, shot, fail, settled }) => {
trackAudit(page);
await go('/settings/audit');
await go('/org/audit');
await page.locator('[data-row-key]').first().waitFor();
const from = new Date(Date.now() - DEFAULT_WINDOW_MS).toISOString();
// The feed page size is 100: only rows in this response are rendered.
+1 -1
View File
@@ -7,7 +7,7 @@ const { DEFAULT_WINDOW_MS, trackAudit } = require('./helpers/audit-helpers.cjs')
module.exports = async ({ page, go, skip }) => {
trackAudit(page);
await go('/settings/audit');
await go('/org/audit');
await page.locator('[data-row-key]').first().waitFor();
const from = new Date(Date.now() - DEFAULT_WINDOW_MS).toISOString();
// The feed page size is 100: only rows in this response are rendered.
+2 -2
View File
@@ -6,7 +6,7 @@ const { trackAudit, exportOnce } = require('./helpers/audit-helpers.cjs');
module.exports = async ({ page, go, shot, fail, settled }) => {
const { waitForUrl } = trackAudit(page);
await go('/settings/audit');
await go('/org/audit');
await page.getByRole('button', { name: 'Runtime', exact: true }).click();
await waitForUrl((u) => u.searchParams.get('categories') === 'runtime');
@@ -37,7 +37,7 @@ module.exports = async ({ page, go, shot, fail, settled }) => {
await savedView.waitFor({ state: 'detached', timeout: 5000 }).catch(() => {});
assert.equal(await savedView.count(), 0, 'deleting the saved view left it in the picker');
await go('/settings/audit');
await go('/org/audit');
await page.getByRole('button', { name: 'Export', exact: true }).click();
await page.getByRole('menuitem', { name: 'CSV', exact: true }).waitFor();
await shot('export');
+3
View File
@@ -155,6 +155,9 @@ func wireOrgSurface(srv *webui.Server, store storecontract.TaskStore) {
if schedules, ok := store.(webui.ScheduleStore); ok {
srv.Schedules = schedules
}
if models, ok := store.(webui.ModelReader); ok {
srv.Models = models
}
}
// wireCatalog attaches the Gateway-owned surfaces the dashboard reads over the
+1 -1
View File
@@ -1810,7 +1810,7 @@ func (d *Daemon) acquireTaskContainer(
) (*container.Container, string, func(), bool) {
park := func(reason string, err error) {
d.Log.ErrorContext(ctx, reason, "err", err)
d.parkRunningTask(ctx, task, reason+": "+err.Error(), taskstate.ParkTransient)
d.parkBlockedTask(ctx, task, reason+": "+err.Error(), taskstate.ParkTransient, parkBlocker(err))
}
// Resolve the PR number from inputs before the brief is written.
+2 -2
View File
@@ -178,7 +178,7 @@ func (d *Daemon) openModelEgress(ctx context.Context, task *workflow.Task, crede
if d.ModelEgress == nil {
for _, p := range cfg.Providers {
if p.APIKeyEnv != "" {
return ModelSession{}, nil, fmt.Errorf("model egress proxy is unavailable on this daemon, and provider keys never enter a container")
return ModelSession{}, nil, blockedPark{taskstate.BlockerModelCredential, fmt.Errorf("model egress proxy is unavailable on this daemon, and provider keys never enter a container")}
}
}
return ModelSession{}, func() {}, nil
@@ -188,7 +188,7 @@ func (d *Daemon) openModelEgress(ctx context.Context, task *workflow.Task, crede
}
session, err := d.ModelEgress.Open(credential, task.OrgOrDefault(), cfg.Providers)
if err != nil {
return ModelSession{}, nil, err
return ModelSession{}, nil, blockedPark{taskstate.BlockerModelCredential, err}
}
return session, func() { d.ModelEgress.Close(ctx, credential) }, nil
}
+1 -1
View File
@@ -51,7 +51,7 @@ var dashboardPages = []DashboardPage{
{Path: "/org/repositories", Label: "Repositories", Description: "Watched repositories and gate overrides."},
{Path: "/org/scheduling-policy", Label: "Scheduling policy", Description: "Work discovery and forge labels."},
{Path: "/settings/tools", Label: "Tools & MCP", Description: "Agent tools and MCP servers."},
{Path: "/settings/audit", Label: "Audit", Description: "Settings, access, identity and runtime events."},
{Path: "/org/audit", Label: "Audit", Description: "Settings, access, identity and runtime events."},
{Path: "/settings/plugins", Label: "Plugins", Description: "Extension directories loaded at startup."},
{Path: "/settings/secret-engines", Label: "Secret engines"},
{Path: "/settings/container-runtime", Label: "Container runtime"},
@@ -360,14 +360,15 @@ func (q *Queries) SettleAlertDelivery(ctx context.Context, arg SettleAlertDelive
}
const taskAlertInfo = `-- name: TaskAlertInfo :one
SELECT org_id, title, workflow, park_class FROM tasks WHERE id = $1
SELECT org_id, title, workflow, park_class, park_blocker FROM tasks WHERE id = $1
`
type TaskAlertInfoRow struct {
OrgID string
Title string
Workflow string
ParkClass string
OrgID string
Title string
Workflow string
ParkClass string
ParkBlocker string
}
func (q *Queries) TaskAlertInfo(ctx context.Context, id int64) (TaskAlertInfoRow, error) {
@@ -378,6 +379,7 @@ func (q *Queries) TaskAlertInfo(ctx context.Context, id int64) (TaskAlertInfoRow
&i.Title,
&i.Workflow,
&i.ParkClass,
&i.ParkBlocker,
)
return i, err
}
@@ -65,4 +65,4 @@ SELECT id, delivery_id, attempt, at, status_code, error
FROM alert_delivery_attempts WHERE delivery_id = ANY(sqlc.arg(delivery_ids)::bigint[]) ORDER BY delivery_id, id;
-- name: TaskAlertInfo :one
SELECT org_id, title, workflow, park_class FROM tasks WHERE id = $1;
SELECT org_id, title, workflow, park_class, park_blocker FROM tasks WHERE id = $1;
@@ -29,9 +29,11 @@ func recordTransition(ctx context.Context, q *postgresdb.Queries, p postgresdb.I
}
// needsDecision reports whether a task in status, parked with class, is waiting
// on an operator's decision.
func needsDecision(status, class string) bool {
return status == workflow.StatusWaitingApproval || (status == workflow.StatusParked && class == taskstate.ParkNeedsDecision)
// on an operator's decision. A park that names a blocker waits on the operator
// whatever its class, because only a fix to that setting lets a retry succeed.
func needsDecision(status, class, blocker string) bool {
return status == workflow.StatusWaitingApproval ||
(status == workflow.StatusParked && (class == taskstate.ParkNeedsDecision || blocker != ""))
}
// failed reports whether a task in status, parked with class, will not
@@ -63,14 +65,10 @@ func syncTaskAlerts(ctx context.Context, q *postgresdb.Queries, p postgresdb.Ins
return alert.Key{Org: org.OrgID(info.OrgID), Kind: kind, Subject: subject}
}
if needsDecision(p.ToStatus, info.ParkClass) {
body := name + " is waiting for approval or review."
if p.ToStatus == workflow.StatusParked {
body = name + " is parked and needs a decision."
}
if needsDecision(p.ToStatus, info.ParkClass, info.ParkBlocker) {
_, err := raiseAlert(ctx, q, alert.Input{
Key: key(alert.KindTaskNeedsDecision), Severity: alert.SeverityAction, Condition: true,
Title: title, Body: body, Link: link,
Title: title, Body: decisionBody(name, p.ToStatus, info.ParkBlocker), Link: link,
})
if err != nil {
return err
@@ -90,6 +88,17 @@ func syncTaskAlerts(ctx context.Context, q *postgresdb.Queries, p postgresdb.Ins
return nil
}
// decisionBody says why a task waits on the operator.
func decisionBody(name, status, blocker string) string {
switch {
case status != workflow.StatusParked:
return name + " is waiting for approval or review."
case blocker != "":
return name + " is blocked by a missing setting."
}
return name + " is parked and needs a decision."
}
// truncate shortens s to at most n runes, marking the cut with an ellipsis.
func truncate(s string, n int) string {
r := []rune(s)
+3
View File
@@ -294,6 +294,9 @@ const (
BlockerConnectionCredential Blocker = "connection_credential"
// BlockerForgeExtension: no running forge extension serves the connection.
BlockerForgeExtension Blocker = "forge_extension"
// BlockerModelCredential: a model provider the run needs has no usable
// credential.
BlockerModelCredential Blocker = "model_credential"
)
// Blocker is the persisted park blocker string.
+1
View File
@@ -45,6 +45,7 @@ func pageProbes() []pageProbe {
{"org_members", http.MethodPost, "/api/orgs/_/members"},
{"org_agents", http.MethodPut, "/api/orgs/_/agents/_"},
{"org_policies", http.MethodPut, "/api/access/policies"},
{"org_audit", http.MethodGet, "/api/audit"},
{"org_config", http.MethodPost, "/api/control-plane/resources/_/commands/replace"},
}
}
+13
View File
@@ -1,6 +1,7 @@
package webui
import (
"context"
"net/http"
"github.com/samcharles93/archie-core/internal/domain/identity"
@@ -17,6 +18,11 @@ type SetupStep struct {
Path string `json:"path,omitempty"`
}
// ModelReader reads the model aliases the calling principal's org may use.
type ModelReader interface {
CallerModels(ctx context.Context) (org string, aliases map[string]string, err error)
}
// handleSetup reports which setup steps are still missing in the caller's
// organisation, from live state. Optional capabilities (a chat channel, a
// repository) are set up where they are used, not listed here.
@@ -36,6 +42,13 @@ func (s *Server) handleSetup(w http.ResponseWriter, r *http.Request) {
}
steps = append(steps, SetupStep{Title: "First task", Done: total > 0, Path: "/tasks"})
}
if s.Models != nil {
// Shown only while the org has no model to run, so a working setup
// carries no extra step.
if _, aliases, err := s.Models.CallerModels(r.Context()); err == nil && len(aliases) == 0 {
steps = append(steps, SetupStep{Title: "Model", Path: "/org/models"})
}
}
writeJSON(w, map[string]any{"steps": steps})
}
+4
View File
@@ -166,6 +166,10 @@ type Server struct {
// the default.
Instance string
// Models answers which model aliases the caller's org may use. Optional:
// nil leaves model readiness out of the setup checklist.
Models ModelReader
// Orgs serves the org pages: the caller's org, its workspaces, members and
// agent assignments. Nil answers the org routes Unavailable.
Orgs org.API
+2
View File
@@ -41,6 +41,8 @@ func blockerRoute(t *task.Task) (recoveryRoute, bool) {
return recoveryRoute{label: "Fix connection credential", page: "/org/connections", method: http.MethodPost, api: "/api/control-plane/resources/forge-connections/commands/replace"}, true
case taskstate.BlockerForgeExtension:
return recoveryRoute{label: "Enable forge extension", page: "/settings/extensions", method: http.MethodPut, api: "/api/extensions/_/enabled", instance: true}, true
case taskstate.BlockerModelCredential:
return recoveryRoute{label: "Set up model", page: "/org/models", method: http.MethodPost, api: "/api/control-plane/resources/provider-settings/commands/replace"}, true
case taskstate.BlockerPolicyDenied:
return recoveryRoute{label: "Edit policies", page: "/org/policies", method: http.MethodPut, api: "/api/access/policies"}, true
}
+4 -4
View File
@@ -166,10 +166,10 @@ XID_Start XIDS`.split(/\s/).map(e=>[Bb(e),e])),Px=new Map([[`s`,vx(383)],[vx(383
`,1)[0]:Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`object`?JSON.stringify(t):t}`).join(`, `)}}catch{}return r.value.split(`
`,1)[0]}),l=Y(()=>[r.value&&`> ${r.value}`,a.value].filter(Boolean).join(`
`));return(t,r)=>e.tool.path?(L(),q(kC,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):l.value?(L(),q(V(Tp),{key:1,"default-open":i.value},{default:I(()=>[A(V(Op),null,{default:I(()=>[A(V(Ap),{status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[i.value?(L(),q(V(Il),{key:0})):o.value?(L(),q(V(DC),{key:1})):(L(),q(V(Nl),{key:2,class:`text-success`}))]),_:1}),R(`span`,AC,B(n.value),1),A(V(jp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,jC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`])]),_:1}),A(V(Ep),null,{default:I(()=>[A(V(Np),{size:`sm`},{default:I(()=>[A(V(Rp),{wrap:``,class:`max-h-64`},{default:I(()=>[H(B(l.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(L(),q(V(Ap),{key:2,status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[i.value?(L(),q(V(Il),{key:0})):o.value?(L(),q(V(DC),{key:1})):(L(),q(V(Nl),{key:2,class:`text-success`}))]),_:1}),R(`span`,MC,B(n.value),1),A(V(jp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,NC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`]))}}),FC={class:`flex flex-col gap-1.5`},IC=P({__name:`ChatToolGroup`,props:{tools:{},streaming:{type:Boolean}},setup(e){let t=e,n=e=>!!(e.err||e.Err||e.failed),r=Y(()=>t.tools.some(n)),i=Y(()=>`${t.tools.length} tool call${t.tools.length===1?``:`s`}`);return(t,n)=>(L(),q(V(Tp),{"default-open":r.value},{default:I(()=>[A(V(Op),null,{default:I(()=>[A(V(Ap),{status:r.value?`error`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[A(V(bte))]),_:1}),A(V(jp),{class:`truncate`},{default:I(()=>[H(B(i.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),A(V(Ep),null,{default:I(()=>[R(`div`,FC,[(L(!0),j(U,null,M(e.tools,(t,n)=>(L(),q(PC,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),LC={key:0,class:`mb-2 flex flex-wrap gap-1.5`},RC={key:2,class:`whitespace-pre-wrap`},zC=P({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){let t=e,n=Y(()=>{let e=Array.from(t.text),n=[],r=0,i=!1;for(let a of t.tools){let t=Math.min(Math.max(a.text_offset??0,r),e.length);t>r&&(n.push({text:e.slice(r,t).join(``)}),r=t,i=!1);let o=n[n.length-1];!a.path&&i&&o&&`tools`in o?o.tools.push(a):(n.push({tools:[a]}),i=!a.path)}return r<e.length&&n.push({text:e.slice(r).join(``)}),n});return(t,r)=>(L(),q(V(ZS),{align:e.assistant?`start`:`end`},{default:I(()=>[A(V(QS),null,{default:I(()=>[A(V(vp),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:I(()=>[A(V(yp),{class:`[overflow-wrap:anywhere]`},{default:I(()=>[e.media.length?(L(),j(`div`,LC,[(L(!0),j(U,null,M(e.media,(e,t)=>(L(),q(rC,{key:t,attachment:e},null,8,[`attachment`]))),128))])):F(``,!0),e.assistant?(L(!0),j(U,{key:1},M(n.value,(t,r)=>(L(),j(U,{key:r},[`text`in t?(L(),q(EC,{key:0,text:t.text},null,8,[`text`])):(L(),q(V(xp),{key:1,class:`my-2`},{default:I(()=>[t.tools.length>1?(L(),q(IC,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(L(),q(PC,{key:1,tool:t.tools[0],streaming:e.streaming&&r===n.value.length-1},null,8,[`tool`,`streaming`]))]),_:2},1024))],64))),128)):(L(),j(`div`,RC,B(e.text),1)),K(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(L(),q(V($S),{key:0,class:`px-0 transition-opacity focus-within:opacity-100 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100`},{default:I(()=>[A(V(Bp),{value:e.text},null,8,[`value`])]),_:1})):F(``,!0)]),_:3})]),_:3},8,[`align`]))}}),BC={class:`text-sm`},VC={key:0,class:`mt-1 text-fg-muted`},HC={key:1,class:`mt-2 flex flex-wrap gap-2`},UC=P({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=Y(()=>ld.value.models??[]);return(e,n)=>(L(),j(`div`,BC,[n[0]||=R(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(L(),j(`div`,HC,[(L(!0),j(U,null,M(t.value,e=>(L(),q(V(X),{key:e,size:`sm`,variant:e===V(ld).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void V(Cd)(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(L(),j(`p`,VC,`None configured.`))]))}}),WC={class:`text-sm`},GC={key:0},KC={class:`mt-1 space-y-0.5`},qC={class:`font-mono`},JC=[`href`],YC={key:0,class:`mt-3 flex gap-2`},XC={key:1,class:`mt-2 text-fg-muted`},ZC={key:2,class:`mt-2 text-fg-muted`},QC={key:3,class:`mt-2 text-ok`},$C={key:4,class:`mt-2 text-danger`},ew={key:5,class:`mt-2 text-xs text-fg-muted`},tw=P({__name:`ChatUpdateCard`,props:{update:{}},setup(e){let t=e,n=Y(()=>t.update.available??[]),r=J(`idle`),i=J(``);async function a(){r.value=`installing`;try{let e=(await Z.updateInstall(t.update.snapshot)).result?.installed;i.value=e?Object.entries(e).map(([e,t])=>`${e} → ${t}`).join(`, `)+`. Archie restarts to apply it.`:`UpdaLine truncated
`));return(t,r)=>e.tool.path?(L(),q(kC,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):l.value?(L(),q(V(Tp),{key:1,"default-open":i.value},{default:I(()=>[A(V(Op),null,{default:I(()=>[A(V(Ap),{status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[i.value?(L(),q(V(Il),{key:0})):o.value?(L(),q(V(DC),{key:1})):(L(),q(V(Nl),{key:2,class:`text-success`}))]),_:1}),R(`span`,AC,B(n.value),1),A(V(jp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,jC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`])]),_:1}),A(V(Ep),null,{default:I(()=>[A(V(Np),{size:`sm`},{default:I(()=>[A(V(Rp),{wrap:``,class:`max-h-64`},{default:I(()=>[H(B(l.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(L(),q(V(Ap),{key:2,status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[i.value?(L(),q(V(Il),{key:0})):o.value?(L(),q(V(DC),{key:1})):(L(),q(V(Nl),{key:2,class:`text-success`}))]),_:1}),R(`span`,MC,B(n.value),1),A(V(jp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,NC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`]))}}),FC={class:`flex flex-col gap-1.5`},IC=P({__name:`ChatToolGroup`,props:{tools:{},streaming:{type:Boolean}},setup(e){let t=e,n=e=>!!(e.err||e.Err||e.failed),r=Y(()=>t.tools.some(n)),i=Y(()=>`${t.tools.length} tool call${t.tools.length===1?``:`s`}`);return(t,n)=>(L(),q(V(Tp),{"default-open":r.value},{default:I(()=>[A(V(Op),null,{default:I(()=>[A(V(Ap),{status:r.value?`error`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[A(V(bte))]),_:1}),A(V(jp),{class:`truncate`},{default:I(()=>[H(B(i.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),A(V(Ep),null,{default:I(()=>[R(`div`,FC,[(L(!0),j(U,null,M(e.tools,(t,n)=>(L(),q(PC,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),LC={key:0,class:`mb-2 flex flex-wrap gap-1.5`},RC={key:2,class:`whitespace-pre-wrap`},zC=P({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){let t=e,n=Y(()=>{let e=Array.from(t.text),n=[],r=0,i=!1;for(let a of t.tools){let t=Math.min(Math.max(a.text_offset??0,r),e.length);t>r&&(n.push({text:e.slice(r,t).join(``)}),r=t,i=!1);let o=n[n.length-1];!a.path&&i&&o&&`tools`in o?o.tools.push(a):(n.push({tools:[a]}),i=!a.path)}return r<e.length&&n.push({text:e.slice(r).join(``)}),n});return(t,r)=>(L(),q(V(ZS),{align:e.assistant?`start`:`end`},{default:I(()=>[A(V(QS),null,{default:I(()=>[A(V(vp),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:I(()=>[A(V(yp),{class:`[overflow-wrap:anywhere]`},{default:I(()=>[e.media.length?(L(),j(`div`,LC,[(L(!0),j(U,null,M(e.media,(e,t)=>(L(),q(rC,{key:t,attachment:e},null,8,[`attachment`]))),128))])):F(``,!0),e.assistant?(L(!0),j(U,{key:1},M(n.value,(t,r)=>(L(),j(U,{key:r},[`text`in t?(L(),q(EC,{key:0,text:t.text},null,8,[`text`])):(L(),q(V(xp),{key:1,class:`my-2`},{default:I(()=>[t.tools.length>1?(L(),q(IC,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(L(),q(PC,{key:1,tool:t.tools[0],streaming:e.streaming&&r===n.value.length-1},null,8,[`tool`,`streaming`]))]),_:2},1024))],64))),128)):(L(),j(`div`,RC,B(e.text),1)),K(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(L(),q(V($S),{key:0,class:`px-0 transition-opacity focus-within:opacity-100 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100`},{default:I(()=>[A(V(Bp),{value:e.text},null,8,[`value`])]),_:1})):F(``,!0)]),_:3})]),_:3},8,[`align`]))}}),BC={class:`text-sm`},VC={key:0,class:`mt-1 text-fg-muted`},HC={key:1,class:`mt-2 flex flex-wrap gap-2`},UC=P({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=Y(()=>ld.value.models??[]);return(e,n)=>(L(),j(`div`,BC,[n[0]||=R(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(L(),j(`div`,HC,[(L(!0),j(U,null,M(t.value,e=>(L(),q(V(X),{key:e,size:`sm`,variant:e===V(ld).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void V(Cd)(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(L(),j(`p`,VC,`None configured.`))]))}}),WC={class:`text-sm`},GC={key:0},KC={class:`mt-1 space-y-0.5`},qC={class:`font-mono`},JC=[`href`],YC={key:0,class:`mt-3 flex gap-2`},XC={key:1,class:`mt-2 text-fg-muted`},ZC={key:2,class:`mt-2 text-fg-muted`},QC={key:3,class:`mt-2 text-ok`},$C={key:4,class:`mt-2 text-danger`},ew={key:5,class:`mt-2 text-xs text-fg-muted`},tw=P({__name:`ChatUpdateCard`,props:{update:{}},setup(e){let t=e,n=Y(()=>t.update.available??[]),r=J(`idle`),i=J(``);async function a(){r.value=`installing`;try{let e=(await Z.updateInstall(t.update.snapshot)).result?.installed;i.value=e?Object.entries(e).map(([e,t])=>`${e} → ${t}`).join(`, `)+`. Archie restarts to apply it.`:`UpdaLine truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>KE?`${r.slice(0,KE).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function JE(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function YE(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`under 1 s`;let n=t/1e3;if(n<60)return`${n.toFixed(+(n<10))} s`;let r=Math.round(n),i=Math.floor(r/60),a=r%60;if(i<60)return a===0?`${i} min`:`${i} min ${a} s`;let o=Math.floor(i/60),s=i-o*60;return s===0?`${o} h`:`${o} h ${s} min`}function XE(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function ZE(e){return typeof e==`string`?e:``}function QE(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=[r,YE(t.duration_ms)].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[e,ZE(t.error),ZE(t.when)].filter(Boolean).join(` · `)}}if(e.kind===`task_retried`){let n=Number(t.retry_count);return{title:Number.isFinite(n)&&n>0?`Retry ${n}`:`Retry requested`,detail:[ZE(t.previous_stage)&&`after ${ZE(t.previous_stage)}`,ZE(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=XE(t.iterations),i=XE(t.tokens),a=Number(t.cached_tokens)||0,o=XE((Number(t.prompt_tokens)||0)-a),s=XE(t.completion_tokens),c=XE(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,ZE(t.model)].filter(Boolean);return{title:`Agent ${ZE(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=ZE(t.author);return{title:`Remediation ${ZE(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${ZE(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=ZE(t.pr_number);return{title:`Pull request approved`,detail:[ZE(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${ZE(t.attempt)} of ${ZE(t.of)} failed: ${e.stage||`step`}`,detail:ZE(t.error),tone:`warn`};if(e.kind===`config_captured`)return{title:`Configuration captured`,detail:`The effective task-runtime configuration for this run.`};if(e.kind===`binding_started`){let e=ZE(t.source),n=ZE(t.capture_id),r=[{label:`binding ${ZE(t.binding_name)||ZE(t.binding_id)}`,to:`/events?tab=bindings`},...n?[{label:`captured event`,to:`/events?tab=inspector&capture=${encodeURIComponent(n)}`}]:[]];return t.unsigned===!0?{title:`Started by an unsigned event`,detail:e?`source ${e}`:``,tone:`warn`,links:r}:{title:`Started by an event`,detail:e?`source ${e}`:``,links:r}}if(e.kind===`changes_captured`){let e=t.totals??{},n=Number(e.files);return{title:`Change capture recorded`,detail:[Number.isFinite(n)&&n>0?`${n} file${n===1?``:`s`} changed`:``,t.captured_after?`captured after ${ZE(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:JE(e.kind||e.type),detail:e.detail||``}}var $E=[`title`],eD=P({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=kE();n.watchIdentities();let r=e,i=t,a=FE(),o=Y(()=>a.taskIDFor(r.event)),s=Y(()=>qE(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}return(t,n)=>(L(),q(V(UE),{class:z(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[lt(_t(c,[`prevent`]),[`enter`]),lt(_t(c,[`prevent`]),[`space`])]},{default:I(()=>[A(V(HE),{class:`font-medium`},{default:I(()=>[H(B(V(QE)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),A(V(HE),{class:`font-mono`},{default:I(()=>[H(B(o.value>0?`#${o.value}`:`–`),1)]),_:1}),A(V(HE),{class:`w-[55%] max-w-0`},{default:I(()=>[R(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,$E)]),_:1}),A(V(HE),null,{default:I(()=>[A(V(ww),{at:e.event.at},null,8,[`at`])]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),tD=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function nD(e){return(Number(e?.task_id)||0)>0}function rD(e,t){return t===`tasks`?nD(e):t!==`system`||!nD(e)}function iD(e,t){return e.filter(e=>rD(e,t))}function aD(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function oD(e,t){return`${e}:${t??0}`}function sD(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=oD(qE(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var cD={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},lD={class:`max-h-[28rem] overflow-y-auto`},uD={class:`inline-flex Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var TO=P({inheritAttrs:!1,__name:`SuggestInput`,props:Ue({options:{},class:{}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=Te(e,`modelValue`),r=J(!1),i=Y(()=>{let e=r.value?n.value.toLowerCase():``;return t.options.filter(t=>t.toLowerCase().includes(e)).slice(0,50)});function a(e,t){let n=e.target,r=t?n.value.length:0;n.setSelectionRange(r,r),n.scrollLeft=t?n.scrollWidth:0}function o(e){r.value=!0,n.value=e}return(e,s)=>(L(),q(V(kr),{modelValue:n.value,"onUpdate:modelValue":s[2]||=e=>n.value=e,"ignore-filter":``,"open-on-focus":``,"display-value":e=>e,"onUpdate:open":s[3]||=e=>r.value=!1},{default:I(()=>[A(V(Ar),{"as-child":``},{default:I(()=>[A(V(Fr),{"as-child":``,"model-value":n.value,"onUpdate:modelValue":o},{default:I(()=>[R(`input`,G(e.$attrs,{"data-slot":`input`,autocomplete:`off`,onKeydown:[s[0]||=lt(e=>a(e,!1),[`home`]),s[1]||=lt(e=>a(e,!0),[`end`])],class:V(W)(V(oee),t.class)}),null,16)]),_:1},8,[`model-value`])]),_:1}),A(V(Lr),null,{default:I(()=>[i.value.length?(L(),q(V(Nr),{key:0,position:`popper`,"side-offset":4,class:`z-50 max-h-60 w-(--reka-combobox-trigger-width) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10`},{default:I(()=>[A(V(zr),{class:`max-h-60 overflow-y-auto p-1`},{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Ir),{key:e,value:e,class:`relative flex w-full cursor-default items-center rounded-md px-1.5 py-1 font-mono text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground`},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})):F(``,!0)]),_:1})]),_:1},8,[`modelValue`,`display-value`]))}});function EO(e){return(e?.merged||0)+(e?.completed||0)}function DO(e){return Object.entries(e?.inputs??{}).map(([e,t])=>({name:e,type:t.type,required:t.required===!0})).sort((e,t)=>e.name.localeCompare(t.name))}function OO(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function kO(e,t){switch(t){case`number`:{let t=e.trim();return t!==``&&!Number.isNaN(Number(t))?Number(t):e}case`bool`:return e===`true`||e!==`false`&&e;case`string`:return e;default:try{return JSON.parse(e)}catch{return e}}}function AO(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=kO(e,r.type))}return n}var jO=[`onKeydown`],MO={key:1,class:`grid gap-1.5`},NO={key:0,class:`font-normal text-fg-subtle`},PO={key:2,class:`grid gap-1.5`},FO=[`id`],IO={class:`min-w-0`},LO={class:`block truncate text-label font-medium`},RO={class:`block text-xs text-fg-subtle`},zO={key:0,class:`text-xs text-fg-subtle`},BO={key:3,class:`grid gap-3`},VO={class:`font-mono`},HO={key:0,class:`text-fg-subtle`},UO={class:`grid gap-1.5`},WO={class:`grid gap-1.5`},GO={class:`flex items-center gap-2 border-t border-border pt-4`},KO={class:`mr-auto text-xs text-fg-subtle`},qO=P({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=ye(),a=J([]),o=J([]),s=J([]),c=J(``);Fe(async()=>{try{let[e,t]=await Promise.all([Z.workflows(),Z.repositories()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=(t??[]).map(e=>`${e.owner}/${e.name}`)}catch(e){c.value=String(e.message||e)}});let l=J(``),u=J(n.workflow??n.initialWorkflow??``),d=J(n.initialInstructions??``),f=J(wO(d.value)),p=J({});ve(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=Y(()=>a.value.find(e=>e.id===u.value)),h=Y(()=>DO(m.value)),g=Y(()=>OO(h.value,p.value)),_=Y(()=>m.value?.repository??`required`),v=Y(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=J(!1),x=J(``),S=Y(()=>!(!l.value.trim()&&v.value||!u.value||!f.value.trim())&&g.value.length===0);async function C(){if(S.value&&!b.value){b.value=!0,x.value=``;try{let e=await Z.workRequest({repository:_.value===`none`?``:l.value.trim(),workflow:u.value,title:f.value.trim(),instructions:d.value,inputs:AO(h.value,p.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){x.value=String(e.message||e)}finally{b.value=!1}}}return(e,t)=>(L(),j(`form`,{class:`grid gap-5`,onSubmit:_t(C,[`prevent`]),onKeydown:[lt(_t(C,[`meta`,`prevent`]),[`enter`]),lt(_t(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(L(),q(V(ut),{key:0,variant:`destructive`},{default:I(()=>[A(V(xt),null,{default:I(()=>[H(B(c.value),1)]),_:1})]),_:1})):F(``,!0),_.value===`none`?F(``,!0):(L(),j(`div`,MO,[A(V(kc),{for:`${V(i)}-repo`,class:`text-label font-medium`},{default:I(()=>[t[5]||=H(`Repository`,-1),v.value?F(``,!0):(L(),j(`span`,NO,` (optional)`))]),_:1},8,[`for`]),A(V(TO),{id:`${V(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,options:s.value,required:v.value},null,8,[`id`,`modelValue`,`options`,`required`])])),n.workflow?F(``,!0):(L(),j(`div`,PO,[R(`span`,{id:`${V(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 sk(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 ck(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 lk(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 uk(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 dk=J([]),fk=J([]),pk=J(!0),mk=J(null),hk=J(!0),gk=J(null),_k=J(!1),vk=J(null);async function yk(){try{let e=await Z.eventTypes(ak().workspace);pk.value=e.enabled!==!1,dk.value=e.event_types||[],fk.value=e.proposals||[],mk.value=null}catch(e){mk.value=e.message||String(e)}finally{hk.value=!1}}function bk(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function xk(e){vk.value=null,gk.value=e}function Sk(e){let t=Ak.value.find(t=>String(t.id)===e.sample_id);xk({mode:`proposal`,id:null,source:e.source,name:``,rule:bk(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Ck(e=``){xk({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function wk(e){xk({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:bk(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Tk(){gk.value=null}async function Ek(){let e=gk.value;if(e){_k.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:uk(e.rule)});else{let t=e.mode===`paste`?ok(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:uk(e.rule),example:{headers:t,body:e.body}})}gk.value=null,await yk()}catch(e){vk.value=e.message||String(e)}finally{_k.value=!1}}}var Dk=J(null);async function Ok(){let e=Dk.value;if(Dk.value=null,e)try{await Z.eventTypeDelete(e.id),await yk()}catch(e){mk.value=e.message||String(e)}}var kk=100,Ak=J([]),jk=J(!0),Mk=J(null),Nk=J(!0),Pk=J(null);async function Fk(){try{let e=await Z.captures(kk);jk.value=e.enabled!==!1,Ak.value=e.captures||[],Mk.value=null}catch(e){Mk.value=e.message||String(e)}finally{Nk.value=!1}}function Ik(e){let t=Ak.value.find(t=>t.id===e);return t&&(Pk.value=t),!!t}function Lk(){Ak.value.length&&(Pk.value=Ak.value[0])}function Rk(){pf(`captures`,()=>{Fk(),yk()})}var zk=P({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=St(n,`class`),a=D(i,r);return(e,t)=>(L(),q(V(Ka),G({"data-slot":`tabs`,"data-orientation":V(a).orientation||`horizontal`},V(a),{class:V(W)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:I(t=>[K(e.$slots,`default`,He(he(t)))]),_:3},16,[`data-orientation`,`class`]))}}),Bk=P({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=St(t,`class`);return(e,r)=>(L(),q(V(Ya),G({"data-slot":`tabs-content`,class:V(W)(`text-sm flex-1 outline-none`,t.class)},V(n)),{default:I(()=>[K(e.$slots,`default`)]),_:3},16,[`class`]))}}),Vk=P({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=St(t,`class`,`variant`);return(r,i)=>(L(),q(V(Xa),G({"data-slot":`tabs-list`,"data-variant":e.variant},V(n),{class:V(W)(V(Uk)({variant:e.variant}),t.class)}),{default:I(()=>[K(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),Hk=P({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=St(t,`class`),r=T(n);return(e,n)=>(L(),q(V(Za),G({"data-slot":`tabs-trigger`,class:V(W)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:oLine 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 sk(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 ck(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 lk(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 uk(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 dk=J([]),fk=J([]),pk=J(!0),mk=J(null),hk=J(!0),gk=J(null),_k=J(!1),vk=J(null);async function yk(){try{let e=await Z.eventTypes(ak().workspace);pk.value=e.enabled!==!1,dk.value=e.event_types||[],fk.value=e.proposals||[],mk.value=null}catch(e){mk.value=e.message||String(e)}finally{hk.value=!1}}function bk(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function xk(e){vk.value=null,gk.value=e}function Sk(e){let t=Ak.value.find(t=>String(t.id)===e.sample_id);xk({mode:`proposal`,id:null,source:e.source,name:``,rule:bk(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Ck(e=``){xk({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function wk(e){xk({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:bk(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Tk(){gk.value=null}async function Ek(){let e=gk.value;if(e){_k.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:uk(e.rule)});else{let t=e.mode===`paste`?ok(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:uk(e.rule),example:{headers:t,body:e.body}})}gk.value=null,await yk()}catch(e){vk.value=e.message||String(e)}finally{_k.value=!1}}}var Dk=J(null);async function Ok(){let e=Dk.value;if(Dk.value=null,e)try{await Z.eventTypeDelete(e.id),await yk()}catch(e){mk.value=e.message||String(e)}}var kk=100,Ak=J([]),jk=J(!0),Mk=J(null),Nk=J(!0),Pk=J(null);async function Fk(){try{let e=await Z.captures(kk);jk.value=e.enabled!==!1,Ak.value=e.captures||[],Mk.value=null}catch(e){Mk.value=e.message||String(e)}finally{Nk.value=!1}}function Ik(e){let t=Ak.value.find(t=>t.id===e);return t&&(Pk.value=t),!!t}function Lk(){Ak.value.length&&(Pk.value=Ak.value[0])}function Rk(){pf(`captures`,()=>{Fk(),yk()})}var zk=P({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=St(n,`class`),a=D(i,r);return(e,t)=>(L(),q(V(Ka),G({"data-slot":`tabs`,"data-orientation":V(a).orientation||`horizontal`},V(a),{class:V(W)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:I(t=>[K(e.$slots,`default`,He(he(t)))]),_:3},16,[`data-orientation`,`class`]))}}),Bk=P({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=St(t,`class`);return(e,r)=>(L(),q(V(Ya),G({"data-slot":`tabs-content`,class:V(W)(`text-sm flex-1 outline-none`,t.class)},V(n)),{default:I(()=>[K(e.$slots,`default`)]),_:3},16,[`class`]))}}),Vk=P({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=St(t,`class`,`variant`);return(r,i)=>(L(),q(V(Xa),G({"data-slot":`tabs-list`,"data-variant":e.variant},V(n),{class:V(W)(V(Uk)({variant:e.variant}),t.class)}),{default:I(()=>[K(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),Hk=P({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=St(t,`class`),r=T(n);return(e,n)=>(L(),q(V(Za),G({"data-slot":`tabs-trigger`,class:V(W)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:oLine truncated
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var AH=gH(`CharSizeService`),jH=gH(`CoreBrowserService`),MH=gH(`MouseService`),NH=gH(`RenderService`),PH=gH(`SelectionService`),FH=gH(`CharacterJoinerService`),IH=gH(`ThemeService`),LH=gH(`LinkProviderService`),RH=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?WH.isErrorNoTelemetry(e)?new WH(e.message+`
@@ -184,7 +184,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),GK&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=mq(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=kK(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-hq),hq),t/=hq,t/Math.abs(t)+Math.round(t*(gq-1)))}shouldForceSelection(e){return VK?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),_q)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(VK&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active Line truncated
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(WW(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(iU(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<_Y+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===_Y+1&&(this._liveRegion.textContent+=YV.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return qV.get()},set promptLabel(e){qV.set(e)},get tooMuchOutput(){return YV.get()},set tooMuchOutput(e){YV.set(e)}}}_verifyIntegers(...e){for(AY of e)if(AY===1/0||isNaN(AY)||AY%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(AY of e)if(AY&&(AY===1/0||isNaN(AY)||AY%1!=0||AY<0))throw Error(`This API only accepts positive integers`)}},MY=2,NY=1,PY=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(MY,Math.floor(u/e.css.cell.width)),rows:Math.max(NY,Math.floor(l/e.css.cell.height))}}},FY={class:`flex h-[32rem] min-h-0 flex-col gap-2`},IY={key:0,class:`text-sm text-fg-muted`,role:`status`},LY=P({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=J(null),r=J(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Fe(()=>{let e=n.value;if(!e)return;i=new jY({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new PY,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),Ze(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(L(),j(`div`,FY,[r.value===`open`?F(``,!0):(L(),j(`p`,IY,[r.value===`connecting`?(L(),j(U,{key:0},[H(`Connecting…`)],64)):r.value===`closed`?(L(),j(U,{key:1},[H(`The sandbox ended.`)],64)):(L(),j(U,{key:2},[H(`Sandbox unavailable.`)],64))])),R(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),RY={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},zY={class:`inline-flex items-center gap-2`},BY={class:`inline-flex items-center gap-2`},VY=`__all__`,HY=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>yN.map(e=>({value:e.value||VY,label:e.label}))),a=Y(()=>n.filters.level||VY),o=Y(()=>n.filters.stage||VY);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===VY?``:String(e)})}function l(e){s({stage:String(e)===VY?``:String(e)})}return(t,n)=>(L(),j(`div`,RY,[R(`div`,zY,[A(V(Wu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Ju),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(Ku),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(qu),{key:e.value,value:e.value},{default:I(()=>[H(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),R(`div`,BY,[A(V(Wu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Ju),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(Ku),null,{default:I(()=>[A(V(qu),{value:VY},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(qu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),UY={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},WY={key:2,class:`flex flex-col items-start gap-2 py-3`},GY={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return qV.get()},set promptLabel(e){qV.set(e)},get tooMuchOutput(){return YV.get()},set tooMuchOutput(e){YV.set(e)}}}_verifyIntegers(...e){for(AY of e)if(AY===1/0||isNaN(AY)||AY%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(AY of e)if(AY&&(AY===1/0||isNaN(AY)||AY%1!=0||AY<0))throw Error(`This API only accepts positive integers`)}},MY=2,NY=1,PY=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(MY,Math.floor(u/e.css.cell.width)),rows:Math.max(NY,Math.floor(l/e.css.cell.height))}}},FY={class:`flex h-[32rem] min-h-0 flex-col gap-2`},IY={key:0,class:`text-sm text-fg-muted`,role:`status`},LY=P({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=J(null),r=J(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Fe(()=>{let e=n.value;if(!e)return;i=new jY({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new PY,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),Ze(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(L(),j(`div`,FY,[r.value===`open`?F(``,!0):(L(),j(`p`,IY,[r.value===`connecting`?(L(),j(U,{key:0},[H(`Connecting…`)],64)):r.value===`closed`?(L(),j(U,{key:1},[H(`The sandbox ended.`)],64)):(L(),j(U,{key:2},[H(`Sandbox unavailable.`)],64))])),R(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),RY={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},zY={class:`inline-flex items-center gap-2`},BY={class:`inline-flex items-center gap-2`},VY=`__all__`,HY=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>yN.map(e=>({value:e.value||VY,label:e.label}))),a=Y(()=>n.filters.level||VY),o=Y(()=>n.filters.stage||VY);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===VY?``:String(e)})}function l(e){s({stage:String(e)===VY?``:String(e)})}return(t,n)=>(L(),j(`div`,RY,[R(`div`,zY,[A(V(Wu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Ju),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(Ku),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(qu),{key:e.value,value:e.value},{default:I(()=>[H(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),R(`div`,BY,[A(V(Wu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Ju),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(Ku),null,{default:I(()=>[A(V(qu),{value:VY},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(qu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),UY={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},WY={key:2,class:`flex flex-col items-start gap-2 py-3`},GY={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};nQ.defaultYaml={explicit:!1,version:`1.2`},nQ.defaultTags={"!!":`tag:yaml.org,2002:`};function rQ(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 iQ(e){let t=new Set;return YZ(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function aQ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function oQ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=iQ(e);let a=aQ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(VZ(t.node)||UZ(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 sQ(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=sQ(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=sQ(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=sQ(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=sQ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function cQ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>cQ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!GZ(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 lQ=class{constructor(e){Object.defineProperty(this,IZ,{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(!RZ(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=cQ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?sQ(i,{"":o},``,o):o}},uQ=class extends lQ{constructor(e){super(AZ),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=[],YZ(e,{Node:(e,t)=>{(LZ(t)||GZ(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||=(cQ(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=dQ(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(rQ(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 dQ(e,t,n){if(LZ(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(UZ(t)){let r=0;for(let i of t.items){let t=dQ(e,i,n);t>r&&(r=t)}return r}if(BZ(t)){let r=dQ(e,t.key,n),i=dQ(e,t.value,n);return Math.max(r,i)}return 1}var fQ=e=>!e||typeof e!=`function`&&typeof e!=`object`,pQ=class extends lQ{constructor(e){super(PZ),this.value=e}toJSON(e,t){return t?.keep?this.value:cQ(this.value,e,t)}toString(){return String(this.value)}};pQ.BLOCK_FOLDED=`BLOCK_FOLDED`,pQ.BLOCK_LITERAL=`BLOCK_LITERAL`,pQ.PLAIN=`PLAIN`,pQ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,pQ.QUOTE_SINGLE=`QUOTE_SINGLE`;var mQ=`tag:yaml.org,2002:`;function hQ(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 gQ(e,t,n){if(RZ(e)&&(e=e.contents),WZ(e))return e;if(BZ(e)){let t=n.schema[MZ].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 uQ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=mQ+t.slice(2));let l=hQ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new pQ(e);return c&&(c.node=t),t Line truncated
`)?xQ(n,t):n.includes(`
`)?`
@@ -322,4 +322,4 @@ 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`},T7=class extends Error{constructor(e,...t){super(w7[e]?.call(w7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function E7(e){return`clientX`in e}function Uce(e){return`sourceEvent`in e}function D7(e,t){let n=E7(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 O7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function Wce(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function k7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var Gce=()=>!0;function A7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function Kce(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())L5(i,I5(e))>0&&r.push(e);return r}var qce=250;function Jce(e,t,n,r){let i=[],a=1/0,o=Kce(e,n,t+qce);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}=x7(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 j7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Gce},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:_}=D7(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=M7(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===E5.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=N7(t,e,a,p,n,!0)}return b}function M7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Yce(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function Xce(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function N7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===E5.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,...x7(o,c,c.position,!0)}:c}var P7={[C5.Left]:C5.Right,[C5.Right]:C5.Left,[C5.Top]:C5.Bottom,[C5.Bottom]:C5.Top},Zce=[`production`,`prod`];function F7(e,...t){I7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function I7(){return!Zce.includes(`production`)}function L7(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,...R5(t)}}):null}function R7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ze(()=>{o.blur()})):n([e])}function z7(e){return V(e)!==void 0}function Qce(e,t,n,r){if(!e||!e.source||!e.target)return n(new T7(C7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=H5(e)?e:{...e,id:J5(e)},i=K5(i,void 0,r),!jce(i,t)&&i}function $ce(e,t,n,r,i){if(!t.source||!t.target)return i(new T7(C7.EDGE_INVALID,e.id)),!1;if(!n)return i(new T7(C7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?J5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function B7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!U5(o)){n(new T7(C7.NODE_INVALID,o?.id));continue}let s=Oce(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 T7(C7.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 V7(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 H7(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}`;V7(`sourcLine truncated
`)},B(e.data.summary||e.data.detail),9,Vue)):F(``,!0),e.data.when||e.data.retry||e.data.continues?(L(),j(`div`,Hue,[e.data.when?(L(),j(`span`,{key:0,class:`flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono`,title:`Runs only when ${e.data.when}`},[A(V(Xl),{class:`size-3 shrink-0`,"aria-hidden":`true`}),R(`span`,Wue,B(e.data.when),1)],8,Uue)):F(``,!0),e.data.retry?(L(),j(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[A(V(xu),{class:`size-3`,"aria-hidden":`true`}),H(`×`+B(e.data.retry),1)],8,Gue)):F(``,!0),e.data.continues?(L(),j(`span`,Kue,[A(V(ju),{class:`size-3`,"aria-hidden":`true`}),r[10]||=H(`continues`,-1)])):F(``,!0)])):F(``,!0),e.data.run?.error?(L(),j(`p`,{key:4,class:`mt-1 line-clamp-2 text-caption text-danger`,title:e.data.run.error},B(e.data.run.error),9,que)):F(``,!0)],64))]),A(it,{"enter-from-class":`opacity-0 -translate-y-1`,"enter-active-class":`transition duration-200`,"leave-to-class":`opacity-0`,"leave-active-class":`transition duration-100`},{default:I(()=>[e.data.expanded?(L(),j(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:r[6]||=_t(()=>{},[`stop`])},[K(t.$slots,`default`)])):F(``,!0)]),_:3}),A(V(i9),{type:`source`,position:V(C5).Bottom},null,8,[`position`]),A(V(i9),{id:`data-out`,type:`source`,position:V(C5).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(L(),q(V(i9),{key:1,id:`otherwise`,type:`source`,position:V(C5).Right,class:`!opacity-0`},null,8,[`position`])):F(``,!0)],2))}}),Yue={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},Xue={class:`flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle`},Zue={key:0},Que={key:1,class:`font-mono`},$ue=P({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(L(),j(`div`,Yue,[R(`div`,Xue,[e.data.lane===`switch`?(L(),j(U,{key:0},[A(V(Mu),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(L(),j(`span`,Zue,`otherwise`)):(L(),j(`span`,Que,`= `+B(e.data.title),1))],64)):(L(),j(U,{key:1},[A(V(Ql),{class:`size-3`,"aria-hidden":`true`}),H(B(e.data.title),1)],64))])]))}}),ede={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},O9=240,tde=416,k9=-140,nde=72,rde=.9,A9=P({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},readonly:{type:Boolean},restartable:{type:Boolean},marks:{},problems:{},title:{},summary:{}},emits:[`toggle`,`insert`,`duplicate`,`move`,`remove`,`rename`,`restart`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>!!n.types?.length&&!n.readonly),a=Y(()=>[...n.types??[],`parallel`,`switch`]),o=Y(()=>a.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),s=e=>e&&T0(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=J(null),u=J(null),d=aee(`(max-width: 767px)`),f=Y(()=>{let e=W0(t2(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:k9},data:{kind:`workflow`,key:`workflow`,title:n.title||`Workflow`,type:``,detail:n.summary??``}},...e.nodes],edges:[{id:`flow-workflow-start`,source:`workflow`,target:`start`,kind:`flow`},...e.edges]}:e}),p=Y(()=>f.value.nodes.filter(e=>e.data.path?.length===2).length),m=J({}),h=J({}),g=Y(()=>f.value.nodes.find(e=>e.type===`step`&&c(e.data)===n.open));function _(e,t){m.value={...m.value,[e]:t},g.value?.id!==e&&(h.value={...h.value,[e]:t})}let v=Y(()=>{let e=d.value?void 0:g.value?.id;return e&&m.value[e]?Math.max(0,m.value[e]-(h.value[e]??m.value[e])):0}),y=uee(),b=ree(v,{duration:Y(()=>y.value===`reduce`?0:200)}),x=Y(()=>{let e=new Map;for(let t of f.value.nodes){if(t.type!==`step`)continue;let n=(t.id===g.value?.id?h.value[t.id]:void 0)??m.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-nde))}return[...e]}),S=e=>x.value.reduce((t,[n,r])=>n<e?t+r:t,0);function C(e){let t=e.data,a=c(t),o=t.path,s={triggers:t.kind===`start`?n.triggers??[]:t.triggers,expanded:!d.value&&a===n.open,editable:i.value,problem:o?n.problems?.[a]:void 0,onResize:t=>_(e.id,t)};return n.types?.length&&(s.onToggle=()=>r(`toggle`,a)),i.value&&o&&(s.onRename=e=>r(`rename`,o,e),s.onDuplicate=()=>r(`duplicate`,o),s.onRemove=()=>r(`remove`,o)),{...e,data:{...t,...s}}}let w=e=>{let t=g.value;return d.value||!t||!e.style?.width?!1:e.position.x<=t.position.x&&e.position.x+parseFloat(String(e.style.width))>=t.position.x+O9};function ee(e){let t=g.value;if(d.value||!t)return 0;if(e.id===t.id||w(e))return-88;let n=t.position.x+O9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?O9:32,i=e.position.x+r/2;return Math.abs(i-n)<O9/2?0:i<n?-88:88}let T=Y(()=>{let e=g.value;return f.value.nodes.map(t=>{let a=t;t.type===`add`?t={...t,data:{...t.data,types:s(t.data.insertAfter),editable:i.value,onInsert:e=>r(`insert`,t.data.insertAfter,e)}}:t.type===`step`&&(t=C(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let c=t.position. Line truncated
`),r=t.split(`
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function j9(e){let t=y0(e).toJS(),n=new Map;for(let r of t2(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function M9(e,t,n){let r=j9(e),i=j9(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var cde={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},lde=[`aria-current`,`onClick`],ude={class:`flex items-center gap-2 text-sm`},dde={class:`font-mono text-xs text-fg-subtle`},fde=[`title`],pde={key:0,class:`px-3 py-2 text-sm text-fg-muted`},mde={key:1,class:`flex min-h-0 flex-col gap-2`},hde={class:`flex items-center gap-2 max-md:flex-wrap`},gde={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},_de={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-label leading-6`},vde={class:`inline-block w-4 select-none text-fg-subtle`},yde={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},bde={class:`flex min-h-0 flex-col gap-1`},xde={class:`text-caption font-medium uppercase text-fg-muted`},Sde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Cde={class:`flex min-h-0 flex-col gap-1`},wde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Tde=P({__name:`WorkflowHistory`,props:Ue({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Ue([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Te(e,`selected`),a=Te(e,`mode`);N(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=Y(()=>n.revisions.find(e=>e.version===i.value)),s=Y(()=>o.value?.yaml??null),c=Y(()=>s.value===null?[]:sde(s.value,n.current)),l=Y(()=>s.value!==null&&s.value===n.current),u=Y(()=>s.value===null?{}:M9(s.value,n.current,`removed`)),d=Y(()=>s.value===null?{}:M9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(L(),j(`div`,cde,[R(`ol`,{class:z(V(W)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(L(!0),j(U,null,M(e.revisions,e=>(L(),j(`li`,{key:e.version},[R(`button`,{type:`button`,class:z([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[R(`span`,ude,[R(`span`,dde,`v`+B(e.version),1),A(V(O),{variant:f[e.change]},{default:I(()=>[H(B(e.change),1)]),_:2},1032,[`variant`])]),R(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},[H(B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `,1),A(V(ww),{at:e.at},null,8,[`at`])],8,fde)],10,lde)]))),128)),e.revisions.length?F(``,!0):(L(),j(`li`,pde,B(e.error||`No recorded changes`),1))],2),e.revisions.length?(L(),q(V(Wu),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:I(()=>[A(V(Ju),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[(L(!0),j(U,null,M(e.revisions,e=>(L(),q(V(qu),{key:e.version,value:String(e.version)},{default:I(()=>[H(`v`+B(e.version)+` · `+B(e.change)+` · `+B(e.actor||`unknown`)+` · `+B(V(yw)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):F(``,!0),o.value?(L(),j(`div`,mde,[R(`div`,hde,[A(V(zk),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:I(()=>[A(V(Vk),null,{default:I(()=>[A(V(Hk),{value:`yaml`},{default:I(()=>[...n[3]||=[H(`YAML`,-1)]]),_:1}),A(V(Hk),{value:`canvas`},{default:I(()=>[...n[4]||=[H(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),A(V(X),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>r(`restore`,s.value)},{default:I(()=>[A(V(Cu),{"data-icon":`inline-start`}),n[5]||=H(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(L(),j(`p`,gde,`Workflow removed in this revision.`)):a.value===`yaml`?(L(),j(`pre`,_de,[R(`code`,null,[(L(!0),j(U,null,M(c.value,(e,t)=>(L(),j(`span`,{key:t,class:z([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-o Line truncated
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function j9(e){let t=y0(e).toJS(),n=new Map;for(let r of t2(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function M9(e,t,n){let r=j9(e),i=j9(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var cde={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},lde=[`aria-current`,`onClick`],ude={class:`flex items-center gap-2 text-sm`},dde={class:`font-mono text-xs text-fg-subtle`},fde=[`title`],pde={key:0,class:`px-3 py-2 text-sm text-fg-muted`},mde={key:1,class:`flex min-h-0 flex-col gap-2`},hde={class:`flex items-center gap-2 max-md:flex-wrap`},gde={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},_de={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-label leading-6`},vde={class:`inline-block w-4 select-none text-fg-subtle`},yde={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},bde={class:`flex min-h-0 flex-col gap-1`},xde={class:`text-caption font-medium uppercase text-fg-muted`},Sde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Cde={class:`flex min-h-0 flex-col gap-1`},wde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Tde=P({__name:`WorkflowHistory`,props:Ue({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Ue([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Te(e,`selected`),a=Te(e,`mode`);N(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=Y(()=>n.revisions.find(e=>e.version===i.value)),s=Y(()=>o.value?.yaml??null),c=Y(()=>s.value===null?[]:sde(s.value,n.current)),l=Y(()=>s.value!==null&&s.value===n.current),u=Y(()=>s.value===null?{}:M9(s.value,n.current,`removed`)),d=Y(()=>s.value===null?{}:M9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(L(),j(`div`,cde,[R(`ol`,{class:z(V(W)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(L(!0),j(U,null,M(e.revisions,e=>(L(),j(`li`,{key:e.version},[R(`button`,{type:`button`,class:z([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[R(`span`,ude,[R(`span`,dde,`v`+B(e.version),1),A(V(O),{variant:f[e.change]},{default:I(()=>[H(B(e.change),1)]),_:2},1032,[`variant`])]),R(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},[H(B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `,1),A(V(ww),{at:e.at},null,8,[`at`])],8,fde)],10,lde)]))),128)),e.revisions.length?F(``,!0):(L(),j(`li`,pde,B(e.error||`No recorded changes`),1))],2),e.revisions.length?(L(),q(V(Wu),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:I(()=>[A(V(Ju),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[(L(!0),j(U,null,M(e.revisions,e=>(L(),q(V(qu),{key:e.version,value:String(e.version)},{default:I(()=>[H(`v`+B(e.version)+` · `+B(e.change)+` · `+B(e.actor||`unknown`)+` · `+B(V(yw)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):F(``,!0),o.value?(L(),j(`div`,mde,[R(`div`,hde,[A(V(zk),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:I(()=>[A(V(Vk),null,{default:I(()=>[A(V(Hk),{value:`yaml`},{default:I(()=>[...n[3]||=[H(`YAML`,-1)]]),_:1}),A(V(Hk),{value:`canvas`},{default:I(()=>[...n[4]||=[H(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),A(V(X),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>r(`restore`,s.value)},{default:I(()=>[A(V(Cu),{"data-icon":`inline-start`}),n[5]||=H(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(L(),j(`p`,gde,`Workflow removed in this revision.`)):a.value===`yaml`?(L(),j(`pre`,_de,[R(`code`,null,[(L(!0),j(U,null,M(c.value,(e,t)=>(L(),j(`span`,{key:t,class:z([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-o Line truncated
+1 -5
View File
@@ -17,7 +17,7 @@ export type CapabilitySections = Record<string, boolean>;
*/
export interface SectionedRoute {
path: string;
meta?: { section?: string; settings?: boolean; instance?: boolean };
meta?: { section?: string; settings?: boolean };
}
// hiddenRoutes returns the paths whose section the server reported it cannot
@@ -27,9 +27,6 @@ export interface SectionedRoute {
// read shows everything.
//
// The Instance settings area belongs to the system org (`sections.settings`).
// Two of its pages are not the instance's: appearance is the caller's own
// preference and audit reads only the caller's org, so they opt out with
// `instance: false`.
export function hiddenRoutes(
sections: CapabilitySections | null | undefined,
table: SectionedRoute[],
@@ -41,7 +38,6 @@ export function hiddenRoutes(
(typeof r.meta?.section === "string" &&
sections[r.meta.section] === false) ||
(r.meta?.settings === true &&
r.meta.instance !== false &&
sections.settings === false),
)
.map((r) => r.path);
+2 -2
View File
@@ -33,7 +33,7 @@ const orgSpecs: NavSpec[] = [
sections: [
{
label: "People & access",
paths: ["/org/members", "/org/agents", "/org/workspaces", "/org/policies"],
paths: ["/org/members", "/org/agents", "/org/workspaces", "/org/policies", "/org/audit"],
},
{
label: "Connections & models",
@@ -80,7 +80,7 @@ const settings: NavSpec = {
"/settings/status",
],
},
{ paths: ["/settings/authentication", "/settings/audit"] },
{ paths: ["/settings/authentication"] },
],
};
+1 -1
View File
@@ -24,7 +24,7 @@ const error = ref("");
// Policies and models act on the caller's own org server-side, so an instance
// admin looking at another org is sent back rather than editing the wrong one.
const OWN_ORG_ONLY = ["/org/policies", "/org/models", "/org/connections", "/org/repositories"];
const OWN_ORG_ONLY = ["/org/audit", "/org/policies", "/org/models", "/org/connections", "/org/repositories"];
const away = computed(() => !!org.value && org.value.id !== homeOrg.value);
const route = useRoute();
const router = useRouter();
+13 -14
View File
@@ -205,6 +205,17 @@ const routes = [
component: OrgAgentsPage,
meta: { section: "org_agents", label: "Agents", navPath: "/org" },
},
{
path: "audit",
name: "audit",
component: AuditPage,
meta: {
section: "org_audit",
label: "Audit",
navPath: "/org",
description: "Settings, access, identity and runtime events.",
},
},
{
path: "workspaces",
name: "org-workspaces",
@@ -380,20 +391,8 @@ const routes = [
section: "settings",
},
},
{
path: "/settings/audit",
name: "audit",
component: AuditPage,
meta: {
navPath: "/settings",
settings: true,
// Reads only the caller's own org, so any org may open it.
instance: false,
label: "Audit",
description: "Settings, access, identity and runtime events.",
},
},
{ path: "/settings/history", redirect: (to: RouteLocationGeneric) => ({ path: "/settings/audit", query: to.query, hash: to.hash }), meta: { nav: false } },
{ path: "/settings/history", redirect: (to: RouteLocationGeneric) => ({ path: "/org/audit", query: to.query, hash: to.hash }), meta: { nav: false } },
{ path: "/settings/audit", redirect: (to: RouteLocationGeneric) => ({ path: "/org/audit", query: to.query, hash: to.hash }), meta: { nav: false } },
{
path: "/settings",
redirect: "/settings/status",
+15
View File
@@ -7,8 +7,10 @@ import { storeToRefs } from "pinia";
import { Plus } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import { useExtensionsStore } from "@/stores/extensions";
import { useOrgStore } from "@/stores/org";
import CardAccordion from "./CardAccordion.vue";
import ConnectionCard from "./ConnectionCard.vue";
@@ -20,8 +22,10 @@ const KIND = "forge-connections";
const store = useSettingsStore();
const orgStore = useOrgStore();
const { catalog, catalogError } = storeToRefs(store);
const extensions = useExtensionsStore();
onMounted(() => {
void store.load();
void extensions.loadInstalled();
orgStore.watchIdentities();
});
@@ -30,6 +34,14 @@ const form = computed(() => store.formFor(KIND));
const connections = computed(() => (store.draftValue(KIND) ?? []) as Connection[]);
const error = computed(() => store.pageErrorFor(KIND));
const open = ref("0");
// What stops a connection serving a repository, from what the page already
// holds. Nothing is claimed while the installed forges could not be read.
function connectionIssue(item: Connection): string {
if (item.type && !extensions.error && !extensions.forges.some((e) => e.name === item.type)) return "Forge not enabled";
if (!item.token?.key) return "No credential";
return "";
}
const unsaved = computed(() => store.changesFor(KIND).length > 0);
// Each edit writes a new array: the document is a root list, and the draft
@@ -102,6 +114,9 @@ function addConnection() {
mono
@remove="removeConnection"
>
<template #aside="{ item }">
<Badge v-if="connectionIssue(item as Connection)" variant="warn">{{ connectionIssue(item as Connection) }}</Badge>
</template>
<template #default="slot">
<ConnectionCard
:model-value="slot.item"
+1 -1
View File
@@ -9,7 +9,7 @@ const props = defineProps<{ kinds: string[] }>();
<template>
<Button variant="ghost" size="sm" as-child>
<RouterLink :to="{ path: '/settings/audit', query: { section: props.kinds.join(',') } }">
<RouterLink :to="{ path: '/org/audit', query: { section: props.kinds.join(',') } }">
<History data-icon="inline-start" /> Audit</RouterLink>
</Button>
</template>
+12
View File
@@ -7,6 +7,7 @@ import { Plus } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
@@ -111,6 +112,14 @@ const checkAgent=ref("");
const checking=ref("");
const results=ref<Record<string,AccessCheck>>({});
watch([checkAgent,()=>JSON.stringify(repos.value)],()=>{results.value={}});
// Where a repository stands: a missing connection is known from the draft, the
// rest only after an access check.
function readiness(repo: Repo): { variant: "ok" | "warn" | "danger"; label: string } | null {
if (!repo.connection || !connections.value.some((connection) => connection.id === repo.connection)) return { variant: "warn", label: "No connection" };
const result = results.value[`${repo.owner}/${repo.name}`];
if (!result) return null;
return result.verified ? { variant: "ok", label: "Verified" } : { variant: "danger", label: "Check failed" };
}
async function checkAccess(repo:Repo):Promise<void>{
if(unsaved.value || !checkAgent.value || checking.value)return;
const key=`${repo.owner}/${repo.name}`;
@@ -138,6 +147,9 @@ async function checkAccess(repo:Repo):Promise<void>{
<template v-if="form">
<CardAccordion v-model:open="open" :items="repos" :title="(r) => `${r.owner}/${r.name}`" remove-label="Remove" mono @remove="removeRepo">
<template #aside="{ item }">
<Badge v-if="readiness(item as Repo)" :variant="readiness(item as Repo)!.variant">{{ readiness(item as Repo)!.label }}</Badge>
</template>
<template #default="{ item: repo, index: i }">
<FieldGroup class="@container/field-group">
<Field orientation="responsive">
+11
View File
@@ -10,6 +10,7 @@ import {
EmptyTitle,
} from "@/components/ui/empty";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import PanelError from "./PanelError.vue";
import PanelLoading from "./PanelLoading.vue";
@@ -46,6 +47,13 @@ const attempt = computed(() =>
const meta = computed(() => stageStatusMeta(attempt.value?.status));
const stages = computed(() => attempt.value?.stages || []);
// The fix applies to the attempt that parked, not to the ones before it.
const recovery = computed(() =>
run.task?.status === "parked" && Number(attempt.value?.attempt) === Math.max(...attempts.value.map((a) => Number(a.attempt)))
? props.state?.recovery
: undefined,
);
/**
* Master-detail selection (docs/prds/task-run-master-detail.md): clicking a
* stage commands the inspector to the log tab with this stage's filter set.
@@ -118,6 +126,9 @@ const timeLimit = computed(() => {
<span v-if="timeLimit" class="text-xs text-fg-muted">{{
timeLimit
}}</span>
<Button v-if="recovery" as-child size="sm" variant="outline">
<RouterLink :to="recovery.link">{{ recovery.label }}</RouterLink>
</Button>
</div>
<Alert v-if="ownError" variant="destructive" class="mb-3 whitespace-pre-wrap break-words"><AlertDescription>{{ ownError }}</AlertDescription></Alert>
<ol