Class InvocationContext

java.lang.Object
com.tnsai.security.InvocationContext

public final class InvocationContext extends Object
Trusted interaction provenance, separate from executing agent and executor principal. Root factories belong to host ingress, not model arguments or arbitrary request fields. USER denotes an interaction category, not an authenticated account. This API is not a JVM sandbox.
  • Method Details

    • user

      public static InvocationContext user(AccessSubject human, AccessSubject executingAgent, String executorId, AuthorityScope authority)
      Host-owned human interaction boundary; the subject may be a stable anonymous chat identity. Stored @Idempotent results are shared by everyone presenting the same subjects, roles, origin, agent and executor, so a subject id must name one principal: a single anonymous id shared by many people lets them read each other's cached results.
    • autonomous

      public static InvocationContext autonomous(AccessSubject executingAgent, String executorId, AuthorityScope authority)
      Use only for the actual agent's own initiative, never for forwarded or human work.
    • otherAgent

      public static InvocationContext otherAgent(AccessSubject callerAgent, AccessSubject executingAgent, String executorId, AuthorityScope authority)
      Trusted peer ingress. For an existing invocation use delegateTo to preserve its origin.
    • unknown

      public static InvocationContext unknown(String executorId)
      Carries an unclassified ingress without granting any execution category.
    • cachePartition

      public String cachePartition()
    • actor

      public AccessSubject actor()
    • executingAgent

      public AccessSubject executingAgent()
    • onBehalfOf

      public List<AccessSubject> onBehalfOf()
    • executorId

      public String executorId()
    • callers

      public Set<ExecutionCaller> callers()
    • authorities

      public List<AuthorityScope> authorities()
    • subjects

      public List<AccessSubject> subjects()
    • current

      public static Optional<InvocationContext> current()
    • delegateTo

      public InvocationContext delegateTo(AccessSubject nextAgent, String nextExecutorId, AuthorityScope nextAuthority)
      Trusted host transfer to the actual recipient agent. The departing agent is derived from this context, never supplied by the caller. Every prior authority and subject remains. A USER peer hop requires USER and OTHER_AGENT; peer work can never become SELF again.
    • call

      public <T> T call(Callable<T> task) throws Exception
      Throws:
      Exception
    • run

      public void run(Runnable task)
    • wrap

      public static <T> Callable<T> wrap(Callable<T> task)
      Captures the current provenance and restores worker state on success, failure or cancellation.
    • wrap

      public static Runnable wrap(Runnable task)