workspace.ts 3.6 KB

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