Awesome Cohub
中文
Conceptscohub.concept.execution-token2 min

An execution token is a short-lived, signed execution grant that authorizes tool and CLI calls as a specific actor in a specific Space, session, or turn without requiring a full interactive Logto session.

Shape

  • actorUserId - who is acting
  • spaceId - bound Space
  • sessionId / turnId - optional turn binding
  • source - for example prompt or run_command
  • scopes - delegated permissions, when present
  • iat / exp - execution-grant lifetime (currently 24 hours)

How it appears

ContextBehavior
Agent tools / run_commandInjects COHUB_EXECUTION_TOKEN and COHUB_USER_UUID into the Sandbox command environment; streamed logs redact the token
CLIA present COHUB_EXECUTION_TOKEN selects execution-token auth and overrides stored Logto auth; it cannot be refreshed as an OIDC session
APIThe bearer token is verified as an execution principal before ordinary user or Work/App sessions

SDK execution context (v2.42)

getCohubContext() returns a fully typed runtime context resolved from the execution token and environment: execution source, actor and viewer users, space/session/turn/tool-call IDs, app and action, granted scopes, and model. CLIs and scripts can branch on the runtime (sandbox vs local) instead of guessing from the environment.

Permission union (v2.29)

A scoped execution token adds its grants to the account's own access. It does not replace the actor's normal permissions. Session and Space filtering use the same additive union as direct permission checks, so an execution-token request cannot see less or more than the corresponding union allows.

The token remains bound to its execution context: an extra grant for Space A does not authorize a call against Space B, and a token does not become a general-purpose user session.

Space creation (v2.45)

space.create is authorized by a user-level permission rather than by the caller's principal type:

  • Execution tokens work again - cohub spaces create inside a Sandbox succeeds when the actor holds the permission.
  • App sessions need an explicit space.create viewer grant.
  • Preview sessions are denied; account sessions are unchanged.

Identity coupling

  • Grants are created per agent turn or command for the actor of that turn.
  • User-config skills enter the system prompt only when actorUserId === spaceOwnerUserId.
  • Collaborator turns still receive project, mod, and platform skills, but not the owner's personal user-config skills.

Not the same as

  • Logto user session - interactive login (cohub auth login)
  • Work/App runtime session - viewer identity inside a published App
  • Preview session cookie - workspace preview host identity