@whoz-oss/coday-factory-cockpit 0.0.0-workstream-forge.290 → 0.0.0-workstream-forge.292
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-o7dvpTSi.js → chunk-B-QNzoQd.js} +1 -1
- package/browser/chunk-B2djg1SY.js +1 -0
- package/browser/{chunk-CUbBr2J_.js → chunk-Bbkjd_hF.js} +1 -1
- package/browser/{chunk-wXC1cF2b.js → chunk-Bw2TqLtz.js} +1 -1
- package/browser/{chunk-Dwsyk4GD.js → chunk-BwlwiO59.js} +1 -1
- package/browser/{chunk-CW8pmj7J.js → chunk-BwyaW4df.js} +1 -1
- package/browser/chunk-CCw_vtw7.js +750 -0
- package/browser/{chunk-TuXWgar3.js → chunk-CH5NCJ8J.js} +1 -1
- package/browser/{chunk-oD82fgLm.js → chunk-CMCT2R5D.js} +1 -1
- package/browser/{chunk-BYxLhbNT.js → chunk-C_M8eONl.js} +1 -1
- package/browser/{chunk-BGom_h8i.js → chunk-ChWPHDMB.js} +1 -1
- package/browser/{chunk-suRqRnfb.js → chunk-CsIB6pkT.js} +9 -9
- package/browser/chunk-DAQCJ8YV.js +171 -0
- package/browser/{chunk-pqCkBoVK.js → chunk-DUZba2Ku.js} +1 -1
- package/browser/{chunk-DnN1wPPn.js → chunk-IYlPieu1.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/main-HHE6S2WZ.js +3922 -0
- package/package.json +1 -1
- package/browser/chunk-C8qyEKmx.js +0 -1
- package/browser/chunk-CHdKWxhc.js +0 -750
- package/browser/chunk-O7g8ETsK.js +0 -171
- package/browser/main-PLOXYS6B.js +0 -3922
|
@@ -1 +1 @@
|
|
|
1
|
-
import {B as Be$1,P as Pe$1}from'./chunk-BGom_h8i.js';import {f,c as cn,aa as Hr,ab as Be,Z,q as ls,ac as _o,ad as wt,k as k_,y as cc,ae as g,H as He,af as vo,ag as fo,ah as Ii,ai as co,aj as ho,ak as nr,al as Sr,am as wr,G as Gu,x as x9,A as A9,a as Pt,I as It,M as Me,S as Se$1,an as _i,L as L4,P as P4,W as Wr,b as Hr$1,d as ce,e as kc,z as zM,h as hp,i as is,X as Xc,s as sM,ao as YT,Q as Qc,J as Ji,l as ss,v as vb,ap as QT,j as aM,m as kb,a8 as Dp,aq as Hb,ar as F_,as as bl,at as Fe$1,au as T$1,av as Dn,aw as B9,ax as Ys,ay as le,az as x,u as bM,aA as Pb}from'./main-PLOXYS6B.js';import {T,U}from'./chunk-pqCkBoVK.js';import {g as g$1}from'./chunk-oD82fgLm.js';var _=class t{api=f(F_);definitions=Z([]);namespaces=Z([]);loading=Z(false);definitionsError=Z(null);namespacesError=Z(null);submitting=Z(false);submissionError=Z(null);loadOptions(){this.loading.set(true),this.definitionsError.set(null),this.namespacesError.set(null),bl({definitions:this.api.getWorkflowDefinitions().pipe(Fe$1(e=>(this.definitionsError.set(e),T$1([])))),namespaces:this.api.getNamespaces().pipe(Fe$1(e=>(this.namespacesError.set(e),T$1([]))))}).pipe(Dn(()=>this.loading.set(false))).subscribe(({definitions:e,namespaces:o})=>{this.definitions.set(g$1(e).filter(n=>!!n.workflowType&&!!n.version&&/^[0-9a-f]{64}$/.test(n.definitionHash??""))),this.namespaces.set(B9(o));});}launch(e){return this.submitting.set(true),this.submissionError.set(null),this.api.createWorkflowRun(e,Ys()).pipe(le({error:o=>this.submissionError.set(o)}),Dn(()=>this.submitting.set(false)))}static \u0275fac=function(o){return new(o||t)};static \u0275prov=x({token:t,factory:t.\u0275fac})};function we(t,e){return this.definitionKey(e)}var ke=(t,e)=>e.id;function Ne(t,e){t&1&&(kc(0,"div",4)(1,"mat-icon",23),zM(2,"check_circle"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Le(t,e){t&1&&(kc(0,"div",5)(1,"mat-icon",23),zM(2,"error"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Te(t,e){t&1&&(kc(0,"div",6)(1,"mat-icon",23),zM(2,"warning"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Ie(t,e){t&1&&(kc(0,"div",7)(1,"mat-icon",23),zM(2,"error"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Pe(t,e){if(t&1&&(kc(0,"mat-option",11),zM(1),hp()),t&2){let o=e.$implicit,n=bM();vb("value",n.definitionKey(o)),Ji(),Pb("",o.workflowType,"@",o.version," \xB7 ",o.definitionHash?.slice(0,12));}}function Fe(t,e){t&1&&(kc(0,"mat-error"),zM(1,"Workflow definition is required."),hp());}function Re(t,e){if(t&1&&(kc(0,"mat-option",11),zM(1),hp()),t&2){let o=e.$implicit;vb("value",o.id),Ji(),kb(o.name);}}function De(t,e){t&1&&(kc(0,"mat-error"),zM(1,"An accessible namespace is required."),hp());}function Oe(t,e){t&1&&(kc(0,"mat-hint"),zM(1),hp()),t&2&&(Ji(),Dp("Namespace id: ",e.id));}function qe(t,e){t&1&&(kc(0,"mat-hint",13),zM(1,"Loading namespaces\u2026"),hp());}function Ae(t,e){t&1&&(kc(0,"mat-hint",14),zM(1,"No AgentOS namespace is available."),hp());}function We(t,e){t&1&&(kc(0,"mat-error"),zM(1,"The objective must not exceed 4,000 characters."),hp());}function Ke(t){let e=t?.code??"UNKNOWN_ERROR",o=t?.message?.trim();return o?`${o} (${e})`:`Launch failed (${e}).`}var Se=class t{launchState=f(_);store=f(cn);router=f(Hr);destroyRef=f(Be);definitions=this.launchState.definitions;namespaces=this.launchState.namespaces;submitting=this.launchState.submitting;successMessage=Z(null);errorMessage=Z(null);definitionsLoading=this.launchState.loading;definitionsError=ls(()=>this.launchState.definitionsError()?.message??null);launchTargetsLoading=this.launchState.loading;launchTargetsError=ls(()=>this.launchState.namespacesError()?.message??null);form=f(_o).group({definitionKey:["",wt.required],namespaceId:["",wt.required],title:["",wt.maxLength(200)],ticket:["",wt.maxLength(64)],initialRequest:["",wt.maxLength(4e3)]});selectedNamespaceId=T(this.form.controls.namespaceId.valueChanges,{initialValue:this.form.controls.namespaceId.value});selectedNamespace=ls(()=>this.namespaces().find(e=>e.id===this.selectedNamespaceId())??null);constructor(){f(k_).crumbs.set([{label:"Workstreams",link:"/workstreams"},{label:"Launch a run"}]),this.launchState.loadOptions(),cc(()=>{let e=this.definitions();e.length===1&&!this.form.controls.definitionKey.value&&this.form.controls.definitionKey.setValue(this.definitionKey(e[0]));let o=this.namespaces();o.length===1&&!this.form.controls.namespaceId.value&&this.form.controls.namespaceId.setValue(o[0]?.id??"");});}definitionKey(e){return JSON.stringify([e?.workflowType,e?.version,e?.definitionHash])}onSubmit(){if(this.submitting())return;if(this.form.invalid){this.form.markAllAsTouched();return}let{definitionKey:e,namespaceId:o,title:n,ticket:b,initialRequest:x}=this.form.getRawValue(),f=this.definitions().find(u=>this.definitionKey(u)===e);if(this.definitionsLoading()||this.definitionsError()||!f){this.errorMessage.set("Select an available workflow version before launching.");return}if(this.launchTargetsLoading()||this.launchTargetsError()||!this.namespaces().some(u=>u.id===o)){this.errorMessage.set("Select an available namespace before launching.");return}let v=n.trim(),C=b.trim(),F=x.trim();this.submitting.set(true),this.successMessage.set(null),this.errorMessage.set(null),this.launchState.launch(g(g(g({namespaceId:o,workflowType:f.workflowType,definitionVersion:f.version,definitionHash:f.definitionHash},v?{title:v}:{}),F?{initialRequest:F}:{}),C?{parameters:{ticket:C}}:{})).pipe(U(this.destroyRef)).subscribe({next:u=>{let R=u?.submissionId;this.successMessage.set(R?`Launch accepted (id: ${R})`:"Launch accepted."),this.store.selectNamespace(o),this.store.refresh(),this.router.navigate(["/sessions",u.workflowId],{queryParams:{namespaceId:o}});},error:u=>{this.errorMessage.set(Ke(u));}});}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=He({type:t,selectors:[["sf-launch-page"]],features:[Hb([_])],decls:55,vars:13,consts:[[1,"page"],[1,"page-head"],[1,"titles"],[1,"sf-muted"],["role","status","data-launch-success","true",1,"banner","banner--success"],["role","alert","data-launch-error","true",1,"banner","banner--error"],["role","alert","data-launch-definitions-error","true",1,"banner","banner--warn"],["role","alert","data-launch-targets-error","true",1,"banner","banner--error"],["novalidate","",1,"sf-panel","launch-form",3,"ngSubmit","formGroup"],["appearance","outline",1,"field"],["formControlName","definitionKey","data-launch-workflow-type","true"],[3,"value"],["formControlName","namespaceId","data-launch-namespace","true"],["data-launch-targets-loading","true"],["data-launch-targets-empty","true"],["appearance","outline",1,"field","field--wide"],["matInput","","formControlName","title","maxlength","200","placeholder","Readable run title","data-launch-title","true"],["matInput","","formControlName","ticket","placeholder","ABC-123 or #123","data-launch-ticket","true",1,"sf-mono"],["matInput","","id","launch-initial-request","formControlName","initialRequest","aria-describedby","launch-initial-request-help","rows","5","maxlength","4000","data-launch-initial-request","true"],["id","launch-initial-request-help"],[1,"form-actions"],["mat-flat-button","","type","submit","data-launch-submit","true",1,"sf-primary",3,"disabled"],["mat-stroked-button","","routerLink","/workstreams",1,"sf-secondary"],["aria-hidden","true"]],template:function(o,n){if(o&1&&(kc(0,"div",0)(1,"header",1)(2,"div",2)(3,"h1"),zM(4,"Launch a run"),hp(),kc(5,"p",3),zM(6," Creates and durably submits a real workflow. Factory assigns identity and execution context. "),hp()()(),is(7,Ne,5,1,"div",4),is(8,Le,5,1,"div",5),is(9,Te,5,1,"div",6),is(10,Ie,5,1,"div",7),kc(11,"form",8),Xc("ngSubmit",function(){return n.onSubmit()}),kc(12,"mat-form-field",9)(13,"mat-label"),zM(14,"Workflow definition"),hp(),kc(15,"mat-select",10),sM(16,Pe,2,4,"mat-option",11,we,true),hp(),YT(),is(18,Fe,2,0,"mat-error"),kc(19,"mat-hint"),zM(20),hp()(),kc(21,"mat-form-field",9)(22,"mat-label"),zM(23,"AgentOS namespace"),hp(),kc(24,"mat-select",12),sM(25,Re,2,2,"mat-option",11,ke),hp(),YT(),is(27,De,2,0,"mat-error"),is(28,Oe,2,1,"mat-hint")(29,qe,2,0,"mat-hint",13)(30,Ae,2,0,"mat-hint",14),hp(),kc(31,"mat-form-field",15)(32,"mat-label"),zM(33,"Title (optional)"),hp(),Qc(34,"input",16),YT(),kc(35,"mat-hint"),zM(36,"Factory generates a readable title if omitted."),hp()(),kc(37,"mat-form-field",9)(38,"mat-label"),zM(39,"Ticket / Issue (optional)"),hp(),Qc(40,"input",17),YT(),hp(),kc(41,"mat-form-field",15)(42,"mat-label"),zM(43,"What would you like to do? (optional)"),hp(),Qc(44,"textarea",18),YT(),is(45,We,2,0,"mat-error"),kc(46,"mat-hint",19),zM(47," Describe your objective, even briefly. The agent will ask for any clarifications needed. "),hp()(),kc(48,"div",20)(49,"button",21)(50,"mat-icon"),zM(51),hp(),zM(52),hp(),kc(53,"a",22),zM(54,"Cancel"),hp()()()()),o&2){let b,x,f,v,C;Ji(7),ss((b=n.successMessage())?7:-1,b),Ji(),ss((x=n.errorMessage())?8:-1,x),Ji(),ss((f=n.definitionsError())?9:-1,f),Ji(),ss((v=n.launchTargetsError())?10:-1,v),Ji(),vb("formGroup",n.form),Ji(4),QT(),Ji(),aM(n.definitions()),Ji(2),ss(n.form.controls.definitionKey.hasError("required")?18:-1),Ji(2),kb(n.definitionsLoading()?"Loading definitions\u2026":n.definitions().length?"Choose an exact version. No automatic latest selection.":"No workflow version is available."),Ji(4),QT(),Ji(),aM(n.namespaces()),Ji(2),ss(n.form.controls.namespaceId.hasError("required")?27:-1),Ji(),ss((C=n.selectedNamespace())?28:n.launchTargetsLoading()?29:!n.launchTargetsError()&&n.namespaces().length===0?30:-1,C),Ji(6),QT(),Ji(6),QT(),Ji(4),QT(),Ji(),ss(n.form.controls.initialRequest.hasError("maxlength")?45:-1),Ji(4),vb("disabled",n.submitting()||n.definitionsLoading()||!!n.definitionsError()||n.definitions().length===0||n.form.invalid||n.launchTargetsLoading()||!!n.launchTargetsError()||n.namespaces().length===0),Ji(2),kb(n.submitting()?"hourglass_top":"play_arrow"),Ji(),Dp(" ",n.submitting()?"Launching\u2026":"Launch run"," ");}},dependencies:[vo,fo,Ii,co,ho,nr,Sr,wr,Gu,x9,A9,Pt,It,Me,Se$1,_i,L4,P4,Be$1,Pe$1,Wr,Hr$1,ce],styles:[".page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px;max-width:900px}.page-head[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:12px}.titles[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:4px}h1[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:28px;font-weight:600;letter-spacing:-.01em}.titles[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:14px}.launch-form[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;padding:24px}.field[_ngcontent-%COMP%]{width:100%}.field--wide[_ngcontent-%COMP%]{grid-column:1/-1}.form-actions[_ngcontent-%COMP%]{grid-column:1/-1;display:flex;gap:10px;padding-top:8px}@media(max-width:720px){.launch-form[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr)}}"]})};export{Se as LaunchPageComponent,Ke as formatLaunchError};
|
|
1
|
+
import {B as Be$1,P as Pe$1}from'./chunk-ChWPHDMB.js';import {f,u as un,aa as Hr,ab as Be,Z,p as ls,ac as _o,ad as wt,k as k_,y as cc,ae as g,H as He,af as vo,ag as fo,ah as Ii,ai as co,aj as ho,ak as nr,al as Sr,am as wr,G as Gu,x as x9,A as A9,a as Pt,I as It,M as Me,S as Se$1,an as _i,L as L4,P as P4,W as Wr,b as Hr$1,c as ce,d as kc,z as zM,h as hp,i as is,X as Xc,s as sM,ao as YT,Q as Qc,J as Ji,j as ss,v as vb,ap as QT,g as aM,l as kb,a8 as Dp,aq as Hb,ar as F_,as as bl,at as Fe$1,au as T$1,av as Dn,aw as B9,ax as Ys,ay as le,az as x,t as bM,aA as Pb}from'./main-HHE6S2WZ.js';import {T,U}from'./chunk-DUZba2Ku.js';import {g as g$1}from'./chunk-CMCT2R5D.js';var _=class t{api=f(F_);definitions=Z([]);namespaces=Z([]);loading=Z(false);definitionsError=Z(null);namespacesError=Z(null);submitting=Z(false);submissionError=Z(null);loadOptions(){this.loading.set(true),this.definitionsError.set(null),this.namespacesError.set(null),bl({definitions:this.api.getWorkflowDefinitions().pipe(Fe$1(e=>(this.definitionsError.set(e),T$1([])))),namespaces:this.api.getNamespaces().pipe(Fe$1(e=>(this.namespacesError.set(e),T$1([]))))}).pipe(Dn(()=>this.loading.set(false))).subscribe(({definitions:e,namespaces:o})=>{this.definitions.set(g$1(e).filter(n=>!!n.workflowType&&!!n.version&&/^[0-9a-f]{64}$/.test(n.definitionHash??""))),this.namespaces.set(B9(o));});}launch(e){return this.submitting.set(true),this.submissionError.set(null),this.api.createWorkflowRun(e,Ys()).pipe(le({error:o=>this.submissionError.set(o)}),Dn(()=>this.submitting.set(false)))}static \u0275fac=function(o){return new(o||t)};static \u0275prov=x({token:t,factory:t.\u0275fac})};function we(t,e){return this.definitionKey(e)}var ke=(t,e)=>e.id;function Ne(t,e){t&1&&(kc(0,"div",4)(1,"mat-icon",23),zM(2,"check_circle"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Le(t,e){t&1&&(kc(0,"div",5)(1,"mat-icon",23),zM(2,"error"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Te(t,e){t&1&&(kc(0,"div",6)(1,"mat-icon",23),zM(2,"warning"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Ie(t,e){t&1&&(kc(0,"div",7)(1,"mat-icon",23),zM(2,"error"),hp(),kc(3,"span"),zM(4),hp()()),t&2&&(Ji(4),kb(e));}function Pe(t,e){if(t&1&&(kc(0,"mat-option",11),zM(1),hp()),t&2){let o=e.$implicit,n=bM();vb("value",n.definitionKey(o)),Ji(),Pb("",o.workflowType,"@",o.version," \xB7 ",o.definitionHash?.slice(0,12));}}function Fe(t,e){t&1&&(kc(0,"mat-error"),zM(1,"Workflow definition is required."),hp());}function Re(t,e){if(t&1&&(kc(0,"mat-option",11),zM(1),hp()),t&2){let o=e.$implicit;vb("value",o.id),Ji(),kb(o.name);}}function De(t,e){t&1&&(kc(0,"mat-error"),zM(1,"An accessible namespace is required."),hp());}function Oe(t,e){t&1&&(kc(0,"mat-hint"),zM(1),hp()),t&2&&(Ji(),Dp("Namespace id: ",e.id));}function qe(t,e){t&1&&(kc(0,"mat-hint",13),zM(1,"Loading namespaces\u2026"),hp());}function Ae(t,e){t&1&&(kc(0,"mat-hint",14),zM(1,"No AgentOS namespace is available."),hp());}function We(t,e){t&1&&(kc(0,"mat-error"),zM(1,"The objective must not exceed 4,000 characters."),hp());}function Ke(t){let e=t?.code??"UNKNOWN_ERROR",o=t?.message?.trim();return o?`${o} (${e})`:`Launch failed (${e}).`}var Se=class t{launchState=f(_);store=f(un);router=f(Hr);destroyRef=f(Be);definitions=this.launchState.definitions;namespaces=this.launchState.namespaces;submitting=this.launchState.submitting;successMessage=Z(null);errorMessage=Z(null);definitionsLoading=this.launchState.loading;definitionsError=ls(()=>this.launchState.definitionsError()?.message??null);launchTargetsLoading=this.launchState.loading;launchTargetsError=ls(()=>this.launchState.namespacesError()?.message??null);form=f(_o).group({definitionKey:["",wt.required],namespaceId:["",wt.required],title:["",wt.maxLength(200)],ticket:["",wt.maxLength(64)],initialRequest:["",wt.maxLength(4e3)]});selectedNamespaceId=T(this.form.controls.namespaceId.valueChanges,{initialValue:this.form.controls.namespaceId.value});selectedNamespace=ls(()=>this.namespaces().find(e=>e.id===this.selectedNamespaceId())??null);constructor(){f(k_).crumbs.set([{label:"Workstreams",link:"/workstreams"},{label:"Launch a run"}]),this.launchState.loadOptions(),cc(()=>{let e=this.definitions();e.length===1&&!this.form.controls.definitionKey.value&&this.form.controls.definitionKey.setValue(this.definitionKey(e[0]));let o=this.namespaces();o.length===1&&!this.form.controls.namespaceId.value&&this.form.controls.namespaceId.setValue(o[0]?.id??"");});}definitionKey(e){return JSON.stringify([e?.workflowType,e?.version,e?.definitionHash])}onSubmit(){if(this.submitting())return;if(this.form.invalid){this.form.markAllAsTouched();return}let{definitionKey:e,namespaceId:o,title:n,ticket:b,initialRequest:x}=this.form.getRawValue(),f=this.definitions().find(u=>this.definitionKey(u)===e);if(this.definitionsLoading()||this.definitionsError()||!f){this.errorMessage.set("Select an available workflow version before launching.");return}if(this.launchTargetsLoading()||this.launchTargetsError()||!this.namespaces().some(u=>u.id===o)){this.errorMessage.set("Select an available namespace before launching.");return}let v=n.trim(),C=b.trim(),F=x.trim();this.submitting.set(true),this.successMessage.set(null),this.errorMessage.set(null),this.launchState.launch(g(g(g({namespaceId:o,workflowType:f.workflowType,definitionVersion:f.version,definitionHash:f.definitionHash},v?{title:v}:{}),F?{initialRequest:F}:{}),C?{parameters:{ticket:C}}:{})).pipe(U(this.destroyRef)).subscribe({next:u=>{let R=u?.submissionId;this.successMessage.set(R?`Launch accepted (id: ${R})`:"Launch accepted."),this.store.selectNamespace(o),this.store.refresh(),this.router.navigate(["/sessions",u.workflowId],{queryParams:{namespaceId:o}});},error:u=>{this.errorMessage.set(Ke(u));}});}static \u0275fac=function(o){return new(o||t)};static \u0275cmp=He({type:t,selectors:[["sf-launch-page"]],features:[Hb([_])],decls:55,vars:13,consts:[[1,"page"],[1,"page-head"],[1,"titles"],[1,"sf-muted"],["role","status","data-launch-success","true",1,"banner","banner--success"],["role","alert","data-launch-error","true",1,"banner","banner--error"],["role","alert","data-launch-definitions-error","true",1,"banner","banner--warn"],["role","alert","data-launch-targets-error","true",1,"banner","banner--error"],["novalidate","",1,"sf-panel","launch-form",3,"ngSubmit","formGroup"],["appearance","outline",1,"field"],["formControlName","definitionKey","data-launch-workflow-type","true"],[3,"value"],["formControlName","namespaceId","data-launch-namespace","true"],["data-launch-targets-loading","true"],["data-launch-targets-empty","true"],["appearance","outline",1,"field","field--wide"],["matInput","","formControlName","title","maxlength","200","placeholder","Readable run title","data-launch-title","true"],["matInput","","formControlName","ticket","placeholder","ABC-123 or #123","data-launch-ticket","true",1,"sf-mono"],["matInput","","id","launch-initial-request","formControlName","initialRequest","aria-describedby","launch-initial-request-help","rows","5","maxlength","4000","data-launch-initial-request","true"],["id","launch-initial-request-help"],[1,"form-actions"],["mat-flat-button","","type","submit","data-launch-submit","true",1,"sf-primary",3,"disabled"],["mat-stroked-button","","routerLink","/workstreams",1,"sf-secondary"],["aria-hidden","true"]],template:function(o,n){if(o&1&&(kc(0,"div",0)(1,"header",1)(2,"div",2)(3,"h1"),zM(4,"Launch a run"),hp(),kc(5,"p",3),zM(6," Creates and durably submits a real workflow. Factory assigns identity and execution context. "),hp()()(),is(7,Ne,5,1,"div",4),is(8,Le,5,1,"div",5),is(9,Te,5,1,"div",6),is(10,Ie,5,1,"div",7),kc(11,"form",8),Xc("ngSubmit",function(){return n.onSubmit()}),kc(12,"mat-form-field",9)(13,"mat-label"),zM(14,"Workflow definition"),hp(),kc(15,"mat-select",10),sM(16,Pe,2,4,"mat-option",11,we,true),hp(),YT(),is(18,Fe,2,0,"mat-error"),kc(19,"mat-hint"),zM(20),hp()(),kc(21,"mat-form-field",9)(22,"mat-label"),zM(23,"AgentOS namespace"),hp(),kc(24,"mat-select",12),sM(25,Re,2,2,"mat-option",11,ke),hp(),YT(),is(27,De,2,0,"mat-error"),is(28,Oe,2,1,"mat-hint")(29,qe,2,0,"mat-hint",13)(30,Ae,2,0,"mat-hint",14),hp(),kc(31,"mat-form-field",15)(32,"mat-label"),zM(33,"Title (optional)"),hp(),Qc(34,"input",16),YT(),kc(35,"mat-hint"),zM(36,"Factory generates a readable title if omitted."),hp()(),kc(37,"mat-form-field",9)(38,"mat-label"),zM(39,"Ticket / Issue (optional)"),hp(),Qc(40,"input",17),YT(),hp(),kc(41,"mat-form-field",15)(42,"mat-label"),zM(43,"What would you like to do? (optional)"),hp(),Qc(44,"textarea",18),YT(),is(45,We,2,0,"mat-error"),kc(46,"mat-hint",19),zM(47," Describe your objective, even briefly. The agent will ask for any clarifications needed. "),hp()(),kc(48,"div",20)(49,"button",21)(50,"mat-icon"),zM(51),hp(),zM(52),hp(),kc(53,"a",22),zM(54,"Cancel"),hp()()()()),o&2){let b,x,f,v,C;Ji(7),ss((b=n.successMessage())?7:-1,b),Ji(),ss((x=n.errorMessage())?8:-1,x),Ji(),ss((f=n.definitionsError())?9:-1,f),Ji(),ss((v=n.launchTargetsError())?10:-1,v),Ji(),vb("formGroup",n.form),Ji(4),QT(),Ji(),aM(n.definitions()),Ji(2),ss(n.form.controls.definitionKey.hasError("required")?18:-1),Ji(2),kb(n.definitionsLoading()?"Loading definitions\u2026":n.definitions().length?"Choose an exact version. No automatic latest selection.":"No workflow version is available."),Ji(4),QT(),Ji(),aM(n.namespaces()),Ji(2),ss(n.form.controls.namespaceId.hasError("required")?27:-1),Ji(),ss((C=n.selectedNamespace())?28:n.launchTargetsLoading()?29:!n.launchTargetsError()&&n.namespaces().length===0?30:-1,C),Ji(6),QT(),Ji(6),QT(),Ji(4),QT(),Ji(),ss(n.form.controls.initialRequest.hasError("maxlength")?45:-1),Ji(4),vb("disabled",n.submitting()||n.definitionsLoading()||!!n.definitionsError()||n.definitions().length===0||n.form.invalid||n.launchTargetsLoading()||!!n.launchTargetsError()||n.namespaces().length===0),Ji(2),kb(n.submitting()?"hourglass_top":"play_arrow"),Ji(),Dp(" ",n.submitting()?"Launching\u2026":"Launch run"," ");}},dependencies:[vo,fo,Ii,co,ho,nr,Sr,wr,Gu,x9,A9,Pt,It,Me,Se$1,_i,L4,P4,Be$1,Pe$1,Wr,Hr$1,ce],styles:[".page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px;max-width:900px}.page-head[_ngcontent-%COMP%]{display:flex;align-items:flex-end;gap:12px}.titles[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:4px}h1[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:28px;font-weight:600;letter-spacing:-.01em}.titles[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:14px}.launch-form[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;padding:24px}.field[_ngcontent-%COMP%]{width:100%}.field--wide[_ngcontent-%COMP%]{grid-column:1/-1}.form-actions[_ngcontent-%COMP%]{grid-column:1/-1;display:flex;gap:10px;padding-top:8px}@media(max-width:720px){.launch-form[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr)}}"]})};export{Se as LaunchPageComponent,Ke as formatLaunchError};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {N as No,p as ls,H as He,L as L4,P as P4,a1 as jt,a2 as vt,$ as Fr,d as kc,z as zM,h as hp,a0 as Tt,v as vb,q as ln,J as Ji,l as kb}from'./main-HHE6S2WZ.js';var M=["*"],y=class a{icon=No.required();label=No("");unknownCostCount=No(void 0);tooltip=ls(()=>{let t=this.label(),e=this.unknownCostCount();return e==null?`${t} \xB7 analytics availability unknown`:e>0?`${t} \xB7 ${e} round(s) with unknown cost (floor value)`:t});static \u0275fac=function(e){return new(e||a)};static \u0275cmp=He({type:a,selectors:[["sf-metric"]],inputs:{icon:[1,"icon"],label:[1,"label"],unknownCostCount:[1,"unknownCostCount"]},ngContentSelectors:M,decls:4,vars:3,consts:[[1,"metric",3,"matTooltip"],["aria-hidden","true"]],template:function(e,o){e&1&&(Fr(),kc(0,"span",0)(1,"mat-icon",1),zM(2),hp(),Tt(3),hp()),e&2&&(vb("matTooltip",o.tooltip()),ln("aria-label",o.tooltip()),Ji(2),kb(o.icon()));},dependencies:[L4,P4,jt,vt],styles:[".metric[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:7px;height:30px;padding:0 11px;border-radius:var(--radius-md, 0);border:1px solid var(--color-divider);background:var(--color-bg);font-family:var(--sf-mono);font-size:13px;font-weight:600;color:var(--sf-text)}mat-icon[_ngcontent-%COMP%]{width:16px;height:16px;font-size:16px;color:var(--sf-text-muted)}"]})};export{y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {T as Se,_ as _e,U as Xo,f,bg as fe,V as y,d5 as _R,H as He,d6 as u0,bw as Fp,by as pb,
|
|
1
|
+
import {T as Se,_ as _e,U as Xo,f,bg as fe,V as y,d5 as _R,H as He,d6 as u0,bw as Fp,by as pb,d as kc,bs as Tg,Q as Qc,h as hp,bt as Sg,bY as bb,bo as wM,J as Ji,q as ln,aM as Mb,v as vb,a5 as cs,K as Wt,bp as wb,be as yp,bf as bp,t as bM,d7 as uA}from'./main-HHE6S2WZ.js';var I=["determinateSpinner"];function z(i,V){if(i&1&&(Tg(),kc(0,"svg",11),Qc(1,"circle",12),hp()),i&2){let e=bM();ln("viewBox",e._viewBox()),Ji(),Mb("stroke-dasharray",e._strokeCircumference(),"px")("stroke-dashoffset",e._strokeCircumference()/2,"px")("stroke-width",e._circleStrokeWidth(),"%"),ln("r",e._circleRadius());}}var D=new y("mat-progress-spinner-default-options",{providedIn:"root",factory:()=>({diameter:O})}),O=100,N=10,Z=(()=>{class i{_elementRef=f(fe);_noopAnimations;get color(){return this._color||this._defaultColor}set color(e){this._color=e;}_color;_defaultColor="primary";_determinateCircle;constructor(){let e=f(D),n=_R(),r=this._elementRef.nativeElement;this._noopAnimations=n==="di-disabled"&&!!e&&!e._forceAnimations,this.mode=r.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",!this._noopAnimations&&n==="reduced-motion"&&r.classList.add("mat-progress-spinner-reduced-motion"),e&&(e.color&&(this.color=this._defaultColor=e.color),e.diameter&&(this.diameter=e.diameter),e.strokeWidth&&(this.strokeWidth=e.strokeWidth));}mode;get value(){return this.mode==="determinate"?this._value:0}set value(e){this._value=Math.max(0,Math.min(100,e||0));}_value=0;get diameter(){return this._diameter}set diameter(e){this._diameter=e||0;}_diameter=O;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(e){this._strokeWidth=e||0;}_strokeWidth;_circleRadius(){return (this.diameter-N)/2}_viewBox(){let e=this._circleRadius()*2+this.strokeWidth;return `0 0 ${e} ${e}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=He({type:i,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(n,r){if(n&1&&wb(I,5),n&2){let s;yp(s=bp())&&(r._determinateCircle=s.first);}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(n,r){n&2&&(ln("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",r.mode==="determinate"?r.value:null)("mode",r.mode),cs("mat-"+r.color),Mb("width",r.diameter,"px")("height",r.diameter,"px")("--mat-progress-spinner-size",r.diameter+"px")("--mat-progress-spinner-active-indicator-width",r.diameter+"px"),Wt("_mat-animation-noopable",r._noopAnimations)("mdc-circular-progress--indeterminate",r.mode==="indeterminate"));},inputs:{color:"color",mode:"mode",value:[2,"value","value",Fp],diameter:[2,"diameter","diameter",Fp],strokeWidth:[2,"strokeWidth","strokeWidth",Fp]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(n,r){if(n&1&&(pb(0,z,2,8,"ng-template",null,0,uA),kc(2,"div",2,1),Tg(),kc(4,"svg",3),Qc(5,"circle",4),hp()(),Sg(),kc(6,"div",5)(7,"div",6)(8,"div",7),bb(9,8),hp(),kc(10,"div",9),bb(11,8),hp(),kc(12,"div",10),bb(13,8),hp()()()),n&2){let s=wM(1);Ji(4),ln("viewBox",r._viewBox()),Ji(),Mb("stroke-dasharray",r._strokeCircumference(),"px")("stroke-dashoffset",r._strokeDashOffset(),"px")("stroke-width",r._circleStrokeWidth(),"%"),ln("r",r._circleRadius()),Ji(4),vb("ngTemplateOutlet",s),Ji(2),vb("ngTemplateOutlet",s),Ji(2),vb("ngTemplateOutlet",s);}},dependencies:[u0],styles:[`.mat-mdc-progress-spinner {
|
|
2
2
|
--mat-progress-spinner-animation-multiplier: 1;
|
|
3
3
|
display: block;
|
|
4
4
|
overflow: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {N as No,bb as Ge,H as He,L as L4,P as P4,$ as Fr,i as is,a0 as Tt,
|
|
1
|
+
import {N as No,bb as Ge,H as He,L as L4,P as P4,$ as Fr,i as is,a0 as Tt,j as ss,a5 as cs,K as Wt,d as kc,z as zM,h as hp,t as bM,J as Ji,l as kb,Q as Qc}from'./main-HHE6S2WZ.js';var _=["*"];function P(e,i){if(e&1&&(kc(0,"mat-icon",2),zM(1),hp()),e&2){let t=bM();Wt("sf-spin",t.spin()),Ji(),kb(t.icon());}}function O(e,i){e&1&&Qc(0,"span",1);}var y=class e{tone=No("neutral");icon=No();spin=No(false,{transform:Ge});dot=No(false,{transform:Ge});size=No("md");static \u0275fac=function(t){return new(t||e)};static \u0275cmp=He({type:e,selectors:[["sf-status-chip"]],hostVars:4,hostBindings:function(t,o){t&2&&(cs("sf-chip sf-chip--"+o.tone()),Wt("sf-chip--sm",o.size()==="sm"));},inputs:{tone:[1,"tone"],icon:[1,"icon"],spin:[1,"spin"],dot:[1,"dot"],size:[1,"size"]},ngContentSelectors:_,decls:3,vars:1,consts:[["aria-hidden","true",3,"sf-spin"],["aria-hidden","true",1,"dot"],["aria-hidden","true"]],template:function(t,o){t&1&&(Fr(),is(0,P,2,3,"mat-icon",0)(1,O,1,0,"span",1),Tt(2)),t&2&&ss(o.icon()?0:o.dot()?1:-1);},dependencies:[L4,P4],styles:["[_nghost-%COMP%]{--tone: var(--color-neutral-500);--tone-text: var(--color-text-secondary);display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 12px;border-radius:var(--radius-pill, 0);border:1px solid color-mix(in srgb,var(--tone) 40%,transparent);background:color-mix(in srgb,var(--tone) 12%,transparent);color:var(--tone-text);font-size:13px;font-weight:600;white-space:nowrap}.sf-chip--sm[_nghost-%COMP%]{height:24px;padding:0 10px;font-size:12.5px}mat-icon[_ngcontent-%COMP%]{width:14px;height:14px;font-size:14px}.dot[_ngcontent-%COMP%]{width:6px;height:6px;border-radius:50%;background:var(--color-success)}.sf-chip--blue[_nghost-%COMP%]{--tone: var(--color-accent);--tone-text: var(--color-accent-700)}.sf-chip--amber[_nghost-%COMP%]{--tone: var(--color-warning);--tone-text: var(--status-pending-text)}.sf-chip--green[_nghost-%COMP%]{--tone: var(--color-success);--tone-text: color-mix(in srgb, var(--color-success) 70%, var(--color-text))}.sf-chip--red[_nghost-%COMP%]{--tone: var(--color-error);--tone-text: var(--red-deep)}.sf-chip--neutral[_nghost-%COMP%]{--tone: var(--color-neutral-500);--tone-text: var(--color-text-secondary)}.sf-chip--violet[_nghost-%COMP%]{--tone: var(--color-accent);--tone-text: var(--color-accent-800);background:color-mix(in srgb,var(--tone) 22%,transparent)}.sf-chip--cyan[_nghost-%COMP%]{--tone: var(--color-info);--tone-text: color-mix(in srgb, var(--color-info) 50%, var(--color-text))}"]})};export{y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {$ as $e,H as Ht,j as jt,N as Nt,z as zt,V as Vt}from'./chunk-
|
|
1
|
+
import {$ as $e,H as Ht,j as jt,N as Nt,z as zt,V as Vt}from'./chunk-CH5NCJ8J.js';import {f,H as He,x as x9,A as A9,d as kc,z as zM,h as hp,i as is,J as Ji,l as kb,j as ss,v as vb,K as Wt,a8 as Dp,t as bM}from'./main-HHE6S2WZ.js';function S(n,m){if(n&1&&(kc(0,"code",1),zM(1),hp()),n&2){let a=bM();Ji(),kb(a.data.detail);}}var I=class n{data=f($e);static \u0275fac=function(a){return new(a||n)};static \u0275cmp=He({type:n,selectors:[["sf-confirm-dialog"]],decls:11,vars:8,consts:[["mat-dialog-title",""],[1,"sf-mono","dialog-detail"],["align","end"],["mat-button","",3,"mat-dialog-close"],["mat-stroked-button","",3,"mat-dialog-close"]],template:function(a,l){a&1&&(kc(0,"h2",0),zM(1),hp(),kc(2,"mat-dialog-content")(3,"p"),zM(4),hp(),is(5,S,2,1,"code",1),hp(),kc(6,"mat-dialog-actions",2)(7,"button",3),zM(8,"Cancel"),hp(),kc(9,"button",4),zM(10),hp()()),a&2&&(Ji(),kb(l.data.title),Ji(3),kb(l.data.message),Ji(),ss(l.data.detail?5:-1),Ji(2),vb("mat-dialog-close",false),Ji(2),Wt("sf-danger",l.data.destructive),vb("mat-dialog-close",true),Ji(),Dp(" ",l.data.confirmLabel??"Confirm"," "));},dependencies:[x9,A9,Ht,jt,Nt,zt,Vt],styles:[".dialog-detail[_ngcontent-%COMP%]{display:inline-block;margin-top:10px;padding:4px 8px;border-radius:var(--radius-sm, 0);background:var(--color-surface-muted);color:var(--color-accent-700)}"]})};export{I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-Dwsyk4GD.js';import {A}from'./chunk-DnN1wPPn.js';import {e as ee}from'./chunk-TuXWgar3.js';import {U}from'./chunk-pqCkBoVK.js';import {f,ab as Be,Z as Z$1,cy as Ce,av as Dn,k as k_,y as cc,cz as re,aB as vn$1,cA as Xr,aa as Hr,H as He$1,cB as mo,cC as po,cD as go,ah as Ii,cE as yr,cF as dn$1,ai as co,ak as nr,cG as er,cH as Qn,cI as mr,x as x9,A as A9,L as L4,P as P4,G as Gu,e as kc,z as zM,h as hp,i as is,J as Ji,v as vb,l as ss,aq as Hb,X as Xc,ar as F_,q as ls,aL as O,ae as g,aw as B9,az as x,u as bM,F as Fb,m as kb,Q as Qc,cJ as wC,w as pM,a6 as hg,a7 as mg,aU as eA,r as ln$1,a8 as Dp,ao as YT,s as sM,ap as QT,j as aM,aA as Pb,bz as iM,aV as oM}from'./main-PLOXYS6B.js';import {J as J$1,Z as Z$2}from'./chunk-CUbBr2J_.js';import {c}from'./chunk-oD82fgLm.js';var K=[{id:"build",label:"Build",hint:"Repository-defined verification. The target repository must declare build in factory/verification.json (Coday: build, lint, tests and OpenAPI)."},{id:"frontend-build",label:"Frontend build",hint:"Factory Nx development build for server-configured buildHosts (default: aphrodite, admin, agentic-studio, copilot-chat). It needs specific server/project configuration and is not ready by default for Coday; use Build."},{id:"frontend-tests",label:"Frontend tests",hint:"Factory-owned Nx frontend-test verifier. It needs PASS-agent ancestor claims.modifiedFiles plus specific server/project configuration and is not ready by default for Coday; use Build."}];function Y(n){return K.some(t=>t.id===n)}function ze(n){return K.find(t=>t.id===n)}function qe(n){return Array.isArray(n.entry)&&typeof n.mission=="string"&&Array.isArray(n.exit)?{entry:[...n.entry],mission:n.mission,exit:[...n.exit]}:null}function ie(n){let t=n.legacyContract;return t?.adoptable&&t.entry&&typeof t.mission=="string"&&t.exit?{entry:[...t.entry],mission:t.mission,exit:[...t.exit]}:null}function He(n){if(!n.mission.trim()||n.mission.length>16e3)return "Prompt must contain 1\u201316,000 characters.";for(let[t,e]of [["Pre-actions",n.entry],["Post-actions",n.exit]])if(e.length>50||e.some(i=>!i.trim()||i.length>4e3))return `${t}: at most 50 actions, each containing 1\u20134,000 characters. Remove empty actions.`;return null}var J=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Ze=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;function Ge(n,t=new Set){if(!J.test(n.workflowType??""))return "Workflow type: use 1\u2013128 letters, digits, dots, underscores or hyphens, starting with a letter or digit.";if(!n.title?.trim()||n.title.length>256)return "Workflow name must contain 1\u2013256 characters.";let e=n.steps??[];if(!e.length||e.length>500)return "Add between 1 and 500 blocks.";let i=new Set(e.map(_=>_.id));if(i.size!==e.length)return "Duplicate block IDs are not allowed.";for(let _ of e){if(!J.test(_.id))return `Invalid block ID: ${_.id}`;if(!_.name.trim()||_.name.length>256)return `${_.id}: block name must contain 1\u2013256 characters.`;if(!_.responsibility?.name?.trim())return `${_.id}: ${_.responsibility?.kind==="human"?"enter a human role.":_.responsibility?.kind==="code"?"select a code verifier.":"select an agent."}`;if(_.responsibility?.kind==="code"&&t.has(_.id)&&!Y(_.responsibility.name))return `${_.id}: select a supported code verifier.`;if(_.dependsOn?.some(V=>!i.has(V)))return `${_.id}: missing predecessor.`;if(new Set(_.dependsOn).size!==(_.dependsOn?.length??0))return `${_.id}: duplicate predecessor.`;let N=qe(_);if(N){let V=He(N);if(V)return `${_.id}: ${V}`}}let o=new Set,d=new Set,f=new Map(e.map(_=>[_.id,_]));function b(_){return d.has(_)?true:o.has(_)?false:(d.add(_),f.get(_)?.dependsOn?.some(b)?true:(d.delete(_),o.add(_),false))}if(e.some(_=>b(_.id)))return "Dependency cycle: remove a predecessor connection.";let h=Ke(e);if(h)return h;let R=_=>{let N=new Set([_]),V=true;for(;V;){V=false;for(let I of e)!N.has(I.id)&&I.dependsOn?.some(Q=>N.has(Q))&&(N.add(I.id),V=true);}return N},B=[];for(let _ of e){let N=_.outcomeTransitions,V=N?.pass,I=N?.fail;if(V?.action==="activate"&&(_.decision||!V.target||!i.has(V.target)||V.target===_.id||!e.find(P=>P.id===V.target)?.dependsOn?.includes(_.id)||e.some(P=>P.decision?.routes.some(O=>O.target===V.target))))return `${_.id}: PASS activation must target a non-conditional direct successor of a non-decision step.`;if(I?.action!=="return")continue;if(_.responsibility?.kind!=="agent")return `${_.id}: FAIL return requires an agent step.`;let Q=P=>{if(P===_.id)return true;let O=new Set,A=ae=>O.add(ae)?f.get(ae)?.dependsOn?.some(re=>re===P||A(re))??false:false;return A(_.id)};if(!I.target||!i.has(I.target)||!Q(I.target))return `${_.id}: FAIL return must target this step or an ancestor.`;if(I.maxCycles!==void 0&&(!Number.isInteger(I.maxCycles)||I.maxCycles<1||I.maxCycles>10))return `${_.id}: correction budget must be an integer from 1 to 10.`;let j=R(I.target);for(let P of e.filter(O=>O.decision)){let O=new Set([P.id,...P.decision?.routes.map(A=>A.target)??[],...e.filter(A=>A.join===P.id).map(A=>A.id)]);if([...O].some(A=>j.has(A))&&![...O].every(A=>j.has(A)))return `${_.id}: FAIL return cannot split a conditional-routing region.`}if(e.some(P=>j.has(P.id)&&["Gitay","prepare-work-branch"].includes(P.responsibility?.name??"")))return `${_.id}: FAIL return cannot replay branch initialization.`;let oe=I.maxCycles??2;if(B.some(P=>[...P.scope].some(O=>j.has(O))&&(![...P.scope].every(O=>j.has(O))||![...j].every(O=>P.scope.has(O))||P.maxCycles!==oe)))return `${_.id}: FAIL return overlaps an incompatible correction scope.`;B.push({scope:j,maxCycles:oe});}return null}function Ke(n){let t=n.filter(h=>h.decision),e=n.filter(h=>h.join);if(!t.length&&!e.length)return null;if(t.length!==1||e.length!==1)return "Routing requires exactly one decision and one explicit join.";let i=t[0],o=e[0],d=i.decision;if(i.responsibility?.kind!=="agent"||!["single","multiple"].includes(d.mode))return "Decision requires an agent and single/multiple mode.";let f=d.routes;if(f.length<2||f.length>16||f.some(h=>!J.test(h.name)||!J.test(h.target))||new Set(f.map(h=>h.name)).size!==f.length||new Set(f.map(h=>h.target)).size!==f.length)return "Configure 2\u201316 unique route names and distinct targets.";if(o.join!==i.id||o.id===i.id)return "Join must reference the decision.";let b=f.map(h=>h.target);for(let h of b){let R=n.find(B=>B.id===h);if(!R||[i.id,o.id].includes(h)||R.dependsOn?.length!==1||R.dependsOn[0]!==i.id)return "Each route targets one step depending only on the decision.";if(n.filter(B=>B.dependsOn?.includes(h)).some(B=>B.id!==o.id)||!o.dependsOn?.includes(h))return "Every branch must lead only and directly to the explicit join. Multi-step/nested branches are not supported."}return n.some(h=>h.dependsOn?.includes(i.id)&&!b.includes(h.id)&&h.id!==o.id)?"Decision fanout must use named routes.":null}var Z=class n{api=f(F_);baseline=null;creating=Z$1(false);editing=Z$1(false);structureDirty=Z$1(false);namespaces=Z$1([]);namespaceId=Z$1("");agents=Z$1([]);codeVerificationPresets=K;newCodeStepIds=Z$1(new Set);agentsLoading=Z$1(false);discoveryError=Z$1(null);discoverySequence=0;definition=Z$1(null);selectedId=Z$1(null);drafts=Z$1({});loading=Z$1(false);saving=Z$1(false);error=Z$1(null);saved=Z$1(null);targetVersion=Z$1("");selected=ls(()=>this.definition()?.steps?.find(t=>t.id===this.selectedId())??null);draft=ls(()=>{let t=this.selected();return t?this.drafts()[t.id]??qe(t):null});dirty=ls(()=>this.structureDirty()||Object.keys(this.drafts()).length>0||this.targetVersion()!==(this.creating()?"1.0.0":""));validation=ls(()=>{for(let e of Object.values(this.drafts())){let i=He(e);if(i)return i}let t=this.preview();return this.structureDirty()&&t?Ge(t,this.newCodeStepIds()):null});preview=ls(()=>{let t=this.definition();return t?O(g({},t),{steps:t.steps?.map(e=>g(g({},e),this.drafts()[e.id]))}):null});startNew(){this.creating.set(true),this.editing.set(true),this.baseline={schemaVersion:"1",workflowType:"",version:"",title:"",steps:[]},this.definition.set(this.baseline),this.targetVersion.set("1.0.0"),this.newCodeStepIds.set(new Set);}loadDiscovery(){this.api.getNamespaces().subscribe({next:t=>this.namespaces.set(B9(t)),error:t=>this.discoveryError.set(t.message||"Unable to load namespaces.")});}discoverAgents(t){this.namespaceId.set(t),this.agents.set([]),this.discoveryError.set(null);let e=++this.discoverySequence;this.agentsLoading.set(!!t),t&&this.api.getAgents(t).subscribe({next:i=>{e===this.discoverySequence&&(this.agents.set([...new Set(i.map(o=>o.name))].sort()),this.agentsLoading.set(false));},error:i=>{e===this.discoverySequence&&(this.discoveryError.set(i.message||"Unable to discover agents."),this.agentsLoading.set(false));}});}metadata(t,e){t==="workflowType"&&!this.creating()||this.changeDefinition(O(g({},this.definition()),{[t]:e}));}addBlock(t="agent"){if(!this.editing()||this.saving())return;let e=this.definition();if(!e||(e.steps?.length??0)>=500)return;let i=1;for(;e.steps?.some(d=>d.id===`step-${i}`);)i++;let o=`step-${i}`;this.changeDefinition(O(g({},e),{steps:[...e.steps??[],g({id:o,name:`${t==="human"?"Human":t==="code"?"Code":"Agent"} step ${i}`,responsibility:{kind:t,name:""},dependsOn:[]},t==="agent"?{entry:[],mission:"",exit:[]}:{})]})),t==="code"&&this.newCodeStepIds.update(d=>new Set([...d,o])),this.selectedId.set(o);}isNewCodeStep(t){return this.newCodeStepIds().has(t)}canRemoveSelected(){let t=this.selected();return !this.editing()||!t||this.saving()?false:t.responsibility?.kind==="agent"||t.responsibility?.kind==="human"||t.responsibility?.kind==="code"&&(this.isNewCodeStep(t.id)||Y(t.responsibility.name))}setCodeVerification(t){this.selected()?.responsibility?.kind==="code"&&Y(t)&&this.updateBlock({responsibility:{kind:"code",name:t}});}updateBlock(t){let e=this.selected();if(!this.editing()||!e||this.saving())return;let i=t.id??e.id;if(i!==e.id&&(!J.test(i)||this.definition()?.steps?.some(d=>d.id===i))){this.error.set("Block ID must be unique and use 1\u2013128 safe characters, starting with a letter or digit.");return}let o=this.definition()?.steps?.map(d=>g(g(g(O(g({},d.id===e.id?O(g(g({},d),t),{legacyContract:t.responsibility||t.dependsOn||t.name?void 0:d.legacyContract}):d),{dependsOn:(d.id===e.id?t.dependsOn??d.dependsOn:d.dependsOn)?.map(f=>f===e.id?i:f)}),i!==e.id&&d.decision?{decision:O(g({},d.decision),{routes:d.decision.routes.map(f=>O(g({},f),{target:f.target===e.id?i:f.target}))})}:{}),i!==e.id&&d.join?{join:d.join===e.id?i:d.join}:{}),i!==e.id&&d.outcomeTransitions?{outcomeTransitions:g(g(g({},d.outcomeTransitions),d.outcomeTransitions.pass?.target===e.id?{pass:O(g({},d.outcomeTransitions.pass),{target:i})}:{}),d.outcomeTransitions.fail?.target===e.id?{fail:O(g({},d.outcomeTransitions.fail),{target:i})}:{})}:{}));if(i!==e.id){let d=g({},this.drafts()),f=d[e.id];f&&(d[i]=f,delete d[e.id]),this.drafts.set(d),this.newCodeStepIds.update(b=>{if(!b.has(e.id))return b;let h=new Set(b);return h.delete(e.id),h.add(i),h});}this.changeDefinition(O(g({},this.definition()),{steps:o})),this.selectedId.set(i);}setRoutingMode(t){let e=this.selected();if(!(!e||e.responsibility?.kind!=="agent")){if(t===""){this.updateBlock({decision:void 0});return}t!=="single"&&t!=="multiple"||this.updateBlock({decision:{mode:t,routes:e.decision?.routes??[{name:"route-1",target:""},{name:"route-2",target:""}]}});}}canConfigureFailReturn(t=this.selected()){return t?.responsibility?.kind==="agent"}canConfigurePassActivate(t=this.selected()){return !!t&&!t.decision&&this.passActivationTargets(t).length>0}passActivationTargets(t=this.selected()){return !t||t.decision?[]:(this.definition()?.steps??[]).filter(e=>e.dependsOn?.includes(t.id)&&!(this.definition()?.steps??[]).some(i=>i.decision?.routes.some(o=>o.target===e.id)))}updateOutcome(t,e){let i=this.selected();if(!i||t==="fail"&&e==="return"&&!this.canConfigureFailReturn(i)||t==="pass"&&e==="activate"&&!this.canConfigurePassActivate(i))return;let o=i.outcomeTransitions??{};t==="pass"?this.updateBlock({outcomeTransitions:O(g({},o),{pass:e==="activate"?{action:"activate"}:{action:"continue"}})}):this.updateBlock({outcomeTransitions:O(g({},o),{fail:e==="return"?{action:"return",maxCycles:2}:{action:"block"}})});}updateOutcomeTarget(t,e){let i=this.selected()?.outcomeTransitions;if(!i)return;let o=i[t];o&&this.updateBlock({outcomeTransitions:O(g({},i),{[t]:O(g({},o),{target:e})})});}updateFailBudget(t){let e=this.selected()?.outcomeTransitions;if(e?.fail?.action!=="return")return;let i=Number(t);this.updateBlock({outcomeTransitions:O(g({},e),{fail:O(g({},e.fail),{maxCycles:i})})});}updateRoute(t,e,i){let o=this.selected()?.decision;o&&this.updateBlock({decision:O(g({},o),{routes:o.routes.map((d,f)=>f===t?O(g({},d),{[e]:i}):d)})});}addRoute(){let t=this.selected()?.decision;t&&t.routes.length<16&&this.updateBlock({decision:O(g({},t),{routes:[...t.routes,{name:"",target:""}]})});}removeRoute(t){let e=this.selected()?.decision;e&&this.updateBlock({decision:O(g({},e),{routes:e.routes.filter((i,o)=>o!==t)})});}setAgent(t){this.selected()?.responsibility?.kind==="agent"&&this.agents().includes(t)&&this.updateBlock({responsibility:{kind:"agent",name:t}});}addHumanContract(){let t=this.selected();this.editing()&&!this.saving()&&t?.responsibility?.kind==="human"&&!this.draft()&&this.setDraft(t.id,{entry:[],mission:t.name,exit:[]});}addExistingCodeInstructions(){let t=this.selected();this.editing()&&!this.saving()&&t?.responsibility?.kind==="code"&&!this.isNewCodeStep(t.id)&&!this.draft()&&this.setDraft(t.id,{entry:[],mission:t.name,exit:[]});}connect(t,e){let i=this.selected();!i||t===i.id||!this.definition()?.steps?.some(o=>o.id===t)||this.updateBlock({dependsOn:e?[...new Set([...i.dependsOn??[],t])]:i.dependsOn?.filter(o=>o!==t)});}removeBlock(){let t=this.selected();if(!this.canRemoveSelected()||!t)return;let e=this.definition()?.steps?.filter(o=>o.id!==t.id).map(o=>O(g(g(g(O(g({},o),{dependsOn:o.dependsOn?.filter(d=>d!==t.id)}),o.decision?{decision:O(g({},o.decision),{routes:o.decision.routes.filter(d=>d.target!==t.id)})}:{}),o.join===t.id?{join:void 0}:{}),o.outcomeTransitions?{outcomeTransitions:g(g({},o.outcomeTransitions.pass?.target===t.id?{pass:{action:"continue"}}:o.outcomeTransitions.pass?{pass:o.outcomeTransitions.pass}:{}),o.outcomeTransitions.fail?.target===t.id?{fail:{action:"block"}}:o.outcomeTransitions.fail?{fail:o.outcomeTransitions.fail}:{})}:{}),{legacyContract:o.dependsOn?.includes(t.id)?void 0:o.legacyContract}))??[],i=g({},this.drafts());delete i[t.id],this.drafts.set(i),this.newCodeStepIds.update(o=>{let d=new Set(o);return d.delete(t.id),d}),this.changeDefinition(O(g({},this.definition()),{steps:e})),this.selectedId.set(e[0]?.id??null);}changeDefinition(t){!this.editing()||this.saving()||(this.definition.set(t),this.structureDirty.set(true),this.saved.set(null),this.error.set(null));}load(t,e){if(!t||!e){this.error.set("Missing route parameters (type or version).");return}this.loading.set(true),this.saved.set(null),this.error.set(null),this.api.getWorkflowDefinition(t,e).pipe(Dn(()=>this.loading.set(false))).subscribe({next:i=>{this.baseline=i,this.definition.set(i),this.creating.set(false),this.editing.set(false),this.drafts.set({}),this.structureDirty.set(false),this.selectedId.set(i.steps?.[0]?.id??null),this.targetVersion.set(""),this.newCodeStepIds.set(new Set);},error:i=>this.error.set(i.message||"Unable to load workflow definition.")});}select(t){this.saving()||this.selectedId.set(t);}adopt(){let t=this.selected(),e=t&&ie(t);this.editing()&&t&&e&&!this.saving()&&this.setDraft(t.id,e);}update(t,e){let i=this.selected(),o=this.draft();!this.editing()||!i||!o||this.saving()||this.setDraft(i.id,O(g({},o),{[t]:e}));}setDraft(t,e){this.drafts.update(i=>O(g({},i),{[t]:e})),this.saved.set(null),this.error.set(null);}edit(){this.definition()&&!this.saving()&&(this.editing.set(true),this.saved.set(null));}cancel(){this.saving()||(this.discard(),this.editing.set(false));}discard(){this.saving()||(this.drafts.set({}),this.definition.set(this.baseline),this.structureDirty.set(false),this.targetVersion.set(this.creating()?"1.0.0":""),this.newCodeStepIds.set(new Set),this.selectedId.set(this.baseline?.steps?.[0]?.id??null),this.error.set(null),this.saved.set(null));}save(){let t=this.definition();if(!this.editing()||!t||!this.dirty()||this.saving())return;let e=this.validation();if(e){this.error.set(e);return}let i=t.workflowType?.trim(),o=this.targetVersion().trim();if(!i||!Ze.test(o)||o===t.version){this.error.set("Choose a new version in MAJOR.MINOR.PATCH format. Existing definitions and active runs are never modified.");return}let d=this.drafts(),f=O(g({},t),{version:o,steps:t.steps?.map(b=>{let h=g(g({},b),d[b.id]);return delete h.legacyContract,h})});this.saving.set(true),this.error.set(null),this.api.createWorkflowDefinition(f).pipe(Dn(()=>this.saving.set(false))).subscribe({next:b=>{this.saved.set(`Saved ${b.workflowType}@${b.version} \xB7 hash ${b.definitionHash??"unavailable"}. Original definition and runs unchanged.`);let h=O(g({},f),{workflowType:b.workflowType??f.workflowType,version:b.version??f.version});this.baseline=h,this.definition.set(h),this.editing.set(false),this.drafts.set({}),this.structureDirty.set(false),this.creating.set(false),this.newCodeStepIds.set(new Set),this.targetVersion.set("");},error:b=>{let h=b.details?.path;this.error.set(`${b.message||"Save failed."}${h?` (${h})`:""}`);}});}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac})};var Ye=()=>[],z=(n,t)=>t.id,Qe=(n,t)=>t.name;function Xe(n,t){n&1&&zM(0," New workflow ");}function et(n,t){if(n&1&&zM(0),n&2){let e=bM();Fb(" ",e.state.definition()?.workflowType||e.workflowType,"@",e.state.definition()?.version||e.version," ");}}function tt(n,t){n&1&&(kc(0,"p",5),zM(1),hp()),n&2&&(Ji(),kb(t));}function nt(n,t){n&1&&(kc(0,"div",6),Qc(1,"mat-progress-spinner",9),zM(2," Loading definition\u2026 "),hp());}function it(n,t){n&1&&(kc(0,"div",7),zM(1),hp()),n&2&&(Ji(),kb(t));}function ot(n,t){n&1&&(kc(0,"p",8),zM(1),hp()),n&2&&(Ji(),kb(t));}function at(n,t){n&1&&(kc(0,"p",19),zM(1),hp()),n&2&&(Ji(),kb(t));}function rt(n,t){if(n&1){let e=pM();kc(0,"div")(1,"div",16)(2,"button",17),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.edit())}),zM(3," Edit workflow "),hp(),kc(4,"button",18),Xc("click",function(){hg(e);let o=bM(2);return mg(o.deleteWorkflow())}),kc(5,"mat-icon"),zM(6,"delete_outline"),hp(),zM(7),hp()(),is(8,at,2,1,"p",19),kc(9,"p",11),zM(10," Read-only definition. Editing saves a new immutable version; existing runs keep their version and hash. "),hp()();}if(n&2){let e,i=bM(),o=bM();Ji(2),vb("disabled",o.deleting()),Ji(2),vb("disabled",o.deleting()),ln$1("aria-label","Delete workflow "+(i.title||i.workflowType)+" "+i.workflowType+"@"+i.version),Ji(3),Dp("",o.deleting()?"Deleting\u2026":"Delete workflow"," "),Ji(),ss((e=o.deleteError())?8:-1,e);}}function lt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),kb(e.name);}}function st(n,t){n&1&&(kc(0,"p",29),zM(1,"Loading agents\u2026"),hp());}function dt(n,t){n&1&&(kc(0,"p",30),zM(1),hp()),n&2&&(Ji(),kb(t));}function ct(n,t){n&1&&(kc(0,"p",29),zM(1," No enabled agents discovered. Existing assignments are preserved; choose another namespace or retry. "),hp());}function _t(n,t){if(n&1){let e=pM();kc(0,"fieldset",20)(1,"legend"),zM(2,"Workflow identity"),hp(),kc(3,"div",21)(4,"label"),zM(5,"Workflow type "),kc(6,"input",22),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.metadata("workflowType",o))}),hp(),YT(),hp(),kc(7,"label"),zM(8,"Workflow name "),kc(9,"input",23),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.metadata("title",o))}),hp(),YT(),hp()(),kc(10,"p",11),zM(11," Schema 1 \xB7 stable workflow type; immutable semantic versions. Agent discovery namespace is not stored in the definition; choose the execution namespace explicitly at launch. "),hp()(),kc(12,"section",24)(13,"h2"),zM(14,"Available agents"),hp(),kc(15,"button",25),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.loadDiscovery())}),kc(16,"mat-icon"),zM(17,"refresh"),hp(),zM(18," Load / refresh namespaces "),hp(),kc(19,"p",11),zM(20,"Optional for human-only workflows. Load agents only when assigning an agent step."),hp(),kc(21,"label"),zM(22,"Agent discovery namespace "),kc(23,"select",26),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.discoverAgents(o))}),kc(24,"option",27),zM(25,"Select namespace"),hp(),sM(26,lt,2,2,"option",28,z),hp(),YT(),hp(),is(28,st,2,0,"p",29),is(29,dt,2,1,"p",30),is(30,ct,2,0,"p",29),hp();}if(n&2){let e,i=bM(),o=bM();vb("disabled",o.state.saving()),Ji(6),vb("ngModel",i.workflowType)("readonly",!o.state.creating()),QT(),Ji(3),vb("ngModel",i.title),QT(),Ji(6),vb("disabled",o.state.saving()),Ji(8),vb("ngModel",o.state.namespaceId())("disabled",o.state.saving()),QT(),Ji(3),aM(o.state.namespaces()),Ji(2),ss(o.state.agentsLoading()?28:-1),Ji(),ss((e=o.state.discoveryError())?29:-1,e),Ji(),ss(o.state.namespaceId()&&!o.state.agentsLoading()&&!o.state.agents().length?30:-1);}}function pt(n,t){if(n&1){let e=pM();kc(0,"p",11),zM(1," Add agent, human or code steps, then select a step to edit its properties and optional dependencies. Arrows show dependencies. Code steps use a closed verifier list; no shell command can be entered here. "),hp(),kc(2,"div",31)(3,"button",32),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.addBlock())}),kc(4,"mat-icon"),zM(5,"smart_toy"),hp(),zM(6," Add agent step "),hp(),kc(7,"button",33),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.addBlock("code"))}),kc(8,"mat-icon"),zM(9,"code"),hp(),zM(10," Add code step "),hp(),kc(11,"button",34),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.addBlock("human"))}),kc(12,"mat-icon"),zM(13,"person_add"),hp(),zM(14," Add human step "),hp()();}if(n&2){let e=bM(),i=bM();Ji(3),vb("disabled",i.state.saving()||(e.steps?.length??0)>=500),Ji(4),vb("disabled",i.state.saving()||(e.steps?.length??0)>=500),Ji(4),vb("disabled",i.state.saving()||(e.steps?.length??0)>=500);}}function mt(n,t){n&1&&(kc(0,"p",11),zM(1,"Select a step to preview its details below. Arrows show dependencies."),hp());}function ut(n,t){if(n&1&&(kc(0,"li"),zM(1),hp()),n&2){let e=t.$implicit,i=bM(4);Ji(),Fb("",e.name," \u2192 ",i.dependencyLabel(e.target));}}function ft(n,t){if(n&1&&(kc(0,"p"),zM(1),hp(),kc(2,"ul"),sM(3,ut,2,2,"li",null,Qe),hp()),n&2){let e=t;Ji(),Dp("Decision: ",e.mode," selection."),Ji(2),aM(e.routes);}}function gt(n,t){if(n&1&&(kc(0,"p"),zM(1),hp()),n&2){let e=bM();Ji(),Dp("Join: waits for every selected branch of ",e.join," to succeed, plus ordinary dependencies.");}}function Ct(n,t){if(n&1&&zM(0),n&2){let e=bM(4);Dp(" \u2192 ",e.dependencyLabel(t)," ");}}function yt(n,t){if(n&1&&zM(0),n&2){let e=bM(4);Dp(" \u2192 ",e.dependencyLabel(t)," ");}}function xt(n,t){if(n&1&&zM(0),n&2){let e=bM(2);Dp(" \xB7 ",e.outcomeTransitions?.fail?.maxCycles??2," correction cycles ");}}function ht(n,t){if(n&1&&(kc(0,"h3"),zM(1,"After this step"),hp(),kc(2,"p"),zM(3),is(4,Ct,1,1),hp(),kc(5,"p"),zM(6),is(7,yt,1,1),is(8,xt,1,1),hp()),n&2){let e,i,o=bM();Ji(3),Dp(" PASS: ",o.outcomeTransitions?.pass?.action??"continue"," "),Ji(),ss((e=o.outcomeTransitions?.pass?.target)?4:-1,e),Ji(2),Dp(" FAIL: ",o.outcomeTransitions?.fail?.action??"block"," "),Ji(),ss((i=o.outcomeTransitions?.fail?.target)?7:-1,i),Ji(),ss(o.outcomeTransitions?.fail?.action==="return"?8:-1);}}function bt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM(3);vb("value",e.responsibility?.name),Ji(),Dp(" ",e.responsibility?.name," (existing; not in discovery) ");}}function vt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e),Ji(),kb(e);}}function wt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Agent "),kc(2,"select",58),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.setAgent(o))}),kc(3,"option",59),zM(4,"Select an agent"),hp(),is(5,bt,2,2,"option",28),sM(6,vt,2,2,"option",28,iM),hp(),YT(),hp(),kc(8,"p",11),zM(9," One agent per block; use separate blocks for multiple agents. Load a namespace above to choose an agent. "),hp();}if(n&2){let e=bM(2),i=bM(2);Ji(2),vb("ngModel",e.responsibility?.name??""),QT(),Ji(3),ss(e.responsibility?.name&&!i.state.agents().includes(e.responsibility?.name??"")?5:-1),Ji(),aM(i.state.agents());}}function kt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Human role "),kc(2,"input",60),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.updateBlock({responsibility:{kind:"human",name:o}}))}),hp(),YT(),hp(),kc(3,"p",11),zM(4," Waits for human approval. The role is not an AgentOS agent; no discovery is required. "),hp();}if(n&2){let e=bM(2);Ji(2),vb("ngModel",e.responsibility?.name??""),QT();}}function St(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),kb(e.label);}}function Et(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Code verifier "),kc(2,"select",61),Xc("ngModelChange",function(o){hg(e);let d=bM(5);return mg(d.state.setCodeVerification(o))}),kc(3,"option",59),zM(4,"Select a verifier"),hp(),sM(5,St,2,2,"option",28,z),hp(),YT(),hp(),kc(7,"p",11),zM(8),hp();}if(n&2){let e=bM(3),i=bM(2);Ji(2),vb("ngModel",e.responsibility?.name??""),QT(),Ji(3),aM(i.state.codeVerificationPresets),Ji(3),kb(i.codeVerificationPreset(e.responsibility?.name)?.hint);}}function Dt(n,t){n&1&&(kc(0,"p",11),zM(1,"This existing code responsibility is read-only."),hp());}function Pt(n,t){if(n&1&&is(0,Et,9,2)(1,Dt,2,0,"p",11),n&2){let e=bM(2),i=bM(2);ss(i.state.isNewCodeStep(e.id)||i.codeVerificationPreset(e.responsibility?.name)?0:1);}}function Tt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Route choice mode "),kc(2,"select",62),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.setRoutingMode(o))}),kc(3,"option",27),zM(4,"No decision"),hp(),kc(5,"option",63),zM(6,"Exactly one route"),hp(),kc(7,"option",64),zM(8,"One or more routes"),hp()(),YT(),hp();}if(n&2){let e=bM(2);Ji(2),vb("ngModel",e.decision?.mode??""),QT();}}function Mt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM().$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Wt(n,t){if(n&1&&is(0,Mt,2,3,"option",28),n&2){let e=t.$implicit,i=bM(4);ss(e.id!==i.id?0:-1);}}function Vt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1),kc(2,"input",66),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.state.updateRoute(d,"name",o))}),hp(),YT(),hp(),kc(3,"label"),zM(4),kc(5,"select",67),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.state.updateRoute(d,"target",o))}),kc(6,"option",27),zM(7,"Choose target"),hp(),sM(8,Wt,1,1,null,null,z),hp(),YT(),hp(),kc(10,"button",68),Xc("click",function(){let o=hg(e).$index,d=bM(5);return mg(d.state.removeRoute(o))}),zM(11," Remove route "),hp();}if(n&2){let e=t.$implicit,i=t.$index,o=bM(4);Ji(),Dp("Route ",i+1," name "),Ji(),vb("ngModel",e.name),ln$1("data-route-name",i),QT(),Ji(2),Dp("Route ",i+1," target "),Ji(),vb("ngModel",e.target),ln$1("data-route-target",i),QT(),Ji(3),aM(o.steps),Ji(2),ln$1("aria-label","Remove route "+(i+1));}}function It(n,t){if(n&1){let e=pM();kc(0,"p"),zM(1," Agents submit configured route names in selectedRoutes on PASS. Multiple selection activates the chosen routes, not an additional route. "),hp(),sM(2,Vt,12,7,null,null,oM),kc(4,"button",65),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.addRoute())}),zM(5," Add route "),hp();}if(n&2){let e=t;Ji(2),aM(e.routes),Ji(2),vb("disabled",e.routes.length>=16);}}function Ot(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM().$implicit;vb("value",e.id),Ji(),kb(e.name);}}function At(n,t){if(n&1&&is(0,Ot,2,2,"option",28),n&2){let e=t.$implicit,i=bM(2);ss(e.decision&&e.id!==i.id?0:-1);}}function Ft(n,t){n&1&&(kc(0,"option",46),zM(1,"Activate a direct successor"),hp());}function $t(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Nt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"PASS destination "),kc(2,"select",69),Xc("ngModelChange",function(o){hg(e);let d=bM(5);return mg(d.state.updateOutcomeTarget("pass",o))}),kc(3,"option",27),zM(4,"Choose direct successor"),hp(),sM(5,$t,2,3,"option",28,z),hp(),YT(),hp();}if(n&2){let e=bM(3),i=bM(2);Ji(2),vb("ngModel",e.outcomeTransitions?.pass?.target??""),QT(),Ji(3),aM(i.state.passActivationTargets(e));}}function Rt(n,t){n&1&&(kc(0,"p",11),zM(1," This preserved PASS activation cannot be edited here because Factory only permits a non-decision step to activate a non-conditional direct successor. "),hp());}function Bt(n,t){if(n&1&&is(0,Nt,7,1,"label")(1,Rt,2,0,"p",11),n&2){let e=bM(2),i=bM(2);ss(i.state.canConfigurePassActivate(e)?0:1);}}function Lt(n,t){n&1&&(kc(0,"option",49),zM(1,"Return for correction (accepted agent FAIL only)"),hp());}function jt(n,t){n&1&&(kc(0,"option",50),zM(1,"Return for correction (preserved; unsupported trigger)"),hp());}function zt(n,t){n&1&&(kc(0,"p",11),zM(1," FAIL return is available only on agent steps with an accepted structured FAIL. Code and human failures block, although those steps can be replayed inside an agent-triggered correction scope. "),hp());}function qt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Ht(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Return destination "),kc(2,"select",70),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.updateOutcomeTarget("fail",o))}),kc(3,"option",27),zM(4,"Choose step"),hp(),sM(5,qt,2,3,"option",28,z),hp(),YT(),hp(),kc(7,"label"),zM(8,"Correction cycle budget "),kc(9,"input",71),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.updateFailBudget(o))}),hp(),YT(),hp();}if(n&2){let e=bM(2),i=bM();Ji(2),vb("ngModel",e.outcomeTransitions?.fail?.target??""),QT(),Ji(3),aM(i.steps),Ji(4),vb("ngModel",e.outcomeTransitions?.fail?.maxCycles??2),QT();}}function Ut(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM().$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Jt(n,t){if(n&1&&is(0,Ut,2,3,"option",28),n&2){let e=t.$implicit,i=bM(2);ss(e.id!==i.id&&!i.dependsOn?.includes(e.id)?0:-1);}}function Zt(n,t){if(n&1){let e=pM();kc(0,"button",72),Xc("click",function(){let o=hg(e).$implicit,d=bM(4);return mg(d.state.connect(o,false))}),kc(1,"mat-icon"),zM(2,"close"),hp(),zM(3),hp();}if(n&2){let e=t.$implicit,i=bM(4);ln$1("data-remove-dependency",e)("aria-label","Remove dependency "+i.dependencyLabel(e)),Ji(3),Dp(" ",i.dependencyLabel(e)," ");}}function Gt(n,t){if(n&1){let e=pM();kc(0,"button",73),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.removeBlock())}),kc(1,"mat-icon"),zM(2,"delete_outline"),hp(),zM(3," Remove step and its connections "),hp();}}function Kt(n,t){if(n&1){let e=pM();kc(0,"fieldset",36)(1,"legend"),zM(2,"Block properties"),hp(),kc(3,"label"),zM(4,"Block ID (applied on leaving the field) "),kc(5,"input",39),Xc("change",function(o){hg(e);let d=bM(3);return mg(d.state.updateBlock({id:o.target.value}))}),hp()(),kc(6,"label"),zM(7,"Block name "),kc(8,"input",40),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateBlock({name:o}))}),hp(),YT(),hp(),is(9,wt,10,2)(10,kt,5,1)(11,Pt,2,1),kc(12,"fieldset",41)(13,"legend"),zM(14,"Conditional routing"),hp(),is(15,Tt,9,1,"label"),is(16,It,6,1),kc(17,"label"),zM(18,"Join decision (convergence) "),kc(19,"select",42),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateBlock({join:o||void 0}))}),kc(20,"option",27),zM(21,"No join"),hp(),sM(22,At,1,1,null,null,z),hp(),YT(),hp(),kc(24,"p",11),zM(25," Initial scope: one decision, 2\u201316 single-step branches, one join. Each branch depends only on the decision and feeds only the join. The join depends on every branch; extra ordinary dependencies still require success. Nested/multi-step routes are rejected. "),hp()(),kc(26,"fieldset",43)(27,"legend"),zM(28,"After this step"),hp(),kc(29,"p",11),zM(30," Standalone execution only. Code/human failures and technical errors cannot trigger automatic return. Parent-Run fragments are not supported. After the budget, human intervention requires an explicitly authorized successor run. "),hp(),kc(31,"p",11),zM(32," PASS activation is limited to an existing direct successor: it never bypasses dependencies or disables other branches. A FAIL return is enforced by Factory and replays the configured target scope. "),hp(),kc(33,"label"),zM(34,"On PASS "),kc(35,"select",44),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateOutcome("pass",o))}),kc(36,"option",45),zM(37,"Continue dependencies"),hp(),is(38,Ft,2,0,"option",46),hp(),YT(),hp(),is(39,Bt,2,1),kc(40,"label"),zM(41,"On FAIL "),kc(42,"select",47),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateOutcome("fail",o))}),kc(43,"option",48),zM(44,"Block workflow"),hp(),is(45,Lt,2,0,"option",49)(46,jt,2,0,"option",50),hp(),YT(),hp(),is(47,zt,2,0,"p",11),is(48,Ht,10,2),hp(),kc(49,"div",51)(50,"label",52),zM(51,"Dependencies (optional)"),hp(),kc(52,"p",53),zM(53," This step waits for all added steps. Leave empty for an entry step. "),hp(),kc(54,"select",54),Xc("change",function(o){return hg(e),bM(3).state.connect(o.target.value,true),mg(o.target.value="")}),kc(55,"option",27),zM(56,"Add a dependency\u2026"),hp(),sM(57,Jt,1,1,null,null,z),hp(),kc(59,"div",55),sM(60,Zt,4,3,"button",56,iM),hp()(),is(62,Gt,4,0,"button",57),hp();}if(n&2){let e,i=bM(),o=bM(),d=bM();vb("disabled",d.state.saving()),Ji(5),vb("value",i.id),Ji(3),vb("ngModel",i.name),QT(),Ji(),ss(i.responsibility?.kind==="agent"?9:i.responsibility?.kind==="human"?10:i.responsibility?.kind==="code"?11:-1),Ji(6),ss(i.responsibility?.kind==="agent"?15:-1),Ji(),ss((e=i.decision)?16:-1,e),Ji(3),vb("ngModel",i.join??""),QT(),Ji(3),aM(o.steps),Ji(13),vb("ngModel",i.outcomeTransitions?.pass?.action??"continue"),QT(),Ji(3),ss(d.state.canConfigurePassActivate(i)?38:-1),Ji(),ss(i.outcomeTransitions?.pass?.action==="activate"?39:-1),Ji(3),vb("ngModel",i.outcomeTransitions?.fail?.action??"block"),QT(),Ji(3),ss(d.state.canConfigureFailReturn(i)?45:i.outcomeTransitions?.fail?.action==="return"?46:-1),Ji(2),ss(d.state.canConfigureFailReturn(i)?-1:47),Ji(),ss(i.outcomeTransitions?.fail?.action==="return"&&d.state.canConfigureFailReturn(i)?48:-1),Ji(9),aM(o.steps),Ji(3),aM(i.dependsOn),Ji(2),ss(d.state.canRemoveSelected()?62:-1);}}function Yt(n,t){n&1&&(kc(0,"p",75),zM(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),hp());}function Qt(n,t){if(n&1&&(kc(0,"li",76),zM(1),hp()),n&2){let e=t.$implicit;Ji(),kb(e);}}function Xt(n,t){n&1&&(kc(0,"p"),zM(1,"None configured."),hp());}function en(n,t){if(n&1&&(kc(0,"li",76),zM(1),hp()),n&2){let e=t.$implicit;Ji(),kb(e);}}function tn(n,t){n&1&&(kc(0,"p"),zM(1,"None configured."),hp());}function nn(n,t){if(n&1&&(kc(0,"div",74)(1,"p")(2,"strong"),zM(3,"Agent / responsibility:"),hp(),zM(4),hp(),is(5,Yt,2,0,"p",75),kc(6,"h3"),zM(7,"Pre-actions"),hp(),kc(8,"ol"),sM(9,Qt,2,1,"li",76,oM),hp(),is(11,Xt,2,0,"p"),kc(12,"h3"),zM(13,"Prompt"),hp(),kc(14,"p",76),zM(15),hp(),kc(16,"h3"),zM(17,"Post-actions"),hp(),kc(18,"ol"),sM(19,en,2,1,"li",76,oM),hp(),is(21,tn,2,0,"p"),hp()),n&2){let e=bM(),i=bM();Ji(4),Fb(" ",i.responsibility?.name||"Not specified"," (",i.responsibility?.kind||"Not specified",") "),Ji(),ss(i.responsibility?.kind!=="agent"?5:-1),Ji(4),aM(e.entry),Ji(2),ss(e.entry.length?-1:11),Ji(4),kb(e.mission),Ji(4),aM(e.exit),Ji(2),ss(e.exit.length?-1:21);}}function on(n,t){n&1&&(kc(0,"p",75),zM(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),hp());}function an(n,t){if(n&1){let e=pM();kc(0,"div",78)(1,"label"),zM(2),kc(3,"textarea",82),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.updateAction("entry",d,o))}),hp(),YT(),hp(),kc(4,"button",83),Xc("click",function(){let o=hg(e).$index,d=bM(5);return mg(d.removeAction("entry",o))}),zM(5," Remove "),hp()();}if(n&2){let e=t.$implicit,i=t.$index;Ji(2),Dp("Pre-action ",i+1," "),Ji(),vb("ngModel",e),ln$1("data-entry",i),QT(),Ji(),ln$1("aria-label","Remove pre-action "+(i+1));}}function rn(n,t){if(n&1){let e=pM();kc(0,"div",78)(1,"label"),zM(2),kc(3,"textarea",82),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.updateAction("exit",d,o))}),hp(),YT(),hp(),kc(4,"button",83),Xc("click",function(){let o=hg(e).$index,d=bM(5);return mg(d.removeAction("exit",o))}),zM(5," Remove "),hp()();}if(n&2){let e=t.$implicit,i=t.$index;Ji(2),Dp("Post-action ",i+1," "),Ji(),vb("ngModel",e),ln$1("data-exit",i),QT(),Ji(),ln$1("aria-label","Remove post-action "+(i+1));}}function ln(n,t){if(n&1){let e=pM();is(0,on,2,0,"p",75),kc(1,"fieldset",77)(2,"legend"),zM(3,"Step instructions"),hp(),kc(4,"h3"),zM(5,"Pre-actions"),hp(),kc(6,"p",11),zM(7,"Preparation / input obligations, in order (not executable commands)."),hp(),sM(8,an,6,4,"div",78,oM),kc(10,"button",79),Xc("click",function(){hg(e);let o=bM(4);return mg(o.addAction("entry"))}),kc(11,"mat-icon"),zM(12,"add"),hp(),zM(13," Add pre-action "),hp(),kc(14,"h3")(15,"label",80),zM(16,"Prompt"),hp()(),kc(17,"p",11),zM(18),hp(),kc(19,"textarea",81),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.update("mission",o))}),hp(),YT(),kc(20,"h3"),zM(21,"Post-actions"),hp(),kc(22,"p",11),zM(23,"Output / deliverable obligations, in order."),hp(),sM(24,rn,6,4,"div",78,oM),kc(26,"button",79),Xc("click",function(){hg(e);let o=bM(4);return mg(o.addAction("exit"))}),kc(27,"mat-icon"),zM(28,"add"),hp(),zM(29," Add post-action "),hp()();}if(n&2){let e=bM(),i=bM(),o=bM(2);ss(i.responsibility?.kind!=="agent"?0:-1),Ji(),vb("disabled",o.state.saving()),Ji(7),aM(e.entry),Ji(2),vb("disabled",e.entry.length>=50),Ji(8),Dp(" ",i.responsibility?.kind==="agent"?"What the agent must do. Replaces legacy Factory business instructions for this step.":"Optional documentation of intent. Human approval and code verification are unchanged; this is not executed as an agent prompt."," "),Ji(),vb("ngModel",e.mission),QT(),Ji(5),aM(e.exit),Ji(2),vb("disabled",e.exit.length>=50);}}function sn(n,t){if(n&1&&is(0,nn,22,6,"div",74)(1,ln,30,6),n&2){let e=bM(3);ss(e.state.editing()?1:0);}}function dn(n,t){n&1&&(kc(0,"p",11),zM(1),hp()),n&2&&(Ji(),kb(t.hint));}function cn(n,t){if(n&1&&(kc(0,"p",84),zM(1),hp()),n&2){let e=bM(2);Ji(),Dp(" Existing code responsibility \u201C",e.responsibility?.name||"unnamed","\u201D is preserved read-only. It is outside this editor's closed verifier list and may not be a verification step. ");}}function _n(n,t){if(n&1){let e=pM();kc(0,"button",86),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.addExistingCodeInstructions())}),kc(1,"mat-icon"),zM(2,"notes"),hp(),zM(3," Add optional instructions "),hp();}if(n&2){let e=bM(4);vb("disabled",e.state.saving());}}function pn(n,t){if(n&1&&(kc(0,"section",37)(1,"h3"),zM(2,"Code verification"),hp(),kc(3,"p"),zM(4," This code step selects a Factory verifier. It does not execute authored shell commands, and its entry, mission and exit text is intent-only documentation. "),hp(),is(5,dn,2,1,"p",11)(6,cn,2,1,"p",84),is(7,_n,4,1,"button",85),hp()),n&2){let e,i=bM(),o=bM(2);Ji(5),ss((e=o.codeVerificationPreset(i.responsibility?.name))?5:6,e),Ji(2),ss(o.state.editing()&&!o.state.isNewCodeStep(i.id)?7:-1);}}function mn(n,t){if(n&1){let e=pM();kc(0,"button",89),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.addHumanContract())}),kc(1,"mat-icon"),zM(2,"notes"),hp(),zM(3," Add optional instructions "),hp();}if(n&2){let e=bM(4);vb("disabled",e.state.saving());}}function un(n,t){if(n&1&&(kc(0,"p",87),zM(1," This human step uses the existing approval or verification implementation, not an agent prompt. "),hp(),is(2,mn,4,1,"button",88)),n&2){let e=bM(3);Ji(2),ss(e.state.editing()?2:-1);}}function fn(n,t){if(n&1){let e=pM();kc(0,"button",92),Xc("click",function(){hg(e);let o=bM(5);return mg(o.state.adopt())}),zM(1," Adopt explicit instructions "),hp();}if(n&2){let e=bM(5);vb("disabled",e.state.saving());}}function gn(n,t){if(n&1&&(kc(0,"p"),zM(1," Adoption copies the generic legacy obligations into editable actions and uses the step name as the initial prompt. Review and refine it before saving. Plugin context and Factory's technical result protocol remain. "),hp(),is(2,fn,2,1,"button",91)),n&2){let e=bM(4);Ji(2),ss(e.state.editing()?2:-1);}}function Cn(n,t){n&1&&(kc(0,"p",90),zM(1," Automatic adoption unavailable: runtime-derived branch/review obligations or non-agent execution cannot safely be replaced with a static prompt. Keep this step legacy pending a backend context/adoption decision. "),hp());}function yn(n,t){if(n&1&&(kc(0,"div",38)(1,"div")(2,"h3"),zM(3,"Legacy instructions \u2014 not an empty prompt"),hp(),kc(4,"p"),zM(5," Factory currently generates hidden business instructions from the agent name and dependency position, plus plugin context. The exact text is available in a dispatched run's selected attempt mandate. "),hp(),kc(6,"p"),zM(7),hp(),is(8,gn,3,1)(9,Cn,2,0,"p",90),hp()()),n&2){let e=bM(),i=bM(2);Ji(7),Dp(" ",e.legacyContract?.summary||"Legacy contract metadata unavailable or changed locally. Reload the saved definition before adoption."," "),Ji(),ss(i.legacyAdoption(e)?8:9);}}function xn(n,t){if(n&1&&(kc(0,"section",13)(1,"h2"),zM(2),hp(),kc(3,"p",35),zM(4),hp(),kc(5,"p"),zM(6),hp(),is(7,ft,5,1),is(8,gt,2,1,"p"),is(9,ht,9,5),is(10,Kt,63,15,"fieldset",36),is(11,sn,2,1)(12,pn,8,2,"section",37)(13,un,3,1)(14,yn,10,2,"div",38),hp()),n&2){let e,i,o=t,d=bM(2);ln$1("aria-label",d.state.editing()?"Selected step editor":"Selected step preview"),Ji(2),kb(o.name),Ji(2),Pb("",o.id," \xB7 ",o.responsibility?.kind," \xB7 ",o.responsibility?.name),Ji(2),Dp("Inputs from dependencies: ",o.dependsOn?.join(", ")||"None (entry step)"),Ji(),ss((e=o.decision)?7:-1,e),Ji(),ss(o.join?8:-1),Ji(),ss(o.outcomeTransitions?.pass||o.outcomeTransitions?.fail?9:-1),Ji(),ss(d.state.editing()?10:-1),Ji(),ss((i=d.state.draft())?11:o.responsibility?.kind==="code"?12:o.responsibility?.kind==="human"?13:14,i);}}function hn(n,t){n&1&&(kc(0,"p",30),zM(1),hp()),n&2&&(Ji(),kb(t));}function bn(n,t){if(n&1){let e=pM();kc(0,"section",14)(1,"h2"),zM(2,"Save workflow definition"),hp(),kc(3,"p"),zM(4," Existing definitions and active pinned runs are never edited. Save this composition as a new immutable version. Plugin routing and untouched step properties are preserved. Saving never starts a run. "),hp(),kc(5,"p",11),zM(6,"Save this workflow first. You can launch a saved version from Launch a run."),hp(),kc(7,"div",21)(8,"label"),zM(9,"Workflow type "),Qc(10,"input",93),hp(),kc(11,"label"),zM(12,"Version "),kc(13,"input",94),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.targetVersion.set(o))}),hp(),YT(),hp()(),is(14,hn,2,1,"p",30),kc(15,"p",29),zM(16),hp(),kc(17,"div",16)(18,"button",95),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.save())}),zM(19),hp(),kc(20,"button",96),Xc("click",function(){hg(e);let o=bM(2);return mg(o.cancel())}),zM(21," Cancel "),hp()(),kc(22,"p",11),zM(23," Prose is not automatically verified. Result submission, authorization, approvals and configured validators remain enforced. Do not put secrets in instructions. "),hp()();}if(n&2){let e,i=bM(),o=bM();Ji(10),vb("value",i.workflowType??""),Ji(3),vb("ngModel",o.state.targetVersion())("disabled",o.state.saving()),QT(),Ji(),ss((e=o.state.validation())?14:-1,e),Ji(2),Dp(" ",o.state.dirty()?"Unsaved step changes and structure edits (kept when selecting another step).":"No unsaved changes."," "),Ji(2),vb("disabled",!o.state.dirty()||!!o.state.validation()||o.state.saving()),Ji(),Dp(" ",o.state.saving()?"Saving\u2026":"Save new version"," "),Ji(),vb("disabled",o.state.saving());}}function vn(n,t){if(n&1){let e=pM();is(0,rt,11,5,"div"),is(1,_t,31,10),kc(2,"section",10)(3,"h2"),zM(4,"Workflow steps"),hp(),is(5,pt,15,3)(6,mt,2,0,"p",11),kc(7,"sf-workflow-definition-diagram",12),Xc("selected",function(o){hg(e);let d=bM();return mg(d.state.select(o))}),hp()(),is(8,xn,15,11,"section",13),is(9,bn,24,8,"section",14),kc(10,"details")(11,"summary"),zM(12,"Definition JSON (read-only reference)"),hp(),kc(13,"pre",15)(14,"code"),zM(15),hp()()();}if(n&2){let e,i=bM();ss(!i.state.editing()&&!i.state.creating()&&!i.state.loading()?0:-1),Ji(),ss(i.state.editing()?1:-1),Ji(4),ss(i.state.editing()?5:6),Ji(2),vb("steps",i.state.preview()?.steps??eA(9,Ye))("selectedId",i.state.selectedId())("disabled",i.state.saving()),Ji(),ss((e=i.state.selected())?8:-1,e),Ji(),ss(i.state.editing()?9:-1),Ji(6),kb(i.formatJson(t));}}function wn(n){try{return JSON.stringify(n,null,2)}catch{return String(n)}}var Ue=class n{state=f(Z);registry=f(c);dialog=f(ee);destroyRef=f(Be);deleting=Z$1(false);deleteError=Z$1(null);deleteWorkflow(){let t=this.state.definition();if(!t||this.state.editing()||this.state.creating()||this.state.loading()||this.deleting())return;let{workflowType:e,version:i}=t;if(!e||!i)return;this.deleting.set(true);let o={title:"Delete workflow",detail:`${t.title||e} \xB7 ${e}@${i}`,message:"Permanently delete this registered version? It will no longer be available for new runs. Runs are not deleted or changed. Deletion is refused if any active or historical run pins this version, including archived or purged runs.",confirmLabel:"Delete workflow",destructive:true};this.dialog.open(I,{data:o,width:"520px",autoFocus:"first-tabbable"}).afterClosed().pipe(Ce(1),U(this.destroyRef)).subscribe(d=>{let f=this.state.definition();if(d!==true||f?.workflowType!==e||f?.version!==i||this.state.editing()){this.deleting.set(false);return}this.deleteError.set(null),this.registry.delete(e,i).pipe(Dn(()=>this.deleting.set(false)),U(this.destroyRef)).subscribe({next:()=>{this.router.navigate(this.backLink);},error:b=>{this.deleteError.set(`${b.message||"Unable to delete workflow. Nothing was changed."}${b.code?` (${b.code})`:""}`);}});});}backLink=["/workflows"];formatJson=wn;legacyAdoption=ie;codeVerificationPreset=ze;workflowType;version;constructor(){let t=f(k_);cc(()=>{let f=this.state.saved();re(()=>{let b=this.state.definition();f&&!this.state.editing()&&b&&(t.crumbs.set([{label:"Workflows",link:"/workflows"},{label:`${b.workflowType}@${b.version}`,mono:true}]),this.router.navigate(["/workflows",b.workflowType,b.version],{replaceUrl:true}));});});let e=f(vn$1),i=e.snapshot,o=i.paramMap,d=i.data?.create===true;this.workflowType=o.get("type")??"",this.version=o.get("version")??"",f(k_).crumbs.set([{label:"Workflows",link:"/workflows"},{label:d?"New workflow":`${this.workflowType}@${this.version}`,mono:true}]),d?this.state.startNew():this.state.load(this.workflowType,this.version),e.paramMap?.pipe(Xr(1),U()).subscribe(f=>{let b=f.get("type")??"",h=f.get("version")??"",R=this.state.definition();!d&&b&&h&&(R?.workflowType!==b||R?.version!==h)&&(t.crumbs.set([{label:"Workflows",link:"/workflows"},{label:`${b}@${h}`,mono:true}]),this.deleteError.set(null),this.state.load(b,h));});}beforeUnload(t){(this.state.dirty()||this.state.saving())&&t.preventDefault();}canLeave(){return !this.state.saving()&&(!this.state.dirty()||window.confirm("Discard unsaved workflow changes?"))}cancel(){if(this.canLeave()){let t=this.state.creating();this.state.cancel(),t&&this.router.navigate(this.backLink);}}router=f(Hr);dependencyLabel(t){let e=this.state.definition()?.steps?.find(i=>i.id===t);return e?`${e.name} (${t})`:t}updateAction(t,e,i){let o=this.state.draft();o&&this.state.update(t,o[t].map((d,f)=>f===e?i:d));}addAction(t){let e=this.state.draft();e&&this.state.update(t,[...e[t],""]);}removeAction(t,e){let i=this.state.draft();i&&this.state.update(t,i[t].filter((o,d)=>d!==e));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=He$1({type:n,selectors:[["sf-workflow-detail-page"]],hostBindings:function(e,i){e&1&&Xc("beforeunload",function(d){return i.beforeUnload(d)},wC);},features:[Hb([Z,c])],decls:15,vars:7,consts:[[1,"page"],[1,"page-head"],["mat-stroked-button","","data-workflow-back","",1,"sf-secondary","back-btn",3,"routerLink"],[1,"titles"],["data-workflow-detail-type","",1,"sf-mono"],["data-workflow-detail-title","",1,"sf-muted"],["data-workflow-detail-loading","",1,"state"],["role","alert","data-workflow-detail-error","",1,"banner","banner--warn"],["role","status","data-save-success",""],["diameter","32","mode","indeterminate"],["aria-label","Workflow diagram","data-workflow-diagram",""],[1,"sf-muted"],[3,"selected","steps","selectedId","disabled"],["data-step-contract","",1,"step-contract"],["aria-label","Save step changes",1,"step-contract"],["data-workflow-detail-json","",1,"json-block"],[1,"save-actions"],["mat-flat-button","","data-edit-workflow","",1,"sf-primary",3,"click","disabled"],["mat-stroked-button","","type","button","data-delete-workflow","",1,"sf-danger",3,"click","disabled"],["role","alert","data-delete-error","",1,"banner","banner--warn"],["aria-label","Workflow identity",1,"step-contract",3,"disabled"],[1,"save-fields"],["maxlength","128","data-workflow-type","",3,"ngModelChange","ngModel","readonly"],["maxlength","256","data-workflow-name","",3,"ngModelChange","ngModel"],["aria-label","Agent discovery",1,"step-contract"],["mat-stroked-button","","type","button","data-refresh-namespaces","",1,"sf-secondary","composer-action",3,"click","disabled"],["data-agent-namespace","",3,"ngModelChange","ngModel","disabled"],["value",""],[3,"value"],["role","status"],["role","alert"],[1,"composer-actions"],["mat-stroked-button","","type","button","data-add-block","",1,"sf-secondary","composer-action",3,"click","disabled"],["mat-stroked-button","","type","button","data-add-code-step","",1,"sf-secondary","composer-action",3,"click","disabled"],["mat-stroked-button","","type","button","data-add-human-step","",1,"sf-secondary","composer-action",3,"click","disabled"],[1,"sf-mono"],["aria-label","Block properties",3,"disabled"],["aria-label","Code verification","data-code-verification-info",""],["data-legacy-contract","",1,"banner","banner--warn"],["maxlength","128","data-block-id","",3,"change","value"],["maxlength","256","data-block-name","",3,"ngModelChange","ngModel"],["aria-label","Conditional routing"],["data-join-decision","",3,"ngModelChange","ngModel"],["aria-label","After this step"],["data-outcome-pass","",3,"ngModelChange","ngModel"],["value","continue"],["value","activate"],["data-outcome-fail","",3,"ngModelChange","ngModel"],["value","block"],["value","return"],["value","return","disabled",""],[1,"dependencies"],["for","step-dependency"],["id","dependency-help",1,"sf-muted"],["id","step-dependency","aria-describedby","dependency-help","data-dependency-select","",3,"change"],["aria-label","Selected dependencies",1,"dependency-chips"],["mat-stroked-button","","type","button",1,"sf-secondary","dependency-chip"],["mat-stroked-button","","type","button","data-remove-block","",1,"sf-secondary","composer-action"],["data-block-agent","",3,"ngModelChange","ngModel"],["value","","disabled",""],["placeholder","e.g. Product owner","maxlength","256","data-human-role","",3,"ngModelChange","ngModel"],["data-code-verifier","",3,"ngModelChange","ngModel"],["data-route-mode","",3,"ngModelChange","ngModel"],["value","single"],["value","multiple"],["type","button",3,"click","disabled"],["maxlength","128",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],["type","button",3,"click"],["data-outcome-pass-target","",3,"ngModelChange","ngModel"],["data-outcome-fail-target","",3,"ngModelChange","ngModel"],["type","number","min","1","max","10","data-outcome-fail-budget","",3,"ngModelChange","ngModel"],["mat-stroked-button","","type","button",1,"sf-secondary","dependency-chip",3,"click"],["mat-stroked-button","","type","button","data-remove-block","",1,"sf-secondary","composer-action",3,"click"],["data-step-preview",""],["role","note"],[1,"prose"],[3,"disabled"],[1,"action-row"],["mat-stroked-button","","type","button",1,"sf-secondary","composer-action",3,"click","disabled"],["for","step-prompt"],["id","step-prompt","rows","8","maxlength","16000","data-step-prompt","",3,"ngModelChange","ngModel"],["rows","2","maxlength","4000",3,"ngModelChange","ngModel"],["mat-stroked-button","","type","button",1,"sf-secondary","composer-action",3,"click"],["role","note","data-unknown-code-verifier",""],["mat-stroked-button","","type","button","data-add-code-instructions","",1,"sf-secondary","composer-action",3,"disabled"],["mat-stroked-button","","type","button","data-add-code-instructions","",1,"sf-secondary","composer-action",3,"click","disabled"],["role","note","data-human-checkpoint",""],["mat-stroked-button","","type","button","data-add-human-contract","",1,"sf-secondary","composer-action",3,"disabled"],["mat-stroked-button","","type","button","data-add-human-contract","",1,"sf-secondary","composer-action",3,"click","disabled"],["data-adoption-blocked",""],["mat-stroked-button","","data-adopt-contract","",3,"disabled"],["mat-stroked-button","","data-adopt-contract","",3,"click","disabled"],["readonly","","data-target-type","",3,"value"],["data-target-version","",3,"ngModelChange","ngModel","disabled"],["mat-flat-button","","data-save-contract","",1,"sf-primary",3,"click","disabled"],["mat-stroked-button","","data-discard-contract","",3,"click","disabled"]],template:function(e,i){if(e&1&&(kc(0,"div",0)(1,"header",1)(2,"a",2)(3,"mat-icon"),zM(4,"arrow_back"),hp(),zM(5," Back "),hp(),kc(6,"div",3)(7,"h1",4),is(8,Xe,1,0)(9,et,1,2),hp(),is(10,tt,2,1,"p",5),hp()(),is(11,nt,3,0,"div",6),is(12,it,2,1,"div",7),is(13,ot,2,1,"p",8),is(14,vn,16,10),hp()),e&2){let o,d,f,b;Ji(2),vb("routerLink",i.backLink),Ji(6),ss(i.state.creating()?8:9),Ji(2),ss((o=i.state.definition()?.title)?10:-1,o),Ji(),ss(i.state.loading()?11:-1),Ji(),ss((d=i.state.error())?12:-1,d),Ji(),ss((f=i.state.saved())?13:-1,f),Ji(),ss((b=i.state.definition())?14:-1,b);}},dependencies:[mo,po,go,Ii,yr,dn$1,co,nr,er,Qn,mr,x9,A9,L4,P4,J$1,Z$2,Gu,A],styles:["[_nghost-%COMP%]{display:block;min-width:0}fieldset[_ngcontent-%COMP%]{border:0;padding:0;margin:0;min-width:0}legend[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}textarea[_ngcontent-%COMP%], select[_ngcontent-%COMP%], input[_ngcontent-%COMP%]{box-sizing:border-box;width:100%;padding:10px;background:var(--sf-surface-2);color:inherit;border:1px solid var(--sf-outline);border-radius:6px;font:inherit}textarea[_ngcontent-%COMP%]{display:block;resize:vertical}label[_ngcontent-%COMP%]{display:block}.composer-actions[_ngcontent-%COMP%], .dependency-chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0}.composer-action[_ngcontent-%COMP%]{margin-block:4px}.composer-action[_ngcontent-%COMP%], .dependency-chip[_ngcontent-%COMP%]{min-height:40px}button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--sf-primary, #9fa8ff);outline-offset:3px}.dependencies[_ngcontent-%COMP%]{margin-block:20px}.dependencies[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin-block:6px 10px}select[_ngcontent-%COMP%]:focus-visible, input[_ngcontent-%COMP%]:focus-visible, textarea[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--sf-primary, #9fa8ff);outline-offset:2px}.action-row[_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center;margin-bottom:10px}.action-row[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{flex:1;min-width:0}.save-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.save-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:12px}.save-fields[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{flex:1 1 180px;min-width:0}button[_ngcontent-%COMP%]{cursor:pointer}button[_ngcontent-%COMP%]:disabled{cursor:default}h2[_ngcontent-%COMP%]{font-size:18px}h3[_ngcontent-%COMP%]{font-size:15px}p[_ngcontent-%COMP%]{line-height:1.5}.prose[_ngcontent-%COMP%]{white-space:pre-wrap;overflow-wrap:anywhere}.step-contract[_ngcontent-%COMP%]{min-width:0;padding:16px;border:1px solid var(--sf-outline);border-radius:8px}.page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px;min-width:0;overflow-wrap:anywhere}.page[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{min-width:0}.page-head[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:16px}.back-btn[_ngcontent-%COMP%]{flex-shrink:0;margin-top:2px}.titles[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}h1[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:600;letter-spacing:-.01em;word-break:break-all}.titles[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:14px}.state[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.json-block[_ngcontent-%COMP%]{margin:0;padding:20px 24px;border-radius:var(--radius-md, 0);border:1px solid var(--color-divider);background:var(--color-surface-muted);font-family:var(--sf-mono);font-size:13px;line-height:1.6;overflow-x:auto;overflow-y:auto;max-height:75vh;white-space:pre;tab-size:2}.json-block[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font:inherit;color:inherit;background:none;padding:0}"]})};export{Ue as WorkflowDetailPageComponent,wn as formatJson};
|
|
1
|
+
import {I}from'./chunk-BwlwiO59.js';import {A}from'./chunk-IYlPieu1.js';import {e as ee}from'./chunk-CH5NCJ8J.js';import {U}from'./chunk-DUZba2Ku.js';import {f,ab as Be,Z as Z$1,cy as Ce,av as Dn,k as k_,y as cc,cz as re,aB as vn$1,cA as Xr,aa as Hr,H as He$1,cB as mo,cC as po,cD as go,ah as Ii,cE as yr,cF as dn$1,ai as co,ak as nr,cG as er,cH as Qn,cI as mr,x as x9,A as A9,L as L4,P as P4,G as Gu,d as kc,z as zM,h as hp,i as is,J as Ji,v as vb,j as ss,aq as Hb,X as Xc,ar as F_,p as ls,aL as O,ae as g,aw as B9,az as x,t as bM,F as Fb,l as kb,Q as Qc,cJ as wC,w as pM,a6 as hg,a7 as mg,aU as eA,q as ln$1,a8 as Dp,ao as YT,s as sM,ap as QT,g as aM,aA as Pb,bz as iM,aV as oM}from'./main-HHE6S2WZ.js';import {J as J$1,Z as Z$2}from'./chunk-Bbkjd_hF.js';import {c}from'./chunk-CMCT2R5D.js';var K=[{id:"build",label:"Build",hint:"Repository-defined verification. The target repository must declare build in factory/verification.json (Coday: build, lint, tests and OpenAPI)."},{id:"frontend-build",label:"Frontend build",hint:"Factory Nx development build for server-configured buildHosts (default: aphrodite, admin, agentic-studio, copilot-chat). It needs specific server/project configuration and is not ready by default for Coday; use Build."},{id:"frontend-tests",label:"Frontend tests",hint:"Factory-owned Nx frontend-test verifier. It needs PASS-agent ancestor claims.modifiedFiles plus specific server/project configuration and is not ready by default for Coday; use Build."}];function Y(n){return K.some(t=>t.id===n)}function ze(n){return K.find(t=>t.id===n)}function qe(n){return Array.isArray(n.entry)&&typeof n.mission=="string"&&Array.isArray(n.exit)?{entry:[...n.entry],mission:n.mission,exit:[...n.exit]}:null}function ie(n){let t=n.legacyContract;return t?.adoptable&&t.entry&&typeof t.mission=="string"&&t.exit?{entry:[...t.entry],mission:t.mission,exit:[...t.exit]}:null}function He(n){if(!n.mission.trim()||n.mission.length>16e3)return "Prompt must contain 1\u201316,000 characters.";for(let[t,e]of [["Pre-actions",n.entry],["Post-actions",n.exit]])if(e.length>50||e.some(i=>!i.trim()||i.length>4e3))return `${t}: at most 50 actions, each containing 1\u20134,000 characters. Remove empty actions.`;return null}var J=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Ze=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;function Ge(n,t=new Set){if(!J.test(n.workflowType??""))return "Workflow type: use 1\u2013128 letters, digits, dots, underscores or hyphens, starting with a letter or digit.";if(!n.title?.trim()||n.title.length>256)return "Workflow name must contain 1\u2013256 characters.";let e=n.steps??[];if(!e.length||e.length>500)return "Add between 1 and 500 blocks.";let i=new Set(e.map(_=>_.id));if(i.size!==e.length)return "Duplicate block IDs are not allowed.";for(let _ of e){if(!J.test(_.id))return `Invalid block ID: ${_.id}`;if(!_.name.trim()||_.name.length>256)return `${_.id}: block name must contain 1\u2013256 characters.`;if(!_.responsibility?.name?.trim())return `${_.id}: ${_.responsibility?.kind==="human"?"enter a human role.":_.responsibility?.kind==="code"?"select a code verifier.":"select an agent."}`;if(_.responsibility?.kind==="code"&&t.has(_.id)&&!Y(_.responsibility.name))return `${_.id}: select a supported code verifier.`;if(_.dependsOn?.some(V=>!i.has(V)))return `${_.id}: missing predecessor.`;if(new Set(_.dependsOn).size!==(_.dependsOn?.length??0))return `${_.id}: duplicate predecessor.`;let N=qe(_);if(N){let V=He(N);if(V)return `${_.id}: ${V}`}}let o=new Set,d=new Set,f=new Map(e.map(_=>[_.id,_]));function b(_){return d.has(_)?true:o.has(_)?false:(d.add(_),f.get(_)?.dependsOn?.some(b)?true:(d.delete(_),o.add(_),false))}if(e.some(_=>b(_.id)))return "Dependency cycle: remove a predecessor connection.";let h=Ke(e);if(h)return h;let R=_=>{let N=new Set([_]),V=true;for(;V;){V=false;for(let I of e)!N.has(I.id)&&I.dependsOn?.some(Q=>N.has(Q))&&(N.add(I.id),V=true);}return N},B=[];for(let _ of e){let N=_.outcomeTransitions,V=N?.pass,I=N?.fail;if(V?.action==="activate"&&(_.decision||!V.target||!i.has(V.target)||V.target===_.id||!e.find(P=>P.id===V.target)?.dependsOn?.includes(_.id)||e.some(P=>P.decision?.routes.some(O=>O.target===V.target))))return `${_.id}: PASS activation must target a non-conditional direct successor of a non-decision step.`;if(I?.action!=="return")continue;if(_.responsibility?.kind!=="agent")return `${_.id}: FAIL return requires an agent step.`;let Q=P=>{if(P===_.id)return true;let O=new Set,A=ae=>O.add(ae)?f.get(ae)?.dependsOn?.some(re=>re===P||A(re))??false:false;return A(_.id)};if(!I.target||!i.has(I.target)||!Q(I.target))return `${_.id}: FAIL return must target this step or an ancestor.`;if(I.maxCycles!==void 0&&(!Number.isInteger(I.maxCycles)||I.maxCycles<1||I.maxCycles>10))return `${_.id}: correction budget must be an integer from 1 to 10.`;let j=R(I.target);for(let P of e.filter(O=>O.decision)){let O=new Set([P.id,...P.decision?.routes.map(A=>A.target)??[],...e.filter(A=>A.join===P.id).map(A=>A.id)]);if([...O].some(A=>j.has(A))&&![...O].every(A=>j.has(A)))return `${_.id}: FAIL return cannot split a conditional-routing region.`}if(e.some(P=>j.has(P.id)&&["Gitay","prepare-work-branch"].includes(P.responsibility?.name??"")))return `${_.id}: FAIL return cannot replay branch initialization.`;let oe=I.maxCycles??2;if(B.some(P=>[...P.scope].some(O=>j.has(O))&&(![...P.scope].every(O=>j.has(O))||![...j].every(O=>P.scope.has(O))||P.maxCycles!==oe)))return `${_.id}: FAIL return overlaps an incompatible correction scope.`;B.push({scope:j,maxCycles:oe});}return null}function Ke(n){let t=n.filter(h=>h.decision),e=n.filter(h=>h.join);if(!t.length&&!e.length)return null;if(t.length!==1||e.length!==1)return "Routing requires exactly one decision and one explicit join.";let i=t[0],o=e[0],d=i.decision;if(i.responsibility?.kind!=="agent"||!["single","multiple"].includes(d.mode))return "Decision requires an agent and single/multiple mode.";let f=d.routes;if(f.length<2||f.length>16||f.some(h=>!J.test(h.name)||!J.test(h.target))||new Set(f.map(h=>h.name)).size!==f.length||new Set(f.map(h=>h.target)).size!==f.length)return "Configure 2\u201316 unique route names and distinct targets.";if(o.join!==i.id||o.id===i.id)return "Join must reference the decision.";let b=f.map(h=>h.target);for(let h of b){let R=n.find(B=>B.id===h);if(!R||[i.id,o.id].includes(h)||R.dependsOn?.length!==1||R.dependsOn[0]!==i.id)return "Each route targets one step depending only on the decision.";if(n.filter(B=>B.dependsOn?.includes(h)).some(B=>B.id!==o.id)||!o.dependsOn?.includes(h))return "Every branch must lead only and directly to the explicit join. Multi-step/nested branches are not supported."}return n.some(h=>h.dependsOn?.includes(i.id)&&!b.includes(h.id)&&h.id!==o.id)?"Decision fanout must use named routes.":null}var Z=class n{api=f(F_);baseline=null;creating=Z$1(false);editing=Z$1(false);structureDirty=Z$1(false);namespaces=Z$1([]);namespaceId=Z$1("");agents=Z$1([]);codeVerificationPresets=K;newCodeStepIds=Z$1(new Set);agentsLoading=Z$1(false);discoveryError=Z$1(null);discoverySequence=0;definition=Z$1(null);selectedId=Z$1(null);drafts=Z$1({});loading=Z$1(false);saving=Z$1(false);error=Z$1(null);saved=Z$1(null);targetVersion=Z$1("");selected=ls(()=>this.definition()?.steps?.find(t=>t.id===this.selectedId())??null);draft=ls(()=>{let t=this.selected();return t?this.drafts()[t.id]??qe(t):null});dirty=ls(()=>this.structureDirty()||Object.keys(this.drafts()).length>0||this.targetVersion()!==(this.creating()?"1.0.0":""));validation=ls(()=>{for(let e of Object.values(this.drafts())){let i=He(e);if(i)return i}let t=this.preview();return this.structureDirty()&&t?Ge(t,this.newCodeStepIds()):null});preview=ls(()=>{let t=this.definition();return t?O(g({},t),{steps:t.steps?.map(e=>g(g({},e),this.drafts()[e.id]))}):null});startNew(){this.creating.set(true),this.editing.set(true),this.baseline={schemaVersion:"1",workflowType:"",version:"",title:"",steps:[]},this.definition.set(this.baseline),this.targetVersion.set("1.0.0"),this.newCodeStepIds.set(new Set);}loadDiscovery(){this.api.getNamespaces().subscribe({next:t=>this.namespaces.set(B9(t)),error:t=>this.discoveryError.set(t.message||"Unable to load namespaces.")});}discoverAgents(t){this.namespaceId.set(t),this.agents.set([]),this.discoveryError.set(null);let e=++this.discoverySequence;this.agentsLoading.set(!!t),t&&this.api.getAgents(t).subscribe({next:i=>{e===this.discoverySequence&&(this.agents.set([...new Set(i.map(o=>o.name))].sort()),this.agentsLoading.set(false));},error:i=>{e===this.discoverySequence&&(this.discoveryError.set(i.message||"Unable to discover agents."),this.agentsLoading.set(false));}});}metadata(t,e){t==="workflowType"&&!this.creating()||this.changeDefinition(O(g({},this.definition()),{[t]:e}));}addBlock(t="agent"){if(!this.editing()||this.saving())return;let e=this.definition();if(!e||(e.steps?.length??0)>=500)return;let i=1;for(;e.steps?.some(d=>d.id===`step-${i}`);)i++;let o=`step-${i}`;this.changeDefinition(O(g({},e),{steps:[...e.steps??[],g({id:o,name:`${t==="human"?"Human":t==="code"?"Code":"Agent"} step ${i}`,responsibility:{kind:t,name:""},dependsOn:[]},t==="agent"?{entry:[],mission:"",exit:[]}:{})]})),t==="code"&&this.newCodeStepIds.update(d=>new Set([...d,o])),this.selectedId.set(o);}isNewCodeStep(t){return this.newCodeStepIds().has(t)}canRemoveSelected(){let t=this.selected();return !this.editing()||!t||this.saving()?false:t.responsibility?.kind==="agent"||t.responsibility?.kind==="human"||t.responsibility?.kind==="code"&&(this.isNewCodeStep(t.id)||Y(t.responsibility.name))}setCodeVerification(t){this.selected()?.responsibility?.kind==="code"&&Y(t)&&this.updateBlock({responsibility:{kind:"code",name:t}});}updateBlock(t){let e=this.selected();if(!this.editing()||!e||this.saving())return;let i=t.id??e.id;if(i!==e.id&&(!J.test(i)||this.definition()?.steps?.some(d=>d.id===i))){this.error.set("Block ID must be unique and use 1\u2013128 safe characters, starting with a letter or digit.");return}let o=this.definition()?.steps?.map(d=>g(g(g(O(g({},d.id===e.id?O(g(g({},d),t),{legacyContract:t.responsibility||t.dependsOn||t.name?void 0:d.legacyContract}):d),{dependsOn:(d.id===e.id?t.dependsOn??d.dependsOn:d.dependsOn)?.map(f=>f===e.id?i:f)}),i!==e.id&&d.decision?{decision:O(g({},d.decision),{routes:d.decision.routes.map(f=>O(g({},f),{target:f.target===e.id?i:f.target}))})}:{}),i!==e.id&&d.join?{join:d.join===e.id?i:d.join}:{}),i!==e.id&&d.outcomeTransitions?{outcomeTransitions:g(g(g({},d.outcomeTransitions),d.outcomeTransitions.pass?.target===e.id?{pass:O(g({},d.outcomeTransitions.pass),{target:i})}:{}),d.outcomeTransitions.fail?.target===e.id?{fail:O(g({},d.outcomeTransitions.fail),{target:i})}:{})}:{}));if(i!==e.id){let d=g({},this.drafts()),f=d[e.id];f&&(d[i]=f,delete d[e.id]),this.drafts.set(d),this.newCodeStepIds.update(b=>{if(!b.has(e.id))return b;let h=new Set(b);return h.delete(e.id),h.add(i),h});}this.changeDefinition(O(g({},this.definition()),{steps:o})),this.selectedId.set(i);}setRoutingMode(t){let e=this.selected();if(!(!e||e.responsibility?.kind!=="agent")){if(t===""){this.updateBlock({decision:void 0});return}t!=="single"&&t!=="multiple"||this.updateBlock({decision:{mode:t,routes:e.decision?.routes??[{name:"route-1",target:""},{name:"route-2",target:""}]}});}}canConfigureFailReturn(t=this.selected()){return t?.responsibility?.kind==="agent"}canConfigurePassActivate(t=this.selected()){return !!t&&!t.decision&&this.passActivationTargets(t).length>0}passActivationTargets(t=this.selected()){return !t||t.decision?[]:(this.definition()?.steps??[]).filter(e=>e.dependsOn?.includes(t.id)&&!(this.definition()?.steps??[]).some(i=>i.decision?.routes.some(o=>o.target===e.id)))}updateOutcome(t,e){let i=this.selected();if(!i||t==="fail"&&e==="return"&&!this.canConfigureFailReturn(i)||t==="pass"&&e==="activate"&&!this.canConfigurePassActivate(i))return;let o=i.outcomeTransitions??{};t==="pass"?this.updateBlock({outcomeTransitions:O(g({},o),{pass:e==="activate"?{action:"activate"}:{action:"continue"}})}):this.updateBlock({outcomeTransitions:O(g({},o),{fail:e==="return"?{action:"return",maxCycles:2}:{action:"block"}})});}updateOutcomeTarget(t,e){let i=this.selected()?.outcomeTransitions;if(!i)return;let o=i[t];o&&this.updateBlock({outcomeTransitions:O(g({},i),{[t]:O(g({},o),{target:e})})});}updateFailBudget(t){let e=this.selected()?.outcomeTransitions;if(e?.fail?.action!=="return")return;let i=Number(t);this.updateBlock({outcomeTransitions:O(g({},e),{fail:O(g({},e.fail),{maxCycles:i})})});}updateRoute(t,e,i){let o=this.selected()?.decision;o&&this.updateBlock({decision:O(g({},o),{routes:o.routes.map((d,f)=>f===t?O(g({},d),{[e]:i}):d)})});}addRoute(){let t=this.selected()?.decision;t&&t.routes.length<16&&this.updateBlock({decision:O(g({},t),{routes:[...t.routes,{name:"",target:""}]})});}removeRoute(t){let e=this.selected()?.decision;e&&this.updateBlock({decision:O(g({},e),{routes:e.routes.filter((i,o)=>o!==t)})});}setAgent(t){this.selected()?.responsibility?.kind==="agent"&&this.agents().includes(t)&&this.updateBlock({responsibility:{kind:"agent",name:t}});}addHumanContract(){let t=this.selected();this.editing()&&!this.saving()&&t?.responsibility?.kind==="human"&&!this.draft()&&this.setDraft(t.id,{entry:[],mission:t.name,exit:[]});}addExistingCodeInstructions(){let t=this.selected();this.editing()&&!this.saving()&&t?.responsibility?.kind==="code"&&!this.isNewCodeStep(t.id)&&!this.draft()&&this.setDraft(t.id,{entry:[],mission:t.name,exit:[]});}connect(t,e){let i=this.selected();!i||t===i.id||!this.definition()?.steps?.some(o=>o.id===t)||this.updateBlock({dependsOn:e?[...new Set([...i.dependsOn??[],t])]:i.dependsOn?.filter(o=>o!==t)});}removeBlock(){let t=this.selected();if(!this.canRemoveSelected()||!t)return;let e=this.definition()?.steps?.filter(o=>o.id!==t.id).map(o=>O(g(g(g(O(g({},o),{dependsOn:o.dependsOn?.filter(d=>d!==t.id)}),o.decision?{decision:O(g({},o.decision),{routes:o.decision.routes.filter(d=>d.target!==t.id)})}:{}),o.join===t.id?{join:void 0}:{}),o.outcomeTransitions?{outcomeTransitions:g(g({},o.outcomeTransitions.pass?.target===t.id?{pass:{action:"continue"}}:o.outcomeTransitions.pass?{pass:o.outcomeTransitions.pass}:{}),o.outcomeTransitions.fail?.target===t.id?{fail:{action:"block"}}:o.outcomeTransitions.fail?{fail:o.outcomeTransitions.fail}:{})}:{}),{legacyContract:o.dependsOn?.includes(t.id)?void 0:o.legacyContract}))??[],i=g({},this.drafts());delete i[t.id],this.drafts.set(i),this.newCodeStepIds.update(o=>{let d=new Set(o);return d.delete(t.id),d}),this.changeDefinition(O(g({},this.definition()),{steps:e})),this.selectedId.set(e[0]?.id??null);}changeDefinition(t){!this.editing()||this.saving()||(this.definition.set(t),this.structureDirty.set(true),this.saved.set(null),this.error.set(null));}load(t,e){if(!t||!e){this.error.set("Missing route parameters (type or version).");return}this.loading.set(true),this.saved.set(null),this.error.set(null),this.api.getWorkflowDefinition(t,e).pipe(Dn(()=>this.loading.set(false))).subscribe({next:i=>{this.baseline=i,this.definition.set(i),this.creating.set(false),this.editing.set(false),this.drafts.set({}),this.structureDirty.set(false),this.selectedId.set(i.steps?.[0]?.id??null),this.targetVersion.set(""),this.newCodeStepIds.set(new Set);},error:i=>this.error.set(i.message||"Unable to load workflow definition.")});}select(t){this.saving()||this.selectedId.set(t);}adopt(){let t=this.selected(),e=t&&ie(t);this.editing()&&t&&e&&!this.saving()&&this.setDraft(t.id,e);}update(t,e){let i=this.selected(),o=this.draft();!this.editing()||!i||!o||this.saving()||this.setDraft(i.id,O(g({},o),{[t]:e}));}setDraft(t,e){this.drafts.update(i=>O(g({},i),{[t]:e})),this.saved.set(null),this.error.set(null);}edit(){this.definition()&&!this.saving()&&(this.editing.set(true),this.saved.set(null));}cancel(){this.saving()||(this.discard(),this.editing.set(false));}discard(){this.saving()||(this.drafts.set({}),this.definition.set(this.baseline),this.structureDirty.set(false),this.targetVersion.set(this.creating()?"1.0.0":""),this.newCodeStepIds.set(new Set),this.selectedId.set(this.baseline?.steps?.[0]?.id??null),this.error.set(null),this.saved.set(null));}save(){let t=this.definition();if(!this.editing()||!t||!this.dirty()||this.saving())return;let e=this.validation();if(e){this.error.set(e);return}let i=t.workflowType?.trim(),o=this.targetVersion().trim();if(!i||!Ze.test(o)||o===t.version){this.error.set("Choose a new version in MAJOR.MINOR.PATCH format. Existing definitions and active runs are never modified.");return}let d=this.drafts(),f=O(g({},t),{version:o,steps:t.steps?.map(b=>{let h=g(g({},b),d[b.id]);return delete h.legacyContract,h})});this.saving.set(true),this.error.set(null),this.api.createWorkflowDefinition(f).pipe(Dn(()=>this.saving.set(false))).subscribe({next:b=>{this.saved.set(`Saved ${b.workflowType}@${b.version} \xB7 hash ${b.definitionHash??"unavailable"}. Original definition and runs unchanged.`);let h=O(g({},f),{workflowType:b.workflowType??f.workflowType,version:b.version??f.version});this.baseline=h,this.definition.set(h),this.editing.set(false),this.drafts.set({}),this.structureDirty.set(false),this.creating.set(false),this.newCodeStepIds.set(new Set),this.targetVersion.set("");},error:b=>{let h=b.details?.path;this.error.set(`${b.message||"Save failed."}${h?` (${h})`:""}`);}});}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac})};var Ye=()=>[],z=(n,t)=>t.id,Qe=(n,t)=>t.name;function Xe(n,t){n&1&&zM(0," New workflow ");}function et(n,t){if(n&1&&zM(0),n&2){let e=bM();Fb(" ",e.state.definition()?.workflowType||e.workflowType,"@",e.state.definition()?.version||e.version," ");}}function tt(n,t){n&1&&(kc(0,"p",5),zM(1),hp()),n&2&&(Ji(),kb(t));}function nt(n,t){n&1&&(kc(0,"div",6),Qc(1,"mat-progress-spinner",9),zM(2," Loading definition\u2026 "),hp());}function it(n,t){n&1&&(kc(0,"div",7),zM(1),hp()),n&2&&(Ji(),kb(t));}function ot(n,t){n&1&&(kc(0,"p",8),zM(1),hp()),n&2&&(Ji(),kb(t));}function at(n,t){n&1&&(kc(0,"p",19),zM(1),hp()),n&2&&(Ji(),kb(t));}function rt(n,t){if(n&1){let e=pM();kc(0,"div")(1,"div",16)(2,"button",17),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.edit())}),zM(3," Edit workflow "),hp(),kc(4,"button",18),Xc("click",function(){hg(e);let o=bM(2);return mg(o.deleteWorkflow())}),kc(5,"mat-icon"),zM(6,"delete_outline"),hp(),zM(7),hp()(),is(8,at,2,1,"p",19),kc(9,"p",11),zM(10," Read-only definition. Editing saves a new immutable version; existing runs keep their version and hash. "),hp()();}if(n&2){let e,i=bM(),o=bM();Ji(2),vb("disabled",o.deleting()),Ji(2),vb("disabled",o.deleting()),ln$1("aria-label","Delete workflow "+(i.title||i.workflowType)+" "+i.workflowType+"@"+i.version),Ji(3),Dp("",o.deleting()?"Deleting\u2026":"Delete workflow"," "),Ji(),ss((e=o.deleteError())?8:-1,e);}}function lt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),kb(e.name);}}function st(n,t){n&1&&(kc(0,"p",29),zM(1,"Loading agents\u2026"),hp());}function dt(n,t){n&1&&(kc(0,"p",30),zM(1),hp()),n&2&&(Ji(),kb(t));}function ct(n,t){n&1&&(kc(0,"p",29),zM(1," No enabled agents discovered. Existing assignments are preserved; choose another namespace or retry. "),hp());}function _t(n,t){if(n&1){let e=pM();kc(0,"fieldset",20)(1,"legend"),zM(2,"Workflow identity"),hp(),kc(3,"div",21)(4,"label"),zM(5,"Workflow type "),kc(6,"input",22),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.metadata("workflowType",o))}),hp(),YT(),hp(),kc(7,"label"),zM(8,"Workflow name "),kc(9,"input",23),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.metadata("title",o))}),hp(),YT(),hp()(),kc(10,"p",11),zM(11," Schema 1 \xB7 stable workflow type; immutable semantic versions. Agent discovery namespace is not stored in the definition; choose the execution namespace explicitly at launch. "),hp()(),kc(12,"section",24)(13,"h2"),zM(14,"Available agents"),hp(),kc(15,"button",25),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.loadDiscovery())}),kc(16,"mat-icon"),zM(17,"refresh"),hp(),zM(18," Load / refresh namespaces "),hp(),kc(19,"p",11),zM(20,"Optional for human-only workflows. Load agents only when assigning an agent step."),hp(),kc(21,"label"),zM(22,"Agent discovery namespace "),kc(23,"select",26),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.discoverAgents(o))}),kc(24,"option",27),zM(25,"Select namespace"),hp(),sM(26,lt,2,2,"option",28,z),hp(),YT(),hp(),is(28,st,2,0,"p",29),is(29,dt,2,1,"p",30),is(30,ct,2,0,"p",29),hp();}if(n&2){let e,i=bM(),o=bM();vb("disabled",o.state.saving()),Ji(6),vb("ngModel",i.workflowType)("readonly",!o.state.creating()),QT(),Ji(3),vb("ngModel",i.title),QT(),Ji(6),vb("disabled",o.state.saving()),Ji(8),vb("ngModel",o.state.namespaceId())("disabled",o.state.saving()),QT(),Ji(3),aM(o.state.namespaces()),Ji(2),ss(o.state.agentsLoading()?28:-1),Ji(),ss((e=o.state.discoveryError())?29:-1,e),Ji(),ss(o.state.namespaceId()&&!o.state.agentsLoading()&&!o.state.agents().length?30:-1);}}function pt(n,t){if(n&1){let e=pM();kc(0,"p",11),zM(1," Add agent, human or code steps, then select a step to edit its properties and optional dependencies. Arrows show dependencies. Code steps use a closed verifier list; no shell command can be entered here. "),hp(),kc(2,"div",31)(3,"button",32),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.addBlock())}),kc(4,"mat-icon"),zM(5,"smart_toy"),hp(),zM(6," Add agent step "),hp(),kc(7,"button",33),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.addBlock("code"))}),kc(8,"mat-icon"),zM(9,"code"),hp(),zM(10," Add code step "),hp(),kc(11,"button",34),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.addBlock("human"))}),kc(12,"mat-icon"),zM(13,"person_add"),hp(),zM(14," Add human step "),hp()();}if(n&2){let e=bM(),i=bM();Ji(3),vb("disabled",i.state.saving()||(e.steps?.length??0)>=500),Ji(4),vb("disabled",i.state.saving()||(e.steps?.length??0)>=500),Ji(4),vb("disabled",i.state.saving()||(e.steps?.length??0)>=500);}}function mt(n,t){n&1&&(kc(0,"p",11),zM(1,"Select a step to preview its details below. Arrows show dependencies."),hp());}function ut(n,t){if(n&1&&(kc(0,"li"),zM(1),hp()),n&2){let e=t.$implicit,i=bM(4);Ji(),Fb("",e.name," \u2192 ",i.dependencyLabel(e.target));}}function ft(n,t){if(n&1&&(kc(0,"p"),zM(1),hp(),kc(2,"ul"),sM(3,ut,2,2,"li",null,Qe),hp()),n&2){let e=t;Ji(),Dp("Decision: ",e.mode," selection."),Ji(2),aM(e.routes);}}function gt(n,t){if(n&1&&(kc(0,"p"),zM(1),hp()),n&2){let e=bM();Ji(),Dp("Join: waits for every selected branch of ",e.join," to succeed, plus ordinary dependencies.");}}function Ct(n,t){if(n&1&&zM(0),n&2){let e=bM(4);Dp(" \u2192 ",e.dependencyLabel(t)," ");}}function yt(n,t){if(n&1&&zM(0),n&2){let e=bM(4);Dp(" \u2192 ",e.dependencyLabel(t)," ");}}function xt(n,t){if(n&1&&zM(0),n&2){let e=bM(2);Dp(" \xB7 ",e.outcomeTransitions?.fail?.maxCycles??2," correction cycles ");}}function ht(n,t){if(n&1&&(kc(0,"h3"),zM(1,"After this step"),hp(),kc(2,"p"),zM(3),is(4,Ct,1,1),hp(),kc(5,"p"),zM(6),is(7,yt,1,1),is(8,xt,1,1),hp()),n&2){let e,i,o=bM();Ji(3),Dp(" PASS: ",o.outcomeTransitions?.pass?.action??"continue"," "),Ji(),ss((e=o.outcomeTransitions?.pass?.target)?4:-1,e),Ji(2),Dp(" FAIL: ",o.outcomeTransitions?.fail?.action??"block"," "),Ji(),ss((i=o.outcomeTransitions?.fail?.target)?7:-1,i),Ji(),ss(o.outcomeTransitions?.fail?.action==="return"?8:-1);}}function bt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM(3);vb("value",e.responsibility?.name),Ji(),Dp(" ",e.responsibility?.name," (existing; not in discovery) ");}}function vt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e),Ji(),kb(e);}}function wt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Agent "),kc(2,"select",58),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.setAgent(o))}),kc(3,"option",59),zM(4,"Select an agent"),hp(),is(5,bt,2,2,"option",28),sM(6,vt,2,2,"option",28,iM),hp(),YT(),hp(),kc(8,"p",11),zM(9," One agent per block; use separate blocks for multiple agents. Load a namespace above to choose an agent. "),hp();}if(n&2){let e=bM(2),i=bM(2);Ji(2),vb("ngModel",e.responsibility?.name??""),QT(),Ji(3),ss(e.responsibility?.name&&!i.state.agents().includes(e.responsibility?.name??"")?5:-1),Ji(),aM(i.state.agents());}}function kt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Human role "),kc(2,"input",60),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.updateBlock({responsibility:{kind:"human",name:o}}))}),hp(),YT(),hp(),kc(3,"p",11),zM(4," Waits for human approval. The role is not an AgentOS agent; no discovery is required. "),hp();}if(n&2){let e=bM(2);Ji(2),vb("ngModel",e.responsibility?.name??""),QT();}}function St(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),kb(e.label);}}function Et(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Code verifier "),kc(2,"select",61),Xc("ngModelChange",function(o){hg(e);let d=bM(5);return mg(d.state.setCodeVerification(o))}),kc(3,"option",59),zM(4,"Select a verifier"),hp(),sM(5,St,2,2,"option",28,z),hp(),YT(),hp(),kc(7,"p",11),zM(8),hp();}if(n&2){let e=bM(3),i=bM(2);Ji(2),vb("ngModel",e.responsibility?.name??""),QT(),Ji(3),aM(i.state.codeVerificationPresets),Ji(3),kb(i.codeVerificationPreset(e.responsibility?.name)?.hint);}}function Dt(n,t){n&1&&(kc(0,"p",11),zM(1,"This existing code responsibility is read-only."),hp());}function Pt(n,t){if(n&1&&is(0,Et,9,2)(1,Dt,2,0,"p",11),n&2){let e=bM(2),i=bM(2);ss(i.state.isNewCodeStep(e.id)||i.codeVerificationPreset(e.responsibility?.name)?0:1);}}function Tt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Route choice mode "),kc(2,"select",62),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.setRoutingMode(o))}),kc(3,"option",27),zM(4,"No decision"),hp(),kc(5,"option",63),zM(6,"Exactly one route"),hp(),kc(7,"option",64),zM(8,"One or more routes"),hp()(),YT(),hp();}if(n&2){let e=bM(2);Ji(2),vb("ngModel",e.decision?.mode??""),QT();}}function Mt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM().$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Wt(n,t){if(n&1&&is(0,Mt,2,3,"option",28),n&2){let e=t.$implicit,i=bM(4);ss(e.id!==i.id?0:-1);}}function Vt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1),kc(2,"input",66),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.state.updateRoute(d,"name",o))}),hp(),YT(),hp(),kc(3,"label"),zM(4),kc(5,"select",67),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.state.updateRoute(d,"target",o))}),kc(6,"option",27),zM(7,"Choose target"),hp(),sM(8,Wt,1,1,null,null,z),hp(),YT(),hp(),kc(10,"button",68),Xc("click",function(){let o=hg(e).$index,d=bM(5);return mg(d.state.removeRoute(o))}),zM(11," Remove route "),hp();}if(n&2){let e=t.$implicit,i=t.$index,o=bM(4);Ji(),Dp("Route ",i+1," name "),Ji(),vb("ngModel",e.name),ln$1("data-route-name",i),QT(),Ji(2),Dp("Route ",i+1," target "),Ji(),vb("ngModel",e.target),ln$1("data-route-target",i),QT(),Ji(3),aM(o.steps),Ji(2),ln$1("aria-label","Remove route "+(i+1));}}function It(n,t){if(n&1){let e=pM();kc(0,"p"),zM(1," Agents submit configured route names in selectedRoutes on PASS. Multiple selection activates the chosen routes, not an additional route. "),hp(),sM(2,Vt,12,7,null,null,oM),kc(4,"button",65),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.addRoute())}),zM(5," Add route "),hp();}if(n&2){let e=t;Ji(2),aM(e.routes),Ji(2),vb("disabled",e.routes.length>=16);}}function Ot(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM().$implicit;vb("value",e.id),Ji(),kb(e.name);}}function At(n,t){if(n&1&&is(0,Ot,2,2,"option",28),n&2){let e=t.$implicit,i=bM(2);ss(e.decision&&e.id!==i.id?0:-1);}}function Ft(n,t){n&1&&(kc(0,"option",46),zM(1,"Activate a direct successor"),hp());}function $t(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Nt(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"PASS destination "),kc(2,"select",69),Xc("ngModelChange",function(o){hg(e);let d=bM(5);return mg(d.state.updateOutcomeTarget("pass",o))}),kc(3,"option",27),zM(4,"Choose direct successor"),hp(),sM(5,$t,2,3,"option",28,z),hp(),YT(),hp();}if(n&2){let e=bM(3),i=bM(2);Ji(2),vb("ngModel",e.outcomeTransitions?.pass?.target??""),QT(),Ji(3),aM(i.state.passActivationTargets(e));}}function Rt(n,t){n&1&&(kc(0,"p",11),zM(1," This preserved PASS activation cannot be edited here because Factory only permits a non-decision step to activate a non-conditional direct successor. "),hp());}function Bt(n,t){if(n&1&&is(0,Nt,7,1,"label")(1,Rt,2,0,"p",11),n&2){let e=bM(2),i=bM(2);ss(i.state.canConfigurePassActivate(e)?0:1);}}function Lt(n,t){n&1&&(kc(0,"option",49),zM(1,"Return for correction (accepted agent FAIL only)"),hp());}function jt(n,t){n&1&&(kc(0,"option",50),zM(1,"Return for correction (preserved; unsupported trigger)"),hp());}function zt(n,t){n&1&&(kc(0,"p",11),zM(1," FAIL return is available only on agent steps with an accepted structured FAIL. Code and human failures block, although those steps can be replayed inside an agent-triggered correction scope. "),hp());}function qt(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=t.$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Ht(n,t){if(n&1){let e=pM();kc(0,"label"),zM(1,"Return destination "),kc(2,"select",70),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.updateOutcomeTarget("fail",o))}),kc(3,"option",27),zM(4,"Choose step"),hp(),sM(5,qt,2,3,"option",28,z),hp(),YT(),hp(),kc(7,"label"),zM(8,"Correction cycle budget "),kc(9,"input",71),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.updateFailBudget(o))}),hp(),YT(),hp();}if(n&2){let e=bM(2),i=bM();Ji(2),vb("ngModel",e.outcomeTransitions?.fail?.target??""),QT(),Ji(3),aM(i.steps),Ji(4),vb("ngModel",e.outcomeTransitions?.fail?.maxCycles??2),QT();}}function Ut(n,t){if(n&1&&(kc(0,"option",28),zM(1),hp()),n&2){let e=bM().$implicit;vb("value",e.id),Ji(),Fb("",e.name," (",e.id,")");}}function Jt(n,t){if(n&1&&is(0,Ut,2,3,"option",28),n&2){let e=t.$implicit,i=bM(2);ss(e.id!==i.id&&!i.dependsOn?.includes(e.id)?0:-1);}}function Zt(n,t){if(n&1){let e=pM();kc(0,"button",72),Xc("click",function(){let o=hg(e).$implicit,d=bM(4);return mg(d.state.connect(o,false))}),kc(1,"mat-icon"),zM(2,"close"),hp(),zM(3),hp();}if(n&2){let e=t.$implicit,i=bM(4);ln$1("data-remove-dependency",e)("aria-label","Remove dependency "+i.dependencyLabel(e)),Ji(3),Dp(" ",i.dependencyLabel(e)," ");}}function Gt(n,t){if(n&1){let e=pM();kc(0,"button",73),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.removeBlock())}),kc(1,"mat-icon"),zM(2,"delete_outline"),hp(),zM(3," Remove step and its connections "),hp();}}function Kt(n,t){if(n&1){let e=pM();kc(0,"fieldset",36)(1,"legend"),zM(2,"Block properties"),hp(),kc(3,"label"),zM(4,"Block ID (applied on leaving the field) "),kc(5,"input",39),Xc("change",function(o){hg(e);let d=bM(3);return mg(d.state.updateBlock({id:o.target.value}))}),hp()(),kc(6,"label"),zM(7,"Block name "),kc(8,"input",40),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateBlock({name:o}))}),hp(),YT(),hp(),is(9,wt,10,2)(10,kt,5,1)(11,Pt,2,1),kc(12,"fieldset",41)(13,"legend"),zM(14,"Conditional routing"),hp(),is(15,Tt,9,1,"label"),is(16,It,6,1),kc(17,"label"),zM(18,"Join decision (convergence) "),kc(19,"select",42),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateBlock({join:o||void 0}))}),kc(20,"option",27),zM(21,"No join"),hp(),sM(22,At,1,1,null,null,z),hp(),YT(),hp(),kc(24,"p",11),zM(25," Initial scope: one decision, 2\u201316 single-step branches, one join. Each branch depends only on the decision and feeds only the join. The join depends on every branch; extra ordinary dependencies still require success. Nested/multi-step routes are rejected. "),hp()(),kc(26,"fieldset",43)(27,"legend"),zM(28,"After this step"),hp(),kc(29,"p",11),zM(30," Standalone execution only. Code/human failures and technical errors cannot trigger automatic return. Parent-Run fragments are not supported. After the budget, human intervention requires an explicitly authorized successor run. "),hp(),kc(31,"p",11),zM(32," PASS activation is limited to an existing direct successor: it never bypasses dependencies or disables other branches. A FAIL return is enforced by Factory and replays the configured target scope. "),hp(),kc(33,"label"),zM(34,"On PASS "),kc(35,"select",44),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateOutcome("pass",o))}),kc(36,"option",45),zM(37,"Continue dependencies"),hp(),is(38,Ft,2,0,"option",46),hp(),YT(),hp(),is(39,Bt,2,1),kc(40,"label"),zM(41,"On FAIL "),kc(42,"select",47),Xc("ngModelChange",function(o){hg(e);let d=bM(3);return mg(d.state.updateOutcome("fail",o))}),kc(43,"option",48),zM(44,"Block workflow"),hp(),is(45,Lt,2,0,"option",49)(46,jt,2,0,"option",50),hp(),YT(),hp(),is(47,zt,2,0,"p",11),is(48,Ht,10,2),hp(),kc(49,"div",51)(50,"label",52),zM(51,"Dependencies (optional)"),hp(),kc(52,"p",53),zM(53," This step waits for all added steps. Leave empty for an entry step. "),hp(),kc(54,"select",54),Xc("change",function(o){return hg(e),bM(3).state.connect(o.target.value,true),mg(o.target.value="")}),kc(55,"option",27),zM(56,"Add a dependency\u2026"),hp(),sM(57,Jt,1,1,null,null,z),hp(),kc(59,"div",55),sM(60,Zt,4,3,"button",56,iM),hp()(),is(62,Gt,4,0,"button",57),hp();}if(n&2){let e,i=bM(),o=bM(),d=bM();vb("disabled",d.state.saving()),Ji(5),vb("value",i.id),Ji(3),vb("ngModel",i.name),QT(),Ji(),ss(i.responsibility?.kind==="agent"?9:i.responsibility?.kind==="human"?10:i.responsibility?.kind==="code"?11:-1),Ji(6),ss(i.responsibility?.kind==="agent"?15:-1),Ji(),ss((e=i.decision)?16:-1,e),Ji(3),vb("ngModel",i.join??""),QT(),Ji(3),aM(o.steps),Ji(13),vb("ngModel",i.outcomeTransitions?.pass?.action??"continue"),QT(),Ji(3),ss(d.state.canConfigurePassActivate(i)?38:-1),Ji(),ss(i.outcomeTransitions?.pass?.action==="activate"?39:-1),Ji(3),vb("ngModel",i.outcomeTransitions?.fail?.action??"block"),QT(),Ji(3),ss(d.state.canConfigureFailReturn(i)?45:i.outcomeTransitions?.fail?.action==="return"?46:-1),Ji(2),ss(d.state.canConfigureFailReturn(i)?-1:47),Ji(),ss(i.outcomeTransitions?.fail?.action==="return"&&d.state.canConfigureFailReturn(i)?48:-1),Ji(9),aM(o.steps),Ji(3),aM(i.dependsOn),Ji(2),ss(d.state.canRemoveSelected()?62:-1);}}function Yt(n,t){n&1&&(kc(0,"p",75),zM(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),hp());}function Qt(n,t){if(n&1&&(kc(0,"li",76),zM(1),hp()),n&2){let e=t.$implicit;Ji(),kb(e);}}function Xt(n,t){n&1&&(kc(0,"p"),zM(1,"None configured."),hp());}function en(n,t){if(n&1&&(kc(0,"li",76),zM(1),hp()),n&2){let e=t.$implicit;Ji(),kb(e);}}function tn(n,t){n&1&&(kc(0,"p"),zM(1,"None configured."),hp());}function nn(n,t){if(n&1&&(kc(0,"div",74)(1,"p")(2,"strong"),zM(3,"Agent / responsibility:"),hp(),zM(4),hp(),is(5,Yt,2,0,"p",75),kc(6,"h3"),zM(7,"Pre-actions"),hp(),kc(8,"ol"),sM(9,Qt,2,1,"li",76,oM),hp(),is(11,Xt,2,0,"p"),kc(12,"h3"),zM(13,"Prompt"),hp(),kc(14,"p",76),zM(15),hp(),kc(16,"h3"),zM(17,"Post-actions"),hp(),kc(18,"ol"),sM(19,en,2,1,"li",76,oM),hp(),is(21,tn,2,0,"p"),hp()),n&2){let e=bM(),i=bM();Ji(4),Fb(" ",i.responsibility?.name||"Not specified"," (",i.responsibility?.kind||"Not specified",") "),Ji(),ss(i.responsibility?.kind!=="agent"?5:-1),Ji(4),aM(e.entry),Ji(2),ss(e.entry.length?-1:11),Ji(4),kb(e.mission),Ji(4),aM(e.exit),Ji(2),ss(e.exit.length?-1:21);}}function on(n,t){n&1&&(kc(0,"p",75),zM(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),hp());}function an(n,t){if(n&1){let e=pM();kc(0,"div",78)(1,"label"),zM(2),kc(3,"textarea",82),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.updateAction("entry",d,o))}),hp(),YT(),hp(),kc(4,"button",83),Xc("click",function(){let o=hg(e).$index,d=bM(5);return mg(d.removeAction("entry",o))}),zM(5," Remove "),hp()();}if(n&2){let e=t.$implicit,i=t.$index;Ji(2),Dp("Pre-action ",i+1," "),Ji(),vb("ngModel",e),ln$1("data-entry",i),QT(),Ji(),ln$1("aria-label","Remove pre-action "+(i+1));}}function rn(n,t){if(n&1){let e=pM();kc(0,"div",78)(1,"label"),zM(2),kc(3,"textarea",82),Xc("ngModelChange",function(o){let d=hg(e).$index,f=bM(5);return mg(f.updateAction("exit",d,o))}),hp(),YT(),hp(),kc(4,"button",83),Xc("click",function(){let o=hg(e).$index,d=bM(5);return mg(d.removeAction("exit",o))}),zM(5," Remove "),hp()();}if(n&2){let e=t.$implicit,i=t.$index;Ji(2),Dp("Post-action ",i+1," "),Ji(),vb("ngModel",e),ln$1("data-exit",i),QT(),Ji(),ln$1("aria-label","Remove post-action "+(i+1));}}function ln(n,t){if(n&1){let e=pM();is(0,on,2,0,"p",75),kc(1,"fieldset",77)(2,"legend"),zM(3,"Step instructions"),hp(),kc(4,"h3"),zM(5,"Pre-actions"),hp(),kc(6,"p",11),zM(7,"Preparation / input obligations, in order (not executable commands)."),hp(),sM(8,an,6,4,"div",78,oM),kc(10,"button",79),Xc("click",function(){hg(e);let o=bM(4);return mg(o.addAction("entry"))}),kc(11,"mat-icon"),zM(12,"add"),hp(),zM(13," Add pre-action "),hp(),kc(14,"h3")(15,"label",80),zM(16,"Prompt"),hp()(),kc(17,"p",11),zM(18),hp(),kc(19,"textarea",81),Xc("ngModelChange",function(o){hg(e);let d=bM(4);return mg(d.state.update("mission",o))}),hp(),YT(),kc(20,"h3"),zM(21,"Post-actions"),hp(),kc(22,"p",11),zM(23,"Output / deliverable obligations, in order."),hp(),sM(24,rn,6,4,"div",78,oM),kc(26,"button",79),Xc("click",function(){hg(e);let o=bM(4);return mg(o.addAction("exit"))}),kc(27,"mat-icon"),zM(28,"add"),hp(),zM(29," Add post-action "),hp()();}if(n&2){let e=bM(),i=bM(),o=bM(2);ss(i.responsibility?.kind!=="agent"?0:-1),Ji(),vb("disabled",o.state.saving()),Ji(7),aM(e.entry),Ji(2),vb("disabled",e.entry.length>=50),Ji(8),Dp(" ",i.responsibility?.kind==="agent"?"What the agent must do. Replaces legacy Factory business instructions for this step.":"Optional documentation of intent. Human approval and code verification are unchanged; this is not executed as an agent prompt."," "),Ji(),vb("ngModel",e.mission),QT(),Ji(5),aM(e.exit),Ji(2),vb("disabled",e.exit.length>=50);}}function sn(n,t){if(n&1&&is(0,nn,22,6,"div",74)(1,ln,30,6),n&2){let e=bM(3);ss(e.state.editing()?1:0);}}function dn(n,t){n&1&&(kc(0,"p",11),zM(1),hp()),n&2&&(Ji(),kb(t.hint));}function cn(n,t){if(n&1&&(kc(0,"p",84),zM(1),hp()),n&2){let e=bM(2);Ji(),Dp(" Existing code responsibility \u201C",e.responsibility?.name||"unnamed","\u201D is preserved read-only. It is outside this editor's closed verifier list and may not be a verification step. ");}}function _n(n,t){if(n&1){let e=pM();kc(0,"button",86),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.addExistingCodeInstructions())}),kc(1,"mat-icon"),zM(2,"notes"),hp(),zM(3," Add optional instructions "),hp();}if(n&2){let e=bM(4);vb("disabled",e.state.saving());}}function pn(n,t){if(n&1&&(kc(0,"section",37)(1,"h3"),zM(2,"Code verification"),hp(),kc(3,"p"),zM(4," This code step selects a Factory verifier. It does not execute authored shell commands, and its entry, mission and exit text is intent-only documentation. "),hp(),is(5,dn,2,1,"p",11)(6,cn,2,1,"p",84),is(7,_n,4,1,"button",85),hp()),n&2){let e,i=bM(),o=bM(2);Ji(5),ss((e=o.codeVerificationPreset(i.responsibility?.name))?5:6,e),Ji(2),ss(o.state.editing()&&!o.state.isNewCodeStep(i.id)?7:-1);}}function mn(n,t){if(n&1){let e=pM();kc(0,"button",89),Xc("click",function(){hg(e);let o=bM(4);return mg(o.state.addHumanContract())}),kc(1,"mat-icon"),zM(2,"notes"),hp(),zM(3," Add optional instructions "),hp();}if(n&2){let e=bM(4);vb("disabled",e.state.saving());}}function un(n,t){if(n&1&&(kc(0,"p",87),zM(1," This human step uses the existing approval or verification implementation, not an agent prompt. "),hp(),is(2,mn,4,1,"button",88)),n&2){let e=bM(3);Ji(2),ss(e.state.editing()?2:-1);}}function fn(n,t){if(n&1){let e=pM();kc(0,"button",92),Xc("click",function(){hg(e);let o=bM(5);return mg(o.state.adopt())}),zM(1," Adopt explicit instructions "),hp();}if(n&2){let e=bM(5);vb("disabled",e.state.saving());}}function gn(n,t){if(n&1&&(kc(0,"p"),zM(1," Adoption copies the generic legacy obligations into editable actions and uses the step name as the initial prompt. Review and refine it before saving. Plugin context and Factory's technical result protocol remain. "),hp(),is(2,fn,2,1,"button",91)),n&2){let e=bM(4);Ji(2),ss(e.state.editing()?2:-1);}}function Cn(n,t){n&1&&(kc(0,"p",90),zM(1," Automatic adoption unavailable: runtime-derived branch/review obligations or non-agent execution cannot safely be replaced with a static prompt. Keep this step legacy pending a backend context/adoption decision. "),hp());}function yn(n,t){if(n&1&&(kc(0,"div",38)(1,"div")(2,"h3"),zM(3,"Legacy instructions \u2014 not an empty prompt"),hp(),kc(4,"p"),zM(5," Factory currently generates hidden business instructions from the agent name and dependency position, plus plugin context. The exact text is available in a dispatched run's selected attempt mandate. "),hp(),kc(6,"p"),zM(7),hp(),is(8,gn,3,1)(9,Cn,2,0,"p",90),hp()()),n&2){let e=bM(),i=bM(2);Ji(7),Dp(" ",e.legacyContract?.summary||"Legacy contract metadata unavailable or changed locally. Reload the saved definition before adoption."," "),Ji(),ss(i.legacyAdoption(e)?8:9);}}function xn(n,t){if(n&1&&(kc(0,"section",13)(1,"h2"),zM(2),hp(),kc(3,"p",35),zM(4),hp(),kc(5,"p"),zM(6),hp(),is(7,ft,5,1),is(8,gt,2,1,"p"),is(9,ht,9,5),is(10,Kt,63,15,"fieldset",36),is(11,sn,2,1)(12,pn,8,2,"section",37)(13,un,3,1)(14,yn,10,2,"div",38),hp()),n&2){let e,i,o=t,d=bM(2);ln$1("aria-label",d.state.editing()?"Selected step editor":"Selected step preview"),Ji(2),kb(o.name),Ji(2),Pb("",o.id," \xB7 ",o.responsibility?.kind," \xB7 ",o.responsibility?.name),Ji(2),Dp("Inputs from dependencies: ",o.dependsOn?.join(", ")||"None (entry step)"),Ji(),ss((e=o.decision)?7:-1,e),Ji(),ss(o.join?8:-1),Ji(),ss(o.outcomeTransitions?.pass||o.outcomeTransitions?.fail?9:-1),Ji(),ss(d.state.editing()?10:-1),Ji(),ss((i=d.state.draft())?11:o.responsibility?.kind==="code"?12:o.responsibility?.kind==="human"?13:14,i);}}function hn(n,t){n&1&&(kc(0,"p",30),zM(1),hp()),n&2&&(Ji(),kb(t));}function bn(n,t){if(n&1){let e=pM();kc(0,"section",14)(1,"h2"),zM(2,"Save workflow definition"),hp(),kc(3,"p"),zM(4," Existing definitions and active pinned runs are never edited. Save this composition as a new immutable version. Plugin routing and untouched step properties are preserved. Saving never starts a run. "),hp(),kc(5,"p",11),zM(6,"Save this workflow first. You can launch a saved version from Launch a run."),hp(),kc(7,"div",21)(8,"label"),zM(9,"Workflow type "),Qc(10,"input",93),hp(),kc(11,"label"),zM(12,"Version "),kc(13,"input",94),Xc("ngModelChange",function(o){hg(e);let d=bM(2);return mg(d.state.targetVersion.set(o))}),hp(),YT(),hp()(),is(14,hn,2,1,"p",30),kc(15,"p",29),zM(16),hp(),kc(17,"div",16)(18,"button",95),Xc("click",function(){hg(e);let o=bM(2);return mg(o.state.save())}),zM(19),hp(),kc(20,"button",96),Xc("click",function(){hg(e);let o=bM(2);return mg(o.cancel())}),zM(21," Cancel "),hp()(),kc(22,"p",11),zM(23," Prose is not automatically verified. Result submission, authorization, approvals and configured validators remain enforced. Do not put secrets in instructions. "),hp()();}if(n&2){let e,i=bM(),o=bM();Ji(10),vb("value",i.workflowType??""),Ji(3),vb("ngModel",o.state.targetVersion())("disabled",o.state.saving()),QT(),Ji(),ss((e=o.state.validation())?14:-1,e),Ji(2),Dp(" ",o.state.dirty()?"Unsaved step changes and structure edits (kept when selecting another step).":"No unsaved changes."," "),Ji(2),vb("disabled",!o.state.dirty()||!!o.state.validation()||o.state.saving()),Ji(),Dp(" ",o.state.saving()?"Saving\u2026":"Save new version"," "),Ji(),vb("disabled",o.state.saving());}}function vn(n,t){if(n&1){let e=pM();is(0,rt,11,5,"div"),is(1,_t,31,10),kc(2,"section",10)(3,"h2"),zM(4,"Workflow steps"),hp(),is(5,pt,15,3)(6,mt,2,0,"p",11),kc(7,"sf-workflow-definition-diagram",12),Xc("selected",function(o){hg(e);let d=bM();return mg(d.state.select(o))}),hp()(),is(8,xn,15,11,"section",13),is(9,bn,24,8,"section",14),kc(10,"details")(11,"summary"),zM(12,"Definition JSON (read-only reference)"),hp(),kc(13,"pre",15)(14,"code"),zM(15),hp()()();}if(n&2){let e,i=bM();ss(!i.state.editing()&&!i.state.creating()&&!i.state.loading()?0:-1),Ji(),ss(i.state.editing()?1:-1),Ji(4),ss(i.state.editing()?5:6),Ji(2),vb("steps",i.state.preview()?.steps??eA(9,Ye))("selectedId",i.state.selectedId())("disabled",i.state.saving()),Ji(),ss((e=i.state.selected())?8:-1,e),Ji(),ss(i.state.editing()?9:-1),Ji(6),kb(i.formatJson(t));}}function wn(n){try{return JSON.stringify(n,null,2)}catch{return String(n)}}var Ue=class n{state=f(Z);registry=f(c);dialog=f(ee);destroyRef=f(Be);deleting=Z$1(false);deleteError=Z$1(null);deleteWorkflow(){let t=this.state.definition();if(!t||this.state.editing()||this.state.creating()||this.state.loading()||this.deleting())return;let{workflowType:e,version:i}=t;if(!e||!i)return;this.deleting.set(true);let o={title:"Delete workflow",detail:`${t.title||e} \xB7 ${e}@${i}`,message:"Permanently delete this registered version? It will no longer be available for new runs. Runs are not deleted or changed. Deletion is refused if any active or historical run pins this version, including archived or purged runs.",confirmLabel:"Delete workflow",destructive:true};this.dialog.open(I,{data:o,width:"520px",autoFocus:"first-tabbable"}).afterClosed().pipe(Ce(1),U(this.destroyRef)).subscribe(d=>{let f=this.state.definition();if(d!==true||f?.workflowType!==e||f?.version!==i||this.state.editing()){this.deleting.set(false);return}this.deleteError.set(null),this.registry.delete(e,i).pipe(Dn(()=>this.deleting.set(false)),U(this.destroyRef)).subscribe({next:()=>{this.router.navigate(this.backLink);},error:b=>{this.deleteError.set(`${b.message||"Unable to delete workflow. Nothing was changed."}${b.code?` (${b.code})`:""}`);}});});}backLink=["/workflows"];formatJson=wn;legacyAdoption=ie;codeVerificationPreset=ze;workflowType;version;constructor(){let t=f(k_);cc(()=>{let f=this.state.saved();re(()=>{let b=this.state.definition();f&&!this.state.editing()&&b&&(t.crumbs.set([{label:"Workflows",link:"/workflows"},{label:`${b.workflowType}@${b.version}`,mono:true}]),this.router.navigate(["/workflows",b.workflowType,b.version],{replaceUrl:true}));});});let e=f(vn$1),i=e.snapshot,o=i.paramMap,d=i.data?.create===true;this.workflowType=o.get("type")??"",this.version=o.get("version")??"",f(k_).crumbs.set([{label:"Workflows",link:"/workflows"},{label:d?"New workflow":`${this.workflowType}@${this.version}`,mono:true}]),d?this.state.startNew():this.state.load(this.workflowType,this.version),e.paramMap?.pipe(Xr(1),U()).subscribe(f=>{let b=f.get("type")??"",h=f.get("version")??"",R=this.state.definition();!d&&b&&h&&(R?.workflowType!==b||R?.version!==h)&&(t.crumbs.set([{label:"Workflows",link:"/workflows"},{label:`${b}@${h}`,mono:true}]),this.deleteError.set(null),this.state.load(b,h));});}beforeUnload(t){(this.state.dirty()||this.state.saving())&&t.preventDefault();}canLeave(){return !this.state.saving()&&(!this.state.dirty()||window.confirm("Discard unsaved workflow changes?"))}cancel(){if(this.canLeave()){let t=this.state.creating();this.state.cancel(),t&&this.router.navigate(this.backLink);}}router=f(Hr);dependencyLabel(t){let e=this.state.definition()?.steps?.find(i=>i.id===t);return e?`${e.name} (${t})`:t}updateAction(t,e,i){let o=this.state.draft();o&&this.state.update(t,o[t].map((d,f)=>f===e?i:d));}addAction(t){let e=this.state.draft();e&&this.state.update(t,[...e[t],""]);}removeAction(t,e){let i=this.state.draft();i&&this.state.update(t,i[t].filter((o,d)=>d!==e));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=He$1({type:n,selectors:[["sf-workflow-detail-page"]],hostBindings:function(e,i){e&1&&Xc("beforeunload",function(d){return i.beforeUnload(d)},wC);},features:[Hb([Z,c])],decls:15,vars:7,consts:[[1,"page"],[1,"page-head"],["mat-stroked-button","","data-workflow-back","",1,"sf-secondary","back-btn",3,"routerLink"],[1,"titles"],["data-workflow-detail-type","",1,"sf-mono"],["data-workflow-detail-title","",1,"sf-muted"],["data-workflow-detail-loading","",1,"state"],["role","alert","data-workflow-detail-error","",1,"banner","banner--warn"],["role","status","data-save-success",""],["diameter","32","mode","indeterminate"],["aria-label","Workflow diagram","data-workflow-diagram",""],[1,"sf-muted"],[3,"selected","steps","selectedId","disabled"],["data-step-contract","",1,"step-contract"],["aria-label","Save step changes",1,"step-contract"],["data-workflow-detail-json","",1,"json-block"],[1,"save-actions"],["mat-flat-button","","data-edit-workflow","",1,"sf-primary",3,"click","disabled"],["mat-stroked-button","","type","button","data-delete-workflow","",1,"sf-danger",3,"click","disabled"],["role","alert","data-delete-error","",1,"banner","banner--warn"],["aria-label","Workflow identity",1,"step-contract",3,"disabled"],[1,"save-fields"],["maxlength","128","data-workflow-type","",3,"ngModelChange","ngModel","readonly"],["maxlength","256","data-workflow-name","",3,"ngModelChange","ngModel"],["aria-label","Agent discovery",1,"step-contract"],["mat-stroked-button","","type","button","data-refresh-namespaces","",1,"sf-secondary","composer-action",3,"click","disabled"],["data-agent-namespace","",3,"ngModelChange","ngModel","disabled"],["value",""],[3,"value"],["role","status"],["role","alert"],[1,"composer-actions"],["mat-stroked-button","","type","button","data-add-block","",1,"sf-secondary","composer-action",3,"click","disabled"],["mat-stroked-button","","type","button","data-add-code-step","",1,"sf-secondary","composer-action",3,"click","disabled"],["mat-stroked-button","","type","button","data-add-human-step","",1,"sf-secondary","composer-action",3,"click","disabled"],[1,"sf-mono"],["aria-label","Block properties",3,"disabled"],["aria-label","Code verification","data-code-verification-info",""],["data-legacy-contract","",1,"banner","banner--warn"],["maxlength","128","data-block-id","",3,"change","value"],["maxlength","256","data-block-name","",3,"ngModelChange","ngModel"],["aria-label","Conditional routing"],["data-join-decision","",3,"ngModelChange","ngModel"],["aria-label","After this step"],["data-outcome-pass","",3,"ngModelChange","ngModel"],["value","continue"],["value","activate"],["data-outcome-fail","",3,"ngModelChange","ngModel"],["value","block"],["value","return"],["value","return","disabled",""],[1,"dependencies"],["for","step-dependency"],["id","dependency-help",1,"sf-muted"],["id","step-dependency","aria-describedby","dependency-help","data-dependency-select","",3,"change"],["aria-label","Selected dependencies",1,"dependency-chips"],["mat-stroked-button","","type","button",1,"sf-secondary","dependency-chip"],["mat-stroked-button","","type","button","data-remove-block","",1,"sf-secondary","composer-action"],["data-block-agent","",3,"ngModelChange","ngModel"],["value","","disabled",""],["placeholder","e.g. Product owner","maxlength","256","data-human-role","",3,"ngModelChange","ngModel"],["data-code-verifier","",3,"ngModelChange","ngModel"],["data-route-mode","",3,"ngModelChange","ngModel"],["value","single"],["value","multiple"],["type","button",3,"click","disabled"],["maxlength","128",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],["type","button",3,"click"],["data-outcome-pass-target","",3,"ngModelChange","ngModel"],["data-outcome-fail-target","",3,"ngModelChange","ngModel"],["type","number","min","1","max","10","data-outcome-fail-budget","",3,"ngModelChange","ngModel"],["mat-stroked-button","","type","button",1,"sf-secondary","dependency-chip",3,"click"],["mat-stroked-button","","type","button","data-remove-block","",1,"sf-secondary","composer-action",3,"click"],["data-step-preview",""],["role","note"],[1,"prose"],[3,"disabled"],[1,"action-row"],["mat-stroked-button","","type","button",1,"sf-secondary","composer-action",3,"click","disabled"],["for","step-prompt"],["id","step-prompt","rows","8","maxlength","16000","data-step-prompt","",3,"ngModelChange","ngModel"],["rows","2","maxlength","4000",3,"ngModelChange","ngModel"],["mat-stroked-button","","type","button",1,"sf-secondary","composer-action",3,"click"],["role","note","data-unknown-code-verifier",""],["mat-stroked-button","","type","button","data-add-code-instructions","",1,"sf-secondary","composer-action",3,"disabled"],["mat-stroked-button","","type","button","data-add-code-instructions","",1,"sf-secondary","composer-action",3,"click","disabled"],["role","note","data-human-checkpoint",""],["mat-stroked-button","","type","button","data-add-human-contract","",1,"sf-secondary","composer-action",3,"disabled"],["mat-stroked-button","","type","button","data-add-human-contract","",1,"sf-secondary","composer-action",3,"click","disabled"],["data-adoption-blocked",""],["mat-stroked-button","","data-adopt-contract","",3,"disabled"],["mat-stroked-button","","data-adopt-contract","",3,"click","disabled"],["readonly","","data-target-type","",3,"value"],["data-target-version","",3,"ngModelChange","ngModel","disabled"],["mat-flat-button","","data-save-contract","",1,"sf-primary",3,"click","disabled"],["mat-stroked-button","","data-discard-contract","",3,"click","disabled"]],template:function(e,i){if(e&1&&(kc(0,"div",0)(1,"header",1)(2,"a",2)(3,"mat-icon"),zM(4,"arrow_back"),hp(),zM(5," Back "),hp(),kc(6,"div",3)(7,"h1",4),is(8,Xe,1,0)(9,et,1,2),hp(),is(10,tt,2,1,"p",5),hp()(),is(11,nt,3,0,"div",6),is(12,it,2,1,"div",7),is(13,ot,2,1,"p",8),is(14,vn,16,10),hp()),e&2){let o,d,f,b;Ji(2),vb("routerLink",i.backLink),Ji(6),ss(i.state.creating()?8:9),Ji(2),ss((o=i.state.definition()?.title)?10:-1,o),Ji(),ss(i.state.loading()?11:-1),Ji(),ss((d=i.state.error())?12:-1,d),Ji(),ss((f=i.state.saved())?13:-1,f),Ji(),ss((b=i.state.definition())?14:-1,b);}},dependencies:[mo,po,go,Ii,yr,dn$1,co,nr,er,Qn,mr,x9,A9,L4,P4,J$1,Z$2,Gu,A],styles:["[_nghost-%COMP%]{display:block;min-width:0}fieldset[_ngcontent-%COMP%]{border:0;padding:0;margin:0;min-width:0}legend[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}textarea[_ngcontent-%COMP%], select[_ngcontent-%COMP%], input[_ngcontent-%COMP%]{box-sizing:border-box;width:100%;padding:10px;background:var(--sf-surface-2);color:inherit;border:1px solid var(--sf-outline);border-radius:6px;font:inherit}textarea[_ngcontent-%COMP%]{display:block;resize:vertical}label[_ngcontent-%COMP%]{display:block}.composer-actions[_ngcontent-%COMP%], .dependency-chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0}.composer-action[_ngcontent-%COMP%]{margin-block:4px}.composer-action[_ngcontent-%COMP%], .dependency-chip[_ngcontent-%COMP%]{min-height:40px}button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--sf-primary, #9fa8ff);outline-offset:3px}.dependencies[_ngcontent-%COMP%]{margin-block:20px}.dependencies[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin-block:6px 10px}select[_ngcontent-%COMP%]:focus-visible, input[_ngcontent-%COMP%]:focus-visible, textarea[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--sf-primary, #9fa8ff);outline-offset:2px}.action-row[_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center;margin-bottom:10px}.action-row[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{flex:1;min-width:0}.save-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.save-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:12px}.save-fields[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{flex:1 1 180px;min-width:0}button[_ngcontent-%COMP%]{cursor:pointer}button[_ngcontent-%COMP%]:disabled{cursor:default}h2[_ngcontent-%COMP%]{font-size:18px}h3[_ngcontent-%COMP%]{font-size:15px}p[_ngcontent-%COMP%]{line-height:1.5}.prose[_ngcontent-%COMP%]{white-space:pre-wrap;overflow-wrap:anywhere}.step-contract[_ngcontent-%COMP%]{min-width:0;padding:16px;border:1px solid var(--sf-outline);border-radius:8px}.page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px;min-width:0;overflow-wrap:anywhere}.page[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{min-width:0}.page-head[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:16px}.back-btn[_ngcontent-%COMP%]{flex-shrink:0;margin-top:2px}.titles[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}h1[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:600;letter-spacing:-.01em;word-break:break-all}.titles[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:14px}.state[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.json-block[_ngcontent-%COMP%]{margin:0;padding:20px 24px;border-radius:var(--radius-md, 0);border:1px solid var(--color-divider);background:var(--color-surface-muted);font-family:var(--sf-mono);font-size:13px;line-height:1.6;overflow-x:auto;overflow-y:auto;max-height:75vh;white-space:pre;tab-size:2}.json-block[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font:inherit;color:inherit;background:none;padding:0}"]})};export{Ue as WorkflowDetailPageComponent,wn as formatJson};
|