@swarmclawai/swarmclaw 1.2.6 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +24 -17
  2. package/next.config.ts +1 -0
  3. package/package.json +3 -2
  4. package/scripts/easy-setup.mjs +1 -1
  5. package/scripts/postinstall.mjs +1 -1
  6. package/skills/swarmclaw.md +115 -0
  7. package/skills/tools/browser.md +131 -0
  8. package/skills/tools/execute.md +98 -0
  9. package/skills/tools/files.md +98 -0
  10. package/skills/tools/memory.md +104 -0
  11. package/skills/tools/platform.md +144 -0
  12. package/skills/tools/skills.md +83 -0
  13. package/src/app/api/chats/[id]/messages/route.ts +23 -19
  14. package/src/app/api/chats/messages-route.test.ts +105 -51
  15. package/src/app/api/mcp-servers/[id]/test/route.ts +3 -2
  16. package/src/app/api/openclaw/deploy/route.ts +2 -0
  17. package/src/app/api/setup/doctor/route.ts +4 -4
  18. package/src/components/agents/agent-chat-list.tsx +23 -1
  19. package/src/components/agents/inspector-panel.tsx +165 -48
  20. package/src/components/chat/chat-area.tsx +38 -9
  21. package/src/components/chat/message-list.tsx +33 -19
  22. package/src/components/gateways/gateway-sheet.tsx +5 -2
  23. package/src/lib/agent-execute-defaults.test.ts +24 -0
  24. package/src/lib/agent-execute-defaults.ts +62 -0
  25. package/src/lib/chat/queued-message-queue.test.ts +134 -1
  26. package/src/lib/chat/queued-message-queue.ts +77 -2
  27. package/src/lib/server/agents/agent-service.ts +5 -0
  28. package/src/lib/server/builtin-extensions.ts +1 -0
  29. package/src/lib/server/chat-execution/chat-execution-advanced.test.ts +1 -1
  30. package/src/lib/server/chat-execution/chat-execution-tool-events.test.ts +1 -0
  31. package/src/lib/server/chat-execution/chat-execution-utils.ts +2 -2
  32. package/src/lib/server/chat-execution/chat-turn-preparation.ts +79 -42
  33. package/src/lib/server/chat-execution/chat-turn-stream-execution.ts +4 -0
  34. package/src/lib/server/chat-execution/continuation-evaluator.ts +8 -0
  35. package/src/lib/server/chat-execution/memory-mutation-tools.ts +1 -1
  36. package/src/lib/server/chat-execution/message-classifier.ts +11 -1
  37. package/src/lib/server/chat-execution/prompt-builder.test.ts +28 -0
  38. package/src/lib/server/chat-execution/prompt-builder.ts +14 -1
  39. package/src/lib/server/chat-execution/prompt-mode.test.ts +24 -0
  40. package/src/lib/server/chat-execution/prompt-mode.ts +5 -1
  41. package/src/lib/server/chat-execution/stream-agent-chat.test.ts +6 -4
  42. package/src/lib/server/chat-execution/stream-agent-chat.ts +45 -16
  43. package/src/lib/server/chatrooms/chatroom-routing.test.ts +4 -0
  44. package/src/lib/server/connectors/discord.ts +2 -2
  45. package/src/lib/server/connectors/matrix.ts +3 -2
  46. package/src/lib/server/connectors/signal.ts +5 -4
  47. package/src/lib/server/connectors/slack.ts +10 -9
  48. package/src/lib/server/connectors/teams.ts +3 -2
  49. package/src/lib/server/connectors/telegram.ts +4 -4
  50. package/src/lib/server/connectors/whatsapp.ts +2 -2
  51. package/src/lib/server/daemon/controller.ts +7 -0
  52. package/src/lib/server/gateways/gateway-profile-service.ts +19 -1
  53. package/src/lib/server/messages/message-repository.test.ts +70 -0
  54. package/src/lib/server/messages/message-repository.ts +11 -6
  55. package/src/lib/server/openclaw/deploy.ts +32 -2
  56. package/src/lib/server/plugins-advanced.test.ts +1 -2
  57. package/src/lib/server/provider-health.ts +1 -1
  58. package/src/lib/server/runtime/process-manager.ts +13 -9
  59. package/src/lib/server/runtime/session-run-manager/queries.ts +15 -0
  60. package/src/lib/server/runtime/session-run-manager.test.ts +58 -0
  61. package/src/lib/server/sandbox/session-runtime.test.ts +18 -1
  62. package/src/lib/server/sandbox/session-runtime.ts +40 -28
  63. package/src/lib/server/session-tools/autonomy-tools.test.ts +7 -9
  64. package/src/lib/server/session-tools/context.ts +1 -1
  65. package/src/lib/server/session-tools/credential-env.ts +109 -0
  66. package/src/lib/server/session-tools/crud.ts +3 -3
  67. package/src/lib/server/session-tools/edit_file.ts +3 -2
  68. package/src/lib/server/session-tools/execute.test.ts +58 -0
  69. package/src/lib/server/session-tools/execute.ts +334 -0
  70. package/src/lib/server/session-tools/files-tool.ts +635 -0
  71. package/src/lib/server/session-tools/index.ts +14 -4
  72. package/src/lib/server/session-tools/memory-tool.ts +242 -0
  73. package/src/lib/server/session-tools/memory.ts +1 -1
  74. package/src/lib/server/session-tools/openclaw-nodes.ts +3 -2
  75. package/src/lib/server/session-tools/openclaw-workspace.ts +3 -2
  76. package/src/lib/server/session-tools/platform-tool.ts +617 -0
  77. package/src/lib/server/session-tools/session-info.ts +3 -2
  78. package/src/lib/server/session-tools/session-tools-wiring.test.ts +3 -4
  79. package/src/lib/server/session-tools/shell.ts +7 -122
  80. package/src/lib/server/session-tools/skills-tool.ts +396 -0
  81. package/src/lib/server/session-tools/web.ts +2 -2
  82. package/src/lib/server/storage-normalization.ts +2 -0
  83. package/src/lib/server/tool-aliases.ts +2 -1
  84. package/src/lib/server/tool-capability-policy-advanced.test.ts +9 -2
  85. package/src/lib/server/tool-capability-policy.test.ts +2 -1
  86. package/src/lib/server/tool-capability-policy.ts +60 -33
  87. package/src/lib/server/tool-planning.ts +11 -0
  88. package/src/lib/setup-defaults.ts +5 -0
  89. package/src/lib/tool-definitions.ts +1 -0
  90. package/src/lib/validation/schemas.test.ts +16 -0
  91. package/src/lib/validation/schemas.ts +16 -0
  92. package/src/stores/use-chat-store.test.ts +231 -0
  93. package/src/stores/use-chat-store.ts +62 -13
  94. package/src/types/agent.ts +348 -0
  95. package/src/types/app-settings.ts +175 -0
  96. package/src/types/approval.ts +27 -0
  97. package/src/types/connector.ts +187 -0
  98. package/src/types/extension.ts +386 -0
  99. package/src/types/index.ts +16 -3555
  100. package/src/types/message.ts +57 -0
  101. package/src/types/misc.ts +739 -0
  102. package/src/types/mission.ts +185 -0
  103. package/src/types/protocol.ts +422 -0
  104. package/src/types/provider.ts +52 -0
  105. package/src/types/run.ts +183 -0
  106. package/src/types/schedule.ts +59 -0
  107. package/src/types/session.ts +265 -0
  108. package/src/types/skill.ts +157 -0
  109. package/src/types/task.ts +140 -0
  110. package/src/types/working-state.ts +211 -0
  111. package/src/views/settings/section-heartbeat.tsx +2 -2
  112. package/src/lib/server/session-tools/sandbox.ts +0 -281
@@ -0,0 +1,183 @@
1
+ import type { SSEEvent } from './misc'
2
+
3
+ // --- Session Runs ---
4
+
5
+ export type SessionRunStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled'
6
+ export type ExecutionKind =
7
+ | 'session_turn'
8
+ | 'task_attempt'
9
+ | 'protocol_step'
10
+ | 'heartbeat_tick'
11
+ | 'schedule_wake'
12
+ | 'repair_turn'
13
+ | 'subagent_turn'
14
+
15
+ export type ExecutionOwnerType =
16
+ | 'session'
17
+ | 'task'
18
+ | 'protocol_run'
19
+ | 'schedule'
20
+ | 'mission'
21
+ | 'agent'
22
+ | 'subagent'
23
+
24
+ export interface SessionRunHeartbeatConfig {
25
+ ackMaxChars: number
26
+ showOk: boolean
27
+ showAlerts: boolean
28
+ target: string | null
29
+ deliveryMode?: 'default' | 'tool_only' | 'silent'
30
+ lightContext?: boolean
31
+ }
32
+
33
+ export interface SessionRunRecoveryPayload {
34
+ message: string
35
+ imagePath?: string
36
+ imageUrl?: string
37
+ attachedFiles?: string[]
38
+ internal: boolean
39
+ source: string
40
+ mode: string
41
+ maxRuntimeMs?: number
42
+ modelOverride?: string
43
+ heartbeatConfig?: SessionRunHeartbeatConfig
44
+ replyToId?: string
45
+ executionGroupKey?: string
46
+ }
47
+
48
+ export interface SessionRunRecord {
49
+ id: string
50
+ sessionId: string
51
+ missionId?: string | null
52
+ kind?: ExecutionKind
53
+ ownerType?: ExecutionOwnerType | null
54
+ ownerId?: string | null
55
+ parentExecutionId?: string | null
56
+ recoveryPolicy?: 'restart_recoverable' | 'ephemeral' | 'manual' | 'none'
57
+ source: string
58
+ internal: boolean
59
+ mode: string
60
+ status: SessionRunStatus
61
+ messagePreview: string
62
+ dedupeKey?: string
63
+ queuedAt: number
64
+ startedAt?: number
65
+ endedAt?: number
66
+ interruptedAt?: number
67
+ interruptedReason?: string
68
+ error?: string
69
+ resultPreview?: string
70
+ recoveredFromRestart?: boolean
71
+ recoveredFromRunId?: string
72
+ recoveryPayload?: SessionRunRecoveryPayload
73
+ totalInputTokens?: number
74
+ totalOutputTokens?: number
75
+ estimatedCost?: number
76
+ }
77
+
78
+ export interface SessionQueuedTurn {
79
+ runId: string
80
+ sessionId: string
81
+ missionId?: string | null
82
+ text: string
83
+ queuedAt: number
84
+ position: number
85
+ imagePath?: string
86
+ imageUrl?: string
87
+ attachedFiles?: string[]
88
+ replyToId?: string
89
+ source?: string
90
+ }
91
+
92
+ export interface SessionQueueSnapshot {
93
+ sessionId: string
94
+ activeRunId: string | null
95
+ activeTurn?: SessionQueuedTurn | null
96
+ queueLength: number
97
+ items: SessionQueuedTurn[]
98
+ }
99
+
100
+ export interface RunEventRecord {
101
+ id: string
102
+ runId: string
103
+ sessionId: string
104
+ kind?: ExecutionKind
105
+ ownerType?: ExecutionOwnerType | null
106
+ ownerId?: string | null
107
+ parentExecutionId?: string | null
108
+ timestamp: number
109
+ phase: 'status' | 'event'
110
+ status?: SessionRunStatus
111
+ summary?: string
112
+ event: SSEEvent
113
+ }
114
+
115
+ export type RuntimeFailureFamily =
116
+ | 'provider_auth'
117
+ | 'provider_transport'
118
+ | 'gateway_disconnected'
119
+ | 'browser_boot'
120
+ | 'cli_missing'
121
+ | 'rate_limit'
122
+ | 'webhook_delivery'
123
+ | 'connector_delivery'
124
+ | 'workspace_recovery'
125
+
126
+ export type SupervisorIncidentKind =
127
+ | 'run_error'
128
+ | 'repeated_tool'
129
+ | 'no_progress'
130
+ | 'budget_pressure'
131
+ | 'context_pressure'
132
+ | 'runtime_failure'
133
+
134
+ export type SupervisorIncidentSeverity = 'low' | 'medium' | 'high'
135
+
136
+ export interface SupervisorIncident {
137
+ id: string
138
+ runId: string
139
+ sessionId: string
140
+ taskId?: string | null
141
+ agentId?: string | null
142
+ source: string
143
+ kind: SupervisorIncidentKind
144
+ severity: SupervisorIncidentSeverity
145
+ summary: string
146
+ details?: string | null
147
+ toolName?: string | null
148
+ failureFamily?: RuntimeFailureFamily | null
149
+ remediation?: string | null
150
+ repairPrompt?: string | null
151
+ autoAction?: 'replan' | 'compact' | 'block' | 'budget_trim' | null
152
+ createdAt: number
153
+ }
154
+
155
+ export interface RunReflection {
156
+ id: string
157
+ runId: string
158
+ sessionId: string
159
+ taskId?: string | null
160
+ agentId?: string | null
161
+ source: string
162
+ status: SessionRunStatus | 'completed' | 'failed'
163
+ summary: string
164
+ sourceSnippet?: string | null
165
+ invariantNotes: string[]
166
+ derivedNotes: string[]
167
+ failureNotes: string[]
168
+ lessonNotes: string[]
169
+ communicationNotes?: string[]
170
+ relationshipNotes?: string[]
171
+ significantEventNotes?: string[]
172
+ profileNotes?: string[]
173
+ boundaryNotes?: string[]
174
+ openLoopNotes?: string[]
175
+ incidentIds?: string[]
176
+ autoMemoryIds?: string[]
177
+ learnedSkillIds?: string[]
178
+ learnedSkillNotes?: string[]
179
+ qualityScore?: number | null
180
+ qualityReasoning?: string | null
181
+ createdAt: number
182
+ updatedAt: number
183
+ }
@@ -0,0 +1,59 @@
1
+ export type ScheduleType = 'cron' | 'interval' | 'once'
2
+ export type ScheduleStatus = 'active' | 'paused' | 'completed' | 'failed' | 'archived'
3
+ export type ScheduleTaskMode = 'task' | 'wake_only' | 'protocol'
4
+
5
+ export interface Schedule {
6
+ id: string
7
+ name: string
8
+ agentId: string
9
+ projectId?: string
10
+ taskPrompt: string
11
+ /** 'task' creates a board task, 'wake_only' just wakes the agent, and 'protocol' launches a structured session run. */
12
+ taskMode?: ScheduleTaskMode
13
+ /** Wake message sent to agent when taskMode is 'wake_only' */
14
+ message?: string
15
+ /** Structured session template launched when taskMode is 'protocol'. */
16
+ protocolTemplateId?: string | null
17
+ protocolParticipantAgentIds?: string[]
18
+ protocolFacilitatorAgentId?: string | null
19
+ protocolObserverAgentIds?: string[]
20
+ protocolConfig?: Record<string, unknown> | null
21
+ scheduleType: ScheduleType
22
+ action?: string
23
+ path?: string
24
+ command?: string
25
+ description?: string
26
+ frequency?: string
27
+ cron?: string
28
+ /** Natural time expression e.g. "at 09:00" — resolved to cron on creation */
29
+ atTime?: string | null
30
+ intervalMs?: number
31
+ runAt?: number
32
+ lastRunAt?: number
33
+ nextRunAt?: number
34
+ /** IANA timezone for schedule evaluation (default: system local) */
35
+ timezone?: string | null
36
+ /** Random stagger window in seconds added to nextRunAt to avoid thundering herd */
37
+ staggerSec?: number | null
38
+ /** Last delivery status for this schedule */
39
+ lastDeliveryStatus?: 'ok' | 'error' | null
40
+ /** Timestamp of last delivery attempt */
41
+ lastDeliveredAt?: number | null
42
+ /** Error message from last failed delivery */
43
+ lastDeliveryError?: string | null
44
+ status: ScheduleStatus
45
+ archivedAt?: number | null
46
+ archivedFromStatus?: Exclude<ScheduleStatus, 'archived'> | null
47
+ linkedTaskId?: string | null
48
+ linkedMissionId?: string | null
49
+ runNumber?: number
50
+ createdByAgentId?: string | null
51
+ createdInSessionId?: string | null
52
+ followupConnectorId?: string | null
53
+ followupChannelId?: string | null
54
+ followupThreadId?: string | null
55
+ followupSenderId?: string | null
56
+ followupSenderName?: string | null
57
+ createdAt: number
58
+ updatedAt?: number
59
+ }
@@ -0,0 +1,265 @@
1
+ import type { ProviderId, OllamaMode } from './provider'
2
+ import type { ConnectorPlatform } from './connector'
3
+ import type { Message } from './message'
4
+ import type { MissionSummary } from './mission'
5
+
6
+ export type SessionResetMode = 'idle' | 'daily' | 'isolated'
7
+ export type SessionResetType = 'direct' | 'group' | 'thread' | 'main'
8
+
9
+ export interface IdentityContinuityState {
10
+ selfSummary?: string | null
11
+ relationshipSummary?: string | null
12
+ personaLabel?: string | null
13
+ toneStyle?: string | null
14
+ boundaries?: string[]
15
+ continuityNotes?: string[]
16
+ updatedAt?: number | null
17
+ }
18
+
19
+ export interface SessionArchiveState {
20
+ memoryId?: string | null
21
+ lastSyncedAt?: number | null
22
+ lastHash?: string | null
23
+ messageCount?: number
24
+ exportPath?: string | null
25
+ }
26
+
27
+ export interface SessionSkillRuntimeState {
28
+ selectedSkillId?: string | null
29
+ selectedSkillName?: string | null
30
+ selectedAt?: number | null
31
+ lastAction?: 'select' | 'load' | 'run' | null
32
+ lastRunAt?: number | null
33
+ lastRunToolName?: string | null
34
+ }
35
+
36
+ export interface CanvasMetricItem {
37
+ label: string
38
+ value: string
39
+ detail?: string
40
+ tone?: 'default' | 'positive' | 'negative' | 'warning'
41
+ }
42
+
43
+ export interface CanvasCardItem {
44
+ title: string
45
+ body?: string
46
+ meta?: string
47
+ tone?: 'default' | 'positive' | 'negative' | 'warning'
48
+ }
49
+
50
+ export interface CanvasActionItem {
51
+ label: string
52
+ href?: string
53
+ note?: string
54
+ intent?: 'primary' | 'secondary' | 'success' | 'danger'
55
+ }
56
+
57
+ export interface CanvasTableData {
58
+ columns: string[]
59
+ rows: Array<Array<string | number | boolean | null>>
60
+ caption?: string
61
+ }
62
+
63
+ export type CanvasBlock =
64
+ | { type: 'markdown'; title?: string; markdown: string }
65
+ | { type: 'metrics'; title?: string; items: CanvasMetricItem[] }
66
+ | { type: 'cards'; title?: string; items: CanvasCardItem[] }
67
+ | { type: 'table'; title?: string; table: CanvasTableData }
68
+ | { type: 'code'; title?: string; code: string; language?: string }
69
+ | { type: 'actions'; title?: string; items: CanvasActionItem[] }
70
+
71
+ export interface CanvasDocument {
72
+ kind: 'structured'
73
+ title?: string
74
+ subtitle?: string
75
+ theme?: 'slate' | 'sky' | 'emerald' | 'amber' | 'rose'
76
+ blocks: CanvasBlock[]
77
+ updatedAt?: number | null
78
+ }
79
+
80
+ export type CanvasContent = string | CanvasDocument | null
81
+
82
+ export interface MailboxEnvelope {
83
+ id: string
84
+ type: string
85
+ payload: string
86
+ fromSessionId?: string | null
87
+ fromAgentId?: string | null
88
+ toSessionId: string
89
+ toAgentId?: string | null
90
+ correlationId?: string | null
91
+ status: MailboxStatus
92
+ createdAt: number
93
+ expiresAt?: number | null
94
+ ackAt?: number | null
95
+ }
96
+
97
+ export type MailboxStatus = 'new' | 'ack'
98
+
99
+ export interface Session {
100
+ id: string
101
+ name: string
102
+ openclawAgentId?: string | null
103
+ shortcutForAgentId?: string | null
104
+ cwd: string
105
+ user: string
106
+ provider: ProviderId
107
+ model: string
108
+ ollamaMode?: OllamaMode | null
109
+ credentialId?: string | null
110
+ fallbackCredentialIds?: string[]
111
+ apiEndpoint?: string | null
112
+ gatewayProfileId?: string | null
113
+ routePreferredGatewayTags?: string[]
114
+ routePreferredGatewayUseCase?: string | null
115
+ claudeSessionId: string | null
116
+ codexThreadId?: string | null
117
+ opencodeSessionId?: string | null
118
+ geminiSessionId?: string | null
119
+ delegateResumeIds?: {
120
+ claudeCode?: string | null
121
+ codex?: string | null
122
+ opencode?: string | null
123
+ gemini?: string | null
124
+ }
125
+ /** @deprecated Messages are stored in session_messages table. Use message-repository. */
126
+ messages: Message[]
127
+ /** Pre-computed message count (kept in sync by message-repository). */
128
+ messageCount?: number
129
+ lastMessageSummary?: Message | null
130
+ lastAssistantAt?: number | null
131
+ createdAt: number
132
+ updatedAt?: number | null
133
+ lastActiveAt: number
134
+ active?: boolean
135
+ sessionType?: SessionType
136
+ agentId?: string | null
137
+ parentSessionId?: string | null
138
+ delegationDepth?: number | null
139
+ tools?: string[]
140
+ extensions?: string[]
141
+ heartbeatEnabled?: boolean | null
142
+ heartbeatIntervalSec?: number | null
143
+ heartbeatTarget?: 'last' | 'none' | string | null
144
+ memoryScopeMode?: 'auto' | 'all' | 'global' | 'agent' | 'session' | 'project' | null
145
+ memoryTierPreference?: 'working' | 'durable' | 'archive' | 'blended' | null
146
+ projectId?: string | null
147
+ sessionResetMode?: SessionResetMode | null
148
+ sessionIdleTimeoutSec?: number | null
149
+ sessionMaxAgeSec?: number | null
150
+ sessionDailyResetAt?: string | null
151
+ sessionResetTimezone?: string | null
152
+ thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high' | null
153
+ browserProfileId?: string | null
154
+ connectorThinkLevel?: 'minimal' | 'low' | 'medium' | 'high' | null
155
+ connectorSessionScope?: 'main' | 'channel' | 'peer' | 'channel-peer' | 'thread' | null
156
+ connectorReplyMode?: 'off' | 'first' | 'all' | null
157
+ connectorThreadBinding?: 'off' | 'prefer' | 'strict' | null
158
+ connectorGroupPolicy?: 'open' | 'mention' | 'reply-or-mention' | 'disabled' | null
159
+ connectorIdleTimeoutSec?: number | null
160
+ connectorMaxAgeSec?: number | null
161
+ /** Last heartbeat/cron delivery status */
162
+ lastDeliveryStatus?: 'ok' | 'error' | null
163
+ /** Timestamp of last heartbeat/cron delivery attempt */
164
+ lastDeliveredAt?: number | null
165
+ /** Error message from last failed delivery */
166
+ lastDeliveryError?: string | null
167
+ mailbox?: MailboxEnvelope[] | null
168
+ connectorContext?: {
169
+ connectorId?: string | null
170
+ platform?: ConnectorPlatform | null
171
+ channelId?: string | null
172
+ channelIdAlt?: string | null
173
+ senderId?: string | null
174
+ senderIdAlt?: string | null
175
+ senderName?: string | null
176
+ senderAvatarUrl?: string | null
177
+ sessionKey?: string | null
178
+ peerKey?: string | null
179
+ scope?: 'main' | 'channel' | 'peer' | 'channel-peer' | 'thread' | null
180
+ replyMode?: 'off' | 'first' | 'all' | null
181
+ threadBinding?: 'off' | 'prefer' | 'strict' | null
182
+ groupPolicy?: 'open' | 'mention' | 'reply-or-mention' | 'disabled' | null
183
+ threadId?: string | null
184
+ threadTitle?: string | null
185
+ threadPersonaLabel?: string | null
186
+ threadParentChannelId?: string | null
187
+ threadParentChannelName?: string | null
188
+ isGroup?: boolean
189
+ isOwnerConversation?: boolean
190
+ lastInboundAt?: number | null
191
+ lastInboundMessageId?: string | null
192
+ lastInboundReplyToMessageId?: string | null
193
+ lastInboundThreadId?: string | null
194
+ lastOutboundAt?: number | null
195
+ lastOutboundMessageId?: string | null
196
+ lastResetAt?: number | null
197
+ lastResetReason?: string | null
198
+ allKnownPeerIds?: string[] | null
199
+ }
200
+ lastAutoMemoryAt?: number | null
201
+ lastHeartbeatText?: string | null
202
+ lastHeartbeatSentAt?: number | null
203
+ lastSessionResetAt?: number | null
204
+ lastSessionResetReason?: string | null
205
+ identityState?: IdentityContinuityState | null
206
+ sessionArchiveState?: SessionArchiveState | null
207
+ missionId?: string | null
208
+ missionSummary?: MissionSummary | null
209
+ skillRuntimeState?: SessionSkillRuntimeState | null
210
+ pinned?: boolean
211
+ file?: string | null
212
+ queuedCount?: number
213
+ currentRunId?: string | null
214
+ conversationTone?: string
215
+ emoji?: string
216
+ creature?: string
217
+ vibe?: string
218
+ theme?: string
219
+ avatar?: string
220
+ canvasContent?: CanvasContent
221
+ /** Tracks how many times each memory ID has been injected via proactive recall in this session. */
222
+ injectedMemoryIds?: Record<string, number>
223
+ /** Structured working memory that survives compaction and flows through delegation. */
224
+ runContext?: RunContext | null
225
+ }
226
+
227
+ export interface RunContext {
228
+ objective: string | null
229
+ constraints: string[]
230
+ keyFacts: string[]
231
+ discoveries: string[]
232
+ failedApproaches: string[]
233
+ currentPlan: string[]
234
+ completedSteps: string[]
235
+ blockers: string[]
236
+ parentContext: string | null
237
+ updatedAt: number
238
+ version: number
239
+ }
240
+
241
+ export type Sessions = Record<string, Session>
242
+
243
+ export type SessionTool =
244
+ | 'shell'
245
+ | 'files'
246
+ | 'claude_code'
247
+ | 'codex_cli'
248
+ | 'opencode_cli'
249
+ | 'web_search'
250
+ | 'web_fetch'
251
+ | 'edit_file'
252
+ | 'process'
253
+ | 'spawn_subagent'
254
+ | 'canvas'
255
+ | 'http_request'
256
+ | 'git'
257
+ | 'mailbox'
258
+ | 'ask_human'
259
+ | 'document'
260
+ | 'extract'
261
+ | 'table'
262
+ | 'crawl'
263
+
264
+ export type SessionType = 'human'
265
+ export type AppView = 'home' | 'agents' | 'org_chart' | 'inbox' | 'chatrooms' | 'protocols' | 'schedules' | 'memory' | 'missions' | 'tasks' | 'secrets' | 'providers' | 'skills' | 'connectors' | 'webhooks' | 'mcp_servers' | 'knowledge' | 'extensions' | 'usage' | 'wallets' | 'runs' | 'autonomy' | 'logs' | 'settings' | 'projects' | 'activity'
@@ -0,0 +1,157 @@
1
+ // --- Skills ---
2
+
3
+ export interface Skill {
4
+ id: string
5
+ name: string
6
+ filename: string
7
+ content: string
8
+ projectId?: string
9
+ description?: string
10
+ sourceUrl?: string
11
+ sourceFormat?: 'openclaw' | 'plain'
12
+ author?: string
13
+ tags?: string[]
14
+ version?: string
15
+ homepage?: string
16
+ primaryEnv?: string | null
17
+ skillKey?: string | null
18
+ toolNames?: string[]
19
+ capabilities?: string[]
20
+ always?: boolean
21
+ installOptions?: SkillInstallOption[]
22
+ skillRequirements?: SkillRequirements
23
+ detectedEnvVars?: string[]
24
+ security?: SkillSecuritySummary | null
25
+ invocation?: SkillInvocationConfig | null
26
+ commandDispatch?: SkillCommandDispatch | null
27
+ frontmatter?: Record<string, unknown> | null
28
+ scope?: 'global' | 'agent'
29
+ agentIds?: string[]
30
+ createdAt: number
31
+ updatedAt: number
32
+ }
33
+
34
+ export type LearnedSkillScope = 'agent' | 'session'
35
+ export type LearnedSkillLifecycle = 'candidate' | 'active' | 'shadow' | 'demoted' | 'review_ready'
36
+ export type LearnedSkillSourceKind = 'success_pattern' | 'failure_repair'
37
+ export type LearnedSkillValidationStatus = 'pending' | 'passed' | 'failed'
38
+ export type LearnedSkillRiskLevel = 'low' | 'medium' | 'high'
39
+
40
+ export interface LearnedSkill {
41
+ id: string
42
+ parentSkillId?: string | null
43
+ agentId: string
44
+ userId?: string | null
45
+ sessionId?: string | null
46
+ scope: LearnedSkillScope
47
+ lifecycle: LearnedSkillLifecycle
48
+ sourceKind: LearnedSkillSourceKind
49
+ workflowKey: string
50
+ failureFamily?: string | null
51
+ objectiveSummary?: string | null
52
+ name?: string | null
53
+ description?: string | null
54
+ content?: string | null
55
+ tags?: string[]
56
+ rationale?: string | null
57
+ confidence?: number | null
58
+ riskLevel?: LearnedSkillRiskLevel | null
59
+ validationStatus: LearnedSkillValidationStatus
60
+ validationSummary?: string | null
61
+ validationEvidenceCount?: number
62
+ evidenceCount?: number
63
+ activationCount?: number
64
+ successCount?: number
65
+ failureCount?: number
66
+ consecutiveSuccessCount?: number
67
+ consecutiveFailureCount?: number
68
+ lastSourceHash?: string | null
69
+ lastUsedAt?: number | null
70
+ lastSucceededAt?: number | null
71
+ lastFailedAt?: number | null
72
+ demotedAt?: number | null
73
+ demotionReason?: string | null
74
+ retryUnlockedAt?: number | null
75
+ retryUnlockedByReflectionId?: string | null
76
+ retryUnlockedBySkillId?: string | null
77
+ reviewReadyAt?: number | null
78
+ sourceSessionName?: string | null
79
+ sourceSnippet?: string | null
80
+ lastRefinedAt?: number | null
81
+ refinementCount?: number
82
+ createdAt: number
83
+ updatedAt: number
84
+ }
85
+
86
+ export type SkillSuggestionStatus = 'draft' | 'approved' | 'rejected'
87
+
88
+ export interface SkillSuggestion {
89
+ id: string
90
+ status: SkillSuggestionStatus
91
+ sourceSessionId: string
92
+ sourceSessionName?: string | null
93
+ sourceAgentId?: string | null
94
+ sourceAgentName?: string | null
95
+ sourceHash?: string | null
96
+ sourceMessageCount?: number | null
97
+ name: string
98
+ description?: string
99
+ content: string
100
+ tags?: string[]
101
+ confidence?: number | null
102
+ rationale?: string | null
103
+ summary?: string | null
104
+ sourceSnippet?: string | null
105
+ createdSkillId?: string | null
106
+ approvedAt?: number | null
107
+ rejectedAt?: number | null
108
+ createdAt: number
109
+ updatedAt: number
110
+ }
111
+
112
+ export interface SkillInvocationConfig {
113
+ userInvocable?: boolean
114
+ }
115
+
116
+ export interface SkillCommandDispatch {
117
+ kind: 'tool'
118
+ toolName: string
119
+ argMode?: 'raw'
120
+ }
121
+
122
+ export interface SkillAuditFinding {
123
+ severity: 'warning' | 'error'
124
+ code: string
125
+ message: string
126
+ path?: string
127
+ }
128
+
129
+ export interface SkillAuditResult {
130
+ status: 'pass' | 'warn' | 'block'
131
+ findings: SkillAuditFinding[]
132
+ }
133
+
134
+ export interface SkillSecuritySummary {
135
+ level: 'low' | 'medium' | 'high'
136
+ notes: string[]
137
+ detectedEnvVars?: string[]
138
+ missingDeclarations?: string[]
139
+ installCommands?: string[]
140
+ }
141
+
142
+ // --- Skill Lifecycle (F11) ---
143
+ export interface SkillInstallOption {
144
+ kind: 'brew' | 'node' | 'go' | 'uv' | 'download'
145
+ label: string
146
+ bins?: string[]
147
+ }
148
+
149
+ export interface SkillRequirements {
150
+ bins?: string[]
151
+ anyBins?: string[][]
152
+ env?: string[]
153
+ config?: string[]
154
+ os?: string[]
155
+ }
156
+
157
+ export type SkillAllowlistMode = 'all' | 'none' | 'selected'