@swarmclawai/swarmclaw 1.2.6 → 1.2.9
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.
- package/README.md +54 -23
- package/next.config.ts +1 -0
- package/package.json +4 -3
- package/scripts/easy-setup.mjs +1 -1
- package/scripts/postinstall.mjs +1 -1
- package/skills/swarmclaw.md +115 -0
- package/skills/tools/browser.md +131 -0
- package/skills/tools/execute.md +98 -0
- package/skills/tools/files.md +98 -0
- package/skills/tools/memory.md +104 -0
- package/skills/tools/platform.md +144 -0
- package/skills/tools/skills.md +83 -0
- package/src/app/agents/[id]/page.tsx +1 -18
- package/src/app/api/agents/thread-route.test.ts +0 -1
- package/src/app/api/approvals/route.test.ts +6 -22
- package/src/app/api/chats/[id]/messages/route.ts +23 -19
- package/src/app/api/chats/messages-route.test.ts +105 -51
- package/src/app/api/connectors/route.ts +2 -2
- package/src/app/api/mcp-servers/[id]/test/route.ts +3 -2
- package/src/app/api/openclaw/deploy/route.ts +2 -0
- package/src/app/api/portability/export/route.ts +8 -0
- package/src/app/api/portability/import/route.test.ts +80 -0
- package/src/app/api/portability/import/route.ts +28 -0
- package/src/app/api/settings/route.ts +0 -2
- package/src/app/api/setup/doctor/route.ts +4 -4
- package/src/app/api/wallets/[id]/route.ts +15 -157
- package/src/app/api/wallets/generate/route.ts +22 -0
- package/src/app/api/wallets/route.test.ts +147 -0
- package/src/app/api/wallets/route.ts +13 -95
- package/src/app/autonomy/page.tsx +2 -57
- package/src/app/protocols/page.tsx +2 -21
- package/src/app/settings/page.tsx +0 -9
- package/src/app/wallets/page.tsx +105 -5
- package/src/cli/index.js +21 -33
- package/src/cli/spec.js +19 -30
- package/src/components/agents/agent-chat-list.tsx +23 -1
- package/src/components/agents/agent-sheet.tsx +2 -40
- package/src/components/agents/inspector-panel.tsx +165 -131
- package/src/components/chat/chat-area.tsx +38 -9
- package/src/components/chat/chat-card.tsx +0 -31
- package/src/components/chat/message-bubble.tsx +1 -108
- package/src/components/chat/message-list.tsx +33 -19
- package/src/components/connectors/connector-sheet.tsx +25 -1
- package/src/components/gateways/gateway-sheet.tsx +5 -2
- package/src/components/layout/sidebar-rail.tsx +6 -10
- package/src/components/projects/project-detail.tsx +3 -35
- package/src/components/projects/tabs/overview-tab.tsx +3 -59
- package/src/components/projects/tabs/work-tab.tsx +7 -77
- package/src/components/protocols/structured-session-launcher.tsx +1 -22
- package/src/components/shared/connector-platform-icon.tsx +1 -0
- package/src/components/tasks/task-card.tsx +4 -34
- package/src/components/tasks/task-sheet.tsx +6 -36
- package/src/components/wallets/wallet-list.tsx +150 -0
- package/src/lib/agent-execute-defaults.test.ts +24 -0
- package/src/lib/agent-execute-defaults.ts +62 -0
- package/src/lib/app/navigation.test.ts +0 -13
- package/src/lib/app/navigation.ts +2 -7
- package/src/lib/app/view-constants.ts +14 -19
- package/src/lib/chat/queued-message-queue.test.ts +134 -1
- package/src/lib/chat/queued-message-queue.ts +77 -2
- package/src/lib/server/agents/agent-service.ts +5 -0
- package/src/lib/server/agents/agent-thread-session.ts +0 -1
- package/src/lib/server/agents/delegation-advisory.test.ts +0 -1
- package/src/lib/server/agents/delegation-jobs.test.ts +0 -69
- package/src/lib/server/agents/delegation-jobs.ts +0 -25
- package/src/lib/server/agents/main-agent-loop.ts +1 -49
- package/src/lib/server/agents/subagent-runtime.ts +0 -1
- package/src/lib/server/approval-match.ts +0 -85
- package/src/lib/server/approvals.test.ts +6 -6
- package/src/lib/server/approvals.ts +0 -6
- package/src/lib/server/autonomy/supervisor-reflection.test.ts +0 -1
- package/src/lib/server/builtin-extensions.ts +1 -2
- package/src/lib/server/capability-router.test.ts +0 -2
- package/src/lib/server/chat-execution/chat-execution-advanced.test.ts +1 -1
- package/src/lib/server/chat-execution/chat-execution-tool-events.test.ts +15 -14
- package/src/lib/server/chat-execution/chat-execution-types.ts +0 -2
- package/src/lib/server/chat-execution/chat-execution-utils.ts +2 -4
- package/src/lib/server/chat-execution/chat-streaming-utils.ts +2 -30
- package/src/lib/server/chat-execution/chat-turn-finalization.ts +1 -36
- package/src/lib/server/chat-execution/chat-turn-preparation.ts +81 -64
- package/src/lib/server/chat-execution/chat-turn-stream-execution.ts +4 -0
- package/src/lib/server/chat-execution/continuation-evaluator.ts +8 -0
- package/src/lib/server/chat-execution/iteration-event-handler.ts +0 -24
- package/src/lib/server/chat-execution/memory-mutation-tools.ts +1 -1
- package/src/lib/server/chat-execution/message-classifier.test.ts +0 -45
- package/src/lib/server/chat-execution/message-classifier.ts +11 -16
- package/src/lib/server/chat-execution/prompt-builder.test.ts +27 -0
- package/src/lib/server/chat-execution/prompt-builder.ts +14 -31
- package/src/lib/server/chat-execution/prompt-mode.test.ts +24 -0
- package/src/lib/server/chat-execution/prompt-mode.ts +5 -1
- package/src/lib/server/chat-execution/prompt-sections.ts +0 -1
- package/src/lib/server/chat-execution/situational-awareness.test.ts +2 -73
- package/src/lib/server/chat-execution/situational-awareness.ts +4 -38
- package/src/lib/server/chat-execution/stream-agent-chat.test.ts +13 -126
- package/src/lib/server/chat-execution/stream-agent-chat.ts +46 -21
- package/src/lib/server/chat-execution/stream-continuation.test.ts +4 -52
- package/src/lib/server/chat-execution/stream-continuation.ts +6 -48
- package/src/lib/server/chatrooms/chatroom-routing.test.ts +4 -0
- package/src/lib/server/chatrooms/session-mailbox.ts +0 -10
- package/src/lib/server/chats/chat-session-service.ts +3 -5
- package/src/lib/server/connectors/connector-inbound.ts +0 -1
- package/src/lib/server/connectors/connector-lifecycle.ts +19 -3
- package/src/lib/server/connectors/connector-service.ts +39 -9
- package/src/lib/server/connectors/discord.ts +2 -2
- package/src/lib/server/connectors/matrix.ts +3 -2
- package/src/lib/server/connectors/signal.ts +5 -4
- package/src/lib/server/connectors/slack.ts +10 -9
- package/src/lib/server/connectors/swarmdock-bidding.ts +74 -0
- package/src/lib/server/connectors/swarmdock-payloads.test.ts +85 -0
- package/src/lib/server/connectors/swarmdock-secret.test.ts +128 -0
- package/src/lib/server/connectors/swarmdock-secret.ts +152 -0
- package/src/lib/server/connectors/swarmdock-tasks.ts +119 -0
- package/src/lib/server/connectors/swarmdock.ts +255 -0
- package/src/lib/server/connectors/teams.ts +3 -2
- package/src/lib/server/connectors/telegram.ts +4 -4
- package/src/lib/server/connectors/whatsapp.ts +2 -2
- package/src/lib/server/daemon/controller.ts +7 -0
- package/src/lib/server/execution-brief.test.ts +2 -25
- package/src/lib/server/execution-brief.ts +12 -35
- package/src/lib/server/execution-engine/task-attempt.ts +0 -1
- package/src/lib/server/gateways/gateway-profile-service.ts +19 -1
- package/src/lib/server/messages/message-repository.test.ts +70 -0
- package/src/lib/server/messages/message-repository.ts +11 -6
- package/src/lib/server/openclaw/deploy.ts +32 -2
- package/src/lib/server/persistence/storage-context.ts +0 -5
- package/src/lib/server/plugins-advanced.test.ts +1 -2
- package/src/lib/server/portability/export.ts +109 -0
- package/src/lib/server/portability/import.ts +159 -0
- package/src/lib/server/protocols/protocol-normalization.ts +0 -4
- package/src/lib/server/protocols/protocol-queries.ts +0 -6
- package/src/lib/server/protocols/protocol-run-lifecycle.ts +4 -32
- package/src/lib/server/protocols/protocol-service.ts +0 -1
- package/src/lib/server/protocols/protocol-step-helpers.ts +0 -4
- package/src/lib/server/protocols/protocol-step-processors.ts +0 -6
- package/src/lib/server/protocols/protocol-swarm.ts +0 -2
- package/src/lib/server/protocols/protocol-types.ts +0 -2
- package/src/lib/server/provider-health.ts +1 -10
- package/src/lib/server/runtime/daemon-state/core.ts +0 -9
- package/src/lib/server/runtime/daemon-state.test.ts +0 -35
- package/src/lib/server/runtime/heartbeat-service.ts +3 -23
- package/src/lib/server/runtime/process-manager.ts +13 -9
- package/src/lib/server/runtime/queue/core.ts +11 -33
- package/src/lib/server/runtime/runtime-storage-write-paths.test.ts +6 -6
- package/src/lib/server/runtime/scheduler.ts +0 -13
- package/src/lib/server/runtime/session-run-manager/drain.ts +0 -24
- package/src/lib/server/runtime/session-run-manager/enqueue.ts +0 -1
- package/src/lib/server/runtime/session-run-manager/queries.ts +15 -1
- package/src/lib/server/runtime/session-run-manager/recovery.ts +0 -1
- package/src/lib/server/runtime/session-run-manager.test.ts +58 -28
- package/src/lib/server/sandbox/session-runtime.test.ts +18 -1
- package/src/lib/server/sandbox/session-runtime.ts +40 -28
- package/src/lib/server/session-tools/autonomy-tools.test.ts +7 -9
- package/src/lib/server/session-tools/context.ts +1 -1
- package/src/lib/server/session-tools/credential-env.ts +109 -0
- package/src/lib/server/session-tools/crud.ts +3 -17
- package/src/lib/server/session-tools/delegate.ts +0 -4
- package/src/lib/server/session-tools/edit_file.ts +3 -2
- package/src/lib/server/session-tools/execute.test.ts +58 -0
- package/src/lib/server/session-tools/execute.ts +334 -0
- package/src/lib/server/session-tools/files-tool.ts +635 -0
- package/src/lib/server/session-tools/index.ts +14 -8
- package/src/lib/server/session-tools/memory-tool.ts +242 -0
- package/src/lib/server/session-tools/memory.ts +1 -1
- package/src/lib/server/session-tools/openclaw-nodes.ts +3 -2
- package/src/lib/server/session-tools/openclaw-workspace.ts +3 -2
- package/src/lib/server/session-tools/platform-tool.ts +617 -0
- package/src/lib/server/session-tools/session-info.ts +3 -2
- package/src/lib/server/session-tools/session-tools-wiring.test.ts +3 -4
- package/src/lib/server/session-tools/shell.ts +7 -122
- package/src/lib/server/session-tools/skills-tool.ts +396 -0
- package/src/lib/server/session-tools/team-context.ts +0 -3
- package/src/lib/server/session-tools/web.ts +2 -2
- package/src/lib/server/storage-normalization.ts +10 -0
- package/src/lib/server/storage.ts +18 -45
- package/src/lib/server/tasks/task-checkout.ts +59 -0
- package/src/lib/server/tasks/task-lifecycle.ts +2 -0
- package/src/lib/server/tasks/task-route-service.ts +4 -26
- package/src/lib/server/tasks/task-service.ts +0 -7
- package/src/lib/server/tool-aliases.ts +2 -2
- package/src/lib/server/tool-capability-policy-advanced.test.ts +13 -6
- package/src/lib/server/tool-capability-policy.test.ts +2 -1
- package/src/lib/server/tool-capability-policy.ts +60 -35
- package/src/lib/server/tool-planning.ts +11 -12
- package/src/lib/server/universal-tool-access.ts +0 -1
- package/src/lib/server/wallets/wallet-crypto.ts +33 -0
- package/src/lib/server/wallets/wallet-repository.ts +24 -0
- package/src/lib/server/wallets/wallet-service.ts +119 -0
- package/src/lib/server/working-state/extraction.ts +8 -42
- package/src/lib/server/working-state/normalization.ts +10 -103
- package/src/lib/server/working-state/service.ts +12 -21
- package/src/lib/setup-defaults.ts +5 -0
- package/src/lib/strip-internal-metadata.test.ts +1 -1
- package/src/lib/strip-internal-metadata.ts +1 -1
- package/src/lib/tool-definitions.ts +1 -1
- package/src/lib/validation/schemas.test.ts +16 -0
- package/src/lib/validation/schemas.ts +49 -2
- package/src/stores/slices/data-slice.ts +5 -1
- package/src/stores/slices/ui-slice.ts +0 -4
- package/src/stores/use-chat-store.test.ts +231 -0
- package/src/stores/use-chat-store.ts +62 -13
- package/src/types/agent.ts +264 -0
- package/src/types/app-settings.ts +173 -0
- package/src/types/approval.ts +25 -0
- package/src/types/connector.ts +188 -0
- package/src/types/extension.ts +386 -0
- package/src/types/index.ts +16 -3555
- package/src/types/message.ts +56 -0
- package/src/types/misc.ts +737 -0
- package/src/types/protocol.ts +420 -0
- package/src/types/provider.ts +52 -0
- package/src/types/run.ts +180 -0
- package/src/types/schedule.ts +59 -0
- package/src/types/session.ts +215 -0
- package/src/types/skill.ts +157 -0
- package/src/types/swarmdock.ts +29 -0
- package/src/types/task.ts +144 -0
- package/src/types/working-state.ts +204 -0
- package/src/views/settings/section-heartbeat.tsx +2 -2
- package/src/views/settings/section-runtime-loop.tsx +0 -14
- package/src/app/api/canvas/[sessionId]/route.ts +0 -35
- package/src/app/api/missions/[id]/actions/route.ts +0 -31
- package/src/app/api/missions/[id]/events/route.ts +0 -14
- package/src/app/api/missions/[id]/route.ts +0 -10
- package/src/app/api/missions/route.test.ts +0 -244
- package/src/app/api/missions/route.ts +0 -57
- package/src/app/api/wallets/[id]/approve/route.ts +0 -79
- package/src/app/api/wallets/[id]/balance-history/route.ts +0 -18
- package/src/app/api/wallets/[id]/send/route.ts +0 -113
- package/src/app/api/wallets/[id]/transactions/route.ts +0 -18
- package/src/app/missions/[id]/page.tsx +0 -3
- package/src/app/missions/page.tsx +0 -685
- package/src/components/canvas/canvas-panel.tsx +0 -267
- package/src/components/wallets/wallet-approval-dialog.tsx +0 -107
- package/src/components/wallets/wallet-panel.tsx +0 -1010
- package/src/components/wallets/wallet-section.tsx +0 -260
- package/src/features/missions/queries.ts +0 -23
- package/src/lib/canvas-content.test.ts +0 -360
- package/src/lib/canvas-content.ts +0 -198
- package/src/lib/server/canvas-content.test.ts +0 -32
- package/src/lib/server/canvas-content.ts +0 -6
- package/src/lib/server/ethereum.ts +0 -591
- package/src/lib/server/evm-swap.ts +0 -476
- package/src/lib/server/missions/mission-intent.test.ts +0 -63
- package/src/lib/server/missions/mission-intent.ts +0 -569
- package/src/lib/server/missions/mission-repository.ts +0 -74
- package/src/lib/server/missions/mission-service/actions.ts +0 -6
- package/src/lib/server/missions/mission-service/bindings.ts +0 -9
- package/src/lib/server/missions/mission-service/context.ts +0 -4
- package/src/lib/server/missions/mission-service/core.ts +0 -2271
- package/src/lib/server/missions/mission-service/queries.ts +0 -12
- package/src/lib/server/missions/mission-service/recovery.ts +0 -5
- package/src/lib/server/missions/mission-service/ticks.ts +0 -9
- package/src/lib/server/missions/mission-service.test.ts +0 -888
- package/src/lib/server/missions/mission-service.ts +0 -6
- package/src/lib/server/session-tools/canvas.ts +0 -105
- package/src/lib/server/session-tools/sandbox.ts +0 -281
- package/src/lib/server/session-tools/wallet-tool.test.ts +0 -150
- package/src/lib/server/session-tools/wallet.ts +0 -1287
- package/src/lib/server/solana.ts +0 -327
- package/src/lib/server/wallet/wallet-execution.test.ts +0 -198
- package/src/lib/server/wallet/wallet-portfolio.test.ts +0 -98
- package/src/lib/server/wallet/wallet-portfolio.ts +0 -772
- package/src/lib/server/wallet/wallet-service.test.ts +0 -81
- package/src/lib/server/wallet/wallet-service.ts +0 -225
- package/src/lib/wallet/wallet-transactions.test.ts +0 -75
- package/src/lib/wallet/wallet-transactions.ts +0 -43
- package/src/lib/wallet/wallet.test.ts +0 -333
- package/src/lib/wallet/wallet.ts +0 -183
- package/src/views/settings/section-wallets.tsx +0 -35
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import type { ProviderId } from './provider'
|
|
2
|
+
import type { Session } from './session'
|
|
3
|
+
import type { Message } from './message'
|
|
4
|
+
import type { ApprovalRequest } from './approval'
|
|
5
|
+
import type { MessageToolEvent } from './message'
|
|
6
|
+
import type { InboundMessage, OutboundSendOptions } from './connector'
|
|
7
|
+
|
|
8
|
+
export interface ExtensionPromptBuildResult {
|
|
9
|
+
systemPrompt?: string
|
|
10
|
+
prependContext?: string
|
|
11
|
+
prependSystemContext?: string
|
|
12
|
+
appendSystemContext?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ExtensionModelResolveResult {
|
|
16
|
+
providerOverride?: ProviderId
|
|
17
|
+
modelOverride?: string
|
|
18
|
+
apiEndpointOverride?: string | null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ExtensionToolCallResult {
|
|
22
|
+
input?: Record<string, unknown> | null
|
|
23
|
+
params?: Record<string, unknown>
|
|
24
|
+
block?: boolean
|
|
25
|
+
blockReason?: string
|
|
26
|
+
warning?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ExtensionMessagePersistResult {
|
|
30
|
+
message?: Message
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ExtensionBeforeMessageWriteResult extends ExtensionMessagePersistResult {
|
|
34
|
+
block?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ExtensionSubagentSpawningResult {
|
|
38
|
+
status: 'ok' | 'error'
|
|
39
|
+
error?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ExtensionHooks {
|
|
43
|
+
beforeAgentStart?: (ctx: { session: Session; message: string }) => Promise<void> | void
|
|
44
|
+
afterAgentComplete?: (ctx: { session: Session; response: string }) => Promise<void> | void
|
|
45
|
+
beforeModelResolve?: (ctx: {
|
|
46
|
+
session: Session
|
|
47
|
+
prompt: string
|
|
48
|
+
message: string
|
|
49
|
+
provider: ProviderId
|
|
50
|
+
model: string
|
|
51
|
+
apiEndpoint?: string | null
|
|
52
|
+
}) => Promise<ExtensionModelResolveResult | void> | ExtensionModelResolveResult | void
|
|
53
|
+
beforeToolExec?: (ctx: { toolName: string; input: Record<string, unknown> | null }) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void
|
|
54
|
+
beforePromptBuild?: (ctx: {
|
|
55
|
+
session: Session
|
|
56
|
+
prompt: string
|
|
57
|
+
message: string
|
|
58
|
+
history: Message[]
|
|
59
|
+
messages: Message[]
|
|
60
|
+
}) => Promise<ExtensionPromptBuildResult | void> | ExtensionPromptBuildResult | void
|
|
61
|
+
beforeToolCall?: (ctx: {
|
|
62
|
+
session: Session
|
|
63
|
+
toolName: string
|
|
64
|
+
input: Record<string, unknown> | null
|
|
65
|
+
runId?: string
|
|
66
|
+
toolCallId?: string
|
|
67
|
+
}) => Promise<ExtensionToolCallResult | Record<string, unknown> | void> | ExtensionToolCallResult | Record<string, unknown> | void
|
|
68
|
+
llmInput?: (ctx: {
|
|
69
|
+
session: Session
|
|
70
|
+
runId: string
|
|
71
|
+
provider: ProviderId
|
|
72
|
+
model: string
|
|
73
|
+
systemPrompt?: string
|
|
74
|
+
prompt: string
|
|
75
|
+
historyMessages: Message[]
|
|
76
|
+
imagesCount: number
|
|
77
|
+
}) => Promise<void> | void
|
|
78
|
+
llmOutput?: (ctx: {
|
|
79
|
+
session: Session
|
|
80
|
+
runId: string
|
|
81
|
+
provider: ProviderId
|
|
82
|
+
model: string
|
|
83
|
+
assistantTexts: string[]
|
|
84
|
+
response: string
|
|
85
|
+
usage?: {
|
|
86
|
+
input?: number
|
|
87
|
+
output?: number
|
|
88
|
+
total?: number
|
|
89
|
+
estimatedCost?: number
|
|
90
|
+
}
|
|
91
|
+
}) => Promise<void> | void
|
|
92
|
+
toolResultPersist?: (ctx: {
|
|
93
|
+
session: Session
|
|
94
|
+
message: Message
|
|
95
|
+
toolName?: string
|
|
96
|
+
toolCallId?: string
|
|
97
|
+
isSynthetic?: boolean
|
|
98
|
+
}) => Promise<ExtensionMessagePersistResult | Message | void> | ExtensionMessagePersistResult | Message | void
|
|
99
|
+
beforeMessageWrite?: (ctx: {
|
|
100
|
+
session: Session
|
|
101
|
+
message: Message
|
|
102
|
+
phase?: 'user' | 'system' | 'assistant_partial' | 'assistant_final' | 'heartbeat'
|
|
103
|
+
runId?: string
|
|
104
|
+
}) => Promise<ExtensionBeforeMessageWriteResult | Message | void> | ExtensionBeforeMessageWriteResult | Message | void
|
|
105
|
+
afterToolExec?: (ctx: { session: Session; toolName: string; input: Record<string, unknown> | null; output: string }) => Promise<void> | void
|
|
106
|
+
onMessage?: (ctx: { session: Session; message: Message }) => Promise<void> | void
|
|
107
|
+
sessionStart?: (ctx: {
|
|
108
|
+
session: Session
|
|
109
|
+
resumedFrom?: string | null
|
|
110
|
+
}) => Promise<void> | void
|
|
111
|
+
sessionEnd?: (ctx: {
|
|
112
|
+
sessionId: string
|
|
113
|
+
session?: Session | null
|
|
114
|
+
messageCount: number
|
|
115
|
+
durationMs?: number
|
|
116
|
+
reason?: string | null
|
|
117
|
+
}) => Promise<void> | void
|
|
118
|
+
subagentSpawning?: (ctx: {
|
|
119
|
+
parentSessionId?: string | null
|
|
120
|
+
agentId: string
|
|
121
|
+
agentName: string
|
|
122
|
+
message: string
|
|
123
|
+
cwd: string
|
|
124
|
+
mode: 'run' | 'session'
|
|
125
|
+
threadRequested: boolean
|
|
126
|
+
}) => Promise<ExtensionSubagentSpawningResult | void> | ExtensionSubagentSpawningResult | void
|
|
127
|
+
subagentSpawned?: (ctx: {
|
|
128
|
+
parentSessionId?: string | null
|
|
129
|
+
childSessionId: string
|
|
130
|
+
agentId: string
|
|
131
|
+
agentName: string
|
|
132
|
+
runId: string
|
|
133
|
+
mode: 'run' | 'session'
|
|
134
|
+
threadRequested: boolean
|
|
135
|
+
}) => Promise<void> | void
|
|
136
|
+
subagentEnded?: (ctx: {
|
|
137
|
+
parentSessionId?: string | null
|
|
138
|
+
childSessionId: string
|
|
139
|
+
agentId: string
|
|
140
|
+
agentName: string
|
|
141
|
+
status: 'completed' | 'failed' | 'cancelled' | 'timed_out'
|
|
142
|
+
response?: string | null
|
|
143
|
+
error?: string | null
|
|
144
|
+
durationMs?: number
|
|
145
|
+
}) => Promise<void> | void
|
|
146
|
+
|
|
147
|
+
// Post-turn hook — fires after a full chat exchange (user message → agent response)
|
|
148
|
+
afterChatTurn?: (ctx: {
|
|
149
|
+
session: Session
|
|
150
|
+
message: string
|
|
151
|
+
response: string
|
|
152
|
+
source: string
|
|
153
|
+
internal: boolean
|
|
154
|
+
toolEvents?: MessageToolEvent[]
|
|
155
|
+
}) => Promise<void> | void
|
|
156
|
+
|
|
157
|
+
// Orchestration & Swarm Hooks
|
|
158
|
+
onTaskComplete?: (ctx: { taskId: string; result: unknown }) => Promise<void> | void
|
|
159
|
+
onAgentDelegation?: (ctx: { sourceAgentId: string; targetAgentId: string; task: string }) => Promise<void> | void
|
|
160
|
+
|
|
161
|
+
// Chat Middleware (Transform messages)
|
|
162
|
+
transformInboundMessage?: (ctx: { session: Session; text: string }) => Promise<string> | string
|
|
163
|
+
transformOutboundMessage?: (ctx: { session: Session; text: string }) => Promise<string> | string
|
|
164
|
+
|
|
165
|
+
// Context injection — return a markdown string to inject into the agent's state modifier, or null/undefined to skip
|
|
166
|
+
getAgentContext?: (ctx: { session: Session; enabledExtensions: string[]; message: string; history: Message[] }) => Promise<string | null | undefined> | string | null | undefined
|
|
167
|
+
|
|
168
|
+
// Self-description — returns a capability line for the system prompt (e.g., "I can remember things across conversations")
|
|
169
|
+
getCapabilityDescription?: () => string | null | undefined
|
|
170
|
+
|
|
171
|
+
// Operating guidance — returns operational hints for the agent when this extension is active
|
|
172
|
+
getOperatingGuidance?: () => string | string[] | null | undefined
|
|
173
|
+
|
|
174
|
+
// Approval guidance — returns approval-scoped instructions when this extension is active
|
|
175
|
+
getApprovalGuidance?: (ctx: {
|
|
176
|
+
approval: ApprovalRequest
|
|
177
|
+
phase: 'request' | 'resume' | 'connector_reminder'
|
|
178
|
+
approved?: boolean
|
|
179
|
+
}) => string | string[] | null | undefined
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface ExtensionToolPlanning {
|
|
183
|
+
/**
|
|
184
|
+
* Capability tags that the harness can use for prompt guidance and tool routing.
|
|
185
|
+
* Examples: research.search, research.fetch, browser.capture, artifact.pdf,
|
|
186
|
+
* delivery.media, delivery.voice_note.
|
|
187
|
+
*/
|
|
188
|
+
capabilities?: string[]
|
|
189
|
+
/**
|
|
190
|
+
* Concrete usage guidance that should be injected into the system prompt when
|
|
191
|
+
* this tool is enabled.
|
|
192
|
+
*/
|
|
193
|
+
disciplineGuidance?: string[]
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface ExtensionToolDef {
|
|
197
|
+
name: string
|
|
198
|
+
description: string
|
|
199
|
+
parameters: Record<string, unknown>
|
|
200
|
+
planning?: ExtensionToolPlanning
|
|
201
|
+
execute: (args: Record<string, unknown>, ctx: { session: Session; message: string }) => Promise<string | object> | string | object
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface ExtensionSettingsField {
|
|
205
|
+
key: string
|
|
206
|
+
label: string
|
|
207
|
+
type: 'text' | 'number' | 'boolean' | 'select' | 'secret'
|
|
208
|
+
placeholder?: string
|
|
209
|
+
help?: string
|
|
210
|
+
options?: Array<{ value: string; label: string }>
|
|
211
|
+
defaultValue?: string | number | boolean
|
|
212
|
+
required?: boolean
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface ExtensionUIDefinition {
|
|
216
|
+
sidebarItems?: Array<{
|
|
217
|
+
id: string
|
|
218
|
+
label: string
|
|
219
|
+
icon?: string
|
|
220
|
+
href: string
|
|
221
|
+
position?: 'top' | 'bottom'
|
|
222
|
+
}>
|
|
223
|
+
headerWidgets?: Array<{
|
|
224
|
+
id: string
|
|
225
|
+
label: string
|
|
226
|
+
icon?: string
|
|
227
|
+
}>
|
|
228
|
+
chatInputActions?: Array<{
|
|
229
|
+
id: string
|
|
230
|
+
label: string
|
|
231
|
+
icon?: string
|
|
232
|
+
tooltip?: string
|
|
233
|
+
action: 'message' | 'link' | 'tool'
|
|
234
|
+
value: string
|
|
235
|
+
}>
|
|
236
|
+
/** Settings fields declared by the extension, rendered in the extension settings panel */
|
|
237
|
+
settingsFields?: ExtensionSettingsField[]
|
|
238
|
+
/** Chat panels the extension provides (e.g., browser view, terminal) */
|
|
239
|
+
chatPanels?: Array<{
|
|
240
|
+
id: string
|
|
241
|
+
label: string
|
|
242
|
+
icon?: string
|
|
243
|
+
/** WS topic to subscribe to for updates (e.g., 'browser:{sessionId}') */
|
|
244
|
+
wsTopic?: string
|
|
245
|
+
}>
|
|
246
|
+
/** Badges to show on agent cards when this extension is enabled */
|
|
247
|
+
agentBadges?: Array<{
|
|
248
|
+
id: string
|
|
249
|
+
label: string
|
|
250
|
+
icon?: string
|
|
251
|
+
}>
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface ExtensionProviderDefinition {
|
|
255
|
+
id: string
|
|
256
|
+
name: string
|
|
257
|
+
models: string[]
|
|
258
|
+
requiresApiKey: boolean
|
|
259
|
+
requiresEndpoint: boolean
|
|
260
|
+
defaultEndpoint?: string
|
|
261
|
+
streamChat: (opts: {
|
|
262
|
+
session: { id: string } & Record<string, unknown>
|
|
263
|
+
message: string
|
|
264
|
+
imagePath?: string
|
|
265
|
+
imageUrl?: string
|
|
266
|
+
apiKey?: string | null
|
|
267
|
+
systemPrompt?: string
|
|
268
|
+
write: (data: string) => void
|
|
269
|
+
active: Map<string, unknown>
|
|
270
|
+
loadHistory: (sessionId: string) => unknown[]
|
|
271
|
+
onUsage?: (usage: { inputTokens: number; outputTokens: number }) => void
|
|
272
|
+
signal?: AbortSignal
|
|
273
|
+
}) => Promise<string>
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface ExtensionConnectorDefinition {
|
|
277
|
+
id: string
|
|
278
|
+
name: string
|
|
279
|
+
description: string
|
|
280
|
+
supportsBinaryMedia?: boolean
|
|
281
|
+
// For sending outbound
|
|
282
|
+
sendMessage?: (
|
|
283
|
+
channelId: string,
|
|
284
|
+
text: string,
|
|
285
|
+
options?: OutboundSendOptions,
|
|
286
|
+
) => Promise<{ messageId?: string } | void>
|
|
287
|
+
// For polling/listening
|
|
288
|
+
startListener?: (onMessage: (msg: InboundMessage) => void) => Promise<() => void>
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface Extension {
|
|
292
|
+
name: string
|
|
293
|
+
version?: string
|
|
294
|
+
description?: string
|
|
295
|
+
author?: string
|
|
296
|
+
openclaw?: boolean
|
|
297
|
+
enabledByDefault?: boolean
|
|
298
|
+
hooks?: ExtensionHooks
|
|
299
|
+
tools?: ExtensionToolDef[]
|
|
300
|
+
ui?: ExtensionUIDefinition
|
|
301
|
+
providers?: ExtensionProviderDefinition[]
|
|
302
|
+
connectors?: ExtensionConnectorDefinition[]
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface ExtensionMeta {
|
|
306
|
+
name: string
|
|
307
|
+
description?: string
|
|
308
|
+
filename: string
|
|
309
|
+
enabled: boolean
|
|
310
|
+
isBuiltin?: boolean
|
|
311
|
+
author?: string
|
|
312
|
+
version?: string
|
|
313
|
+
source?: 'local' | 'manual' | 'marketplace'
|
|
314
|
+
sourceLabel?: ExtensionPublisherSource
|
|
315
|
+
installSource?: ExtensionInstallSource
|
|
316
|
+
sourceUrl?: string
|
|
317
|
+
openclaw?: boolean
|
|
318
|
+
failureCount?: number
|
|
319
|
+
lastFailureAt?: number
|
|
320
|
+
lastFailureStage?: string
|
|
321
|
+
lastFailureError?: string
|
|
322
|
+
autoDisabled?: boolean
|
|
323
|
+
toolCount?: number
|
|
324
|
+
hookCount?: number
|
|
325
|
+
hasUI?: boolean
|
|
326
|
+
providerCount?: number
|
|
327
|
+
connectorCount?: number
|
|
328
|
+
createdByAgentId?: string | null
|
|
329
|
+
settingsFields?: ExtensionSettingsField[]
|
|
330
|
+
hasDependencyManifest?: boolean
|
|
331
|
+
dependencyCount?: number
|
|
332
|
+
devDependencyCount?: number
|
|
333
|
+
packageManager?: ExtensionPackageManager
|
|
334
|
+
dependencyInstallStatus?: ExtensionDependencyInstallStatus
|
|
335
|
+
dependencyInstallError?: string
|
|
336
|
+
dependencyInstalledAt?: number
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export type ExtensionPublisherSource =
|
|
340
|
+
| 'builtin'
|
|
341
|
+
| 'local'
|
|
342
|
+
| 'manual'
|
|
343
|
+
| 'swarmclaw'
|
|
344
|
+
| 'swarmforge'
|
|
345
|
+
| 'clawhub'
|
|
346
|
+
|
|
347
|
+
export type ExtensionCatalogSource =
|
|
348
|
+
| 'swarmclaw'
|
|
349
|
+
| 'swarmclaw-site'
|
|
350
|
+
| 'swarmforge'
|
|
351
|
+
| 'clawhub'
|
|
352
|
+
|
|
353
|
+
export type ExtensionInstallSource =
|
|
354
|
+
| 'builtin'
|
|
355
|
+
| 'local'
|
|
356
|
+
| 'manual'
|
|
357
|
+
| ExtensionCatalogSource
|
|
358
|
+
|
|
359
|
+
export type ExtensionPackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun'
|
|
360
|
+
export type ExtensionDependencyInstallStatus = 'none' | 'ready' | 'installing' | 'installed' | 'error'
|
|
361
|
+
|
|
362
|
+
export interface MarketplaceExtension {
|
|
363
|
+
id: string
|
|
364
|
+
name: string
|
|
365
|
+
description: string
|
|
366
|
+
author: string
|
|
367
|
+
version: string
|
|
368
|
+
url: string
|
|
369
|
+
source?: ExtensionPublisherSource
|
|
370
|
+
catalogSource?: ExtensionCatalogSource
|
|
371
|
+
tags?: string[]
|
|
372
|
+
openclaw?: boolean
|
|
373
|
+
downloads?: number
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export interface ExtensionInvocationRecord {
|
|
377
|
+
extensionId: string
|
|
378
|
+
toolName: string
|
|
379
|
+
inputTokens: number
|
|
380
|
+
outputTokens: number
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export interface ExtensionDefinitionCost {
|
|
384
|
+
extensionId: string
|
|
385
|
+
estimatedTokens: number
|
|
386
|
+
}
|