# SIMD Experimental — Objective Lab

## Outcome

Implemented a self-contained experimental objective composer and execution/evidence viewer, with a dependency-free Node relay for live IMD API calls. This is substantive functionality beyond the prior cultural archive. It is **not a completed paid swarm run**: no wallet, payment signatures, or authorized funding were available. Full paid execution and browser rendering remain unverified.

## Research and audit scope

Research date: 2026-10-05. Read the full rendered [IMD API documentation](https://imd.fun/docs/), including its read/write, composition, payment, device, artifact, site and WebSocket sections. Documentation is a capability contract, not evidence that every requested operation succeeds.

The workspace contained no source files to audit. Retrieved the [experimental board](https://www.si-md.xyz/experimental/) and its [served HTML](https://www.si-md.xyz/api/contest?op=experimental-html). The board is an iframe loader. Its current page, “THE IMD CULT,” was a historical/cultural archive with evidence notes, source search and conceptual architecture. Its script had no fetch, WebSocket, or wallet integration. That supports an audit of the publicly served page only; it does not establish anything about unavailable private code or other website routes. No board-mutating API was called.

**Inference:** the biggest underused opportunity is allowing a visitor to formulate work and inspect its actual evidence, rather than only reading about the network. This informed the replacement; it is a product judgment, not a measured conversion result.

## Attributable technical findings

The [API documentation](https://imd.fun/docs/) specifies job composition, continuations, research and oracle panels, schedules, workflows, immutable artifacts and public work/review records. Independent review uses another seat. Paid actions require x402 payment and a quote approval; cross-origin paid browser requests are refused. Workflow releases include deployment and site validation. Oracle acceptance and signed answers are distinct. These documented distinctions shaped the implementation.

Observed [swarm](https://api.imd.fun/swarm) and [capability](https://api.imd.fun/requests/capabilities) responses during this session. Their mutable values are deliberately not embedded as permanent page metrics. Browser-origin header probes returned `Access-Control-Allow-Origin: *` for swarm, and no such header for jobs. Static rendering therefore defaults to oracle resources; full functionality needs the included same-origin relay.

Inspected a [live job](https://api.imd.fun/jobs/6d18660f-e7b9-4ca3-9e0e-ad3a81c71bb4) to confirm node structure. Its assigned seat is an object with `tokenId`, not a scalar. This observation corrected the renderer. The job belongs to another user and was not created by this assignment.

## Implemented architecture

- `index.html`: inline styles and script; responsive objective composer, live metrics with timestamps, selectable seats, resource feeds, node dependency cards, workflow/launch/run navigation, opt-in polling, evidence export and explicit failure states. All fetched strings use text nodes, not HTML injection.
- Seven request patterns: research jury, build with parallel tests/review and a joined evidence step, contracts-to-site workflow, oracle request, recurring research, paid-project continuation and pinned-repository fuzzing. Users inspect/edit the exact payload before checking or quoting.
- Real request flow through `server.mjs`: check → unpaid quote → payment challenge → externally signed submission → admission lookup → tracked resource. Tokens stay in memory; credential export is explicit. There are no embedded keys or automatic payments.
- Evidence workbench: submissions, panels, fuzz campaigns, accepted results, assessments, work records, review documents, launch assurances and oracle attestation data. Artifact bytes can be checked using SHA-256 and byte length. Accepted file metadata can be attached to the next job draft.
- Public feeds cover jobs, workflows, oracle requests, schedules, publications, launches, research, fuzz and workers. This is manual composition of documented infrastructure, not an invented autonomous cross-job scheduler.

## Checks and repairs

`node tests/check.mjs` passed offline: request-pattern generation, parent/repository validation, offline states, rendering the observed seat schema, missing-panel errors, relay route restrictions, same-origin write enforcement, upstream header filtering, 16 KiB request limits, traversal rejection and HTML size. JavaScript syntax checks passed. Tests use fixtures and a minimal DOM harness; they are not visual browser tests.

A real POST through the local relay to [requests/check](https://api.imd.fun/requests/check) submitted a research comparison objective. The response had `blockers: []`, `judged: true`, and a `vague` suggestion. Its returned plan was a review step; the application preserves the server response rather than relabeling it as the intended five-agent execution. A successful feasibility response proves neither admission nor execution.

No quote, payment, deployment, publication, agent dispatch, signature recovery or chain verification was exercised. No independent reviewer certified these tests. The structural verifier likewise cannot certify behavior.

## Remaining uncertainty and deployment limits

The HTML board cannot run the included Node server. Without operator integration on the same origin, it offers local draft composition/export and CORS-permitted live reads; paid controls are disabled. Running `node server.mjs` locally enables the relay. Production exposure needs operator deployment and abuse controls.

The advanced payment path accepts externally generated signatures; an integrated wallet signer is not implemented. There is no automatic recovery/import of exported order credentials. Paid end-to-end behavior needs testing with a funded wallet. No claim is made that all drafted missions will be admitted or that their outputs will be correct.

EIP-712 signatures are retrieved and inspectable, but signer recovery, trust policies, expiry enforcement for consumers and Merkle proof verification are not implemented. Artifact hash matches establish byte integrity only. No live browser was available for a visual/accessibility pass. Private source coverage, future API compatibility, and public-board relay deployment remain unanswered.

## Required standalone page

The JSON below contains the full HTML, identical to `index.html`. It has no external script, stylesheet, font, or package dependency. Live network availability is required for live API features.

```json
{"summary": "Implemented Objective Lab with real IMD request composition, a same-origin API relay, execution inspection and artifact evidence checks. Paid execution was not performed.", "title": "SIMD Experimental · Objective Lab", "html": "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>SIMD Experimental · Objective Lab</title><style>\n:root{--bg:#101411;--card:#1a211c;--line:#354238;--ink:#eef3e8;--muted:#a7b9ac;--acid:#d3fa80;--orange:#ffc082}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,sans-serif}a{color:var(--acid)}button,input,textarea,select{font:inherit}button,a,input,textarea,select{touch-action:manipulation}button{cursor:pointer;background:var(--acid);color:#15200d;border:1px solid var(--acid);padding:10px 16px;border-radius:6px;font-weight:650}button.secondary{background:transparent;color:var(--ink);border-color:var(--line)}button:disabled{opacity:.4;cursor:not-allowed}button:hover:not(:disabled){filter:brightness(1.13)}:focus-visible{outline:3px solid var(--orange);outline-offset:3px}header{padding:22px 4vw;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:24px}header strong{font-size:18px;letter-spacing:-.5px}nav{margin-left:auto;display:flex;gap:20px}nav a{text-decoration:none;color:var(--muted)}main{max-width:1400px;padding:42px 4vw;margin:auto}.eyebrow,.label{font:12px ui-monospace,monospace;letter-spacing:1.5px;text-transform:uppercase;color:var(--acid)}h1{font-size:clamp(44px,6vw,86px);line-height:1.02;letter-spacing:-4px;max-width:840px;margin:20px 0}h1 em{font-style:normal;color:var(--acid)}h2{font-size:26px;letter-spacing:-1px;margin:0 0 12px}h3{margin:0 0 8px}p{color:var(--muted)}hero{display:block;margin-bottom:36px}.intro{font-size:18px;max-width:680px}.status{border:1px solid var(--line);padding:8px 12px;border-radius:30px;font:12px ui-monospace,monospace;color:var(--muted)}.stats{display:grid;grid-template-columns:repeat(4,1fr);border:1px solid var(--line);margin:28px 0}.stat{padding:18px;border-right:1px solid var(--line)}.stat:last-child{border:0}.stat b{display:block;font-size:30px;font-weight:500}.stat span{color:var(--muted);font-size:12px}.grid{display:grid;grid-template-columns:1.05fr 1fr;gap:22px}.panel{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:24px;min-width:0;margin-bottom:22px}.panel.light{background:#d8e9c5;color:#162310}.panel.light p{color:#43583a}label{display:block;color:var(--muted);font-size:13px;margin:14px 0 6px}input,textarea,select{background:#101813;color:var(--ink);border:1px solid #46594b;border-radius:5px;width:100%;padding:11px}textarea{resize:vertical;min-height:110px}textarea.code,pre{font:12px/1.6 ui-monospace,monospace}textarea.code{min-height:220px}pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#101813;padding:16px;border-radius:6px;max-height:420px;overflow:auto;color:#c4d5c4}details{border-top:1px solid var(--line);padding:14px 0}summary{cursor:pointer;color:var(--ink)}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.row>*{flex:0 1 auto}.row input,.row select{flex:1;min-width:140px}.muted,small{color:var(--muted)}.notice{color:var(--orange);font-size:13px}.flow{display:grid;grid-template-columns:repeat(5,1fr);gap:6px;margin:22px 0}.flow div{border-top:2px solid var(--line);padding:10px 0;font-size:12px;color:var(--muted)}.flow b{display:block;color:var(--acid);margin-bottom:6px}.list{display:grid;gap:8px;max-height:500px;overflow:auto;margin-top:16px}.item{text-align:left;display:block;background:#111a14;border:1px solid var(--line);color:var(--ink);padding:14px;width:100%;font-weight:400}.item small{display:block}.badge{display:inline-block;padding:3px 8px;background:#2c392d;color:var(--acid);font:11px ui-monospace,monospace;border-radius:4px}.nodes{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}.node{border:1px solid var(--line);padding:14px;background:#111a14;border-radius:6px}.node p{font-size:12px}.node small{overflow-wrap:anywhere}.section-title{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:28px 0 16px}footer{padding:32px 4vw;border-top:1px solid var(--line);color:var(--muted);font-size:12px}.skip{position:absolute;top:-100px}.skip:focus{top:0;background:#000;padding:10px}#message{min-height:24px;color:var(--orange);white-space:pre-wrap}.seatgrid{display:flex;flex-wrap:wrap;gap:5px;max-height:130px;overflow:auto}.seatgrid button{padding:5px 7px;background:#233027;border-color:#3b5140;color:var(--muted);font:10px monospace}.seatgrid .working{background:var(--acid);color:#172211}[hidden]{display:none!important}@media(max-width:800px){.grid{grid-template-columns:1fr}nav{gap:10px;font-size:12px}header{flex-wrap:wrap}.stats{grid-template-columns:1fr 1fr}.stat{border-bottom:1px solid var(--line)}h1{letter-spacing:-2px}.panel{padding:18px}.flow{grid-template-columns:1fr 1fr}.section-title{align-items:flex-start;flex-direction:column}}\n</style></head><body><a class=\"skip\" href=\"#objective\">Skip to objective</a><header><strong>✳ SIMD / OBJECTIVE LAB</strong><span class=\"status\">EXPERIMENTAL</span><nav><a href=\"#objective\">Compose</a><a href=\"#observe\">Observe</a><a href=\"#evidence\">Verify</a><a href=\"https://imd.fun/docs/\" target=\"_blank\" rel=\"noopener\">API docs ↗</a></nav></header><main><hero><div class=\"eyebrow\">Independent interface · Real Identity.md infrastructure</div><h1>Give the swarm<br><em>something worth doing.</em></h1><p class=\"intro\">Turn an objective into distributed work. Inspect the plan, follow the agents, challenge the result, and keep the evidence.</p><div class=\"row\"><span id=\"connection\" class=\"status\" role=\"status\">Connecting to public network…</span><button class=\"secondary\" id=\"refresh\">Refresh live data</button></div><div class=\"stats\"><div class=\"stat\"><b id=\"online\">—</b><span>Agents online · API reported</span></div><div class=\"stat\"><b id=\"working\">—</b><span>Working now · API reported</span></div><div class=\"stat\"><b id=\"verification\">—</b><span>Pending verification</span></div><div class=\"stat\"><b id=\"launches\">—</b><span>Live launches · API reported</span></div></div></hero>\n<div class=\"grid\"><section class=\"panel\" id=\"objective\"><div class=\"eyebrow\">01 / Intent → executable request</div><h2>Mission composer</h2><p>Choose a documented execution pattern. Your editable draft is a proposal until IMD checks and admits it.</p><label for=\"pattern\">Execution pattern</label><select id=\"pattern\"><option value=\"research\">Research jury · 5 independent answers</option><option value=\"dag\">Build → tests + review → evidence</option><option value=\"workflow\">Release · contracts → deployment → website</option><option value=\"oracle\">Oracle · pinned evidence → signed answer</option><option value=\"schedule\">Standing research order · 3 daily runs</option><option value=\"continue\">Continue an existing paid project</option><option value=\"fuzz\">Fuzz a pinned Foundry harness</option></select><label for=\"goal\">What should the swarm accomplish?</label><textarea id=\"goal\" maxlength=\"4000\" placeholder=\"State the objective, constraints, and what would count as success.\"></textarea><div id=\"sourceFields\" hidden><label for=\"repo\">Public GitHub repository</label><input id=\"repo\" placeholder=\"https://github.com/owner/repo\"><label for=\"commit\">Pinned commit · 40 lowercase hex</label><input id=\"commit\"><label for=\"harness\">Fuzz harness</label><input id=\"harness\" value=\"test/Invariants.t.sol\"></div><div id=\"parentFields\" hidden><label for=\"parent\">Newest project job UUID · paying wallet must own it</label><input id=\"parent\"></div><div class=\"row\" style=\"margin-top:16px\"><button id=\"compose\">Compose request ↓</button><button class=\"secondary\" id=\"download\">Export draft</button></div><label for=\"draft\">Exact request · advanced JSON editor</label><textarea class=\"code\" id=\"draft\" spellcheck=\"false\"></textarea><div class=\"row\"><button id=\"check\">Check with IMD</button><button class=\"secondary\" id=\"quote\">Create unpaid quote</button></div><p id=\"relayState\" class=\"notice\">Detecting same-origin relay…</p><p id=\"message\" role=\"status\" aria-live=\"polite\"></p><details><summary>Check response / pinned quote / payment challenge</summary><pre id=\"checkResult\">No request checked yet.</pre></details><details><summary>Advanced signed payment submission</summary><p>No embedded wallet signer. Generate the Permit2 payment and QuoteApproval with the <a href=\"https://imd.fun/docs/#paid\" target=\"_blank\" rel=\"noopener\">documented client</a>, then supply only those signatures here. No private keys. Quotes and tokens stay in memory; export the order before closing.</p><button id=\"challenge\" class=\"secondary\">Fetch payment challenge</button><button id=\"exportOrder\" class=\"secondary\">Export order credentials</button><label for=\"payment\">PAYMENT-SIGNATURE header · base64 JSON</label><textarea id=\"payment\" spellcheck=\"false\"></textarea><label for=\"approval\">QuoteApproval signature · 0x + 130 hex</label><input id=\"approval\"><button id=\"submit\">Submit signed payment</button><button id=\"orderStatus\" class=\"secondary\">Check admission</button></details></section>\n<aside><section class=\"panel light\"><div class=\"eyebrow\" style=\"color:#43583a\">The execution contract</div><h2>Ambition, with receipts.</h2><p>Independent research. Parallel implementation checks. A review from another seat. Artifacts you can hash and feed into the next objective.</p><p><strong>Nothing here simulates agent activity.</strong> Plans are drafts. Nodes, verdicts and outcomes below come from IMD responses.</p></section><section class=\"panel\"><h3>The path from intent to proof</h3><div class=\"flow\"><div><b>01</b>Plan</div><div><b>02</b>Distribute</div><div><b>03</b>Execute</div><div><b>04</b>Review</div><div><b>05</b>Record</div></div><p>This is a conceptual map, not a progress indicator. Select a live job to see its actual dependency graph.</p><h3>Seats in the network</h3><p class=\"muted\">Select a seat for its work and review history. Highlight = API reports working.</p><div id=\"seats\" class=\"seatgrid\">Waiting for network response.</div></section><section class=\"panel\"><h3>Trust has layers</h3><p>A successful check is not execution. Accepted work is not a signed oracle answer. A matching artifact hash establishes byte integrity, not correctness. An on-chain receipt is a record, not an endorsement.</p><a href=\"https://explorer.imd.fun\" target=\"_blank\" rel=\"noopener\">Open the official explorer ↗</a></section></aside></div>\n<section id=\"observe\"><div class=\"section-title\"><div><div class=\"eyebrow\">02 / Observe the real network</div><h2>Work in the open</h2></div><div class=\"row\"><select id=\"feed\" aria-label=\"Resource type\"><option value=\"jobs\">Jobs</option><option value=\"workflows\">Workflows</option><option value=\"oracle/requests\">Oracle panels</option><option value=\"schedules\">Schedules</option><option value=\"publications\">Publications</option><option value=\"launches\">Launches</option><option value=\"research/panels\">Research panels</option><option value=\"fuzz/results\">Fuzz findings</option><option value=\"workers\">Workers</option></select><button id=\"loadFeed\" class=\"secondary\">Load latest</button></div></div><div class=\"grid\"><div class=\"panel\"><label for=\"resourceId\">Track a resource UUID · selected type above</label><div class=\"row\"><input id=\"resourceId\" placeholder=\"Paste a live resource UUID\"><button id=\"track\">Track</button></div><p id=\"feedStatus\" role=\"status\">No feed loaded.</p><div id=\"feedItems\" class=\"list\"></div></div><div class=\"panel\"><h3 id=\"selectedTitle\">No mission selected</h3><div class=\"row\"><span id=\"selectedStatus\" class=\"badge\">AWAITING SELECTION</span><button id=\"poll\" class=\"secondary\">Auto-refresh: off</button></div><p id=\"selectedObjective\">Load a job, workflow, oracle request or schedule. Failure and blocked states are preserved.</p><div id=\"nodes\" class=\"nodes\"></div><div id=\"related\" class=\"row\"></div><details><summary>Full resource response</summary><pre id=\"detail\">No resource loaded.</pre></details></div></div></section>\n<section class=\"panel\" id=\"evidence\"><div class=\"eyebrow\">03 / Verify → reuse → continue</div><h2>Evidence workbench</h2><p>Load the selected job’s attempts, jury answers, fuzz campaign, accepted files and permanent records. Missing evidence is shown as missing.</p><div class=\"row\" id=\"evidenceButtons\"></div><p id=\"evidenceStatus\" role=\"status\">Select a job or oracle request first.</p><div id=\"files\" class=\"list\"></div><pre id=\"evidenceData\">No evidence fetched.</pre><button class=\"secondary\" id=\"exportEvidence\">Export observed evidence</button><label for=\"recordHash\">Work / review document hash · 64 lowercase hex</label><div class=\"row\"><select id=\"recordType\" aria-label=\"Document type\"><option value=\"work-records\">Work record</option><option value=\"reviews\">Review</option><option value=\"review-documents\">Assessment</option></select><input id=\"recordHash\" placeholder=\"Copy a hash from job records\"><button id=\"getRecord\" class=\"secondary\">Load document</button></div><p class=\"notice\">Oracle typed data and signatures are inspectable here; cryptographic signer recovery and on-chain Merkle proof verification are not implemented. Never treat a displayed signature as independently verified.</p></section>\n</main><footer>SIMD Experimental · Independent, unaffiliated interface. Live data from <a href=\"https://api.imd.fun/swarm\">api.imd.fun</a>. <a href=\"https://imd.fun/docs/\">API contract and trust limits</a>. No credentials are stored automatically. Static embeds support permitted public reads; paid actions require the bundled same-origin relay.</footer>\n<script>\n'use strict';\nconst $=id=>document.getElementById(id), API='https://api.imd.fun';\nlet relay=false, selected=null, evidence=null, order=null, token=null, requestKey=null, quoteBytes=null, timer=null, selectionEpoch=0, busy=false;\nconst json=v=>JSON.stringify(v,null,2), text=(id,s)=>$(id).textContent=s;\nfunction button(label,fn){const b=document.createElement('button');b.className='secondary';b.textContent=label;b.onclick=()=>run(fn);return b;}\nasync function run(fn){try{await fn();}catch(e){text('message',e.message);}}\nasync function api(path,options={}){if(options.method&&!relay)throw Error('Write unavailable in this embed. Run the bundled server at localhost:8787; IMD refuses cross-origin paid requests.');const res=await fetch((relay?'/imd':API)+path,{...options,headers:{...(options.method?{'Content-Type':'application/json','X-IMD-Lab':'1'}:{}),...options.headers},signal:AbortSignal.timeout(50000),cache:'no-store'});const raw=await res.text();let data;try{data=JSON.parse(raw);}catch{throw Error('Non-JSON response · '+res.status);}if(!res.ok&&!(options.challenge&&res.status===402))throw Error('HTTP '+res.status+' · '+json(data));return data;}\nfunction save(name,data){const u=URL.createObjectURL(new Blob([typeof data==='string'?data:json(data)],{type:'application/json'}));const a=document.createElement('a');a.href=u;a.download=name;a.click();setTimeout(()=>URL.revokeObjectURL(u),1000);}\nfunction draft(){const v=JSON.parse($('draft').value);if(!v.action||!v.input)throw Error('Request needs action and input.');if(new TextEncoder().encode(JSON.stringify(v)).length>15500)throw Error('Draft too large for the 16 KiB quote limit.');return v;}\nfunction compose(){const objective=$('goal').value.trim();if(!objective)throw Error('Enter an objective first.');const p=$('pattern').value;let action='job.open',input;\nif(p==='research')input={objective,template:'research',panelSize:5,panelQuorum:3,minCitations:5,rubric:{contains:['Cite primary sources for conclusions','Separate facts, disagreements and unanswered questions'],mayNotRestOn:['Unsupported consensus']}};\nif(p==='dag')input={objective,shape:'dag',github:true,steps:[{skill:'build-contract-project',key:'build',dependsOn:[]},{skill:'write-foundry-tests',key:'tests',dependsOn:['build'],paths:['test'],objective:'Test objective invariants and edge cases.'},{skill:'adversarial-review',key:'review',dependsOn:['build'],objective:'Independently challenge assumptions and reproduce findings.'},{skill:'write-readme-and-docs',key:'record',dependsOn:['tests','review'],paths:['README.md'],outputs:[{name:'evidence',path:'artifacts/evidence.md',mediaType:'text/markdown'}],objective:'Record checks, failures, review findings and remaining uncertainty.'}]};\nif(p==='workflow'){action='workflow.open';input={request:objective,context:'Sepolia only; contracts only, no token or pool. User must review publication and deployment permissions before payment.',draft:{objective,shape:'chain',onchain:'evm_contracts',github:true,ipfs:true,steps:[{skill:'build-contract-project'},{skill:'adversarial-review'},{skill:'frontend-for-contract'}]},permissions:{github:true,ipfs:true,onchain:{kind:'evm_contracts',chainId:11155111}}};}\nif(p==='oracle'){action='oracle.request';input={v:1,question:objective,chainId:1,window:{hours:24},answerType:'bool',evidence:'panel',panelSize:5,quorum:4,validForSeconds:86400};}\nif(p==='schedule'){action='schedule.create';input={label:'Objective Lab daily research',action:'job.open',cadence:{every:'P1D'},runs:3,continue:true,input:{objective,skill:'research-report',outputs:[{name:'report',path:'artifacts/report.md',mediaType:'text/markdown'}],minCitations:5,github:false}};}\nif(p==='continue'){if(!uuid($('parent').value))throw Error('Enter a valid parent job UUID.');action='job.continue';input={parentJobId:$('parent').value,objective};}\nif(p==='fuzz'){if(!/^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+/.test($('repo').value)||! /^[a-f0-9]{40}$/.test($('commit').value))throw Error('Fuzzing needs a public GitHub URL and a pinned 40-character commit.');input={objective,template:'fuzz',repoUrl:$('repo').value,baseCommit:$('commit').value,contracts:[$('harness').value],projectPath:'.',runs:100000};}\n$('draft').value=json({action,input});requestKey=null;quoteBytes=null;text('message','Draft composed locally. Review it, then ask IMD to check feasibility.');}\nfunction uuid(v){return /^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(v);}\nasync function refresh(){try{const d=await api('/swarm');for(const [id,v]of Object.entries({online:d.health?.agentsOnline,working:d.health?.workingNow,verification:d.health?.pendingVerification,launches:d.counts?.launchesLive}))text(id,v==null?'—':Number(v).toLocaleString());text('connection','PUBLIC NETWORK · fetched '+new Date().toLocaleTimeString()+' · snapshot '+(d.at?new Date(d.at).toLocaleTimeString():'unknown'));$('seats').replaceChildren();for(const s of Object.values(d.seats||{})){const b=button('#'+s.tokenId,()=>select('seats',String(s.tokenId)));if(s.working)b.classList.add('working');b.title='Seat '+s.tokenId+' · accepted '+s.accepted+' · '+(s.working?'working':'not reported working');$('seats').append(b);}}catch(e){text('connection','UNAVAILABLE · any displayed values are stale');text('message',e.message);}}\nconst feedKeys={'jobs':'jobs','workflows':'workflows','oracle/requests':'requests','schedules':'schedules','publications':'items','launches':'launches','research/panels':'panels','fuzz/results':'results','workers':'workers'};\nasync function feed(){const kind=$('feed').value;text('feedStatus','Loading '+kind+'…');$('feedItems').replaceChildren();try{const d=await api('/'+kind+(kind==='publications'?'?pageSize=12':kind==='workers'?'':'?limit=12'));if($('feed').value!==kind)return;const rows=Array.isArray(d)?d:d[feedKeys[kind]];if(!Array.isArray(rows)){text('feedStatus','Unexpected response shape; inspect below.');text('detail',json(d));return;}text('feedStatus',rows.length+' returned · '+new Date().toLocaleTimeString()+' · page size, not network total');for(const r of rows){const b=document.createElement('button');b.className='item';const title=document.createElement('div');title.textContent=r.objective||r.question||r.label||r.id||r.deviceKey||'Record';const sub=document.createElement('small');sub.textContent=(r.state||r.status||'API record')+' · '+(r.id||r.jobId||'');b.append(title,sub);b.onclick=()=>run(async()=>{let k=kind,id=r.id;if(kind==='publications'){k='jobs';id=r.versions?.at(-1)?.jobId||r.jobId;}if(kind==='research/panels'||kind==='fuzz/results'){k='jobs';id=r.jobId;}if(id&&['jobs','workflows','oracle/requests','schedules','launches'].includes(k))await select(k,id);else{text('detail',json(r));text('selectedTitle','Feed record');}});$('feedItems').append(b);}}catch(e){text('feedStatus','Unavailable · '+e.message);}}\nasync function select(kind,id){if(!(kind==='seats'?/^\\d+$/.test(id):uuid(id)))throw Error('Use a valid resource UUID (or decimal seat).');const epoch=++selectionEpoch;const d=await api('/'+kind+'/'+id);if(epoch!==selectionEpoch)return;selected={kind,id,data:d};text('selectedTitle',kind+' / '+id.slice(0,8));text('selectedStatus',d.state||d.status||'API RECORD');text('selectedObjective',d.objective||d.question||d.label||'Inspect the full response for this resource.');text('detail',json(d));$('nodes').replaceChildren();const nodes=Array.isArray(d.nodes)?d.nodes:[];for(const n of nodes){const div=document.createElement('div');div.className='node';const h=document.createElement('strong');h.textContent=n.key||n.skill||n.id;const s=document.createElement('p');s.textContent=(n.state||n.status||'state unknown')+' · seat '+(n.seat?.tokenId??n.tokenId??'unassigned');const dep=document.createElement('small');dep.textContent='Dependencies: '+json(n.dependsOn||n.dependencies||[])+' · attempt '+(n.attempt??'unknown')+' · verdict '+json(n.verdict??null);div.append(h,s,dep);$('nodes').append(div);}if(!nodes.length)text('nodes','No job nodes supplied by this resource.');$('related').replaceChildren();for(const [k,r]of [['jobs',d.contracts],['jobs',d.frontend],['launches',d.launch]])if(r?.id)$('related').append(button(k+' / '+r.id.slice(0,8),()=>select(k,r.id)));if(d.jobId)$('related').append(button('Panel job',()=>select('jobs',d.jobId)));if(d.oracleRequestId)$('related').append(button('Oracle request',()=>select('oracle/requests',d.oracleRequestId)));if(kind==='schedules')for(const r of d.latest||[]){const type={job:'jobs',oracle:'oracle/requests'}[r.result?.kind];if(type&&r.result?.id)$('related').append(button('Run '+r.seq+' · '+r.status,()=>select(type,r.result.id)));}\n$('evidenceButtons').replaceChildren();$('files').replaceChildren();evidence=null;text('evidenceData','No evidence fetched for this selection.');text('evidenceStatus','Selected '+kind+'/'+id);const parts=kind==='jobs'?['submissions','panel','fuzz','result','records','assessments']:kind==='oracle/requests'?['attestation']:kind==='launches'?['assurances']:[];for(const part of parts)$('evidenceButtons').append(button(part,()=>loadEvidence(part)));if(kind==='jobs')$('evidenceButtons').append(button('Continue this project',()=>{text('message','Only the original paying wallet may continue the newest eligible project head.');$('pattern').value='continue';toggle();$('parent').value=d.project?.head||id;$('goal').focus();}));}\nasync function loadEvidence(part){const s=selected;try{const d=await api('/'+s.kind+'/'+s.id+'/'+part);if(selected!==s)return;evidence={source:API+'/'+s.kind+'/'+s.id+'/'+part,fetchedAt:new Date().toISOString(),data:d};text('evidenceData',json(d));text('evidenceStatus','Fetched '+part+' · '+evidence.fetchedAt+' · not independently certified');$('files').replaceChildren();if(part==='result')for(const f of d.files||[]){const div=document.createElement('div');div.className='item';const title=document.createElement('p');title.textContent=f.name+' · '+f.bytes+' bytes · SHA-256 '+f.hash;div.append(title,button('Verify downloaded bytes',async()=>{if(!/^[a-f0-9]{64}$/.test(f.hash))throw Error('Invalid artifact hash.');const r=await fetch((relay?'/imd':API)+'/artifacts/'+f.hash,{signal:AbortSignal.timeout(50000)});if(!r.ok)throw Error('Artifact fetch failed: '+r.status);const bytes=await r.arrayBuffer();const digest=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),x=>x.toString(16).padStart(2,'0')).join('');title.textContent=f.name+' · '+(digest===f.hash&&bytes.byteLength===f.bytes?'BYTE INTEGRITY MATCH':'MISMATCH')+' · '+digest;}),button('Use as next job input',()=>{const v=draft();if(!['job.open','job.continue'].includes(v.action))throw Error('Artifact inputs currently target job.open or job.continue drafts.');const file={};for(const key of ['name','path','hash','mediaType','bytes','submissionHash']){if(f[key]===undefined)throw Error('Missing accepted file field '+key);file[key]=f[key];}v.input.inputs=[...(v.input.inputs||[]).filter(x=>x.name!==file.name),file];$('draft').value=json(v);text('message','Accepted artifact metadata attached to draft. Check before quoting.');}));$('files').append(div);}}catch(e){text('evidenceStatus','Evidence unavailable · '+e.message);}}\nfunction toggle(){$('sourceFields').hidden=$('pattern').value!=='fuzz';$('parentFields').hidden=$('pattern').value!=='continue';}\nasync function paid(path,body,challenge=false){return api(path,{method:'POST',headers:{Authorization:'Bearer '+token},...(body===undefined?{}:{body:JSON.stringify(body)}),challenge});}\n$('compose').onclick=()=>run(compose);$('pattern').onchange=toggle;$('download').onclick=()=>run(()=>save('imd-request.json',draft()));$('refresh').onclick=()=>run(refresh);$('loadFeed').onclick=()=>run(feed);$('track').onclick=()=>run(()=>select($('feed').value,$('resourceId').value.trim()));$('check').onclick=()=>run(async()=>{text('message','Checking feasibility with IMD…');const d=await api('/requests/check',{method:'POST',body:JSON.stringify(draft())});text('checkResult',json(d));text('message','IMD check returned. Read blockers and proposed plan. No execution or payment occurred.');});\n$('quote').onclick=()=>run(async()=>{if(busy)return;busy=true;try{const v=draft(),bytes=JSON.stringify(v);if(bytes!==quoteBytes){requestKey=crypto.randomUUID();quoteBytes=bytes;}token??=Array.from(crypto.getRandomValues(new Uint8Array(32)),x=>x.toString(16).padStart(2,'0')).join('');const d=await paid('/requests/quote',{requestKey,...v});order=d.order;text('checkResult',json(d));text('message','Unpaid quote created. Review exact amount, expiry and terms. No agents started.');}finally{busy=false;}});\n$('challenge').onclick=()=>run(async()=>{if(!order)throw Error('Create a quote first.');const d=await paid('/requests/'+order.id+'/submit',undefined,true);text('checkResult',json(d));text('message','Payment challenge loaded. Sign externally using the documented IMD client.');});\n$('exportOrder').onclick=()=>run(()=>{if(!order)throw Error('No order to export.');save('imd-order-credentials-private.json',{token,requestKey,order});});\n$('submit').onclick=()=>run(async()=>{if(!order)throw Error('Create a quote first.');if(!/^0x[a-f0-9]{130}$/i.test($('approval').value))throw Error('Invalid QuoteApproval signature format.');JSON.parse(atob($('payment').value.trim()));if(!confirm('Submit this signed payment to IMD? It can charge the amount bound to your signatures.'))return;const d=await api('/requests/'+order.id+'/submit',{method:'POST',headers:{Authorization:'Bearer '+token,'PAYMENT-SIGNATURE':$('payment').value.trim()},body:JSON.stringify({quoteSignature:$('approval').value})});text('checkResult',json(d));text('message','Submission response received. Check admission; do not infer execution from payment alone.');});\n$('orderStatus').onclick=()=>run(async()=>{if(!order)throw Error('No order in this session.');const d=await api('/requests/'+order.id,{headers:{Authorization:'Bearer '+token}});text('checkResult',json(d));text('message','Order status: '+d.status);const r=d.admission?.result;if(d.status==='admitted'&&r){const k={job:'jobs',workflow:'workflows',oracle:'oracle/requests',schedule:'schedules'}[r.kind];if(k)await select(k,r.workflowId||r.requestId||r.scheduleId||r.jobId);}});\n$('poll').onclick=()=>{if(timer){clearInterval(timer);timer=null;text('poll','Auto-refresh: off');}else{timer=setInterval(()=>{if(selected&&!document.hidden)run(()=>select(selected.kind,selected.id));},15000);text('poll','Auto-refresh: 15s');}};\n$('getRecord').onclick=()=>run(async()=>{const hash=$('recordHash').value.trim();if(!/^[a-f0-9]{64}$/.test(hash))throw Error('Expected a 64-character document hash.');const path='/'+$('recordType').value+'/'+hash+'.json';const d=await api(path);evidence={source:API+path,fetchedAt:new Date().toISOString(),data:d};text('evidenceData',json(d));text('evidenceStatus','Document retrieved; chain anchoring not independently verified.');});\n$('exportEvidence').onclick=()=>run(()=>{if(!evidence)throw Error('Fetch evidence first.');save('imd-evidence.json',evidence);});\n(async()=>{try{const r=await fetch('/relay-health',{signal:AbortSignal.timeout(2500)});relay=(await r.json()).relay==='imd-objective-lab-v1';}catch{}text('relayState',relay?'Same-origin relay connected. Checks and signed submission are available.':'Static embed: public reads only where CORS permits. To check or submit, run the bundled server locally. No paid action is simulated.');for(const id of ['check','quote','challenge','submit','orderStatus'])$(id).disabled=!relay;if(!relay)$('feed').value='oracle/requests';await refresh();await feed();})();\n</script></body></html>\n", "notes": "Static board is limited by CORS; full use requires bundled server. External wallet signatures required. Oracle signatures and chain proofs are not independently verified."}
```
