workspace.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /** Application-owned identities. Hermes profile/session IDs never identify a chat. */
  2. export interface WorkspaceAgent {
  3. id: string
  4. name: string
  5. avatar: string
  6. instructions: string
  7. /** Explicit account-owner grant; absent on older records means disabled. */
  8. execution?: 'profile' | 'computer'
  9. canManageTeam?: boolean
  10. teamAuthorizationVersion?: number
  11. temporaryGoalId?:string
  12. helperActivation?:number
  13. helperRunnerId?:string
  14. retiredAt?:number
  15. cleanupState?:'pending'|'complete'
  16. createdByAgentId?: string
  17. createdFromRunId?: string
  18. nodeId: string
  19. profile: string
  20. remoteAgentId?: string
  21. archived: boolean
  22. revision: number
  23. createdAt: number
  24. updatedAt: number
  25. }
  26. export interface WorkspaceMemberRole {
  27. name: string
  28. description: string
  29. }
  30. export interface WorkspaceConversation {
  31. id: string
  32. kind: 'direct' | 'group'
  33. name: string
  34. avatar: string
  35. memberIds: string[]
  36. memberRoles?: Record<string, WorkspaceMemberRole>
  37. instructions: string
  38. administratorId: string
  39. mode: 'host' | 'free'
  40. autoReplyIds: string[]
  41. maxReplyRounds: number
  42. archived: boolean
  43. pinned: boolean
  44. readSeq: number
  45. lastSeq: number
  46. lastMessageAt?: number
  47. preview: string
  48. previewAgentId?: string
  49. activeRunId?: string
  50. activeAgentId?: string
  51. activeRunStatus?: WorkspaceRun['status']
  52. activeAgentStates?: Record<string, 'running' | 'waiting' | 'uncertain' | 'queued'>
  53. avatarSignals?: Record<string, { id: string; state: 'success' | 'failure'; at: number }>
  54. queuedMessageCount?: number
  55. unreadCount?: number
  56. createdAt: number
  57. updatedAt: number
  58. }
  59. export interface WorkspaceTask {
  60. id: string
  61. conversationId: string
  62. title: string
  63. titleSource: 'automatic' | 'user'
  64. messageCount: number
  65. readSeq: number
  66. lastSeq: number
  67. unreadCount: number
  68. activeRunId?: string
  69. activeRunStatus?: WorkspaceRun['status']
  70. lastMessageAt?: number
  71. createdAt: number
  72. updatedAt: number
  73. goal?: import('./agentTasks.js').AgentGoal
  74. }
  75. export interface WorkspaceFile {
  76. id: string
  77. name: string
  78. mimeType: string
  79. size: number
  80. createdAt: number
  81. sourcePath?: string
  82. conversationId?: string
  83. messageId?: string
  84. profile?: string
  85. sender: 'user' | 'agent'
  86. }
  87. export interface WorkspaceMessage {
  88. execution?:'profile'|'computer'
  89. id: string
  90. conversationId: string
  91. /** User-visible task scope. `taskId` below remains the scheduler turn ID. */
  92. conversationTaskId?: string
  93. seq: number
  94. role: 'user' | 'assistant' | 'system'
  95. taskReference?: { conversationId: string; taskId: string }
  96. agentId?: string
  97. agentName?: string
  98. content: string
  99. reasoning: string
  100. runId?: string
  101. taskId?: string
  102. visible?: boolean
  103. error?: string
  104. status: 'queued' | 'streaming' | 'complete' | 'failed' | 'interrupted' | 'uncertain'
  105. attachments: WorkspaceFile[]
  106. tools: Array<Record<string, unknown>>
  107. createdAt: number
  108. }
  109. export interface WorkspaceRun {
  110. id: string
  111. conversationId: string
  112. conversationTaskId?: string
  113. messageId: string
  114. mentionIds: string[]
  115. activeAgentId?: string
  116. status: 'queued' | 'running' | 'waiting' | 'complete' | 'failed' | 'interrupted' | 'uncertain'
  117. round: number
  118. error?: string
  119. stopRequested?: boolean
  120. assignmentId?: string
  121. targetAgentId?: string
  122. triggerKind?: 'assignment' | 'task_review' | 'task_result'
  123. internalInstruction?: string
  124. authorizationVersion?: number
  125. createdAt: number
  126. updatedAt: number
  127. }
  128. export interface WorkspaceInteraction {
  129. id: string
  130. conversationId: string
  131. conversationTaskId?: string
  132. runId: string
  133. agentId: string
  134. kind: 'approval' | 'clarification'
  135. message: string
  136. choices: string[]
  137. resolved: boolean
  138. }
  139. export interface WorkspaceEvent {
  140. seq: number
  141. type: string
  142. conversationId?: string
  143. data: unknown
  144. }
  145. export interface WorkspaceSource {
  146. nodeId: string
  147. profile: string
  148. name: string
  149. }