Choose the execution route, identify the exact targets and define the evidence needed to finish. Your request is preserved in a private ticket. Approval does not issue a key or execute a change.
+
+
+
+
diff --git a/website/integrations/osticket/dev-jarvis-policy.php b/website/integrations/osticket/dev-jarvis-policy.php
new file mode 100644
index 00000000..ccd448ef
--- /dev/null
+++ b/website/integrations/osticket/dev-jarvis-policy.php
@@ -0,0 +1,109 @@
+'Execute an existing J.A.R.V.I.S. action','idea'=>'New feature / future idea','capability'=>'New key / J.A.R.V.I.S. action proposal','code'=>'Code / interface change','devkey'=>'Dev key request'];
+}
+function dune_jarvis_catalogue() {
+ $path=__DIR__.'/dev-jarvis-catalogue.json';
+ if(!is_file($path))return ['actions'=>[],'sourceHash'=>'unavailable'];
+ $data=json_decode(file_get_contents($path),true);
+ return is_array($data)&&isset($data['actions'],$data['sourceHash'])?$data:['actions'=>[],'sourceHash'=>'unavailable'];
+}
+function dune_jarvis_fields() {
+ return [
+ 'title'=>['Request title',true,160,'input','A short, specific outcome'],
+ 'workflow'=>['Execution route',true,40,'route',dune_jarvis_routes()],
+ 'type'=>['Request category',true,40,'select',['Feature','Bug','Design / artwork','Operations','Documentation','Release / verification']],
+ 'system'=>['System / component',true,120,'input','Website, Support, Shop, Minecraft, clan, company or server'],
+ 'environment'=>['Target environment',true,40,'choice',['proposal'=>'Not decided — proposal only','test'=>'Test','staging'=>'Staging','production'=>'Production']],
+ 'action_id'=>['Existing mastertemplate / action',false,80,'action',[]],
+ 'catalogue_review'=>['Catalogue review / why the normal action is insufficient',false,2000,'textarea','Which existing actions were checked? Explain the specific gap; do not bypass them.'],
+ 'targets'=>['Target users / organisations / records',true,2000,'textarea','For an operation: exact account names and record references. For an idea: intended users or audience; technical IDs are not required.'],
+ 'objective'=>['Objective / full request',true,12000,'textarea','What must change, and why? Describe the requested outcome, not arbitrary executable code.'],
+ 'current'=>['Current behaviour / context',true,6000,'textarea','What happens now? Include 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 / execution evidence',true,6000,'textarea','Observable before/after checks, expected result and the receipt or audit evidence needed to close this request.'],
+ 'scope'=>['Scope and exclusions',true,4000,'textarea','Exact approved scope. What must remain untouched?'],
+ 'preserve'=>['Records / behaviour that must be preserved',true,3000,'textarea','Protected organisations, members, balances, votes, uploads and unrelated records. Use None only when appropriate.'],
+ 'missing_capability'=>['Proposed key / action and what it should allow',false,3000,'textarea','Describe the desired ability in plain language. You do not need to know how an adapter is implemented.'],
+ 'dev_actor'=>['Requested developer executor',false,120,'input','Developer account or operator to review; this field does not grant authority.'],
+ 'dev_actions'=>['Exact requested developer manifest / operations',false,6000,'textarea','List the exact actions and target IDs. The developer must create and independently validate the final manifest before issuance.'],
+ 'dev_expiry'=>['Requested devkey lifetime in minutes (1–15)',false,2,'number','10'],
+ 'destructive_actions'=>['Irreversible / destructive effects',false,3000,'textarea','Explicitly list deletions, resets or wipes and their exact boundaries. Write None if there are no destructive effects.'],
+ 'risk'=>['Data, rollout and rollback considerations',false,4000,'textarea','Backup or restore plan, recovery limitations and service impact. A devkey request must include this.'],
+ 'reproduction'=>['Reproduction steps / error messages',false,6000,'textarea','For bugs: steps, exact error, client and server versions.'],
+ 'testplan'=>['Suggested tests',false,4000,'textarea','Positive and failure cases, preserved records, repeated requests and relevant devices.'],
+ 'references'=>['Links / related tickets / receipts',false,4000,'textarea','Relevant HTTPS pages, source paths, ticket IDs or existing audit references. Never paste a key or credentials.'],
+ 'dependencies'=>['Dependencies / related tasks',false,3000,'textarea','What must be ready first? Who can clarify the request?'],
+ 'priority'=>['Requested priority',true,40,'select',['Medium','Low','High']],
+ 'timing'=>['Desired timing / reason',false,500,'input','A request, not a guaranteed deadline'],
+ ];
+}
+function dune_jarvis_request_validate($input) {
+ $values=[];$errors=[];$definitions=dune_jarvis_fields();
+ foreach($definitions as$key=>[$label,$required,$max,$type,$hint]) {
+ $value=is_string($input[$key]??null)?trim($input[$key]):'';
+ if(($required&&$value==='')||!dune_dev_text_valid($value,0,$max)||(isset($input[$key])&&!is_string($input[$key])))$errors[]=$label.': enter a valid value (maximum '.$max.' characters).';
+ if(in_array($type,['route','choice'],true)&&!array_key_exists($value,$hint))$errors[]=$label.': choose a listed option.';
+ if($type==='select'&&!in_array($value,$hint,true))$errors[]=$label.': choose a listed option.';
+ $values[$key]=$value;
+ }
+ $route=$values['workflow'];$catalogue=dune_jarvis_catalogue();$action=null;$parameters=[];
+ foreach($catalogue['actions']as$item)if($item['id']===$values['action_id'])$action=$item;
+ if($route==='existing'){
+ if(!$action)$errors[]='Choose an existing action from the current Jarvis catalogue.';
+ $submitted=$input['jarvis_values']??[];
+ if(!is_array($submitted)){$errors[]='Action fields must be a structured form.';$submitted=[];}
+ $allowed=array_column($action['fields']??[],'name');
+ foreach(array_keys($submitted)as$name)if(!in_array($name,$allowed,true))$errors[]='Unknown action parameter.';
+ foreach($action['fields']??[]as$field){
+ $name=$field['name'];$value=$submitted[$name]??'';$label=$field['label'];
+ if(!is_string($value)||!dune_dev_text_valid($value,0,$field['maxLength']??240)){$errors[]='Invalid action field: '.$label;continue;}
+ $value=trim($value);if(($field['required']??false)&&$value===''){$errors[]=$label.' is required.';continue;}
+ if($value===''&&!($field['required']??false))continue;
+ if(($field['type']??'text')==='number'){
+ if(!preg_match('/^-?[0-9]+$/D',$value)||filter_var($value,FILTER_VALIDATE_INT)===false||(int)$value<($field['min']??0)||abs((float)$value)>9007199254740991){$errors[]='Invalid action field: '.$label;continue;}
+ $value=(int)$value;
+ }
+ $parameters[$name]=$value;
+ }
+ }else{
+ // Never accept a hidden ordinary-action payload as developer authority.
+ $values['action_id']='';
+ if(!empty($input['jarvis_values']))$errors[]='Action parameters do not belong to the selected route.';
+ if(in_array($route,['idea','capability'],true)&&$values['catalogue_review']==='')$values['catalogue_review']='Not yet reviewed — reviewer must check the existing catalogue before implementation.';
+ if(!dune_dev_text_valid($values['catalogue_review'],10,2000))$errors[]='Explain which normal Jarvis actions were checked, or state that catalogue review is needed.';
+ }
+ if($values['environment']==='proposal'&&!in_array($route,['idea','capability'],true))$errors[]='Choose a concrete environment for an operation or developer request.';
+ if($route==='capability'&&!dune_dev_text_valid($values['missing_capability'],10,3000))$errors[]='Describe the missing Jarvis adapter or capability.';
+ if($route==='devkey'){
+ foreach(['dev_actor','dev_actions','destructive_actions','risk']as$key)if(!dune_dev_text_valid($values[$key],$key==='dev_actor'?1:4,$definitions[$key][2]))$errors[]=$definitions[$key][0].' is required for a dev key request.';
+ if(!preg_match('/^(?:[1-9]|1[0-5])$/D',$values['dev_expiry']))$errors[]='A developer key lifetime must be 1–15 minutes.';
+ if(($input['dev_acknowledgement']??'')!=='1')$errors[]='Acknowledge that this requests review only; developer issuance and execution remain separately controlled.';
+ }else{
+ foreach(['dev_actor','dev_actions','dev_expiry','destructive_actions']as$key){if($values[$key]!=='')$errors[]='Choose Dev key request for developer-only request fields.';$values[$key]='';}
+ }
+ if(($input['privacy']??'')!=='1')$errors[]='Confirm that the request contains no passwords, tokens or unnecessary personal data.';
+ $values['jarvis_request_version']=1;
+ $values['action_parameters']=json_encode((object)$parameters,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR);
+ $values['action_template_version']=$action&&$route==='existing'?(int)$action['version']:null;
+ $values['catalogue_source_hash']=$catalogue['sourceHash'];
+ $values['execution_state']='requested';
+ return [$values,array_values(array_unique($errors))];
+}
+function dune_jarvis_execution_brief($values) {
+ $route=$values['workflow']??'';
+ if(!isset(dune_jarvis_routes()[$route]))return "Legacy request — manual Jarvis review required. The original request is retained. Do not infer permission to code, issue keys or execute data operations from this legacy brief.";
+ $steps=[
+ 'existing'=>"1. Recheck the current catalogue, identity, action scope and domain conditions.\n2. Use the existing validated domain adapter with the recorded typed parameters. Do not write code or direct SQL for a supported data operation. Select an available supported interface before starting; lack of browser control is not missing domain authority.\n3. Obtain any required normal scoped key through its existing flow; execute once and record the real receipt. If the adapter is unavailable, stop and report the exact missing capability.",
+ 'idea'=>"1. Treat this as a feature proposal, not an instruction to execute a data operation.\n2. Review the desired outcome and existing Jarvis capabilities; staff need not know technical adapter names.\n3. Clarify feasibility and acceptance criteria during review. Agree the implementation scope before building or issuing any key.",
+ 'capability'=>"1. Confirm the gap against the current masterkey catalogue and domain adapters.\n2. Implement only the smallest missing typed action; register it, test it and publish through Git/CI.\n3. Then execute the original request through the normal Jarvis action, with current authority and scope checks.",
+ 'code'=>"1. Confirm this is an implementation change rather than an already supported data action.\n2. Make the smallest approved source change; reuse existing adapters and permissions.\n3. Run focused checks and required CI, then verify publication. Do not treat deployed code as proof a requested data operation ran.",
+ 'devkey'=>"1. Treat this ticket as a DEV KEY REQUEST, never as an ordinary web key or an instruction to modify the database directly.\n2. Recheck why normal scoped Jarvis actions are insufficient. An authorised developer must independently validate the exact manifest, actor, environment, preservation rules, destructive effects and short lifetime.\n3. Developer issuance remains server/CLI-only. Ticket approval is not a key, not a grant of developer authority and not evidence of execution.\n4. Execute only through the separately permitted developer executor, bound to the exact manifest and current authorised actor. Record issuance/hash and execution results without any secret. Stop if the manifest, scope, environment or authority changes."
+ ];
+ $parts=['J.A.R.V.I.S. REQUEST v1 — '.dune_jarvis_routes()[$route],"State: REQUESTED / NOT EXECUTED. Ticket approval does not execute an operation.","Execution route\n".$steps[$route]];
+ foreach(dune_jarvis_fields()as$key=>[$label])if(($values[$key]??'')!=='')$parts[]=$label."\n".$values[$key];
+ if($route==='existing')$parts[]="Recorded action template version: ".($values['action_template_version']??'unknown')."\nTyped action parameters:\n".($values['action_parameters']??'{}');
+ $parts[]='Completion requires actual results, preserved-record checks and an audit/receipt reference. Clearly distinguish planned, simulated, staged, deployed and executed. Never include a secret key in ticket text or attachments.';
+ return implode("\n\n",$parts);
+}
diff --git a/website/integrations/osticket/dev-policy.php b/website/integrations/osticket/dev-policy.php
index a431920b..81eb3c1e 100644
--- a/website/integrations/osticket/dev-policy.php
+++ b/website/integrations/osticket/dev-policy.php
@@ -1,4 +1,5 @@
=$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;}
@@ -30,7 +31,7 @@ function dune_dev_transition($identity,$action,$state,$note) {
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'&&in_array('web_dev',$identity['ranks']??[],true));}
-function dune_dev_fields() {
+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']],
@@ -50,22 +51,17 @@ function dune_dev_fields() {
];
}
function dune_dev_validate($input) {
- $values=[];$errors=[];
- foreach(dune_dev_fields() as$key=>[$label,$required,$max,$type,$hint]) {
- $value=is_string($input[$key]??null)?trim($input[$key]):'';
- if(($required&&$value==='')||!dune_dev_text_valid($value,0,$max)|| (isset($input[$key])&&!is_string($input[$key]))||($type==='select'&&!in_array($value,$hint,true)))$errors[]=$label.': enter a valid value (maximum '.$max.' characters).';
- $values[$key]=$value;
- }
- if(($input['privacy']??'')!=='1')$errors[]='Confirm that the request contains no passwords, tokens or unnecessary personal data.';
- return [$values,$errors];
+ 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) {
- $parts=['DuneRealms development task — submitted through the private Dev form.'];
- foreach(dune_dev_fields() as$key=>[$label])if(($values[$key]??'')!=='')$parts[]=$label."\n".$values[$key];
- $parts[]='Workflow: Owner approval required before execution except explicit Owner submissions and the imported owner-approved backlog. Complete only with actual changes, checks, evidence and deployment/merge status. Scheduled morning/evening slots remain in effect.';
- return implode("\n\n",$parts);
+ 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 "## Approved objective\n".($values['objective']??'')."\n\n## Scope and exclusions\n".($values['scope']??'Keep the approved request scope.')."\n\n## Implementation plan\n1. Inspect the current implementation and linked original request.\n2. Make the smallest complete change within approved scope.\n3. Run focused positive, failure and permission checks.\n4. Review and merge through the Dev fork; back up and verify any authorised rollout.\n\n## Acceptance criteria\n".($values['acceptance']??'')."\n\n## Test plan\n".($values['testplan']??'')."\n\n## Dependencies\n".($values['dependencies']??'')."\n\n## Completion report required\nChanges, actual checks/results, evidence, fork/merge link, deployed versus staged, rollback and remaining limits. Do not silently enlarge the approved scope.";
+ return dune_jarvis_execution_brief($values);
}
diff --git a/website/integrations/osticket/tests/dev-jarvis-policy.test.php b/website/integrations/osticket/tests/dev-jarvis-policy.test.php
new file mode 100644
index 00000000..c3746969
--- /dev/null
+++ b/website/integrations/osticket/tests/dev-jarvis-policy.test.php
@@ -0,0 +1,30 @@
+'A clear staff request','workflow'=>'existing','type'=>'Operations','system'=>'Account service','environment'=>'test','action_id'=>'clan.clear-protected-rosters','targets'=>'The two fixed protected institutions','objective'=>'Perform the approved scoped operation.','current'=>'The current roster is populated.','expected'=>'Only the approved target roster changes.','acceptance'=>'Verify the exact result and audit receipt.','scope'=>'Only the selected action and its fixed targets.','preserve'=>'All unrelated clans, balances and votes.','priority'=>'Medium','privacy'=>'1','jarvis_values'=>['ticketId'=>'DR_DEV-0000098','reference'=>'Owner-approved example']];}
+function invalid_request($input,$message){[$v,$e]=dune_dev_validate($input);check(count($e)>0,$message);return $v;}
+[$v,$e]=dune_dev_validate(valid_request());check(!$e,'Existing action rejected: '.implode('; ',$e));
+check($v['execution_state']==='requested','Submission must not claim execution');
+check(json_decode($v['action_parameters'],true)['ticketId']==='DR_DEV-0000098','Typed action parameters missing');
+check($v['action_template_version']===1,'Action version not pinned');
+check(str_contains(dune_dev_execution_brief($v),'Do not write code or direct SQL'),'Existing action lost the execution route');
+$q=valid_request();$q['action_id']='dev.issue';invalid_request($q,'Web developer issuance accepted');
+$q=valid_request();$q['jarvis_values']['sql']='DELETE';invalid_request($q,'Unknown action parameter accepted');
+$q=valid_request();unset($q['jarvis_values']['ticketId']);invalid_request($q,'Required typed field not checked');
+$q=valid_request();$q['jarvis_values']['reference']=['bad'];invalid_request($q,'Nested action value accepted');
+$q=valid_request();$q['action_id']='xp.correct';$q['jarvis_values']=['ticketId'=>'DR_DEV-0000098','recipient'=>'Example','amountXP'=>'50','caseReference'=>'Approved example'];[$v,$e]=dune_dev_validate($q);check(!$e,'Typed number rejected');check(json_decode($v['action_parameters'],true)['amountXP']===50,'Number was not typed');
+$q['jarvis_values']['amountXP']='1e9';invalid_request($q,'Non-integer notation accepted');
+$q=valid_request();$q['workflow']='idea';$q['environment']='proposal';unset($q['jarvis_values']);$q['action_id']='';[$v,$e]=dune_dev_validate($q);check(!$e,'Future idea requires technical catalogue knowledge');check(str_contains($v['catalogue_review'],'Not yet reviewed'),'Unknown catalogue status fabricated a completed review');check(str_contains(dune_dev_execution_brief($v),'feature proposal'),'Idea classified as an execution');
+$q['workflow']='capability';invalid_request($q,'Missing new-action proposal accepted');$q['missing_capability']='A key that enables a proposed scoped staff task.';[$v,$e]=dune_dev_validate($q);check(!$e,'Plain-language new key proposal rejected');
+$q=valid_request();$q['workflow']='devkey';$q['action_id']='';unset($q['jarvis_values']);$q+=['catalogue_review'=>'No normal scoped action supports the approved maintenance request.','dev_actor'=>'Reviewed developer account','dev_actions'=>'Review the exact approved manifest and target records.','dev_expiry'=>'10','destructive_actions'=>'None','risk'=>'Validate recovery and preserve unrelated records.','dev_acknowledgement'=>'1'];[$v,$e]=dune_dev_validate($q);check(!$e,'Complete devkey request rejected: '.implode('; ',$e));check($v['action_id']===''&&$v['action_parameters']==='{}','Developer request inherited ordinary action parameters');check(str_contains(dune_dev_prompt($v),'DEV KEY REQUEST'),'Developer intent absent from ticket');check(str_contains(dune_dev_execution_brief($v),'server/CLI-only'),'Developer boundary omitted');
+foreach(['0','16','1e1']as$expiry){$bad=$q;$bad['dev_expiry']=$expiry;invalid_request($bad,'Invalid dev lifetime accepted');}
+$bad=$q;unset($bad['dev_acknowledgement']);invalid_request($bad,'Developer review acknowledgement omitted');
+$bad=$q;$bad['environment']='proposal';invalid_request($bad,'Developer request without concrete environment accepted');
+$bad=valid_request();$bad['dev_actions']='Unexpected developer operation';invalid_request($bad,'Hidden developer operation accepted on ordinary route');
+$bad=valid_request();$bad['privacy']='0';invalid_request($bad,'Privacy confirmation omitted');
+$bad=valid_request();$bad['execution_state']='completed';[$v,$e]=dune_dev_validate($bad);check(!$e&&$v['execution_state']==='requested','Client overrode execution state');
+check(str_contains(dune_dev_execution_brief(['objective'=>'Old request']),'Legacy request'),'Legacy ticket was reinterpreted as an executable instruction');
+$original=['title'=>'Old title','objective'=>'Original request'];$copy=$original;dune_dev_execution_brief($original);check($original===$copy,'Legacy request data mutated');
+$owner=['username'=>'unimatrix999','ranks'=>['owners']];check(dune_dev_owner($owner),'Existing owner approval changed');check(!dune_dev_owner(['username'=>'unimatrix999','ranks'=>['user']]),'Name alone gained owner authority');
+echo json_encode(['passed'=>$checks,'failed'=>0,'ticket_created'=>false,'keys_issued'=>0])."\n";
diff --git a/website/ops/test_jarvis_dev_form_publisher.py b/website/ops/test_jarvis_dev_form_publisher.py
new file mode 100644
index 00000000..15473d69
--- /dev/null
+++ b/website/ops/test_jarvis_dev_form_publisher.py
@@ -0,0 +1,14 @@
+import importlib.util,pathlib,unittest
+path=pathlib.Path(__file__).resolve().parents[1]/'scripts/publish-jarvis-dev-form.py'
+spec=importlib.util.spec_from_file_location('dev_form',path);module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module)
+class DevFormPublisherTests(unittest.TestCase):
+ def test_only_new_form_replaced_and_history_preserved(self):
+ old="