@whoz-oss/coday-factory-cockpit 0.0.0-workstream-forge.306 → 0.0.0-workstream-forge.310
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-BS8ewwkG.js → chunk-1Psr-icp.js} +1 -1
- package/browser/{chunk-C_lxOME_.js → chunk-B_4j4J3_.js} +1 -1
- package/browser/{chunk-Clx0bvGz.js → chunk-BgFBBwpx.js} +1 -1
- package/browser/{chunk-CEs51rlG.js → chunk-BlZk5vZF.js} +1 -1
- package/browser/chunk-C-qu5lON.js +750 -0
- package/browser/{chunk-CnKPyIQK.js → chunk-C4tkfNSW.js} +1 -1
- package/browser/{chunk-bHpAPe7O.js → chunk-CM2lHl3p.js} +1 -1
- package/browser/{chunk-CC-LFx8S.js → chunk-CPCXJtgc.js} +1 -1
- package/browser/{chunk-GflAHPXN.js → chunk-CYwplJeI.js} +1 -1
- package/browser/{chunk-B99O2JWv.js → chunk-D7Rw3ZfK.js} +4 -4
- package/browser/{chunk-CFeLuvfm.js → chunk-D9qJN01e.js} +1 -1
- package/browser/{chunk-BgwvxoIf.js → chunk-Dedq0OWd.js} +1 -1
- package/browser/{chunk-CRyj8s5o.js → chunk-Dl4d2552.js} +1 -1
- package/browser/{chunk-DzdTqKLn.js → chunk-DtYNvLBh.js} +1 -1
- package/browser/{chunk-C0hfXNUa.js → chunk-KRWk__j_.js} +1 -1
- package/browser/{chunk-Cn7Sh1Sa.js → chunk-el-z4iRF.js} +2 -2
- package/browser/index.html +1 -1
- package/browser/{main-YM5YA3UI.js → main-T4S6RIJZ.js} +21 -21
- package/package.json +1 -1
- package/browser/chunk-BsXlEFK6.js +0 -750
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-BgwvxoIf.js';import {A}from'./chunk-C0hfXNUa.js';import {e as ee}from'./chunk-CFeLuvfm.js';import {U}from'./chunk-GflAHPXN.js';import {h,ab as Ue$1,Q as Qe$1,cy as Ge$1,av as yr,y as yb,$ as $s,cz as pi,aB as G,cA as vr,aa as ce,x as xe,cB as Ln,cC as Gn,cD as Un,ah as Xe$1,cE as ln$1,cF as Dt$1,ai as kn,ak as qt$1,cG as Ht$1,cH as Gt$1,cI as on$1,H as HW,U as UW,Y as Y8,Z as Z8,N as Nt$1,m as ma,V as VC,b as Id,f as ci,r as ri,j as Zg,u as ui,aq as Ey,e as ey,ar as vb,q as lT,aL as P,ae as I$1,aw as XW,az as M,A as pC,v as my,k as hy,g as Yg,cJ as m_,B as aC,a6 as Wp,a7 as Gp,aU as KC,s as ir,a8 as Sd,ao as UI,d as eC,ap as $I,t as tC,aA as gy,bz as Jw,aV as Xw}from'./main-YM5YA3UI.js';import {c}from'./chunk-CC-LFx8S.js';import {J as J$1,Z as Z$1}from'./chunk-CEs51rlG.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=h(vb);baseline=null;creating=Qe$1(false);editing=Qe$1(false);structureDirty=Qe$1(false);namespaces=Qe$1([]);namespaceId=Qe$1("");agents=Qe$1([]);codeVerificationPresets=K;newCodeStepIds=Qe$1(new Set);agentsLoading=Qe$1(false);discoveryError=Qe$1(null);discoverySequence=0;definition=Qe$1(null);selectedId=Qe$1(null);drafts=Qe$1({});loading=Qe$1(false);saving=Qe$1(false);error=Qe$1(null);saved=Qe$1(null);targetVersion=Qe$1("");selected=lT(()=>this.definition()?.steps?.find(t=>t.id===this.selectedId())??null);draft=lT(()=>{let t=this.selected();return t?this.drafts()[t.id]??qe(t):null});dirty=lT(()=>this.structureDirty()||Object.keys(this.drafts()).length>0||this.targetVersion()!==(this.creating()?"1.0.0":""));validation=lT(()=>{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=lT(()=>{let t=this.definition();return t?P(I$1({},t),{steps:t.steps?.map(e=>I$1(I$1({},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(XW(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(P(I$1({},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(P(I$1({},e),{steps:[...e.steps??[],I$1({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=>I$1(I$1(I$1(P(I$1({},d.id===e.id?P(I$1(I$1({},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:P(I$1({},d.decision),{routes:d.decision.routes.map(f=>P(I$1({},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:I$1(I$1(I$1({},d.outcomeTransitions),d.outcomeTransitions.pass?.target===e.id?{pass:P(I$1({},d.outcomeTransitions.pass),{target:i})}:{}),d.outcomeTransitions.fail?.target===e.id?{fail:P(I$1({},d.outcomeTransitions.fail),{target:i})}:{})}:{}));if(i!==e.id){let d=I$1({},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(P(I$1({},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:P(I$1({},o),{pass:e==="activate"?{action:"activate"}:{action:"continue"}})}):this.updateBlock({outcomeTransitions:P(I$1({},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:P(I$1({},i),{[t]:P(I$1({},o),{target:e})})});}updateFailBudget(t){let e=this.selected()?.outcomeTransitions;if(e?.fail?.action!=="return")return;let i=Number(t);this.updateBlock({outcomeTransitions:P(I$1({},e),{fail:P(I$1({},e.fail),{maxCycles:i})})});}updateRoute(t,e,i){let o=this.selected()?.decision;o&&this.updateBlock({decision:P(I$1({},o),{routes:o.routes.map((d,f)=>f===t?P(I$1({},d),{[e]:i}):d)})});}addRoute(){let t=this.selected()?.decision;t&&t.routes.length<16&&this.updateBlock({decision:P(I$1({},t),{routes:[...t.routes,{name:"",target:""}]})});}removeRoute(t){let e=this.selected()?.decision;e&&this.updateBlock({decision:P(I$1({},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=>P(I$1(I$1(I$1(P(I$1({},o),{dependsOn:o.dependsOn?.filter(d=>d!==t.id)}),o.decision?{decision:P(I$1({},o.decision),{routes:o.decision.routes.filter(d=>d.target!==t.id)})}:{}),o.join===t.id?{join:void 0}:{}),o.outcomeTransitions?{outcomeTransitions:I$1(I$1({},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=I$1({},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(P(I$1({},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(yr(()=>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,P(I$1({},o),{[t]:e}));}setDraft(t,e){this.drafts.update(i=>P(I$1({},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=P(I$1({},t),{version:o,steps:t.steps?.map(b=>{let h=I$1(I$1({},b),d[b.id]);return delete h.legacyContract,h})});this.saving.set(true),this.error.set(null),this.api.createWorkflowDefinition(f).pipe(yr(()=>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=P(I$1({},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=M({token:n,factory:n.\u0275fac})};var Ye=()=>[],z=(n,t)=>t.id,Qe=(n,t)=>t.name;function Xe(n,t){n&1&&VC(0," New workflow ");}function et(n,t){if(n&1&&VC(0),n&2){let e=pC();my(" ",e.state.definition()?.workflowType||e.workflowType,"@",e.state.definition()?.version||e.version," ");}}function tt(n,t){n&1&&(ma(0,"p",5),VC(1),Id()),n&2&&(ri(),hy(t));}function nt(n,t){n&1&&(ma(0,"div",6),Yg(1,"mat-progress-spinner",9),VC(2," Loading definition\u2026 "),Id());}function it(n,t){n&1&&(ma(0,"div",7),VC(1),Id()),n&2&&(ri(),hy(t));}function ot(n,t){n&1&&(ma(0,"p",8),VC(1),Id()),n&2&&(ri(),hy(t));}function at(n,t){n&1&&(ma(0,"p",19),VC(1),Id()),n&2&&(ri(),hy(t));}function rt(n,t){if(n&1){let e=aC();ma(0,"div")(1,"div",16)(2,"button",17),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.edit())}),VC(3," Edit workflow "),Id(),ma(4,"button",18),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.deleteWorkflow())}),ma(5,"mat-icon"),VC(6,"delete_outline"),Id(),VC(7),Id()(),ci(8,at,2,1,"p",19),ma(9,"p",11),VC(10," Read-only definition. Editing saves a new immutable version; existing runs keep their version and hash. "),Id()();}if(n&2){let e,i=pC(),o=pC();ri(2),Zg("disabled",o.deleting()),ri(2),Zg("disabled",o.deleting()),ir("aria-label","Delete workflow "+(i.title||i.workflowType)+" "+i.workflowType+"@"+i.version),ri(3),Sd("",o.deleting()?"Deleting\u2026":"Delete workflow"," "),ri(),ui((e=o.deleteError())?8:-1,e);}}function lt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),hy(e.name);}}function st(n,t){n&1&&(ma(0,"p",29),VC(1,"Loading agents\u2026"),Id());}function dt(n,t){n&1&&(ma(0,"p",30),VC(1),Id()),n&2&&(ri(),hy(t));}function ct(n,t){n&1&&(ma(0,"p",29),VC(1," No enabled agents discovered. Existing assignments are preserved; choose another namespace or retry. "),Id());}function _t(n,t){if(n&1){let e=aC();ma(0,"fieldset",20)(1,"legend"),VC(2,"Workflow identity"),Id(),ma(3,"div",21)(4,"label"),VC(5,"Workflow type "),ma(6,"input",22),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.metadata("workflowType",o))}),Id(),UI(),Id(),ma(7,"label"),VC(8,"Workflow name "),ma(9,"input",23),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.metadata("title",o))}),Id(),UI(),Id()(),ma(10,"p",11),VC(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. "),Id()(),ma(12,"section",24)(13,"h2"),VC(14,"Available agents"),Id(),ma(15,"button",25),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.loadDiscovery())}),ma(16,"mat-icon"),VC(17,"refresh"),Id(),VC(18," Load / refresh namespaces "),Id(),ma(19,"p",11),VC(20,"Optional for human-only workflows. Load agents only when assigning an agent step."),Id(),ma(21,"label"),VC(22,"Agent discovery namespace "),ma(23,"select",26),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.discoverAgents(o))}),ma(24,"option",27),VC(25,"Select namespace"),Id(),eC(26,lt,2,2,"option",28,z),Id(),UI(),Id(),ci(28,st,2,0,"p",29),ci(29,dt,2,1,"p",30),ci(30,ct,2,0,"p",29),Id();}if(n&2){let e,i=pC(),o=pC();Zg("disabled",o.state.saving()),ri(6),Zg("ngModel",i.workflowType)("readonly",!o.state.creating()),$I(),ri(3),Zg("ngModel",i.title),$I(),ri(6),Zg("disabled",o.state.saving()),ri(8),Zg("ngModel",o.state.namespaceId())("disabled",o.state.saving()),$I(),ri(3),tC(o.state.namespaces()),ri(2),ui(o.state.agentsLoading()?28:-1),ri(),ui((e=o.state.discoveryError())?29:-1,e),ri(),ui(o.state.namespaceId()&&!o.state.agentsLoading()&&!o.state.agents().length?30:-1);}}function pt(n,t){if(n&1){let e=aC();ma(0,"p",11),VC(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. "),Id(),ma(2,"div",31)(3,"button",32),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.addBlock())}),ma(4,"mat-icon"),VC(5,"smart_toy"),Id(),VC(6," Add agent step "),Id(),ma(7,"button",33),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.addBlock("code"))}),ma(8,"mat-icon"),VC(9,"code"),Id(),VC(10," Add code step "),Id(),ma(11,"button",34),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.addBlock("human"))}),ma(12,"mat-icon"),VC(13,"person_add"),Id(),VC(14," Add human step "),Id()();}if(n&2){let e=pC(),i=pC();ri(3),Zg("disabled",i.state.saving()||(e.steps?.length??0)>=500),ri(4),Zg("disabled",i.state.saving()||(e.steps?.length??0)>=500),ri(4),Zg("disabled",i.state.saving()||(e.steps?.length??0)>=500);}}function mt(n,t){n&1&&(ma(0,"p",11),VC(1,"Select a step to preview its details below. Arrows show dependencies."),Id());}function ut(n,t){if(n&1&&(ma(0,"li"),VC(1),Id()),n&2){let e=t.$implicit,i=pC(4);ri(),my("",e.name," \u2192 ",i.dependencyLabel(e.target));}}function ft(n,t){if(n&1&&(ma(0,"p"),VC(1),Id(),ma(2,"ul"),eC(3,ut,2,2,"li",null,Qe),Id()),n&2){let e=t;ri(),Sd("Decision: ",e.mode," selection."),ri(2),tC(e.routes);}}function gt(n,t){if(n&1&&(ma(0,"p"),VC(1),Id()),n&2){let e=pC();ri(),Sd("Join: waits for every selected branch of ",e.join," to succeed, plus ordinary dependencies.");}}function Ct(n,t){if(n&1&&VC(0),n&2){let e=pC(4);Sd(" \u2192 ",e.dependencyLabel(t)," ");}}function yt(n,t){if(n&1&&VC(0),n&2){let e=pC(4);Sd(" \u2192 ",e.dependencyLabel(t)," ");}}function xt(n,t){if(n&1&&VC(0),n&2){let e=pC(2);Sd(" \xB7 ",e.outcomeTransitions?.fail?.maxCycles??2," correction cycles ");}}function ht(n,t){if(n&1&&(ma(0,"h3"),VC(1,"After this step"),Id(),ma(2,"p"),VC(3),ci(4,Ct,1,1),Id(),ma(5,"p"),VC(6),ci(7,yt,1,1),ci(8,xt,1,1),Id()),n&2){let e,i,o=pC();ri(3),Sd(" PASS: ",o.outcomeTransitions?.pass?.action??"continue"," "),ri(),ui((e=o.outcomeTransitions?.pass?.target)?4:-1,e),ri(2),Sd(" FAIL: ",o.outcomeTransitions?.fail?.action??"block"," "),ri(),ui((i=o.outcomeTransitions?.fail?.target)?7:-1,i),ri(),ui(o.outcomeTransitions?.fail?.action==="return"?8:-1);}}function bt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC(3);Zg("value",e.responsibility?.name),ri(),Sd(" ",e.responsibility?.name," (existing; not in discovery) ");}}function vt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e),ri(),hy(e);}}function wt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Agent "),ma(2,"select",58),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.setAgent(o))}),ma(3,"option",59),VC(4,"Select an agent"),Id(),ci(5,bt,2,2,"option",28),eC(6,vt,2,2,"option",28,Jw),Id(),UI(),Id(),ma(8,"p",11),VC(9," One agent per block; use separate blocks for multiple agents. Load a namespace above to choose an agent. "),Id();}if(n&2){let e=pC(2),i=pC(2);ri(2),Zg("ngModel",e.responsibility?.name??""),$I(),ri(3),ui(e.responsibility?.name&&!i.state.agents().includes(e.responsibility?.name??"")?5:-1),ri(),tC(i.state.agents());}}function kt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Human role "),ma(2,"input",60),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.updateBlock({responsibility:{kind:"human",name:o}}))}),Id(),UI(),Id(),ma(3,"p",11),VC(4," Waits for human approval. The role is not an AgentOS agent; no discovery is required. "),Id();}if(n&2){let e=pC(2);ri(2),Zg("ngModel",e.responsibility?.name??""),$I();}}function St(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),hy(e.label);}}function Et(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Code verifier "),ma(2,"select",61),ey("ngModelChange",function(o){Wp(e);let d=pC(5);return Gp(d.state.setCodeVerification(o))}),ma(3,"option",59),VC(4,"Select a verifier"),Id(),eC(5,St,2,2,"option",28,z),Id(),UI(),Id(),ma(7,"p",11),VC(8),Id();}if(n&2){let e=pC(3),i=pC(2);ri(2),Zg("ngModel",e.responsibility?.name??""),$I(),ri(3),tC(i.state.codeVerificationPresets),ri(3),hy(i.codeVerificationPreset(e.responsibility?.name)?.hint);}}function Dt(n,t){n&1&&(ma(0,"p",11),VC(1,"This existing code responsibility is read-only."),Id());}function Pt(n,t){if(n&1&&ci(0,Et,9,2)(1,Dt,2,0,"p",11),n&2){let e=pC(2),i=pC(2);ui(i.state.isNewCodeStep(e.id)||i.codeVerificationPreset(e.responsibility?.name)?0:1);}}function Tt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Route choice mode "),ma(2,"select",62),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.setRoutingMode(o))}),ma(3,"option",27),VC(4,"No decision"),Id(),ma(5,"option",63),VC(6,"Exactly one route"),Id(),ma(7,"option",64),VC(8,"One or more routes"),Id()(),UI(),Id();}if(n&2){let e=pC(2);ri(2),Zg("ngModel",e.decision?.mode??""),$I();}}function Mt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC().$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Wt(n,t){if(n&1&&ci(0,Mt,2,3,"option",28),n&2){let e=t.$implicit,i=pC(4);ui(e.id!==i.id?0:-1);}}function Vt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1),ma(2,"input",66),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.state.updateRoute(d,"name",o))}),Id(),UI(),Id(),ma(3,"label"),VC(4),ma(5,"select",67),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.state.updateRoute(d,"target",o))}),ma(6,"option",27),VC(7,"Choose target"),Id(),eC(8,Wt,1,1,null,null,z),Id(),UI(),Id(),ma(10,"button",68),ey("click",function(){let o=Wp(e).$index,d=pC(5);return Gp(d.state.removeRoute(o))}),VC(11," Remove route "),Id();}if(n&2){let e=t.$implicit,i=t.$index,o=pC(4);ri(),Sd("Route ",i+1," name "),ri(),Zg("ngModel",e.name),ir("data-route-name",i),$I(),ri(2),Sd("Route ",i+1," target "),ri(),Zg("ngModel",e.target),ir("data-route-target",i),$I(),ri(3),tC(o.steps),ri(2),ir("aria-label","Remove route "+(i+1));}}function It(n,t){if(n&1){let e=aC();ma(0,"p"),VC(1," Agents submit configured route names in selectedRoutes on PASS. Multiple selection activates the chosen routes, not an additional route. "),Id(),eC(2,Vt,12,7,null,null,Xw),ma(4,"button",65),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.addRoute())}),VC(5," Add route "),Id();}if(n&2){let e=t;ri(2),tC(e.routes),ri(2),Zg("disabled",e.routes.length>=16);}}function Ot(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC().$implicit;Zg("value",e.id),ri(),hy(e.name);}}function At(n,t){if(n&1&&ci(0,Ot,2,2,"option",28),n&2){let e=t.$implicit,i=pC(2);ui(e.decision&&e.id!==i.id?0:-1);}}function Ft(n,t){n&1&&(ma(0,"option",46),VC(1,"Activate a direct successor"),Id());}function $t(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Nt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"PASS destination "),ma(2,"select",69),ey("ngModelChange",function(o){Wp(e);let d=pC(5);return Gp(d.state.updateOutcomeTarget("pass",o))}),ma(3,"option",27),VC(4,"Choose direct successor"),Id(),eC(5,$t,2,3,"option",28,z),Id(),UI(),Id();}if(n&2){let e=pC(3),i=pC(2);ri(2),Zg("ngModel",e.outcomeTransitions?.pass?.target??""),$I(),ri(3),tC(i.state.passActivationTargets(e));}}function Rt(n,t){n&1&&(ma(0,"p",11),VC(1," This preserved PASS activation cannot be edited here because Factory only permits a non-decision step to activate a non-conditional direct successor. "),Id());}function Bt(n,t){if(n&1&&ci(0,Nt,7,1,"label")(1,Rt,2,0,"p",11),n&2){let e=pC(2),i=pC(2);ui(i.state.canConfigurePassActivate(e)?0:1);}}function Lt(n,t){n&1&&(ma(0,"option",49),VC(1,"Return for correction (accepted agent FAIL only)"),Id());}function jt(n,t){n&1&&(ma(0,"option",50),VC(1,"Return for correction (preserved; unsupported trigger)"),Id());}function zt(n,t){n&1&&(ma(0,"p",11),VC(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. "),Id());}function qt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Ht(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Return destination "),ma(2,"select",70),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.updateOutcomeTarget("fail",o))}),ma(3,"option",27),VC(4,"Choose step"),Id(),eC(5,qt,2,3,"option",28,z),Id(),UI(),Id(),ma(7,"label"),VC(8,"Correction cycle budget "),ma(9,"input",71),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.updateFailBudget(o))}),Id(),UI(),Id();}if(n&2){let e=pC(2),i=pC();ri(2),Zg("ngModel",e.outcomeTransitions?.fail?.target??""),$I(),ri(3),tC(i.steps),ri(4),Zg("ngModel",e.outcomeTransitions?.fail?.maxCycles??2),$I();}}function Ut(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC().$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Jt(n,t){if(n&1&&ci(0,Ut,2,3,"option",28),n&2){let e=t.$implicit,i=pC(2);ui(e.id!==i.id&&!i.dependsOn?.includes(e.id)?0:-1);}}function Zt(n,t){if(n&1){let e=aC();ma(0,"button",72),ey("click",function(){let o=Wp(e).$implicit,d=pC(4);return Gp(d.state.connect(o,false))}),ma(1,"mat-icon"),VC(2,"close"),Id(),VC(3),Id();}if(n&2){let e=t.$implicit,i=pC(4);ir("data-remove-dependency",e)("aria-label","Remove dependency "+i.dependencyLabel(e)),ri(3),Sd(" ",i.dependencyLabel(e)," ");}}function Gt(n,t){if(n&1){let e=aC();ma(0,"button",73),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.removeBlock())}),ma(1,"mat-icon"),VC(2,"delete_outline"),Id(),VC(3," Remove step and its connections "),Id();}}function Kt(n,t){if(n&1){let e=aC();ma(0,"fieldset",36)(1,"legend"),VC(2,"Block properties"),Id(),ma(3,"label"),VC(4,"Block ID (applied on leaving the field) "),ma(5,"input",39),ey("change",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateBlock({id:o.target.value}))}),Id()(),ma(6,"label"),VC(7,"Block name "),ma(8,"input",40),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateBlock({name:o}))}),Id(),UI(),Id(),ci(9,wt,10,2)(10,kt,5,1)(11,Pt,2,1),ma(12,"fieldset",41)(13,"legend"),VC(14,"Conditional routing"),Id(),ci(15,Tt,9,1,"label"),ci(16,It,6,1),ma(17,"label"),VC(18,"Join decision (convergence) "),ma(19,"select",42),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateBlock({join:o||void 0}))}),ma(20,"option",27),VC(21,"No join"),Id(),eC(22,At,1,1,null,null,z),Id(),UI(),Id(),ma(24,"p",11),VC(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. "),Id()(),ma(26,"fieldset",43)(27,"legend"),VC(28,"After this step"),Id(),ma(29,"p",11),VC(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. "),Id(),ma(31,"p",11),VC(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. "),Id(),ma(33,"label"),VC(34,"On PASS "),ma(35,"select",44),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateOutcome("pass",o))}),ma(36,"option",45),VC(37,"Continue dependencies"),Id(),ci(38,Ft,2,0,"option",46),Id(),UI(),Id(),ci(39,Bt,2,1),ma(40,"label"),VC(41,"On FAIL "),ma(42,"select",47),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateOutcome("fail",o))}),ma(43,"option",48),VC(44,"Block workflow"),Id(),ci(45,Lt,2,0,"option",49)(46,jt,2,0,"option",50),Id(),UI(),Id(),ci(47,zt,2,0,"p",11),ci(48,Ht,10,2),Id(),ma(49,"div",51)(50,"label",52),VC(51,"Dependencies (optional)"),Id(),ma(52,"p",53),VC(53," This step waits for all added steps. Leave empty for an entry step. "),Id(),ma(54,"select",54),ey("change",function(o){return Wp(e),pC(3).state.connect(o.target.value,true),Gp(o.target.value="")}),ma(55,"option",27),VC(56,"Add a dependency\u2026"),Id(),eC(57,Jt,1,1,null,null,z),Id(),ma(59,"div",55),eC(60,Zt,4,3,"button",56,Jw),Id()(),ci(62,Gt,4,0,"button",57),Id();}if(n&2){let e,i=pC(),o=pC(),d=pC();Zg("disabled",d.state.saving()),ri(5),Zg("value",i.id),ri(3),Zg("ngModel",i.name),$I(),ri(),ui(i.responsibility?.kind==="agent"?9:i.responsibility?.kind==="human"?10:i.responsibility?.kind==="code"?11:-1),ri(6),ui(i.responsibility?.kind==="agent"?15:-1),ri(),ui((e=i.decision)?16:-1,e),ri(3),Zg("ngModel",i.join??""),$I(),ri(3),tC(o.steps),ri(13),Zg("ngModel",i.outcomeTransitions?.pass?.action??"continue"),$I(),ri(3),ui(d.state.canConfigurePassActivate(i)?38:-1),ri(),ui(i.outcomeTransitions?.pass?.action==="activate"?39:-1),ri(3),Zg("ngModel",i.outcomeTransitions?.fail?.action??"block"),$I(),ri(3),ui(d.state.canConfigureFailReturn(i)?45:i.outcomeTransitions?.fail?.action==="return"?46:-1),ri(2),ui(d.state.canConfigureFailReturn(i)?-1:47),ri(),ui(i.outcomeTransitions?.fail?.action==="return"&&d.state.canConfigureFailReturn(i)?48:-1),ri(9),tC(o.steps),ri(3),tC(i.dependsOn),ri(2),ui(d.state.canRemoveSelected()?62:-1);}}function Yt(n,t){n&1&&(ma(0,"p",75),VC(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),Id());}function Qt(n,t){if(n&1&&(ma(0,"li",76),VC(1),Id()),n&2){let e=t.$implicit;ri(),hy(e);}}function Xt(n,t){n&1&&(ma(0,"p"),VC(1,"None configured."),Id());}function en(n,t){if(n&1&&(ma(0,"li",76),VC(1),Id()),n&2){let e=t.$implicit;ri(),hy(e);}}function tn(n,t){n&1&&(ma(0,"p"),VC(1,"None configured."),Id());}function nn(n,t){if(n&1&&(ma(0,"div",74)(1,"p")(2,"strong"),VC(3,"Agent / responsibility:"),Id(),VC(4),Id(),ci(5,Yt,2,0,"p",75),ma(6,"h3"),VC(7,"Pre-actions"),Id(),ma(8,"ol"),eC(9,Qt,2,1,"li",76,Xw),Id(),ci(11,Xt,2,0,"p"),ma(12,"h3"),VC(13,"Prompt"),Id(),ma(14,"p",76),VC(15),Id(),ma(16,"h3"),VC(17,"Post-actions"),Id(),ma(18,"ol"),eC(19,en,2,1,"li",76,Xw),Id(),ci(21,tn,2,0,"p"),Id()),n&2){let e=pC(),i=pC();ri(4),my(" ",i.responsibility?.name||"Not specified"," (",i.responsibility?.kind||"Not specified",") "),ri(),ui(i.responsibility?.kind!=="agent"?5:-1),ri(4),tC(e.entry),ri(2),ui(e.entry.length?-1:11),ri(4),hy(e.mission),ri(4),tC(e.exit),ri(2),ui(e.exit.length?-1:21);}}function on(n,t){n&1&&(ma(0,"p",75),VC(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),Id());}function an(n,t){if(n&1){let e=aC();ma(0,"div",78)(1,"label"),VC(2),ma(3,"textarea",82),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.updateAction("entry",d,o))}),Id(),UI(),Id(),ma(4,"button",83),ey("click",function(){let o=Wp(e).$index,d=pC(5);return Gp(d.removeAction("entry",o))}),VC(5," Remove "),Id()();}if(n&2){let e=t.$implicit,i=t.$index;ri(2),Sd("Pre-action ",i+1," "),ri(),Zg("ngModel",e),ir("data-entry",i),$I(),ri(),ir("aria-label","Remove pre-action "+(i+1));}}function rn(n,t){if(n&1){let e=aC();ma(0,"div",78)(1,"label"),VC(2),ma(3,"textarea",82),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.updateAction("exit",d,o))}),Id(),UI(),Id(),ma(4,"button",83),ey("click",function(){let o=Wp(e).$index,d=pC(5);return Gp(d.removeAction("exit",o))}),VC(5," Remove "),Id()();}if(n&2){let e=t.$implicit,i=t.$index;ri(2),Sd("Post-action ",i+1," "),ri(),Zg("ngModel",e),ir("data-exit",i),$I(),ri(),ir("aria-label","Remove post-action "+(i+1));}}function ln(n,t){if(n&1){let e=aC();ci(0,on,2,0,"p",75),ma(1,"fieldset",77)(2,"legend"),VC(3,"Step instructions"),Id(),ma(4,"h3"),VC(5,"Pre-actions"),Id(),ma(6,"p",11),VC(7,"Preparation / input obligations, in order (not executable commands)."),Id(),eC(8,an,6,4,"div",78,Xw),ma(10,"button",79),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.addAction("entry"))}),ma(11,"mat-icon"),VC(12,"add"),Id(),VC(13," Add pre-action "),Id(),ma(14,"h3")(15,"label",80),VC(16,"Prompt"),Id()(),ma(17,"p",11),VC(18),Id(),ma(19,"textarea",81),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.update("mission",o))}),Id(),UI(),ma(20,"h3"),VC(21,"Post-actions"),Id(),ma(22,"p",11),VC(23,"Output / deliverable obligations, in order."),Id(),eC(24,rn,6,4,"div",78,Xw),ma(26,"button",79),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.addAction("exit"))}),ma(27,"mat-icon"),VC(28,"add"),Id(),VC(29," Add post-action "),Id()();}if(n&2){let e=pC(),i=pC(),o=pC(2);ui(i.responsibility?.kind!=="agent"?0:-1),ri(),Zg("disabled",o.state.saving()),ri(7),tC(e.entry),ri(2),Zg("disabled",e.entry.length>=50),ri(8),Sd(" ",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."," "),ri(),Zg("ngModel",e.mission),$I(),ri(5),tC(e.exit),ri(2),Zg("disabled",e.exit.length>=50);}}function sn(n,t){if(n&1&&ci(0,nn,22,6,"div",74)(1,ln,30,6),n&2){let e=pC(3);ui(e.state.editing()?1:0);}}function dn(n,t){n&1&&(ma(0,"p",11),VC(1),Id()),n&2&&(ri(),hy(t.hint));}function cn(n,t){if(n&1&&(ma(0,"p",84),VC(1),Id()),n&2){let e=pC(2);ri(),Sd(" 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=aC();ma(0,"button",86),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.addExistingCodeInstructions())}),ma(1,"mat-icon"),VC(2,"notes"),Id(),VC(3," Add optional instructions "),Id();}if(n&2){let e=pC(4);Zg("disabled",e.state.saving());}}function pn(n,t){if(n&1&&(ma(0,"section",37)(1,"h3"),VC(2,"Code verification"),Id(),ma(3,"p"),VC(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. "),Id(),ci(5,dn,2,1,"p",11)(6,cn,2,1,"p",84),ci(7,_n,4,1,"button",85),Id()),n&2){let e,i=pC(),o=pC(2);ri(5),ui((e=o.codeVerificationPreset(i.responsibility?.name))?5:6,e),ri(2),ui(o.state.editing()&&!o.state.isNewCodeStep(i.id)?7:-1);}}function mn(n,t){if(n&1){let e=aC();ma(0,"button",89),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.addHumanContract())}),ma(1,"mat-icon"),VC(2,"notes"),Id(),VC(3," Add optional instructions "),Id();}if(n&2){let e=pC(4);Zg("disabled",e.state.saving());}}function un(n,t){if(n&1&&(ma(0,"p",87),VC(1," This human step uses the existing approval or verification implementation, not an agent prompt. "),Id(),ci(2,mn,4,1,"button",88)),n&2){let e=pC(3);ri(2),ui(e.state.editing()?2:-1);}}function fn(n,t){if(n&1){let e=aC();ma(0,"button",92),ey("click",function(){Wp(e);let o=pC(5);return Gp(o.state.adopt())}),VC(1," Adopt explicit instructions "),Id();}if(n&2){let e=pC(5);Zg("disabled",e.state.saving());}}function gn(n,t){if(n&1&&(ma(0,"p"),VC(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. "),Id(),ci(2,fn,2,1,"button",91)),n&2){let e=pC(4);ri(2),ui(e.state.editing()?2:-1);}}function Cn(n,t){n&1&&(ma(0,"p",90),VC(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. "),Id());}function yn(n,t){if(n&1&&(ma(0,"div",38)(1,"div")(2,"h3"),VC(3,"Legacy instructions \u2014 not an empty prompt"),Id(),ma(4,"p"),VC(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. "),Id(),ma(6,"p"),VC(7),Id(),ci(8,gn,3,1)(9,Cn,2,0,"p",90),Id()()),n&2){let e=pC(),i=pC(2);ri(7),Sd(" ",e.legacyContract?.summary||"Legacy contract metadata unavailable or changed locally. Reload the saved definition before adoption."," "),ri(),ui(i.legacyAdoption(e)?8:9);}}function xn(n,t){if(n&1&&(ma(0,"section",13)(1,"h2"),VC(2),Id(),ma(3,"p",35),VC(4),Id(),ma(5,"p"),VC(6),Id(),ci(7,ft,5,1),ci(8,gt,2,1,"p"),ci(9,ht,9,5),ci(10,Kt,63,15,"fieldset",36),ci(11,sn,2,1)(12,pn,8,2,"section",37)(13,un,3,1)(14,yn,10,2,"div",38),Id()),n&2){let e,i,o=t,d=pC(2);ir("aria-label",d.state.editing()?"Selected step editor":"Selected step preview"),ri(2),hy(o.name),ri(2),gy("",o.id," \xB7 ",o.responsibility?.kind," \xB7 ",o.responsibility?.name),ri(2),Sd("Inputs from dependencies: ",o.dependsOn?.join(", ")||"None (entry step)"),ri(),ui((e=o.decision)?7:-1,e),ri(),ui(o.join?8:-1),ri(),ui(o.outcomeTransitions?.pass||o.outcomeTransitions?.fail?9:-1),ri(),ui(d.state.editing()?10:-1),ri(),ui((i=d.state.draft())?11:o.responsibility?.kind==="code"?12:o.responsibility?.kind==="human"?13:14,i);}}function hn(n,t){n&1&&(ma(0,"p",30),VC(1),Id()),n&2&&(ri(),hy(t));}function bn(n,t){if(n&1){let e=aC();ma(0,"section",14)(1,"h2"),VC(2,"Save workflow definition"),Id(),ma(3,"p"),VC(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. "),Id(),ma(5,"p",11),VC(6,"Save this workflow first. You can launch a saved version from Launch a run."),Id(),ma(7,"div",21)(8,"label"),VC(9,"Workflow type "),Yg(10,"input",93),Id(),ma(11,"label"),VC(12,"Version "),ma(13,"input",94),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.targetVersion.set(o))}),Id(),UI(),Id()(),ci(14,hn,2,1,"p",30),ma(15,"p",29),VC(16),Id(),ma(17,"div",16)(18,"button",95),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.save())}),VC(19),Id(),ma(20,"button",96),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.cancel())}),VC(21," Cancel "),Id()(),ma(22,"p",11),VC(23," Prose is not automatically verified. Result submission, authorization, approvals and configured validators remain enforced. Do not put secrets in instructions. "),Id()();}if(n&2){let e,i=pC(),o=pC();ri(10),Zg("value",i.workflowType??""),ri(3),Zg("ngModel",o.state.targetVersion())("disabled",o.state.saving()),$I(),ri(),ui((e=o.state.validation())?14:-1,e),ri(2),Sd(" ",o.state.dirty()?"Unsaved step changes and structure edits (kept when selecting another step).":"No unsaved changes."," "),ri(2),Zg("disabled",!o.state.dirty()||!!o.state.validation()||o.state.saving()),ri(),Sd(" ",o.state.saving()?"Saving\u2026":"Save new version"," "),ri(),Zg("disabled",o.state.saving());}}function vn(n,t){if(n&1){let e=aC();ci(0,rt,11,5,"div"),ci(1,_t,31,10),ma(2,"section",10)(3,"h2"),VC(4,"Workflow steps"),Id(),ci(5,pt,15,3)(6,mt,2,0,"p",11),ma(7,"sf-workflow-definition-diagram",12),ey("selected",function(o){Wp(e);let d=pC();return Gp(d.state.select(o))}),Id()(),ci(8,xn,15,11,"section",13),ci(9,bn,24,8,"section",14),ma(10,"details")(11,"summary"),VC(12,"Definition JSON (read-only reference)"),Id(),ma(13,"pre",15)(14,"code"),VC(15),Id()()();}if(n&2){let e,i=pC();ui(!i.state.editing()&&!i.state.creating()&&!i.state.loading()?0:-1),ri(),ui(i.state.editing()?1:-1),ri(4),ui(i.state.editing()?5:6),ri(2),Zg("steps",i.state.preview()?.steps??KC(9,Ye))("selectedId",i.state.selectedId())("disabled",i.state.saving()),ri(),ui((e=i.state.selected())?8:-1,e),ri(),ui(i.state.editing()?9:-1),ri(6),hy(i.formatJson(t));}}function wn(n){try{return JSON.stringify(n,null,2)}catch{return String(n)}}var Ue=class n{state=h(Z);registry=h(c);dialog=h(ee);destroyRef=h(Ue$1);deleting=Qe$1(false);deleteError=Qe$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(Ge$1(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(yr(()=>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=h(yb);$s(()=>{let f=this.state.saved();pi(()=>{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=h(G),i=e.snapshot,o=i.paramMap,d=i.data?.create===true;this.workflowType=o.get("type")??"",this.version=o.get("version")??"",h(yb).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(vr(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=h(ce);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=xe({type:n,selectors:[["sf-workflow-detail-page"]],hostBindings:function(e,i){e&1&&ey("beforeunload",function(d){return i.beforeUnload(d)},m_);},features:[Ey([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&&(ma(0,"div",0)(1,"header",1)(2,"a",2)(3,"mat-icon"),VC(4,"arrow_back"),Id(),VC(5," Back "),Id(),ma(6,"div",3)(7,"h1",4),ci(8,Xe,1,0)(9,et,1,2),Id(),ci(10,tt,2,1,"p",5),Id()(),ci(11,nt,3,0,"div",6),ci(12,it,2,1,"div",7),ci(13,ot,2,1,"p",8),ci(14,vn,16,10),Id()),e&2){let o,d,f,b;ri(2),Zg("routerLink",i.backLink),ri(6),ui(i.state.creating()?8:9),ri(2),ui((o=i.state.definition()?.title)?10:-1,o),ri(),ui(i.state.loading()?11:-1),ri(),ui((d=i.state.error())?12:-1,d),ri(),ui((f=i.state.saved())?13:-1,f),ri(),ui((b=i.state.definition())?14:-1,b);}},dependencies:[Ln,Gn,Un,Xe$1,ln$1,Dt$1,kn,qt$1,Ht$1,Gt$1,on$1,HW,UW,Y8,Z8,J$1,Z$1,Nt$1,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-Dedq0OWd.js';import {A}from'./chunk-KRWk__j_.js';import {e as ee}from'./chunk-D9qJN01e.js';import {U}from'./chunk-CYwplJeI.js';import {h,ab as Ue$1,Q as Qe$1,cy as Ge$1,av as yr,y as yb,$ as $s,cz as pi,aB as G,cA as vr,aa as ce,x as xe,cB as Ln,cC as Gn,cD as Un,ah as Xe$1,cE as ln$1,cF as Dt$1,ai as kn,ak as qt$1,cG as Ht$1,cH as Gt$1,cI as on$1,H as HW,U as UW,Y as Y8,Z as Z8,N as Nt$1,m as ma,V as VC,b as Id,f as ci,r as ri,j as Zg,u as ui,aq as Ey,e as ey,ar as vb,q as lT,aL as P,ae as I$1,aw as XW,az as M,A as pC,v as my,k as hy,g as Yg,cJ as m_,B as aC,a6 as Wp,a7 as Gp,aU as KC,s as ir,a8 as Sd,ao as UI,d as eC,ap as $I,t as tC,aA as gy,bz as Jw,aV as Xw}from'./main-T4S6RIJZ.js';import {c}from'./chunk-CPCXJtgc.js';import {J as J$1,Z as Z$1}from'./chunk-BlZk5vZF.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=h(vb);baseline=null;creating=Qe$1(false);editing=Qe$1(false);structureDirty=Qe$1(false);namespaces=Qe$1([]);namespaceId=Qe$1("");agents=Qe$1([]);codeVerificationPresets=K;newCodeStepIds=Qe$1(new Set);agentsLoading=Qe$1(false);discoveryError=Qe$1(null);discoverySequence=0;definition=Qe$1(null);selectedId=Qe$1(null);drafts=Qe$1({});loading=Qe$1(false);saving=Qe$1(false);error=Qe$1(null);saved=Qe$1(null);targetVersion=Qe$1("");selected=lT(()=>this.definition()?.steps?.find(t=>t.id===this.selectedId())??null);draft=lT(()=>{let t=this.selected();return t?this.drafts()[t.id]??qe(t):null});dirty=lT(()=>this.structureDirty()||Object.keys(this.drafts()).length>0||this.targetVersion()!==(this.creating()?"1.0.0":""));validation=lT(()=>{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=lT(()=>{let t=this.definition();return t?P(I$1({},t),{steps:t.steps?.map(e=>I$1(I$1({},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(XW(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(P(I$1({},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(P(I$1({},e),{steps:[...e.steps??[],I$1({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=>I$1(I$1(I$1(P(I$1({},d.id===e.id?P(I$1(I$1({},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:P(I$1({},d.decision),{routes:d.decision.routes.map(f=>P(I$1({},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:I$1(I$1(I$1({},d.outcomeTransitions),d.outcomeTransitions.pass?.target===e.id?{pass:P(I$1({},d.outcomeTransitions.pass),{target:i})}:{}),d.outcomeTransitions.fail?.target===e.id?{fail:P(I$1({},d.outcomeTransitions.fail),{target:i})}:{})}:{}));if(i!==e.id){let d=I$1({},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(P(I$1({},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:P(I$1({},o),{pass:e==="activate"?{action:"activate"}:{action:"continue"}})}):this.updateBlock({outcomeTransitions:P(I$1({},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:P(I$1({},i),{[t]:P(I$1({},o),{target:e})})});}updateFailBudget(t){let e=this.selected()?.outcomeTransitions;if(e?.fail?.action!=="return")return;let i=Number(t);this.updateBlock({outcomeTransitions:P(I$1({},e),{fail:P(I$1({},e.fail),{maxCycles:i})})});}updateRoute(t,e,i){let o=this.selected()?.decision;o&&this.updateBlock({decision:P(I$1({},o),{routes:o.routes.map((d,f)=>f===t?P(I$1({},d),{[e]:i}):d)})});}addRoute(){let t=this.selected()?.decision;t&&t.routes.length<16&&this.updateBlock({decision:P(I$1({},t),{routes:[...t.routes,{name:"",target:""}]})});}removeRoute(t){let e=this.selected()?.decision;e&&this.updateBlock({decision:P(I$1({},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=>P(I$1(I$1(I$1(P(I$1({},o),{dependsOn:o.dependsOn?.filter(d=>d!==t.id)}),o.decision?{decision:P(I$1({},o.decision),{routes:o.decision.routes.filter(d=>d.target!==t.id)})}:{}),o.join===t.id?{join:void 0}:{}),o.outcomeTransitions?{outcomeTransitions:I$1(I$1({},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=I$1({},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(P(I$1({},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(yr(()=>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,P(I$1({},o),{[t]:e}));}setDraft(t,e){this.drafts.update(i=>P(I$1({},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=P(I$1({},t),{version:o,steps:t.steps?.map(b=>{let h=I$1(I$1({},b),d[b.id]);return delete h.legacyContract,h})});this.saving.set(true),this.error.set(null),this.api.createWorkflowDefinition(f).pipe(yr(()=>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=P(I$1({},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=M({token:n,factory:n.\u0275fac})};var Ye=()=>[],z=(n,t)=>t.id,Qe=(n,t)=>t.name;function Xe(n,t){n&1&&VC(0," New workflow ");}function et(n,t){if(n&1&&VC(0),n&2){let e=pC();my(" ",e.state.definition()?.workflowType||e.workflowType,"@",e.state.definition()?.version||e.version," ");}}function tt(n,t){n&1&&(ma(0,"p",5),VC(1),Id()),n&2&&(ri(),hy(t));}function nt(n,t){n&1&&(ma(0,"div",6),Yg(1,"mat-progress-spinner",9),VC(2," Loading definition\u2026 "),Id());}function it(n,t){n&1&&(ma(0,"div",7),VC(1),Id()),n&2&&(ri(),hy(t));}function ot(n,t){n&1&&(ma(0,"p",8),VC(1),Id()),n&2&&(ri(),hy(t));}function at(n,t){n&1&&(ma(0,"p",19),VC(1),Id()),n&2&&(ri(),hy(t));}function rt(n,t){if(n&1){let e=aC();ma(0,"div")(1,"div",16)(2,"button",17),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.edit())}),VC(3," Edit workflow "),Id(),ma(4,"button",18),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.deleteWorkflow())}),ma(5,"mat-icon"),VC(6,"delete_outline"),Id(),VC(7),Id()(),ci(8,at,2,1,"p",19),ma(9,"p",11),VC(10," Read-only definition. Editing saves a new immutable version; existing runs keep their version and hash. "),Id()();}if(n&2){let e,i=pC(),o=pC();ri(2),Zg("disabled",o.deleting()),ri(2),Zg("disabled",o.deleting()),ir("aria-label","Delete workflow "+(i.title||i.workflowType)+" "+i.workflowType+"@"+i.version),ri(3),Sd("",o.deleting()?"Deleting\u2026":"Delete workflow"," "),ri(),ui((e=o.deleteError())?8:-1,e);}}function lt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),hy(e.name);}}function st(n,t){n&1&&(ma(0,"p",29),VC(1,"Loading agents\u2026"),Id());}function dt(n,t){n&1&&(ma(0,"p",30),VC(1),Id()),n&2&&(ri(),hy(t));}function ct(n,t){n&1&&(ma(0,"p",29),VC(1," No enabled agents discovered. Existing assignments are preserved; choose another namespace or retry. "),Id());}function _t(n,t){if(n&1){let e=aC();ma(0,"fieldset",20)(1,"legend"),VC(2,"Workflow identity"),Id(),ma(3,"div",21)(4,"label"),VC(5,"Workflow type "),ma(6,"input",22),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.metadata("workflowType",o))}),Id(),UI(),Id(),ma(7,"label"),VC(8,"Workflow name "),ma(9,"input",23),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.metadata("title",o))}),Id(),UI(),Id()(),ma(10,"p",11),VC(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. "),Id()(),ma(12,"section",24)(13,"h2"),VC(14,"Available agents"),Id(),ma(15,"button",25),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.loadDiscovery())}),ma(16,"mat-icon"),VC(17,"refresh"),Id(),VC(18," Load / refresh namespaces "),Id(),ma(19,"p",11),VC(20,"Optional for human-only workflows. Load agents only when assigning an agent step."),Id(),ma(21,"label"),VC(22,"Agent discovery namespace "),ma(23,"select",26),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.discoverAgents(o))}),ma(24,"option",27),VC(25,"Select namespace"),Id(),eC(26,lt,2,2,"option",28,z),Id(),UI(),Id(),ci(28,st,2,0,"p",29),ci(29,dt,2,1,"p",30),ci(30,ct,2,0,"p",29),Id();}if(n&2){let e,i=pC(),o=pC();Zg("disabled",o.state.saving()),ri(6),Zg("ngModel",i.workflowType)("readonly",!o.state.creating()),$I(),ri(3),Zg("ngModel",i.title),$I(),ri(6),Zg("disabled",o.state.saving()),ri(8),Zg("ngModel",o.state.namespaceId())("disabled",o.state.saving()),$I(),ri(3),tC(o.state.namespaces()),ri(2),ui(o.state.agentsLoading()?28:-1),ri(),ui((e=o.state.discoveryError())?29:-1,e),ri(),ui(o.state.namespaceId()&&!o.state.agentsLoading()&&!o.state.agents().length?30:-1);}}function pt(n,t){if(n&1){let e=aC();ma(0,"p",11),VC(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. "),Id(),ma(2,"div",31)(3,"button",32),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.addBlock())}),ma(4,"mat-icon"),VC(5,"smart_toy"),Id(),VC(6," Add agent step "),Id(),ma(7,"button",33),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.addBlock("code"))}),ma(8,"mat-icon"),VC(9,"code"),Id(),VC(10," Add code step "),Id(),ma(11,"button",34),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.addBlock("human"))}),ma(12,"mat-icon"),VC(13,"person_add"),Id(),VC(14," Add human step "),Id()();}if(n&2){let e=pC(),i=pC();ri(3),Zg("disabled",i.state.saving()||(e.steps?.length??0)>=500),ri(4),Zg("disabled",i.state.saving()||(e.steps?.length??0)>=500),ri(4),Zg("disabled",i.state.saving()||(e.steps?.length??0)>=500);}}function mt(n,t){n&1&&(ma(0,"p",11),VC(1,"Select a step to preview its details below. Arrows show dependencies."),Id());}function ut(n,t){if(n&1&&(ma(0,"li"),VC(1),Id()),n&2){let e=t.$implicit,i=pC(4);ri(),my("",e.name," \u2192 ",i.dependencyLabel(e.target));}}function ft(n,t){if(n&1&&(ma(0,"p"),VC(1),Id(),ma(2,"ul"),eC(3,ut,2,2,"li",null,Qe),Id()),n&2){let e=t;ri(),Sd("Decision: ",e.mode," selection."),ri(2),tC(e.routes);}}function gt(n,t){if(n&1&&(ma(0,"p"),VC(1),Id()),n&2){let e=pC();ri(),Sd("Join: waits for every selected branch of ",e.join," to succeed, plus ordinary dependencies.");}}function Ct(n,t){if(n&1&&VC(0),n&2){let e=pC(4);Sd(" \u2192 ",e.dependencyLabel(t)," ");}}function yt(n,t){if(n&1&&VC(0),n&2){let e=pC(4);Sd(" \u2192 ",e.dependencyLabel(t)," ");}}function xt(n,t){if(n&1&&VC(0),n&2){let e=pC(2);Sd(" \xB7 ",e.outcomeTransitions?.fail?.maxCycles??2," correction cycles ");}}function ht(n,t){if(n&1&&(ma(0,"h3"),VC(1,"After this step"),Id(),ma(2,"p"),VC(3),ci(4,Ct,1,1),Id(),ma(5,"p"),VC(6),ci(7,yt,1,1),ci(8,xt,1,1),Id()),n&2){let e,i,o=pC();ri(3),Sd(" PASS: ",o.outcomeTransitions?.pass?.action??"continue"," "),ri(),ui((e=o.outcomeTransitions?.pass?.target)?4:-1,e),ri(2),Sd(" FAIL: ",o.outcomeTransitions?.fail?.action??"block"," "),ri(),ui((i=o.outcomeTransitions?.fail?.target)?7:-1,i),ri(),ui(o.outcomeTransitions?.fail?.action==="return"?8:-1);}}function bt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC(3);Zg("value",e.responsibility?.name),ri(),Sd(" ",e.responsibility?.name," (existing; not in discovery) ");}}function vt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e),ri(),hy(e);}}function wt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Agent "),ma(2,"select",58),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.setAgent(o))}),ma(3,"option",59),VC(4,"Select an agent"),Id(),ci(5,bt,2,2,"option",28),eC(6,vt,2,2,"option",28,Jw),Id(),UI(),Id(),ma(8,"p",11),VC(9," One agent per block; use separate blocks for multiple agents. Load a namespace above to choose an agent. "),Id();}if(n&2){let e=pC(2),i=pC(2);ri(2),Zg("ngModel",e.responsibility?.name??""),$I(),ri(3),ui(e.responsibility?.name&&!i.state.agents().includes(e.responsibility?.name??"")?5:-1),ri(),tC(i.state.agents());}}function kt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Human role "),ma(2,"input",60),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.updateBlock({responsibility:{kind:"human",name:o}}))}),Id(),UI(),Id(),ma(3,"p",11),VC(4," Waits for human approval. The role is not an AgentOS agent; no discovery is required. "),Id();}if(n&2){let e=pC(2);ri(2),Zg("ngModel",e.responsibility?.name??""),$I();}}function St(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),hy(e.label);}}function Et(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Code verifier "),ma(2,"select",61),ey("ngModelChange",function(o){Wp(e);let d=pC(5);return Gp(d.state.setCodeVerification(o))}),ma(3,"option",59),VC(4,"Select a verifier"),Id(),eC(5,St,2,2,"option",28,z),Id(),UI(),Id(),ma(7,"p",11),VC(8),Id();}if(n&2){let e=pC(3),i=pC(2);ri(2),Zg("ngModel",e.responsibility?.name??""),$I(),ri(3),tC(i.state.codeVerificationPresets),ri(3),hy(i.codeVerificationPreset(e.responsibility?.name)?.hint);}}function Dt(n,t){n&1&&(ma(0,"p",11),VC(1,"This existing code responsibility is read-only."),Id());}function Pt(n,t){if(n&1&&ci(0,Et,9,2)(1,Dt,2,0,"p",11),n&2){let e=pC(2),i=pC(2);ui(i.state.isNewCodeStep(e.id)||i.codeVerificationPreset(e.responsibility?.name)?0:1);}}function Tt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Route choice mode "),ma(2,"select",62),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.setRoutingMode(o))}),ma(3,"option",27),VC(4,"No decision"),Id(),ma(5,"option",63),VC(6,"Exactly one route"),Id(),ma(7,"option",64),VC(8,"One or more routes"),Id()(),UI(),Id();}if(n&2){let e=pC(2);ri(2),Zg("ngModel",e.decision?.mode??""),$I();}}function Mt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC().$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Wt(n,t){if(n&1&&ci(0,Mt,2,3,"option",28),n&2){let e=t.$implicit,i=pC(4);ui(e.id!==i.id?0:-1);}}function Vt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1),ma(2,"input",66),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.state.updateRoute(d,"name",o))}),Id(),UI(),Id(),ma(3,"label"),VC(4),ma(5,"select",67),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.state.updateRoute(d,"target",o))}),ma(6,"option",27),VC(7,"Choose target"),Id(),eC(8,Wt,1,1,null,null,z),Id(),UI(),Id(),ma(10,"button",68),ey("click",function(){let o=Wp(e).$index,d=pC(5);return Gp(d.state.removeRoute(o))}),VC(11," Remove route "),Id();}if(n&2){let e=t.$implicit,i=t.$index,o=pC(4);ri(),Sd("Route ",i+1," name "),ri(),Zg("ngModel",e.name),ir("data-route-name",i),$I(),ri(2),Sd("Route ",i+1," target "),ri(),Zg("ngModel",e.target),ir("data-route-target",i),$I(),ri(3),tC(o.steps),ri(2),ir("aria-label","Remove route "+(i+1));}}function It(n,t){if(n&1){let e=aC();ma(0,"p"),VC(1," Agents submit configured route names in selectedRoutes on PASS. Multiple selection activates the chosen routes, not an additional route. "),Id(),eC(2,Vt,12,7,null,null,Xw),ma(4,"button",65),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.addRoute())}),VC(5," Add route "),Id();}if(n&2){let e=t;ri(2),tC(e.routes),ri(2),Zg("disabled",e.routes.length>=16);}}function Ot(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC().$implicit;Zg("value",e.id),ri(),hy(e.name);}}function At(n,t){if(n&1&&ci(0,Ot,2,2,"option",28),n&2){let e=t.$implicit,i=pC(2);ui(e.decision&&e.id!==i.id?0:-1);}}function Ft(n,t){n&1&&(ma(0,"option",46),VC(1,"Activate a direct successor"),Id());}function $t(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Nt(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"PASS destination "),ma(2,"select",69),ey("ngModelChange",function(o){Wp(e);let d=pC(5);return Gp(d.state.updateOutcomeTarget("pass",o))}),ma(3,"option",27),VC(4,"Choose direct successor"),Id(),eC(5,$t,2,3,"option",28,z),Id(),UI(),Id();}if(n&2){let e=pC(3),i=pC(2);ri(2),Zg("ngModel",e.outcomeTransitions?.pass?.target??""),$I(),ri(3),tC(i.state.passActivationTargets(e));}}function Rt(n,t){n&1&&(ma(0,"p",11),VC(1," This preserved PASS activation cannot be edited here because Factory only permits a non-decision step to activate a non-conditional direct successor. "),Id());}function Bt(n,t){if(n&1&&ci(0,Nt,7,1,"label")(1,Rt,2,0,"p",11),n&2){let e=pC(2),i=pC(2);ui(i.state.canConfigurePassActivate(e)?0:1);}}function Lt(n,t){n&1&&(ma(0,"option",49),VC(1,"Return for correction (accepted agent FAIL only)"),Id());}function jt(n,t){n&1&&(ma(0,"option",50),VC(1,"Return for correction (preserved; unsupported trigger)"),Id());}function zt(n,t){n&1&&(ma(0,"p",11),VC(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. "),Id());}function qt(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=t.$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Ht(n,t){if(n&1){let e=aC();ma(0,"label"),VC(1,"Return destination "),ma(2,"select",70),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.updateOutcomeTarget("fail",o))}),ma(3,"option",27),VC(4,"Choose step"),Id(),eC(5,qt,2,3,"option",28,z),Id(),UI(),Id(),ma(7,"label"),VC(8,"Correction cycle budget "),ma(9,"input",71),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.updateFailBudget(o))}),Id(),UI(),Id();}if(n&2){let e=pC(2),i=pC();ri(2),Zg("ngModel",e.outcomeTransitions?.fail?.target??""),$I(),ri(3),tC(i.steps),ri(4),Zg("ngModel",e.outcomeTransitions?.fail?.maxCycles??2),$I();}}function Ut(n,t){if(n&1&&(ma(0,"option",28),VC(1),Id()),n&2){let e=pC().$implicit;Zg("value",e.id),ri(),my("",e.name," (",e.id,")");}}function Jt(n,t){if(n&1&&ci(0,Ut,2,3,"option",28),n&2){let e=t.$implicit,i=pC(2);ui(e.id!==i.id&&!i.dependsOn?.includes(e.id)?0:-1);}}function Zt(n,t){if(n&1){let e=aC();ma(0,"button",72),ey("click",function(){let o=Wp(e).$implicit,d=pC(4);return Gp(d.state.connect(o,false))}),ma(1,"mat-icon"),VC(2,"close"),Id(),VC(3),Id();}if(n&2){let e=t.$implicit,i=pC(4);ir("data-remove-dependency",e)("aria-label","Remove dependency "+i.dependencyLabel(e)),ri(3),Sd(" ",i.dependencyLabel(e)," ");}}function Gt(n,t){if(n&1){let e=aC();ma(0,"button",73),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.removeBlock())}),ma(1,"mat-icon"),VC(2,"delete_outline"),Id(),VC(3," Remove step and its connections "),Id();}}function Kt(n,t){if(n&1){let e=aC();ma(0,"fieldset",36)(1,"legend"),VC(2,"Block properties"),Id(),ma(3,"label"),VC(4,"Block ID (applied on leaving the field) "),ma(5,"input",39),ey("change",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateBlock({id:o.target.value}))}),Id()(),ma(6,"label"),VC(7,"Block name "),ma(8,"input",40),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateBlock({name:o}))}),Id(),UI(),Id(),ci(9,wt,10,2)(10,kt,5,1)(11,Pt,2,1),ma(12,"fieldset",41)(13,"legend"),VC(14,"Conditional routing"),Id(),ci(15,Tt,9,1,"label"),ci(16,It,6,1),ma(17,"label"),VC(18,"Join decision (convergence) "),ma(19,"select",42),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateBlock({join:o||void 0}))}),ma(20,"option",27),VC(21,"No join"),Id(),eC(22,At,1,1,null,null,z),Id(),UI(),Id(),ma(24,"p",11),VC(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. "),Id()(),ma(26,"fieldset",43)(27,"legend"),VC(28,"After this step"),Id(),ma(29,"p",11),VC(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. "),Id(),ma(31,"p",11),VC(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. "),Id(),ma(33,"label"),VC(34,"On PASS "),ma(35,"select",44),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateOutcome("pass",o))}),ma(36,"option",45),VC(37,"Continue dependencies"),Id(),ci(38,Ft,2,0,"option",46),Id(),UI(),Id(),ci(39,Bt,2,1),ma(40,"label"),VC(41,"On FAIL "),ma(42,"select",47),ey("ngModelChange",function(o){Wp(e);let d=pC(3);return Gp(d.state.updateOutcome("fail",o))}),ma(43,"option",48),VC(44,"Block workflow"),Id(),ci(45,Lt,2,0,"option",49)(46,jt,2,0,"option",50),Id(),UI(),Id(),ci(47,zt,2,0,"p",11),ci(48,Ht,10,2),Id(),ma(49,"div",51)(50,"label",52),VC(51,"Dependencies (optional)"),Id(),ma(52,"p",53),VC(53," This step waits for all added steps. Leave empty for an entry step. "),Id(),ma(54,"select",54),ey("change",function(o){return Wp(e),pC(3).state.connect(o.target.value,true),Gp(o.target.value="")}),ma(55,"option",27),VC(56,"Add a dependency\u2026"),Id(),eC(57,Jt,1,1,null,null,z),Id(),ma(59,"div",55),eC(60,Zt,4,3,"button",56,Jw),Id()(),ci(62,Gt,4,0,"button",57),Id();}if(n&2){let e,i=pC(),o=pC(),d=pC();Zg("disabled",d.state.saving()),ri(5),Zg("value",i.id),ri(3),Zg("ngModel",i.name),$I(),ri(),ui(i.responsibility?.kind==="agent"?9:i.responsibility?.kind==="human"?10:i.responsibility?.kind==="code"?11:-1),ri(6),ui(i.responsibility?.kind==="agent"?15:-1),ri(),ui((e=i.decision)?16:-1,e),ri(3),Zg("ngModel",i.join??""),$I(),ri(3),tC(o.steps),ri(13),Zg("ngModel",i.outcomeTransitions?.pass?.action??"continue"),$I(),ri(3),ui(d.state.canConfigurePassActivate(i)?38:-1),ri(),ui(i.outcomeTransitions?.pass?.action==="activate"?39:-1),ri(3),Zg("ngModel",i.outcomeTransitions?.fail?.action??"block"),$I(),ri(3),ui(d.state.canConfigureFailReturn(i)?45:i.outcomeTransitions?.fail?.action==="return"?46:-1),ri(2),ui(d.state.canConfigureFailReturn(i)?-1:47),ri(),ui(i.outcomeTransitions?.fail?.action==="return"&&d.state.canConfigureFailReturn(i)?48:-1),ri(9),tC(o.steps),ri(3),tC(i.dependsOn),ri(2),ui(d.state.canRemoveSelected()?62:-1);}}function Yt(n,t){n&1&&(ma(0,"p",75),VC(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),Id());}function Qt(n,t){if(n&1&&(ma(0,"li",76),VC(1),Id()),n&2){let e=t.$implicit;ri(),hy(e);}}function Xt(n,t){n&1&&(ma(0,"p"),VC(1,"None configured."),Id());}function en(n,t){if(n&1&&(ma(0,"li",76),VC(1),Id()),n&2){let e=t.$implicit;ri(),hy(e);}}function tn(n,t){n&1&&(ma(0,"p"),VC(1,"None configured."),Id());}function nn(n,t){if(n&1&&(ma(0,"div",74)(1,"p")(2,"strong"),VC(3,"Agent / responsibility:"),Id(),VC(4),Id(),ci(5,Yt,2,0,"p",75),ma(6,"h3"),VC(7,"Pre-actions"),Id(),ma(8,"ol"),eC(9,Qt,2,1,"li",76,Xw),Id(),ci(11,Xt,2,0,"p"),ma(12,"h3"),VC(13,"Prompt"),Id(),ma(14,"p",76),VC(15),Id(),ma(16,"h3"),VC(17,"Post-actions"),Id(),ma(18,"ol"),eC(19,en,2,1,"li",76,Xw),Id(),ci(21,tn,2,0,"p"),Id()),n&2){let e=pC(),i=pC();ri(4),my(" ",i.responsibility?.name||"Not specified"," (",i.responsibility?.kind||"Not specified",") "),ri(),ui(i.responsibility?.kind!=="agent"?5:-1),ri(4),tC(e.entry),ri(2),ui(e.entry.length?-1:11),ri(4),hy(e.mission),ri(4),tC(e.exit),ri(2),ui(e.exit.length?-1:21);}}function on(n,t){n&1&&(ma(0,"p",75),VC(1," For human/code steps these fields document intent only. They do not change approval or verifier execution. "),Id());}function an(n,t){if(n&1){let e=aC();ma(0,"div",78)(1,"label"),VC(2),ma(3,"textarea",82),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.updateAction("entry",d,o))}),Id(),UI(),Id(),ma(4,"button",83),ey("click",function(){let o=Wp(e).$index,d=pC(5);return Gp(d.removeAction("entry",o))}),VC(5," Remove "),Id()();}if(n&2){let e=t.$implicit,i=t.$index;ri(2),Sd("Pre-action ",i+1," "),ri(),Zg("ngModel",e),ir("data-entry",i),$I(),ri(),ir("aria-label","Remove pre-action "+(i+1));}}function rn(n,t){if(n&1){let e=aC();ma(0,"div",78)(1,"label"),VC(2),ma(3,"textarea",82),ey("ngModelChange",function(o){let d=Wp(e).$index,f=pC(5);return Gp(f.updateAction("exit",d,o))}),Id(),UI(),Id(),ma(4,"button",83),ey("click",function(){let o=Wp(e).$index,d=pC(5);return Gp(d.removeAction("exit",o))}),VC(5," Remove "),Id()();}if(n&2){let e=t.$implicit,i=t.$index;ri(2),Sd("Post-action ",i+1," "),ri(),Zg("ngModel",e),ir("data-exit",i),$I(),ri(),ir("aria-label","Remove post-action "+(i+1));}}function ln(n,t){if(n&1){let e=aC();ci(0,on,2,0,"p",75),ma(1,"fieldset",77)(2,"legend"),VC(3,"Step instructions"),Id(),ma(4,"h3"),VC(5,"Pre-actions"),Id(),ma(6,"p",11),VC(7,"Preparation / input obligations, in order (not executable commands)."),Id(),eC(8,an,6,4,"div",78,Xw),ma(10,"button",79),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.addAction("entry"))}),ma(11,"mat-icon"),VC(12,"add"),Id(),VC(13," Add pre-action "),Id(),ma(14,"h3")(15,"label",80),VC(16,"Prompt"),Id()(),ma(17,"p",11),VC(18),Id(),ma(19,"textarea",81),ey("ngModelChange",function(o){Wp(e);let d=pC(4);return Gp(d.state.update("mission",o))}),Id(),UI(),ma(20,"h3"),VC(21,"Post-actions"),Id(),ma(22,"p",11),VC(23,"Output / deliverable obligations, in order."),Id(),eC(24,rn,6,4,"div",78,Xw),ma(26,"button",79),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.addAction("exit"))}),ma(27,"mat-icon"),VC(28,"add"),Id(),VC(29," Add post-action "),Id()();}if(n&2){let e=pC(),i=pC(),o=pC(2);ui(i.responsibility?.kind!=="agent"?0:-1),ri(),Zg("disabled",o.state.saving()),ri(7),tC(e.entry),ri(2),Zg("disabled",e.entry.length>=50),ri(8),Sd(" ",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."," "),ri(),Zg("ngModel",e.mission),$I(),ri(5),tC(e.exit),ri(2),Zg("disabled",e.exit.length>=50);}}function sn(n,t){if(n&1&&ci(0,nn,22,6,"div",74)(1,ln,30,6),n&2){let e=pC(3);ui(e.state.editing()?1:0);}}function dn(n,t){n&1&&(ma(0,"p",11),VC(1),Id()),n&2&&(ri(),hy(t.hint));}function cn(n,t){if(n&1&&(ma(0,"p",84),VC(1),Id()),n&2){let e=pC(2);ri(),Sd(" 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=aC();ma(0,"button",86),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.addExistingCodeInstructions())}),ma(1,"mat-icon"),VC(2,"notes"),Id(),VC(3," Add optional instructions "),Id();}if(n&2){let e=pC(4);Zg("disabled",e.state.saving());}}function pn(n,t){if(n&1&&(ma(0,"section",37)(1,"h3"),VC(2,"Code verification"),Id(),ma(3,"p"),VC(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. "),Id(),ci(5,dn,2,1,"p",11)(6,cn,2,1,"p",84),ci(7,_n,4,1,"button",85),Id()),n&2){let e,i=pC(),o=pC(2);ri(5),ui((e=o.codeVerificationPreset(i.responsibility?.name))?5:6,e),ri(2),ui(o.state.editing()&&!o.state.isNewCodeStep(i.id)?7:-1);}}function mn(n,t){if(n&1){let e=aC();ma(0,"button",89),ey("click",function(){Wp(e);let o=pC(4);return Gp(o.state.addHumanContract())}),ma(1,"mat-icon"),VC(2,"notes"),Id(),VC(3," Add optional instructions "),Id();}if(n&2){let e=pC(4);Zg("disabled",e.state.saving());}}function un(n,t){if(n&1&&(ma(0,"p",87),VC(1," This human step uses the existing approval or verification implementation, not an agent prompt. "),Id(),ci(2,mn,4,1,"button",88)),n&2){let e=pC(3);ri(2),ui(e.state.editing()?2:-1);}}function fn(n,t){if(n&1){let e=aC();ma(0,"button",92),ey("click",function(){Wp(e);let o=pC(5);return Gp(o.state.adopt())}),VC(1," Adopt explicit instructions "),Id();}if(n&2){let e=pC(5);Zg("disabled",e.state.saving());}}function gn(n,t){if(n&1&&(ma(0,"p"),VC(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. "),Id(),ci(2,fn,2,1,"button",91)),n&2){let e=pC(4);ri(2),ui(e.state.editing()?2:-1);}}function Cn(n,t){n&1&&(ma(0,"p",90),VC(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. "),Id());}function yn(n,t){if(n&1&&(ma(0,"div",38)(1,"div")(2,"h3"),VC(3,"Legacy instructions \u2014 not an empty prompt"),Id(),ma(4,"p"),VC(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. "),Id(),ma(6,"p"),VC(7),Id(),ci(8,gn,3,1)(9,Cn,2,0,"p",90),Id()()),n&2){let e=pC(),i=pC(2);ri(7),Sd(" ",e.legacyContract?.summary||"Legacy contract metadata unavailable or changed locally. Reload the saved definition before adoption."," "),ri(),ui(i.legacyAdoption(e)?8:9);}}function xn(n,t){if(n&1&&(ma(0,"section",13)(1,"h2"),VC(2),Id(),ma(3,"p",35),VC(4),Id(),ma(5,"p"),VC(6),Id(),ci(7,ft,5,1),ci(8,gt,2,1,"p"),ci(9,ht,9,5),ci(10,Kt,63,15,"fieldset",36),ci(11,sn,2,1)(12,pn,8,2,"section",37)(13,un,3,1)(14,yn,10,2,"div",38),Id()),n&2){let e,i,o=t,d=pC(2);ir("aria-label",d.state.editing()?"Selected step editor":"Selected step preview"),ri(2),hy(o.name),ri(2),gy("",o.id," \xB7 ",o.responsibility?.kind," \xB7 ",o.responsibility?.name),ri(2),Sd("Inputs from dependencies: ",o.dependsOn?.join(", ")||"None (entry step)"),ri(),ui((e=o.decision)?7:-1,e),ri(),ui(o.join?8:-1),ri(),ui(o.outcomeTransitions?.pass||o.outcomeTransitions?.fail?9:-1),ri(),ui(d.state.editing()?10:-1),ri(),ui((i=d.state.draft())?11:o.responsibility?.kind==="code"?12:o.responsibility?.kind==="human"?13:14,i);}}function hn(n,t){n&1&&(ma(0,"p",30),VC(1),Id()),n&2&&(ri(),hy(t));}function bn(n,t){if(n&1){let e=aC();ma(0,"section",14)(1,"h2"),VC(2,"Save workflow definition"),Id(),ma(3,"p"),VC(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. "),Id(),ma(5,"p",11),VC(6,"Save this workflow first. You can launch a saved version from Launch a run."),Id(),ma(7,"div",21)(8,"label"),VC(9,"Workflow type "),Yg(10,"input",93),Id(),ma(11,"label"),VC(12,"Version "),ma(13,"input",94),ey("ngModelChange",function(o){Wp(e);let d=pC(2);return Gp(d.state.targetVersion.set(o))}),Id(),UI(),Id()(),ci(14,hn,2,1,"p",30),ma(15,"p",29),VC(16),Id(),ma(17,"div",16)(18,"button",95),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.state.save())}),VC(19),Id(),ma(20,"button",96),ey("click",function(){Wp(e);let o=pC(2);return Gp(o.cancel())}),VC(21," Cancel "),Id()(),ma(22,"p",11),VC(23," Prose is not automatically verified. Result submission, authorization, approvals and configured validators remain enforced. Do not put secrets in instructions. "),Id()();}if(n&2){let e,i=pC(),o=pC();ri(10),Zg("value",i.workflowType??""),ri(3),Zg("ngModel",o.state.targetVersion())("disabled",o.state.saving()),$I(),ri(),ui((e=o.state.validation())?14:-1,e),ri(2),Sd(" ",o.state.dirty()?"Unsaved step changes and structure edits (kept when selecting another step).":"No unsaved changes."," "),ri(2),Zg("disabled",!o.state.dirty()||!!o.state.validation()||o.state.saving()),ri(),Sd(" ",o.state.saving()?"Saving\u2026":"Save new version"," "),ri(),Zg("disabled",o.state.saving());}}function vn(n,t){if(n&1){let e=aC();ci(0,rt,11,5,"div"),ci(1,_t,31,10),ma(2,"section",10)(3,"h2"),VC(4,"Workflow steps"),Id(),ci(5,pt,15,3)(6,mt,2,0,"p",11),ma(7,"sf-workflow-definition-diagram",12),ey("selected",function(o){Wp(e);let d=pC();return Gp(d.state.select(o))}),Id()(),ci(8,xn,15,11,"section",13),ci(9,bn,24,8,"section",14),ma(10,"details")(11,"summary"),VC(12,"Definition JSON (read-only reference)"),Id(),ma(13,"pre",15)(14,"code"),VC(15),Id()()();}if(n&2){let e,i=pC();ui(!i.state.editing()&&!i.state.creating()&&!i.state.loading()?0:-1),ri(),ui(i.state.editing()?1:-1),ri(4),ui(i.state.editing()?5:6),ri(2),Zg("steps",i.state.preview()?.steps??KC(9,Ye))("selectedId",i.state.selectedId())("disabled",i.state.saving()),ri(),ui((e=i.state.selected())?8:-1,e),ri(),ui(i.state.editing()?9:-1),ri(6),hy(i.formatJson(t));}}function wn(n){try{return JSON.stringify(n,null,2)}catch{return String(n)}}var Ue=class n{state=h(Z);registry=h(c);dialog=h(ee);destroyRef=h(Ue$1);deleting=Qe$1(false);deleteError=Qe$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(Ge$1(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(yr(()=>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=h(yb);$s(()=>{let f=this.state.saved();pi(()=>{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=h(G),i=e.snapshot,o=i.paramMap,d=i.data?.create===true;this.workflowType=o.get("type")??"",this.version=o.get("version")??"",h(yb).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(vr(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=h(ce);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=xe({type:n,selectors:[["sf-workflow-detail-page"]],hostBindings:function(e,i){e&1&&ey("beforeunload",function(d){return i.beforeUnload(d)},m_);},features:[Ey([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&&(ma(0,"div",0)(1,"header",1)(2,"a",2)(3,"mat-icon"),VC(4,"arrow_back"),Id(),VC(5," Back "),Id(),ma(6,"div",3)(7,"h1",4),ci(8,Xe,1,0)(9,et,1,2),Id(),ci(10,tt,2,1,"p",5),Id()(),ci(11,nt,3,0,"div",6),ci(12,it,2,1,"div",7),ci(13,ot,2,1,"p",8),ci(14,vn,16,10),Id()),e&2){let o,d,f,b;ri(2),Zg("routerLink",i.backLink),ri(6),ui(i.state.creating()?8:9),ri(2),ui((o=i.state.definition()?.title)?10:-1,o),ri(),ui(i.state.loading()?11:-1),ri(),ui((d=i.state.error())?12:-1,d),ri(),ui((f=i.state.saved())?13:-1,f),ri(),ui((b=i.state.definition())?14:-1,b);}},dependencies:[Ln,Gn,Un,Xe$1,ln$1,Dt$1,kn,qt$1,Ht$1,Gt$1,on$1,HW,UW,Y8,Z8,J$1,Z$1,Nt$1,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 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-CPCXJtgc.js';import {h,q as lT,y as yb,x as xe,N as Nt,H as HW,U as UW,Y as Y8,Z as Z8,m as ma,V as VC,b as Id,e as ey,f as ci,r as ri,j as Zg,u as ui,aq as Ey,k as hy,g as Yg,d as eC,A as pC,t as tC,s as ir,v as my,a8 as Sd}from'./main-T4S6RIJZ.js';import {J,Z}from'./chunk-BlZk5vZF.js';function z(o,e){return this.definitionKey(e)}function H(o,e){o&1&&(ma(0,"div",6)(1,"mat-icon",10),VC(2,"cloud_off"),Id(),ma(3,"span"),VC(4),Id()()),o&2&&(ri(4),hy(e));}function N(o,e){o&1&&(ma(0,"div",7),Yg(1,"mat-progress-spinner",11),ma(2,"span",3),VC(3,"Loading definitions\u2026"),Id()());}function $(o,e){o&1&&(ma(0,"div",8)(1,"mat-icon",10),VC(2,"inventory_2"),Id(),ma(3,"p",3),VC(4,"No workflow definitions registered."),Id()());}function K(o,e){if(o&1&&(ma(0,"a",12)(1,"div",13)(2,"h2",14),VC(3),Id(),ma(4,"p",15),VC(5),Id()(),ma(6,"span",16),VC(7),Id(),ma(8,"mat-icon",17),VC(9,"chevron_right"),Id()()),o&2){let t=e.$implicit,a=pC(2);Zg("routerLink",a.detailLink(t)),ir("data-workflow-card",a.definitionKey(t))("data-workflow-card-link",a.definitionKey(t)),ri(3),hy(a.definitionTitle(t)),ri(2),my(" ",t.workflowType,"@",t.version," "),ri(),Zg("title",t.definitionHash??""),ri(),Sd(" ",a.shortHash(t)," ");}}function F(o,e){if(o&1&&(ma(0,"div",9),eC(1,K,10,8,"a",12,z,true),Id()),o&2){let t=pC();ri(),tC(t.definitions());}}var L=class o{state=h(c);definitions=this.state.definitions;loading=this.state.loading;error=lT(()=>this.state.error()?.message?.trim()||(this.state.error()?"Unable to load workflow definitions.":null));constructor(){h(yb).crumbs.set([{label:"Workflows"}]),this.load();}load(){this.state.load();}definitionKey(e){return `${e.workflowType??""}@${e.version??""}`}definitionTitle(e){let t=typeof e.title=="string"?e.title.trim():"",a=typeof e.workflowType=="string"?e.workflowType.trim():"";return t||a||"Definition without type"}shortHash(e){let t=typeof e.definitionHash=="string"?e.definitionHash.trim():"";return t?t.length>12?`${t.slice(0,12)}\u2026`:t:"\u2014"}detailLink(e){return ["/workflows",String(e.workflowType??""),String(e.version??"")]}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xe({type:o,selectors:[["sf-workflows-page"]],features:[Ey([c])],decls:17,vars:3,consts:[[1,"page"],[1,"page-head"],[1,"titles"],[1,"sf-muted"],["mat-flat-button","","routerLink","/workflows/new","data-new-workflow","",1,"sf-primary"],["mat-stroked-button","",1,"sf-secondary",3,"click","disabled"],["role","alert","data-workflow-error","true",1,"banner","banner--warn"],["data-workflow-loading","true",1,"state"],["data-workflow-empty","true",1,"state","sf-panel"],["data-workflow-list","true",1,"grid"],["aria-hidden","true"],["diameter","32","mode","indeterminate"],[1,"wf-card",3,"routerLink"],[1,"wf-card__titles"],["data-workflow-title","",1,"wf-card__title"],["data-workflow-subtitle","",1,"wf-card__subtitle","sf-mono"],["data-workflow-hash","",1,"wf-card__hash","sf-mono",3,"title"],["aria-hidden","true",1,"wf-card__chevron"]],template:function(t,a){if(t&1&&(ma(0,"div",0)(1,"header",1)(2,"div",2)(3,"h1"),VC(4,"Workflows"),Id(),ma(5,"p",3),VC(6,"Registered workflow definitions and their governed steps."),Id()(),ma(7,"a",4),VC(8,"New workflow"),Id(),ma(9,"button",5),ey("click",function(){return a.load()}),ma(10,"mat-icon"),VC(11,"refresh"),Id(),VC(12," Refresh "),Id()(),ci(13,H,5,1,"div",6),ci(14,N,4,0,"div",7)(15,$,5,0,"div",8)(16,F,3,0,"div",9),Id()),t&2){let s;ri(9),Zg("disabled",a.loading()),ri(4),ui((s=a.error())?13:-1,s),ri(),ui(a.loading()?14:a.definitions().length===0?15:16);}},dependencies:[Nt,HW,UW,Y8,Z8,J,Z],styles:["[_nghost-%COMP%]{display:block;min-width:0}.page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px;min-width:0;overflow-wrap:anywhere}.page-head[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:flex-end;gap:16px}.titles[_ngcontent-%COMP%]{flex:1 1 220px;min-width:0;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}.state[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.state.sf-panel[_ngcontent-%COMP%]{flex-direction:column;justify-content:center;gap:8px;padding:40px;text-align:center}.state.sf-panel[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:36px;height:36px;font-size:36px;color:var(--sf-text-muted)}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(420px,100%),1fr));gap:16px}.wf-card[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;min-width:0;align-items:center;gap:14px;padding:18px 20px;border-radius:var(--radius-md, 0);border:1px solid var(--color-divider);background:var(--color-bg);text-decoration:none;color:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.wf-card[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-accent)}.wf-card[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.wf-card__titles[_ngcontent-%COMP%]{flex:1 1 180px;min-width:0;display:flex;flex-direction:column;gap:4px}.wf-card__title[_ngcontent-%COMP%]{margin:0;font-size:17px;font-weight:700;color:var(--sf-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wf-card__subtitle[_ngcontent-%COMP%]{margin:0;font-size:12.5px;color:var(--sf-secondary)}.wf-card__hash[_ngcontent-%COMP%]{font-size:12px;color:var(--sf-text-muted);padding:4px 10px;border:1px solid var(--color-divider);border-radius:var(--radius-pill, 0);background:var(--color-surface-muted);white-space:nowrap;flex-shrink:0}.wf-card__chevron[_ngcontent-%COMP%]{color:var(--sf-text-muted);flex-shrink:0}"]})};export{L as WorkflowsPageComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {h,Q as Qe,q as lT,y as yb,x as xe,cB as Ln,ag as Bn,ah as Xe,cE as ln,ai as kn,aj as Tn,cG as Ht,cH as Gt,cI as on,cq as nn,H as HW,U as UW,Y as Y8,Z as Z8,m as ma,V as VC,b as Id,f as ci,r as ri,u as ui,aq as Ey,ar as vb,av as yr,ay as zt,aD as A,at as ke,d5 as ut,az as M,B as aC,e as ey,k as hy,g as Yg,ao as UI,A as pC,j as Zg,s as ir,ap as $I,a8 as Sd,aA as gy,a6 as Wp,a7 as Gp}from'./main-
|
|
1
|
+
import {h,Q as Qe,q as lT,y as yb,x as xe,cB as Ln,ag as Bn,ah as Xe,cE as ln,ai as kn,aj as Tn,cG as Ht,cH as Gt,cI as on,cq as nn,H as HW,U as UW,Y as Y8,Z as Z8,m as ma,V as VC,b as Id,f as ci,r as ri,u as ui,aq as Ey,ar as vb,av as yr,ay as zt,aD as A,at as ke,d5 as ut,az as M,B as aC,e as ey,k as hy,g as Yg,ao as UI,A as pC,j as Zg,s as ir,ap as $I,a8 as Sd,aA as gy,a6 as Wp,a7 as Gp}from'./main-T4S6RIJZ.js';import {J,Z}from'./chunk-BlZk5vZF.js';var v=class n{api=h(vb);settings=Qe(null);loading=Qe(false);saving=Qe(false);error=Qe(null);load(){this.loading.set(true),this.error.set(null),this.api.getRunConcurrency().pipe(yr(()=>this.loading.set(false))).subscribe({next:e=>this.settings.set(e),error:e=>this.error.set(e)});}save(e){return this.saving.set(true),this.error.set(null),this.api.updateRunConcurrency(e).pipe(zt(t=>this.settings.set(t)),A(()=>{}),ke(t=>(this.error.set(t),ut(()=>t))),yr(()=>this.saving.set(false)))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=M({token:n,factory:n.\u0275fac})};function ie(n,e){if(n&1){let t=aC();ma(0,"div",6)(1,"mat-icon",9),VC(2,"cloud_off"),Id(),ma(3,"span"),VC(4),Id(),ma(5,"button",10),ey("click",function(){Wp(t);let r=pC();return Gp(r.load())}),VC(6,"Retry"),Id()();}n&2&&(ri(4),hy(e));}function ae(n,e){n&1&&(ma(0,"div",7),Yg(1,"mat-progress-spinner",11),ma(2,"span",3),VC(3,"Loading\u2026"),Id()());}function re(n,e){if(n&1&&VC(0),n&2){let t=pC(2);Sd(" by ",t.updatedBy," ");}}function oe(n,e){if(n&1&&VC(0),n&2){let t=pC(3);Sd(" on ",t.formatUpdatedAt(e)," ");}}function le(n,e){if(n&1&&(ma(0,"p",19),VC(1," Last changed "),ci(2,re,1,1),ci(3,oe,1,1),Id()),n&2){let t,l=pC();ri(2),ui(l.updatedBy?2:-1),ri(),ui((t=l.updatedAt)?3:-1,t);}}function de(n,e){n&1&&(ma(0,"p",20),VC(1),Id()),n&2&&(ri(),hy(e));}function se(n,e){n&1&&(ma(0,"p",21),VC(1),Id()),n&2&&(ri(),hy(e));}function me(n,e){if(n&1){let t=aC();ma(0,"form",12),ey("ngSubmit",function(){Wp(t);let r=pC();return Gp(r.save())}),ma(1,"label",13),VC(2,"Maximum parallel workflow runs"),Id(),ma(3,"div",14)(4,"input",15),ey("ngModelChange",function(r){Wp(t);let s=pC();return Gp(s.onValueChange(r))}),Id(),UI(),ma(5,"button",16),VC(6),Id()(),ma(7,"p",17),VC(8),Id(),ma(9,"p",18),VC(10),Id(),ci(11,le,4,2,"p",19),ci(12,de,2,1,"p",20),ci(13,se,2,1,"p",21),Id();}if(n&2){let t,l,r=e,s=pC();ri(4),Zg("min",r.min)("max",r.max)("ngModel",s.draft())("disabled",s.saving()),ir("aria-invalid",s.validation()?"true":null),$I(),ri(),Zg("disabled",!s.canSave()),ri(),Sd(" ",s.saving()?"Saving\u2026":"Save"," "),ri(2),gy(" Default: ",r.defaultMaxParallelRuns," \xB7 allowed ",r.min,"\u2013",r.max,". Extra runs wait in the queue. "),ri(2),Sd(" ",s.validation()," "),ri(),ui(r.updatedBy||r.updatedAt?11:-1),ri(),ui((t=s.savedMessage())?12:-1,t),ri(),ui((l=s.saveError())?13:-1,l);}}var te=class n{state=h(v);settings=this.state.settings;loading=this.state.loading;saving=this.state.saving;edited=Qe(void 0);draft=lT(()=>{let e=this.edited();return e!==void 0?e:this.settings()?.maxParallelRuns??null});savedMessage=Qe(null);saveError=Qe(null);loadError=lT(()=>this.state.error()&&!this.settings()?this.state.error()?.message?.trim()||"Unable to load the run concurrency setting.":null);validation=lT(()=>{let e=this.settings();if(!e||this.edited()===void 0)return null;let t=this.draft();return t===null||!Number.isInteger(t)?"Enter a whole number.":t<e.min||t>e.max?`Enter a value between ${e.min} and ${e.max}.`:null});canSave=lT(()=>{let e=this.settings(),t=this.draft();return !!e&&!this.validation()&&t!==null&&t!==e.maxParallelRuns&&!this.saving()});constructor(){h(yb).crumbs.set([{label:"Admin"}]),this.load();}load(){this.edited.set(void 0),this.savedMessage.set(null),this.saveError.set(null),this.state.load();}onValueChange(e){this.savedMessage.set(null),this.saveError.set(null),this.edited.set(e===null||e===""?null:Number(e));}save(){let e=this.draft();!this.canSave()||e===null||(this.savedMessage.set(null),this.saveError.set(null),this.state.save(e).subscribe({next:()=>{this.edited.set(void 0),this.savedMessage.set(`Saved: up to ${this.settings()?.maxParallelRuns??e} workflow runs in parallel.`);},error:t=>{let l=t.message?.trim()||"Unable to save the setting.";this.saveError.set(`${l} (${t.code})`);}}));}formatUpdatedAt(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=xe({type:n,selectors:[["sf-admin-page"]],features:[Ey([v])],decls:13,vars:1,consts:[[1,"page"],[1,"page-head"],[1,"titles"],[1,"sf-muted"],["aria-labelledby","run-concurrency-title","data-run-concurrency","",1,"sf-panel","setting"],["id","run-concurrency-title"],["role","alert","data-admin-load-error","",1,"banner","banner--warn"],["data-admin-loading","",1,"state"],[1,"field"],["aria-hidden","true"],["mat-stroked-button","","type","button","data-admin-retry","",1,"sf-secondary",3,"click"],["diameter","32","mode","indeterminate"],[1,"field",3,"ngSubmit"],["for","max-parallel-runs"],[1,"field__row"],["id","max-parallel-runs","name","maxParallelRuns","type","number","step","1","inputmode","numeric","aria-describedby","max-parallel-runs-hint max-parallel-runs-error","data-max-parallel-runs","",3,"ngModelChange","min","max","ngModel","disabled"],["mat-flat-button","","type","submit","data-admin-save","",1,"sf-primary",3,"disabled"],["id","max-parallel-runs-hint","data-admin-hint","",1,"sf-muted"],["id","max-parallel-runs-error","role","alert","data-admin-validation","",1,"field__error"],["data-admin-updated","",1,"sf-muted"],["role","status","data-admin-saved",""],["role","alert","data-admin-save-error","",1,"banner","banner--warn"]],template:function(t,l){if(t&1&&(ma(0,"div",0)(1,"header",1)(2,"div",2)(3,"h1"),VC(4,"Admin"),Id(),ma(5,"p",3),VC(6,"Instance-wide settings of the Factory."),Id()()(),ma(7,"section",4)(8,"h2",5),VC(9,"Workflow execution"),Id(),ci(10,ie,7,1,"div",6)(11,ae,4,0,"div",7)(12,me,14,14,"form",8),Id()()),t&2){let r;ri(10),ui((r=l.loadError())?10:l.loading()&&!l.settings()?11:(r=l.settings())?12:-1,r);}},dependencies:[Ln,Bn,Xe,ln,kn,Tn,Ht,Gt,on,nn,HW,UW,Y8,Z8,J,Z],styles:["[_nghost-%COMP%]{display:block;min-width:0}.page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px;min-width:0;overflow-wrap:anywhere}.titles[_ngcontent-%COMP%]{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}.setting[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding:20px;max-width:640px}.setting[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;font-size:17px;font-weight:700}.state[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.field[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{font-weight:600}.field__row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.field[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:120px}.field[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:13px}.field__error[_ngcontent-%COMP%]:empty{display:none}.field__error[_ngcontent-%COMP%]{color:var(--color-danger, currentColor)}"]})};export{te as AdminPageComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {L as he,R as ce,T as no,h,bg as ue,X as y,d6 as OM,x as xe,d7 as aS,bw as Bd,by as $g,m as ma,bs as rh,g as Yg,b as Id,bt as oh,bY as Qg,bo as bC,r as ri,s as ir,aM as cy,j as Zg,a5 as di,G as It,bp as ry,be as gC,bf as yC,A as pC,d8 as iT}from'./main-
|
|
1
|
+
import {L as he,R as ce,T as no,h,bg as ue,X as y,d6 as OM,x as xe,d7 as aS,bw as Bd,by as $g,m as ma,bs as rh,g as Yg,b as Id,bt as oh,bY as Qg,bo as bC,r as ri,s as ir,aM as cy,j as Zg,a5 as di,G as It,bp as ry,be as gC,bf as yC,A as pC,d8 as iT}from'./main-T4S6RIJZ.js';var I=["determinateSpinner"];function z(i,V){if(i&1&&(rh(),ma(0,"svg",11),Yg(1,"circle",12),Id()),i&2){let e=pC();ir("viewBox",e._viewBox()),ri(),cy("stroke-dasharray",e._strokeCircumference(),"px")("stroke-dashoffset",e._strokeCircumference()/2,"px")("stroke-width",e._circleStrokeWidth(),"%"),ir("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=h(ue);_noopAnimations;get color(){return this._color||this._defaultColor}set color(e){this._color=e;}_color;_defaultColor="primary";_determinateCircle;constructor(){let e=h(D),n=OM(),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=xe({type:i,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(n,r){if(n&1&&ry(I,5),n&2){let s;gC(s=yC())&&(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&&(ir("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",r.mode==="determinate"?r.value:null)("mode",r.mode),di("mat-"+r.color),cy("width",r.diameter,"px")("height",r.diameter,"px")("--mat-progress-spinner-size",r.diameter+"px")("--mat-progress-spinner-active-indicator-width",r.diameter+"px"),It("_mat-animation-noopable",r._noopAnimations)("mdc-circular-progress--indeterminate",r.mode==="indeterminate"));},inputs:{color:"color",mode:"mode",value:[2,"value","value",Bd],diameter:[2,"diameter","diameter",Bd],strokeWidth:[2,"strokeWidth","strokeWidth",Bd]},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&&($g(0,z,2,8,"ng-template",null,0,iT),ma(2,"div",2,1),rh(),ma(4,"svg",3),Yg(5,"circle",4),Id()(),oh(),ma(6,"div",5)(7,"div",6)(8,"div",7),Qg(9,8),Id(),ma(10,"div",9),Qg(11,8),Id(),ma(12,"div",10),Qg(13,8),Id()()()),n&2){let s=bC(1);ri(4),ir("viewBox",r._viewBox()),ri(),cy("stroke-dasharray",r._strokeCircumference(),"px")("stroke-dashoffset",r._strokeDashOffset(),"px")("stroke-width",r._circleStrokeWidth(),"%"),ir("r",r._circleRadius()),ri(4),Zg("ngTemplateOutlet",s),ri(2),Zg("ngTemplateOutlet",s),ri(2),Zg("ngTemplateOutlet",s);}},dependencies:[aS],styles:[`.mat-mdc-progress-spinner {
|
|
2
2
|
--mat-progress-spinner-animation-multiplier: 1;
|
|
3
3
|
display: block;
|
|
4
4
|
overflow: hidden;
|