import { actionTitle, ApprovalDecision, deviceName, display, Fact, identityName, OrderRows, orderTitle, PageButtons, Requester, Status, statusOf, statusText, targets, when } from './order-presentation'; import { Devices } from './devices'; import { CustomerManagement } from './customer-management'; import { ErrorBox, useResource, errorText } from './resource'; import { NavIcon, orderDetailRoute, type NavKey } from './navigation'; import { OrderComposer } from './order-composer'; import { ApprovalInbox, usePendingApprovals } from './approval-inbox'; import { ScriptLibrary } from './script-library'; import { McpTokenManagement } from './mcp-token-management'; import React, { useEffect, useRef, useState } from 'react'; import { createRoot } from 'react-dom/client'; import { ApiError, authConfig, approvalBlockers, objectId, page, pretty, record, RecordValue, request, session, Session, stringField, tenant, tenantPath, windowsPowerShellRemoteSignedProfile, fullMaintenanceScriptProfile } from './api'; import './style.css'; import { AdminControl, Catalog, TenantControls } from './management'; import { allowed, parseStrictJson, powerShellApprovalBlockers, powerShellPlanJobs, rootWarning, systemWarning, systemPlanJobs, verifyPlanIntegrity, queryLogsApprovalBlockers, queryLogsPlanJobs, windowsMsiApprovalBlockers, windowsMsiPlanJobs, verifyWindowsMsiManifest, adminScriptWarning } from './safety'; import { Login } from './login'; import { ConsoleOutput, visibleControls } from './console-output'; import { scriptApprovalBlockers, scriptPlanJobs, verifyScriptPlan } from './script-console'; import { agentUpdateWarning, agentUpdatePlanJobs, agentUpdateApprovalBlockers, verifyAgentUpdatePlan, verifyReleaseMetadata, releaseEnvelope, uploadAgentUpdateArtifact } from './agent-updates'; export function JsonView({ value, label = 'Vollständige Daten' }: { value: unknown; label?: string }) { return
{label}
{pretty(value)}
; } export function AgentUpdatePlanNotice({ plan }: { plan: RecordValue }) { try { const jobs = agentUpdatePlanJobs(plan); if (!jobs.length) return null; return

Vollständige feste Agent-Selbstupdates ({jobs.length})

{agentUpdateWarning}

{jobs.map(job =>

Asset {job.assetId}

Agent: {job.agentId} · Job: {job.jobId} · Versuch: {job.attemptId} · Identität: {job.identity}

Release: {String(job.manifest.release_id)} · Version: {String(job.manifest.version)} · Plattform: {String(job.manifest.platform)} · Sequenz: {String(job.manifest.release_sequence)}

Manifest-SHA256: {String(job.update.manifest_sha256)} · Job-SHA256: {job.jobHash}

Die folgenden Vorgänger-, Codepaar-, Updater-, Keyring- und Peerpinbindungen stammen vollständig aus den unveränderten gespeicherten Planbytes. Gesamtbudget600s, Healthfrist180s; keine allgemeine Reparatur oder neue Freigabe.

)}
; } catch { return ; } } export function ScriptPlanNotice({ plan }: { plan: RecordValue }) { try { const jobs = scriptPlanJobs(plan); if (!jobs.length) return null; const grouped = new Map(); for (const job of jobs) { const key = JSON.stringify([job.scriptHash, job.interpreter, job.identity, job.windowsProfile, job.privilegedProfile, job.arguments, job.expectedStdout, job.notBefore, job.startBefore, job.runtimeSeconds, job.outputBytes]); const group = grouped.get(key); if (group) group.push(job); else grouped.set(key,[job]); } const names = targets(plan); return

Skriptinhalt

{[...grouped.values()].map(group => { const job = group[0]!; return
{grouped.size > 1 &&

{group.map(j => { const target = names.find(t => t.asset_id === j.assetId && t.agent_id === j.agentId); return target ? deviceName(target) : j.assetId; }).join(', ')}

}

{job.revision ? job.revision.name+' · Version '+job.revision.version : 'Einmaliges Skript'} · {job.interpreter} · {identityName(job.identity)}

{job.privilegedProfile === fullMaintenanceScriptProfile &&

{adminScriptWarning}

} {job.identity === 'root' && job.privilegedProfile !== fullMaintenanceScriptProfile &&

{rootWarning}

} {job.interpreter === 'powershell' &&

Windows PowerShell 5.1 · {job.windowsProfile === windowsPowerShellRemoteSignedProfile ? 'RemoteSigned für diesen Prozess' : 'Richtlinie des Geräts'}

}
{visibleControls(job.script)}
{job.arguments.length > 0 &&

Argumente {JSON.stringify(job.arguments)}

} {job.expectedStdout !== null &&

Erwartete Ausgabe {JSON.stringify(job.expectedStdout)}

}
Ausführungsdetails und Prüfsummen

{job.scriptBytes} Byte · SHA256 {job.scriptHash}

Profil {job.privilegedProfile} · {job.identity} · Laufzeit {job.runtimeSeconds}s · Ausgabe bis {job.outputBytes} Byte

{group.map(j =>

Gerät {j.assetId} · Agent {j.agentId}

Job {j.jobId} · Versuch {j.attemptId} · SHA256 {j.jobHash}

)}
; })}
; } catch { return ; } } export function SystemPlanNotice({ plan }: { plan: RecordValue }) { let jobs: RecordValue[]; try { jobs = systemPlanJobs(plan).filter(p => record(p.action).action === 'set_service_state'); } catch { return ; } if (!jobs.length) return null; return ; } export function WindowsRebootPlanNotice({ plan }: { plan: RecordValue }) { try { const jobs = systemPlanJobs(plan).filter(p => record(p.action).action === 'reboot'); if (!jobs.length) return null; return ; } catch { return ; } } export function WindowsMsiPlanNotice({ plan }: { plan: RecordValue }) { try { const jobs = windowsMsiPlanJobs(plan); if (!jobs.length) return null; return ; } catch { return ; } } export function PowerShellPlanNotice({ plan }: { plan: RecordValue }) { try { const jobs = powerShellPlanJobs(plan); if (!jobs.length) return null; return ; } catch { return ; } } export function QueryLogsPlanNotice({ plan }: { plan: RecordValue }) { try { const jobs = queryLogsPlanJobs(plan); if (!jobs.length) return null; return ; } catch { return ; } } function WindowsMsiCatalog({ tenantId, auth }: { tenantId: string; auth: Session }) { const [source, setSource] = useState('{}'), [cursor, setCursor] = useState(null), [revision, setRevision] = useState(0), [error, setError] = useState(null), [busy, setBusy] = useState(false), [receipt, setReceipt] = useState(null); const list = useResource(async signal => { const result = page(await request(tenantPath(tenantId, `/windows-msi-recipes${cursor ? `?cursor=${encodeURIComponent(cursor)}` : ''}`), { signal })); const items: RecordValue[] = []; for (const item of result.items) { const manifest = await verifyWindowsMsiManifest(item.manifest); if (item.sha256 !== manifest.recipe_sha256 || item.recipe_id !== manifest.recipe.recipe_id) throw new Error('MSI-Katalogansicht widerspricht Rezeptbytes'); items.push({ catalog_id: item.catalog_id, recipe_id: manifest.recipe.recipe_id, sha256: manifest.recipe_sha256, manifest }); } return { ...result, items }; }, [tenantId, cursor, revision]); return

Getrennter unveränderlicher Windows-MSI-Katalog

Nur die zwei festen eigenen Machine/x64-Rezepte. Import ist Metadatenpflege mit catalog:write, keine Genehmigung, Installation oder Capabilityfreigabe. Öffentliche MSI-Artefakte werden über den bestehenden Artefaktimport gebunden. Vollständiges geprüftes Manifest für den Parametereditor kopieren.

{list.data && <> {list.data.items.length ? :

Für diesen Kunden sind keine Windows-MSI-Rezepte hinterlegt.

} {(cursor || list.data.next_cursor) &&
} }
Neues festes MSI-Manifest importieren
{ event.preventDefault(); setBusy(true); setError(null); setReceipt(null); try { if (!allowed(auth, 'catalog:write')) throw new Error('catalog:write unbekannt/nicht erteilt'); const manifest = await verifyWindowsMsiManifest(parseStrictJson(source)); const result = record(await request(tenantPath(tenantId, '/windows-msi-recipes'), { body: manifest, csrf: auth.csrf_token })); const stored = await verifyWindowsMsiManifest(result.manifest); if (result.sha256 !== manifest.recipe_sha256 || result.recipe_id !== manifest.recipe.recipe_id || JSON.stringify(stored) !== JSON.stringify(manifest)) throw new Error('MSI-Importbeleg widerspricht unveränderlichen Rezeptbytes'); setReceipt({ catalog_id: result.catalog_id, manifest: stored }); setRevision(n => n + 1); } catch (error) { setError(errorText(error)); } finally { setBusy(false); } }}>