=$min&&mb_strlen(trim($value),'UTF-8')<=$max;} function dune_dev_id($value){return is_string($value)&&preg_match('/^[1-9][0-9]*$/D',$value)&&filter_var($value,FILTER_VALIDATE_INT)!==false?(int)$value:false;} function dune_dev_origin_valid($origin){return $origin===null||$origin==='https://support.dunerealms.com';} // Central SSO identity only. Never accept ranks or actor IDs from submitted fields. function dune_dev_team($identity) { if (!is_array($identity)) return false; if (($identity['nativePermissionManagement']??null)===false) return in_array('web.tickets.dev',$identity['permissions']??[],true); return (bool)array_intersect($identity['ranks']??[], ['owners','official_account','corestaff','network_admin','web_net_admin','web_dev']); } function dune_dev_submitter($identity) { if (!is_array($identity)) return false; $staffRanks=['owners','official_account','corestaff','staff','network_admin','network_admin','web_net_admin','web_dev','web_streamer','web_news','web_forum','web_support','web_sales','web_legal','web_appeal','game_mod','game_admin','game_support','game_appeal','game_quests','game_restoration']; return (bool)array_intersect($identity['ranks']??[],array_merge($staffRanks,['vip','council_member'])) || (bool)array_intersect($identity['permissions']??[], ['web.menu.staffmanual','web.tickets.staff','web.forum.moderate','web.posts.edit']); } function dune_dev_owner($identity) { if(!is_array($identity))return false; $ranks=$identity['ranks']??[];$nodes=$identity['permissions']??[]; if (($identity['nativePermissionManagement']??null)===false) return (bool)array_intersect($ranks,['org_owner_ceo','org_executive']) && in_array('web.tickets.dev',$nodes,true) && in_array('web.ranks.manage',$nodes,true); $name=strtolower($identity['username']??''); return ($name==='unimatrix999'&&in_array('owners',$ranks,true))||($name==='grmacken'&&in_array('web_net_admin',$ranks,true)); } function dune_dev_transition($identity,$action,$state,$note) { if(!dune_dev_team($identity)||($action!=='complete'&&!dune_dev_owner($identity)))throw new RuntimeException('Only unimatrix999 or grmacken can approve or deny tasks.'); if(!dune_dev_text_valid($note,10,10000))throw new RuntimeException('Provide a decision reason or completion report of 10–10,000 characters.'); if($action==='complete'&&$state==='approved')return 'completed'; if($action==='approve'&&$state==='pending')return 'approved'; if($action==='deny'&&$state==='pending')return 'denied'; throw new RuntimeException('This action is not available for the current task state.'); } function dune_dev_priority_editor($identity) {return dune_dev_owner($identity)||(strtolower($identity['username']??'')==='dev'&&dune_dev_team($identity));} function dune_dev_legacy_fields() { return [ 'title'=>['Task title',true,160,'input','A short, specific outcome'], 'type'=>['Request type',true,40,'select',['Feature','Bug','Design / artwork','Operations','Documentation','Release / verification']], 'system'=>['System / component',true,120,'input','Website, Support, Shop, game plugin, world or server'], 'objective'=>['Objective / full task prompt',true,12000,'textarea','What should be built or changed, and why?'], 'current'=>['Current behaviour / context',true,6000,'textarea','What happens now? Add the relevant page, command or version.'], 'expected'=>['Expected result',true,6000,'textarea','Describe the finished result from the user’s point of view.'], 'acceptance'=>['Acceptance criteria',true,6000,'textarea','List the observable checks that must pass before this ticket can close.'], 'scope'=>['Scope and exclusions',false,4000,'textarea','What is included? What must remain unchanged?'], 'reproduction'=>['Reproduction steps / error messages',false,6000,'textarea','For bugs: steps, exact error, Java/Bedrock, client and server version.'], 'testplan'=>['Suggested tests',false,4000,'textarea','Desktop/mobile, Java/Bedrock, permissions, failed and repeated requests.'], 'references'=>['Links / design references',false,4000,'textarea','Relevant HTTPS pages, source paths or related ticket numbers. No credentials.'], 'dependencies'=>['Dependencies / related tasks',false,3000,'textarea','What must be ready first? Who can clarify the request?'], 'risk'=>['Data, rollout and rollback considerations',false,4000,'textarea','Mention sensitive data, paid receipts, migrations, backups or service interruptions.'], 'priority'=>['Requested priority',true,40,'select',['Medium','Low','High']], 'timing'=>['Desired timing / reason',false,500,'input','A request, not a guaranteed deadline'], ]; } function dune_dev_validate($input) { return dune_jarvis_request_validate($input); } function dune_dev_fields(){return dune_jarvis_fields()+[ 'action_template_version'=>['Recorded action template version',false,20,'input',''], 'action_parameters'=>['Recorded typed action parameters',false,12000,'textarea',''], 'execution_state'=>['Execution state at submission',false,40,'input',''], ];} function dune_dev_prompt($values) { return dune_jarvis_execution_brief($values)."\n\nReview: existing Owner approval and private ticket visibility rules remain authoritative. Approval alone neither issues a key nor executes a change."; } function dune_dev_execution_brief($values) { return dune_jarvis_execution_brief($values); }