# Integration milestone: read-only v4 This integration supersedes mutation/chat expectations below. All orchestration POST/PUT routes return 403 **before calling legacy services**, including task creation, transitions, gate decisions, budget writes, kill-switch and chat. No feature flag can enable them. `availableActions` is always `[]`. Do not enable mutation controls until hardened core is merged and independently verified. GET `/admin/orchestration/overview` returns `{items:[{id:"tasks",title:"Persisted task inventory",count:number}], measuredAt, capabilities:{mutations:false,chat:false,runtime:false},reason:"security_hardening_pending"}`. The timestamp describes this DB inventory observation, not runtime health. Frontend capability fetch defaults to all false on failure or missing fields. GET tasks and detail use explicit allowlists: task identity/state/version/mode/budget; run identity/status/commit/environment; artifact identity/kind/hash; decision identity/gate/decision/expiry/bindings; event identity/type/states/sequence/time; ledger identity/amount/kind/time. Arbitrary metadata, notes, event payloads, artifact URI/signature and BigInt size are not exposed. Scope/acceptance metadata remains withheld pending a reviewed structured schema. GET `/releases` is persisted run evidence only, not a claim of release authorization or deployment. GET `/agents`, `/schedules`, `/model-policy` return 503 with explicit unavailable reasons: there are no trusted runtime identity/auth or persisted model policy read contracts. HermesManagementModule is registered deny-all with an empty token and no HTTP controllers; no runtime calls or cron changes occur. RouterUsageModule is registered with its admin-protected read-only endpoint and returns unavailable when credentials are absent. No new secrets are configured. ## Historical component contract (mutation proposals disabled) # Admin orchestration v4 adapter contract All client traffic uses existing authenticated Axios client (`src/services/api.ts`). Relative `/admin/...` paths are served below `/api`. No runtime secrets, Hermes tokens, PTY, terminal websocket or direct gateway credentials may enter these DTOs. Backend must project/redact task metadata, artifacts, audit payloads and chat text before returning them. Browser does not enforce authorization. ## Implemented core API observed in sibling core worktree - GET `/admin/orchestration/tasks`: bare Task[] or `{success:true,data:Task[]}`. - GET `/admin/orchestration/tasks/:id`: immutable task detail with runs/artifacts, decisions, events and budgetLedger. - POST `/admin/orchestration/tasks`: key,title,department,operationMode,budgetLimitCents,metadata {scope,acceptanceCriteria[]} (no execution authorization). - PUT `/admin/orchestration/tasks/:id/transition`: toState,expectedVersion,idempotencyKey,reason. - POST `/admin/orchestration/tasks/:id/gates/{1|2}/decide`: decision,expectedVersion,idempotencyKey,expiresAt,notes. Gate2 APPROVED additionally binds runId,artifactHash,commitSha,environment to registered immutable run and artifact. - PUT `/admin/orchestration/kill-switch`: level,reason. Levels FREEZE_NEW_WORK,STOP_AGENTS,DISABLE_MUTATIONS,EMERGENCY_HALT. No invented reset/resume route. Task fields and optional service DTOs are declared in `src/services/orchestration.ts`. ## Required integration additions (fail closed until backend provides) Task `availableActions: {id,label,toState?,gate?:1|2,decision?:APPROVED|REJECTED,disabledReason?}[]` must be advertised by backend after permission, state, gate, policy and kill-switch evaluation. Browser never derives transitions from state. Missing actions means read-only, not an invitation to synthesize controls. Backend core inspected initially did not advertise these actions. This is an integration blocker for execution. Optional read-only resources GET `/admin/orchestration/{agents|model-policy|schedules|releases}` return `{items:[{id,title?,status?,department?,readiness?,model?,budgetLimitCents?,spentCents?,cron?,timezone?,environment?,commitSha?,reason?}],measuredAt:ISO8601}`. May be wrapped in `{success:true,data:...}`. 404/403/network/malformed replies render unavailable, not mock cards. These endpoint contracts are proposals requiring backend reconciliation, not claims that endpoints exist. Schedule editing, model policy editing, budget adjustments, agent start/stop and release execution require separately advertised typed backend commands; intentionally not implemented against guessed routes. Existing task run/evidence, decisions, ledger and ordered events remain inspectable independent of optional feeds. POST `/admin/orchestration/chat/messages`: {sessionId,message,idempotencyKey} -> {id,role:'assistant',content}. Advisory-only bridge; no browser runtime connection or auto-execution of text. Backend must bind sessions to authenticated user and redact sensitive output. ## Retry and concurrency Command dialog snapshots immutable task version and allocates one key. On first attempt inputs lock; failed retries use identical payload/key. Cancel and refresh to reconcile 409 conflict; refresh invalidates selection and dialog. Successful command refetches authoritative tasks; no optimistic status. Backend must enforce idempotency transactionally, compare payload bindings and versions; frontend is not a safety boundary. Task creation is keyed by unique business key; reconcile ambiguous failures by refreshing before retry. ## 9router usage concrete contract (aligned with backend worker b0f4636) GET `/admin/router-usage?period=today|24h|7d|30d|60d|all` default7d; authenticated admin. Response: source,period,status available|unavailable,reason,data null|{totals,providers[],models[],accounts[]},freshness {retrievedAt,sourceUpdatedAt,stale},attribution {scope:9router_total,hermes:null,additive:false}. Metrics: requests,inputTokens,outputTokens,cacheReadTokens,cacheWriteTokens,reasoningTokens,errors. Last three unsupported=null. Account quota {status:unknown,remaining:null,resetAt:null,reason:upstream_quota_get_mutates_credentials}. No upstream quota GET because it refreshes credentials. No estimates or raw credentials. Nullable provider/model/account IDs are sanitized by backend. Breakdowns overlap and are never summed. Hermes attribution unknown, not zero and not added. Retrieved timestamp is not source freshness. SourceUpdatedAt and stale remain explicitly unknown. Frontend explicitly projects DTO fields and rejects malformed/unavailable replies. No direct gateway connection. ## Monitoring Existing payment stats/health and SMS credit are read independently. Only returned values displayed. Request failures remain unknown with source and client observation timestamp. Database/Redis/Post/OCR/uptime/environment/agent runtime remain unknown without measured endpoints. No fabricated 14-day uptime, Production label, derived DB ping, SMS count or healthy post service. ## Verification caveats All verification uses disposable node:22-bookworm Docker runners against this worktree. Plain `npm run typecheck` uses solution-style config and does not verify app files. `tsc --noEmit -p tsconfig.app.json` exposes pre-existing errors in legacy Approvals/Audit/HQ/Tasks imports and Orders/Symptoms types; report these separately, not as a green full application typecheck. Build warning: unresolved existing Shabnam font remains runtime-resolved.