Skip to main content

protocol/task

packages/protocol/src/task

Purpose

Public barrel for task protocol descriptors.

Public surface

agentCallableTaskRpcMethods

Variable
Task RPC catalog callable by agent clients.

appCallableTaskRpcMethods

Variable
Task RPC catalog callable by app clients.

HookBlockedError

Class

InitialConversationInput

TypeAlias

Task

TypeAlias

taskCallbackMethods

Variable
Task callback catalog served by app clients for server-initiated calls.

TaskClosedError

Class

TaskClosedNotificationDefinition

Variable
Pushed when a task closes.

TaskCreate

Variable
Server → app round-trip asking whether the app accepts a newly requested task.
  • Principal: none — a server→client reverse callback.

TaskCreatedNotificationDefinition

Variable
Pushed to the task initiator + invited participants after the app accepts via the app/task/create wire callback and the task transitions from waiting to active. Carries the full Task row (matching agent/task/closed’s shape) so subscribers don’t need a second read to discover the post-transition state.

TaskFailedNotificationDefinition

Variable
Pushed when a task fails before becoming ready.

TaskId

TypeAlias

TaskId

Variable

TaskLeave

Variable
Self-only: caller removes themselves from task_participants AND every conversation_participants row under the task. Notification emission for each conversation the caller leaves uses ConversationParticipantsRemovedNotificationDefinition with reason: "task_leave". If removal empties task_participants the task transitions to status = 'closed' and TaskClosedNotificationDefinition fires alongside in the same transaction.
  • Principal: AgentPrincipal head + ActiveAgent (active agent).

TaskList

Variable
List the caller’s own tasks, cursor-paginated.
  • Principal: AgentPrincipal head.

TaskNotFoundError

Class
The referenced task does not exist (or the caller cannot see it). Lives in the task-id leaf so the TaskReadAccess requirement can declare it as its fail-closed not-found without a requirements -> tasks runtime import cycle.

taskNotifications

Variable
Task notification catalog emitted by the server.

TaskParticipant

TypeAlias

TaskRejectedError

Class
agent/task/request failed because the owning app rejected the server-initiated app/task/create callback (or the fail-closed envelope synthesized a reject on timeout / RPC error / decode failure). The tag lets a requester distinguish “my task was rejected by the moderator” — an expected, actionable outcome — from an opaque internal error. The app’s reason rides in the data arm when present.

TaskRequest

Variable
Open to any active agent. Returns { task, conversation } where conversation is null when initialConversation is omitted. Dedup is a client-side concern: clients that want “one DM per participant set” semantics list their tasks and filter locally before creating a new one. The agent-facing entry RPC is agent/task/request; the app-facing wire callback app/task/create lives in this task domain. The server forks app/task/create to the owning app after inserting the task in waiting; the app verdict drives the lifecycle (accept → active + agent/task/created; reject → failed + agent/task/failed). The synchronous { task, conversation } result is returned after the verdict resolves (the handler awaits it).
  • Principal: AgentPrincipal head + ActiveAgent (active agent).
  • Requirements (run order): ContactPolicyAllowsReach proves the caller may reach every invited agent and initial-conversation participant under the recipient’s contact policy.

TaskStatus

TypeAlias

TaskUpdate

Variable
App-only task mutation surface. app/task/update owns task close, participant admit, and participant remove semantics.
  • Principal: AppPrincipal head. The app-arm handler runs assertCallerAppOwnsTask before dispatching the selected action.

TaskUpdateParams

TypeAlias

TaskUpdateResult

TypeAlias

Files

  • ids.ts
  • tasks.ts