Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.6 KB
Raw Blame
// Read-only request-show resolves mutations whose response was lost in transit.

export const MUTATION_REQUEST_STATES = ['completed', 'pending', 'absent'] as const

export type OrchestrationMutationRequestState = (typeof MUTATION_REQUEST_STATES)[number]

export type OrchestrationMutationRequestShowResult = {
  requestId: string
  state: OrchestrationMutationRequestState
  method?: string
  createdAt?: string
  updatedAt?: string
  receipt?: unknown
  // Ship absent’s ambiguous interpretation so callers cannot silently soften it.
  interpretation: string
}

export function describeMutationRequestState(params: {
  requestId: string
  state: OrchestrationMutationRequestState
  method?: string
}): string {
  const { requestId, state, method } = params
  if (state === 'completed') {
    return `Request ${requestId} already took effect${method ? ` (${method})` : ''}. Replaying it with --retry-request ${requestId} returns the recorded outcome and starts nothing new.`
  }
  if (state === 'pending') {
    return `Request ${requestId} was accepted${method ? ` by ${method}` : ''} but its outcome is not recorded yet. The original mutation may still be running, or Orca may have restarted before recording its outcome. Wait for the original command when it is still running; otherwise replay it with --retry-request ${requestId}. Do not issue a fresh mutation.`
  }
  return `No receipt for request ${requestId} under this caller identity. It never reached this Orca runtime, failed before recording anything, or its receipt was pruned. Absent is not proof that nothing happened.`
}