@swarmclawai/swarmclaw 1.2.8 → 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.
Files changed (195) hide show
  1. package/README.md +30 -6
  2. package/package.json +2 -2
  3. package/src/app/agents/[id]/page.tsx +1 -18
  4. package/src/app/api/agents/thread-route.test.ts +0 -1
  5. package/src/app/api/approvals/route.test.ts +6 -22
  6. package/src/app/api/connectors/route.ts +2 -2
  7. package/src/app/api/portability/export/route.ts +8 -0
  8. package/src/app/api/portability/import/route.test.ts +80 -0
  9. package/src/app/api/portability/import/route.ts +28 -0
  10. package/src/app/api/settings/route.ts +0 -2
  11. package/src/app/api/wallets/[id]/route.ts +15 -157
  12. package/src/app/api/wallets/generate/route.ts +22 -0
  13. package/src/app/api/wallets/route.test.ts +147 -0
  14. package/src/app/api/wallets/route.ts +13 -95
  15. package/src/app/autonomy/page.tsx +2 -57
  16. package/src/app/protocols/page.tsx +2 -21
  17. package/src/app/settings/page.tsx +0 -9
  18. package/src/app/wallets/page.tsx +105 -5
  19. package/src/cli/index.js +21 -33
  20. package/src/cli/spec.js +19 -30
  21. package/src/components/agents/agent-sheet.tsx +2 -40
  22. package/src/components/agents/inspector-panel.tsx +0 -83
  23. package/src/components/chat/chat-card.tsx +0 -31
  24. package/src/components/chat/message-bubble.tsx +1 -108
  25. package/src/components/connectors/connector-sheet.tsx +25 -1
  26. package/src/components/layout/sidebar-rail.tsx +6 -10
  27. package/src/components/projects/project-detail.tsx +3 -35
  28. package/src/components/projects/tabs/overview-tab.tsx +3 -59
  29. package/src/components/projects/tabs/work-tab.tsx +7 -77
  30. package/src/components/protocols/structured-session-launcher.tsx +1 -22
  31. package/src/components/shared/connector-platform-icon.tsx +1 -0
  32. package/src/components/tasks/task-card.tsx +4 -34
  33. package/src/components/tasks/task-sheet.tsx +6 -36
  34. package/src/components/wallets/wallet-list.tsx +150 -0
  35. package/src/lib/app/navigation.test.ts +0 -13
  36. package/src/lib/app/navigation.ts +2 -7
  37. package/src/lib/app/view-constants.ts +14 -19
  38. package/src/lib/server/agents/agent-thread-session.ts +0 -1
  39. package/src/lib/server/agents/delegation-advisory.test.ts +0 -1
  40. package/src/lib/server/agents/delegation-jobs.test.ts +0 -69
  41. package/src/lib/server/agents/delegation-jobs.ts +0 -25
  42. package/src/lib/server/agents/main-agent-loop.ts +1 -49
  43. package/src/lib/server/agents/subagent-runtime.ts +0 -1
  44. package/src/lib/server/approval-match.ts +0 -85
  45. package/src/lib/server/approvals.test.ts +6 -6
  46. package/src/lib/server/approvals.ts +0 -6
  47. package/src/lib/server/autonomy/supervisor-reflection.test.ts +0 -1
  48. package/src/lib/server/builtin-extensions.ts +0 -2
  49. package/src/lib/server/capability-router.test.ts +0 -2
  50. package/src/lib/server/chat-execution/chat-execution-tool-events.test.ts +14 -14
  51. package/src/lib/server/chat-execution/chat-execution-types.ts +0 -2
  52. package/src/lib/server/chat-execution/chat-execution-utils.ts +0 -2
  53. package/src/lib/server/chat-execution/chat-streaming-utils.ts +2 -30
  54. package/src/lib/server/chat-execution/chat-turn-finalization.ts +1 -36
  55. package/src/lib/server/chat-execution/chat-turn-preparation.ts +2 -22
  56. package/src/lib/server/chat-execution/iteration-event-handler.ts +0 -24
  57. package/src/lib/server/chat-execution/message-classifier.test.ts +0 -45
  58. package/src/lib/server/chat-execution/message-classifier.ts +1 -16
  59. package/src/lib/server/chat-execution/prompt-builder.test.ts +0 -1
  60. package/src/lib/server/chat-execution/prompt-builder.ts +0 -30
  61. package/src/lib/server/chat-execution/prompt-sections.ts +0 -1
  62. package/src/lib/server/chat-execution/situational-awareness.test.ts +2 -73
  63. package/src/lib/server/chat-execution/situational-awareness.ts +4 -38
  64. package/src/lib/server/chat-execution/stream-agent-chat.test.ts +8 -123
  65. package/src/lib/server/chat-execution/stream-agent-chat.ts +1 -5
  66. package/src/lib/server/chat-execution/stream-continuation.test.ts +4 -52
  67. package/src/lib/server/chat-execution/stream-continuation.ts +6 -48
  68. package/src/lib/server/chatrooms/session-mailbox.ts +0 -10
  69. package/src/lib/server/chats/chat-session-service.ts +3 -5
  70. package/src/lib/server/connectors/connector-inbound.ts +0 -1
  71. package/src/lib/server/connectors/connector-lifecycle.ts +19 -3
  72. package/src/lib/server/connectors/connector-service.ts +39 -9
  73. package/src/lib/server/connectors/swarmdock-bidding.ts +74 -0
  74. package/src/lib/server/connectors/swarmdock-payloads.test.ts +85 -0
  75. package/src/lib/server/connectors/swarmdock-secret.test.ts +128 -0
  76. package/src/lib/server/connectors/swarmdock-secret.ts +152 -0
  77. package/src/lib/server/connectors/swarmdock-tasks.ts +119 -0
  78. package/src/lib/server/connectors/swarmdock.ts +255 -0
  79. package/src/lib/server/execution-brief.test.ts +2 -25
  80. package/src/lib/server/execution-brief.ts +12 -35
  81. package/src/lib/server/execution-engine/task-attempt.ts +0 -1
  82. package/src/lib/server/persistence/storage-context.ts +0 -5
  83. package/src/lib/server/portability/export.ts +109 -0
  84. package/src/lib/server/portability/import.ts +159 -0
  85. package/src/lib/server/protocols/protocol-normalization.ts +0 -4
  86. package/src/lib/server/protocols/protocol-queries.ts +0 -6
  87. package/src/lib/server/protocols/protocol-run-lifecycle.ts +4 -32
  88. package/src/lib/server/protocols/protocol-service.ts +0 -1
  89. package/src/lib/server/protocols/protocol-step-helpers.ts +0 -4
  90. package/src/lib/server/protocols/protocol-step-processors.ts +0 -6
  91. package/src/lib/server/protocols/protocol-swarm.ts +0 -2
  92. package/src/lib/server/protocols/protocol-types.ts +0 -2
  93. package/src/lib/server/provider-health.ts +0 -9
  94. package/src/lib/server/runtime/daemon-state/core.ts +0 -9
  95. package/src/lib/server/runtime/daemon-state.test.ts +0 -35
  96. package/src/lib/server/runtime/heartbeat-service.ts +3 -23
  97. package/src/lib/server/runtime/queue/core.ts +11 -33
  98. package/src/lib/server/runtime/runtime-storage-write-paths.test.ts +6 -6
  99. package/src/lib/server/runtime/scheduler.ts +0 -13
  100. package/src/lib/server/runtime/session-run-manager/drain.ts +0 -24
  101. package/src/lib/server/runtime/session-run-manager/enqueue.ts +0 -1
  102. package/src/lib/server/runtime/session-run-manager/queries.ts +0 -1
  103. package/src/lib/server/runtime/session-run-manager/recovery.ts +0 -1
  104. package/src/lib/server/runtime/session-run-manager.test.ts +0 -28
  105. package/src/lib/server/session-tools/crud.ts +0 -14
  106. package/src/lib/server/session-tools/delegate.ts +0 -4
  107. package/src/lib/server/session-tools/index.ts +0 -4
  108. package/src/lib/server/session-tools/team-context.ts +0 -3
  109. package/src/lib/server/storage-normalization.ts +8 -0
  110. package/src/lib/server/storage.ts +18 -45
  111. package/src/lib/server/tasks/task-checkout.ts +59 -0
  112. package/src/lib/server/tasks/task-lifecycle.ts +2 -0
  113. package/src/lib/server/tasks/task-route-service.ts +4 -26
  114. package/src/lib/server/tasks/task-service.ts +0 -7
  115. package/src/lib/server/tool-aliases.ts +0 -1
  116. package/src/lib/server/tool-capability-policy-advanced.test.ts +4 -4
  117. package/src/lib/server/tool-capability-policy.ts +0 -2
  118. package/src/lib/server/tool-planning.ts +0 -12
  119. package/src/lib/server/universal-tool-access.ts +0 -1
  120. package/src/lib/server/wallets/wallet-crypto.ts +33 -0
  121. package/src/lib/server/wallets/wallet-repository.ts +24 -0
  122. package/src/lib/server/wallets/wallet-service.ts +119 -0
  123. package/src/lib/server/working-state/extraction.ts +8 -42
  124. package/src/lib/server/working-state/normalization.ts +10 -103
  125. package/src/lib/server/working-state/service.ts +12 -21
  126. package/src/lib/strip-internal-metadata.test.ts +1 -1
  127. package/src/lib/strip-internal-metadata.ts +1 -1
  128. package/src/lib/tool-definitions.ts +0 -1
  129. package/src/lib/validation/schemas.ts +33 -2
  130. package/src/stores/slices/data-slice.ts +5 -1
  131. package/src/stores/slices/ui-slice.ts +0 -4
  132. package/src/types/agent.ts +0 -84
  133. package/src/types/app-settings.ts +0 -2
  134. package/src/types/approval.ts +0 -2
  135. package/src/types/connector.ts +1 -0
  136. package/src/types/index.ts +1 -1
  137. package/src/types/message.ts +0 -1
  138. package/src/types/misc.ts +0 -2
  139. package/src/types/protocol.ts +0 -2
  140. package/src/types/run.ts +0 -3
  141. package/src/types/session.ts +1 -51
  142. package/src/types/swarmdock.ts +29 -0
  143. package/src/types/task.ts +7 -3
  144. package/src/types/working-state.ts +2 -9
  145. package/src/views/settings/section-runtime-loop.tsx +0 -14
  146. package/src/app/api/canvas/[sessionId]/route.ts +0 -35
  147. package/src/app/api/missions/[id]/actions/route.ts +0 -31
  148. package/src/app/api/missions/[id]/events/route.ts +0 -14
  149. package/src/app/api/missions/[id]/route.ts +0 -10
  150. package/src/app/api/missions/route.test.ts +0 -244
  151. package/src/app/api/missions/route.ts +0 -57
  152. package/src/app/api/wallets/[id]/approve/route.ts +0 -79
  153. package/src/app/api/wallets/[id]/balance-history/route.ts +0 -18
  154. package/src/app/api/wallets/[id]/send/route.ts +0 -113
  155. package/src/app/api/wallets/[id]/transactions/route.ts +0 -18
  156. package/src/app/missions/[id]/page.tsx +0 -3
  157. package/src/app/missions/page.tsx +0 -685
  158. package/src/components/canvas/canvas-panel.tsx +0 -267
  159. package/src/components/wallets/wallet-approval-dialog.tsx +0 -107
  160. package/src/components/wallets/wallet-panel.tsx +0 -1010
  161. package/src/components/wallets/wallet-section.tsx +0 -260
  162. package/src/features/missions/queries.ts +0 -23
  163. package/src/lib/canvas-content.test.ts +0 -360
  164. package/src/lib/canvas-content.ts +0 -198
  165. package/src/lib/server/canvas-content.test.ts +0 -32
  166. package/src/lib/server/canvas-content.ts +0 -6
  167. package/src/lib/server/ethereum.ts +0 -591
  168. package/src/lib/server/evm-swap.ts +0 -476
  169. package/src/lib/server/missions/mission-intent.test.ts +0 -63
  170. package/src/lib/server/missions/mission-intent.ts +0 -569
  171. package/src/lib/server/missions/mission-repository.ts +0 -74
  172. package/src/lib/server/missions/mission-service/actions.ts +0 -6
  173. package/src/lib/server/missions/mission-service/bindings.ts +0 -9
  174. package/src/lib/server/missions/mission-service/context.ts +0 -4
  175. package/src/lib/server/missions/mission-service/core.ts +0 -2271
  176. package/src/lib/server/missions/mission-service/queries.ts +0 -12
  177. package/src/lib/server/missions/mission-service/recovery.ts +0 -5
  178. package/src/lib/server/missions/mission-service/ticks.ts +0 -9
  179. package/src/lib/server/missions/mission-service.test.ts +0 -888
  180. package/src/lib/server/missions/mission-service.ts +0 -6
  181. package/src/lib/server/session-tools/canvas.ts +0 -105
  182. package/src/lib/server/session-tools/wallet-tool.test.ts +0 -150
  183. package/src/lib/server/session-tools/wallet.ts +0 -1287
  184. package/src/lib/server/solana.ts +0 -327
  185. package/src/lib/server/wallet/wallet-execution.test.ts +0 -198
  186. package/src/lib/server/wallet/wallet-portfolio.test.ts +0 -98
  187. package/src/lib/server/wallet/wallet-portfolio.ts +0 -772
  188. package/src/lib/server/wallet/wallet-service.test.ts +0 -81
  189. package/src/lib/server/wallet/wallet-service.ts +0 -225
  190. package/src/lib/wallet/wallet-transactions.test.ts +0 -75
  191. package/src/lib/wallet/wallet-transactions.ts +0 -43
  192. package/src/lib/wallet/wallet.test.ts +0 -333
  193. package/src/lib/wallet/wallet.ts +0 -183
  194. package/src/types/mission.ts +0 -185
  195. package/src/views/settings/section-wallets.tsx +0 -35
@@ -4,7 +4,6 @@ import { genId } from '@/lib/id'
4
4
  import { cleanText, cleanMultiline, normalizeList } from '@/lib/server/text-normalization'
5
5
  import type {
6
6
  EvidenceRef,
7
- Mission,
8
7
  SessionWorkingState,
9
8
  WorkingArtifact,
10
9
  WorkingArtifactPatch,
@@ -56,7 +55,7 @@ export const WorkingPlanStepPatchSchema = z.object({
56
55
  export const WorkingFactPatchSchema = z.object({
57
56
  id: z.string().optional().nullable(),
58
57
  statement: z.string().optional().nullable(),
59
- source: z.enum(['user', 'tool', 'assistant', 'mission', 'system']).optional().nullable(),
58
+ source: z.enum(['user', 'tool', 'assistant', 'system']).optional().nullable(),
60
59
  status: WorkingItemStatusSchema.optional().nullable(),
61
60
  evidenceIds: z.array(z.string()).optional().nullable(),
62
61
  })
@@ -150,7 +149,6 @@ import type { MessageToolEvent } from '@/types'
150
149
 
151
150
  export interface WorkingStateDeterministicUpdateInput {
152
151
  sessionId: string
153
- mission?: Mission | null
154
152
  message?: string | null
155
153
  assistantText?: string | null
156
154
  error?: string | null
@@ -233,7 +231,6 @@ export function normalizeEvidenceRef(input: unknown): EvidenceRef | null {
233
231
  if (!summary) return null
234
232
  const type = record.type === 'tool'
235
233
  || record.type === 'message'
236
- || record.type === 'mission'
237
234
  || record.type === 'task'
238
235
  || record.type === 'artifact'
239
236
  || record.type === 'error'
@@ -249,7 +246,6 @@ export function normalizeEvidenceRef(input: unknown): EvidenceRef | null {
249
246
  toolCallId: cleanText(record.toolCallId, 120) || null,
250
247
  runId: cleanText(record.runId, 120) || null,
251
248
  sessionId: cleanText(record.sessionId, 120) || null,
252
- missionId: cleanText(record.missionId, 120) || null,
253
249
  taskId: cleanText(record.taskId, 120) || null,
254
250
  createdAt: typeof record.createdAt === 'number' && Number.isFinite(record.createdAt)
255
251
  ? Math.trunc(record.createdAt)
@@ -290,7 +286,6 @@ export function normalizeFact(input: unknown): WorkingFact | null {
290
286
  source: record.source === 'user'
291
287
  || record.source === 'tool'
292
288
  || record.source === 'assistant'
293
- || record.source === 'mission'
294
289
  || record.source === 'system'
295
290
  ? record.source
296
291
  : 'assistant',
@@ -434,17 +429,16 @@ export function normalizeMatchKey(value: string): string {
434
429
  // defaultWorkingState & normalizeWorkingState
435
430
  // ---------------------------------------------------------------------------
436
431
 
437
- export function defaultWorkingState(sessionId: string, mission?: Mission | null): SessionWorkingState {
432
+ export function defaultWorkingState(sessionId: string): SessionWorkingState {
438
433
  const nowTs = now()
439
434
  return {
440
435
  sessionId,
441
- missionId: mission?.id || null,
442
- objective: cleanMultiline(mission?.objective, 900) || null,
443
- summary: cleanMultiline(mission?.verifierSummary || mission?.plannerSummary, 600) || null,
436
+ objective: null,
437
+ summary: null,
444
438
  constraints: [],
445
- successCriteria: normalizeList(mission?.successCriteria, 12, 240),
446
- status: mission ? missionStatusToWorkingStateStatus(mission) : 'idle',
447
- nextAction: cleanText(mission?.currentStep, 240) || null,
439
+ successCriteria: [],
440
+ status: 'idle',
441
+ nextAction: null,
448
442
  planSteps: [],
449
443
  confirmedFacts: [],
450
444
  artifacts: [],
@@ -462,19 +456,17 @@ export function defaultWorkingState(sessionId: string, mission?: Mission | null)
462
456
  export function normalizeWorkingState(
463
457
  input: unknown,
464
458
  sessionId: string,
465
- mission?: Mission | null,
466
459
  ): SessionWorkingState {
467
460
  if (!input || typeof input !== 'object' || Array.isArray(input)) {
468
- return defaultWorkingState(sessionId, mission)
461
+ return defaultWorkingState(sessionId)
469
462
  }
470
463
  const record = input as Record<string, unknown>
471
- const base = defaultWorkingState(sessionId, mission)
464
+ const base = defaultWorkingState(sessionId)
472
465
  const createdAt = typeof record.createdAt === 'number' && Number.isFinite(record.createdAt)
473
466
  ? Math.trunc(record.createdAt)
474
467
  : base.createdAt
475
468
  const normalized: SessionWorkingState = {
476
469
  sessionId: cleanText(record.sessionId, 120) || sessionId,
477
- missionId: cleanText(record.missionId, 120) || mission?.id || null,
478
470
  objective: cleanMultiline(record.objective, 900) || base.objective,
479
471
  summary: cleanMultiline(record.summary, 600) || base.summary,
480
472
  constraints: normalizeList(record.constraints, 12, 240),
@@ -497,7 +489,7 @@ export function normalizeWorkingState(
497
489
  ? Math.trunc(record.lastCompactedAt)
498
490
  : null,
499
491
  }
500
- return compactWorkingStateObject(syncWorkingStateWithMission(normalized, mission))
492
+ return compactWorkingStateObject(normalized)
501
493
  }
502
494
 
503
495
  // ---------------------------------------------------------------------------
@@ -522,89 +514,6 @@ export function compactWorkingStateObject(state: SessionWorkingState): SessionWo
522
514
  }
523
515
 
524
516
  // ---------------------------------------------------------------------------
525
- // missionStatusToWorkingStateStatus & syncWorkingStateWithMission
526
- // ---------------------------------------------------------------------------
527
-
528
- export function missionStatusToWorkingStateStatus(mission: Mission): WorkingStateStatus {
529
- if (mission.status === 'completed') return 'completed'
530
- if (mission.status === 'waiting') return 'waiting'
531
- if (mission.status === 'failed' || mission.status === 'cancelled') return 'blocked'
532
- return 'progress'
533
- }
534
-
535
- export function syncWorkingStateWithMission(
536
- state: SessionWorkingState,
537
- mission?: Mission | null,
538
- ): SessionWorkingState {
539
- if (!mission) return state
540
- const next = { ...state }
541
- next.missionId = mission.id
542
- next.objective = cleanMultiline(mission.objective, 900) || next.objective
543
- next.successCriteria = normalizeList(mission.successCriteria, 12, 240)
544
- next.summary = next.summary || cleanMultiline(mission.verifierSummary || mission.plannerSummary, 600) || null
545
- const missionStatus = missionStatusToWorkingStateStatus(mission)
546
- if (missionStatus === 'completed' || missionStatus === 'waiting' || missionStatus === 'blocked') {
547
- next.status = missionStatus
548
- } else if (next.status === 'idle') {
549
- next.status = missionStatus
550
- }
551
- next.nextAction = next.nextAction || cleanText(mission.currentStep, 240) || null
552
-
553
- if (mission.currentStep) {
554
- next.planSteps = upsertItems(next.planSteps, [{
555
- id: null,
556
- text: mission.currentStep,
557
- status: mission.status === 'completed' ? 'resolved' : 'active',
558
- } satisfies WorkingPlanStepPatch], {
559
- max: MAX_PLAN_STEPS,
560
- getPatchId: (patch) => cleanText(patch.id, 120) || null,
561
- getPatchKey: (patch) => cleanText(patch.text, 240),
562
- getItemKey: (item) => item.text,
563
- create: (patch, nowTs) => ({
564
- id: genId(12),
565
- text: cleanText(patch.text, 240),
566
- status: normalizeItemStatus(patch.status),
567
- createdAt: nowTs,
568
- updatedAt: nowTs,
569
- }),
570
- merge: (current, patch, nowTs) => ({
571
- ...current,
572
- text: cleanText(patch.text, 240) || current.text,
573
- status: normalizeItemStatus(patch.status, current.status),
574
- updatedAt: nowTs,
575
- }),
576
- compact: compactPlanSteps,
577
- })
578
- }
579
-
580
- if (mission.waitState?.reason || mission.blockerSummary) {
581
- const blockerSummary = cleanText(mission.waitState?.reason || mission.blockerSummary, 280)
582
- if (blockerSummary) {
583
- next.blockers = upsertItems(next.blockers, [{
584
- summary: blockerSummary,
585
- kind: mission.waitState?.kind === 'approval'
586
- ? 'approval'
587
- : mission.waitState?.kind === 'human_reply'
588
- ? 'human_input'
589
- : mission.waitState?.kind === 'external_dependency' || mission.waitState?.kind === 'provider'
590
- ? 'external_dependency'
591
- : mission.status === 'failed'
592
- ? 'error'
593
- : 'other',
594
- nextAction: mission.currentStep || null,
595
- status: mission.status === 'completed' ? 'resolved' : 'active',
596
- }], blockerUpsertConfig())
597
- }
598
- }
599
-
600
- if (mission.status === 'completed') {
601
- next.blockers = next.blockers.map((blocker) => blocker.status === 'active'
602
- ? { ...blocker, status: 'resolved', updatedAt: now() }
603
- : blocker)
604
- }
605
-
606
- return next
607
- }
608
517
 
609
518
  // ---------------------------------------------------------------------------
610
519
  // upsertItems & upsertConfig factories
@@ -647,7 +556,6 @@ export function factUpsertConfig(): UpsertConfig<WorkingFact, WorkingFactPatch>
647
556
  source: patch.source === 'user'
648
557
  || patch.source === 'tool'
649
558
  || patch.source === 'assistant'
650
- || patch.source === 'mission'
651
559
  || patch.source === 'system'
652
560
  ? patch.source
653
561
  : 'assistant',
@@ -662,7 +570,6 @@ export function factUpsertConfig(): UpsertConfig<WorkingFact, WorkingFactPatch>
662
570
  source: patch.source === 'user'
663
571
  || patch.source === 'tool'
664
572
  || patch.source === 'assistant'
665
- || patch.source === 'mission'
666
573
  || patch.source === 'system'
667
574
  ? patch.source
668
575
  : current.source,
@@ -1,7 +1,6 @@
1
1
  import { genId } from '@/lib/id'
2
2
  import { cleanText, cleanMultiline, normalizeList } from '@/lib/server/text-normalization'
3
3
  import type {
4
- Mission,
5
4
  SessionWorkingState,
6
5
  WorkingBlocker,
7
6
  WorkingPlanStepPatch,
@@ -20,7 +19,6 @@ import {
20
19
  normalizeWorkingState,
21
20
  defaultWorkingState,
22
21
  compactWorkingStateObject,
23
- syncWorkingStateWithMission,
24
22
  normalizeItemStatus,
25
23
  normalizeStateStatus,
26
24
  upsertItems,
@@ -96,8 +94,6 @@ export {
96
94
  compactPlanSteps,
97
95
  defaultWorkingState,
98
96
  compactWorkingStateObject,
99
- missionStatusToWorkingStateStatus,
100
- syncWorkingStateWithMission,
101
97
  // Upsert
102
98
  upsertItems,
103
99
  factUpsertConfig,
@@ -142,14 +138,14 @@ export { buildWorkingStatePromptBlockFromState } from '@/lib/server/working-stat
142
138
  // CRUD / coordination layer
143
139
  // ---------------------------------------------------------------------------
144
140
 
145
- export function loadSessionWorkingState(sessionId: string, options?: { mission?: Mission | null }): SessionWorkingState | null {
141
+ export function loadSessionWorkingState(sessionId: string): SessionWorkingState | null {
146
142
  const stored = loadPersistedWorkingState(sessionId)
147
- if (!stored && !options?.mission) return null
148
- return normalizeWorkingState(stored, sessionId, options?.mission || null)
143
+ if (!stored) return null
144
+ return normalizeWorkingState(stored, sessionId)
149
145
  }
150
146
 
151
- export function getOrCreateSessionWorkingState(sessionId: string, options?: { mission?: Mission | null }): SessionWorkingState {
152
- return loadSessionWorkingState(sessionId, options) || defaultWorkingState(sessionId, options?.mission || null)
147
+ export function getOrCreateSessionWorkingState(sessionId: string): SessionWorkingState {
148
+ return loadSessionWorkingState(sessionId) || defaultWorkingState(sessionId)
153
149
  }
154
150
 
155
151
  export function saveSessionWorkingState(state: SessionWorkingState): SessionWorkingState {
@@ -165,12 +161,10 @@ export function deleteSessionWorkingState(sessionId: string): void {
165
161
  export function applyWorkingStatePatch(
166
162
  sessionId: string,
167
163
  patch: WorkingStatePatch,
168
- options?: { mission?: Mission | null },
169
164
  ): SessionWorkingState {
170
- const current = getOrCreateSessionWorkingState(sessionId, options)
165
+ const current = getOrCreateSessionWorkingState(sessionId)
171
166
  const next: SessionWorkingState = {
172
167
  ...current,
173
- missionId: options?.mission?.id || current.missionId || null,
174
168
  objective: patch.objective !== undefined ? (cleanMultiline(patch.objective, 900) || null) : current.objective,
175
169
  summary: patch.summary !== undefined ? (cleanMultiline(patch.summary, 600) || null) : current.summary,
176
170
  constraints: patch.constraints !== undefined ? normalizeList(patch.constraints, 12, 240) : current.constraints,
@@ -215,16 +209,15 @@ export function applyWorkingStatePatch(
215
209
  next.openQuestions = markSuperseded(next.openQuestions, patch.supersedeIds)
216
210
  next.hypotheses = markSuperseded(next.hypotheses, patch.supersedeIds)
217
211
 
218
- const synced = compactWorkingStateObject(syncWorkingStateWithMission(next, options?.mission || null))
219
- upsertPersistedWorkingState(sessionId, synced as unknown as Record<string, unknown>)
220
- return synced
212
+ const compacted = compactWorkingStateObject(next)
213
+ upsertPersistedWorkingState(sessionId, compacted as unknown as Record<string, unknown>)
214
+ return compacted
221
215
  }
222
216
 
223
217
  export function recordWorkingStateEvidence(input: WorkingStateDeterministicUpdateInput): SessionWorkingState {
224
218
  return applyWorkingStatePatch(
225
219
  input.sessionId,
226
220
  deterministicEvidencePatch(input),
227
- { mission: input.mission || null },
228
221
  )
229
222
  }
230
223
 
@@ -241,12 +234,11 @@ export async function synchronizeWorkingStateForTurn(
241
234
  currentState: deterministic,
242
235
  }, options)
243
236
  if (!patch) return deterministic
244
- return applyWorkingStatePatch(input.sessionId, patch, { mission: input.mission || null })
237
+ return applyWorkingStatePatch(input.sessionId, patch)
245
238
  }
246
239
 
247
240
  export function syncWorkingStateFromMainLoopState(input: {
248
241
  sessionId: string
249
- mission?: Mission | null
250
242
  goal?: string | null
251
243
  summary?: string | null
252
244
  status?: WorkingStateStatus | null
@@ -281,13 +273,12 @@ export function syncWorkingStateFromMainLoopState(input: {
281
273
  status: (input.status === 'completed' ? 'resolved' : 'active') as WorkingStateItemStatus,
282
274
  })).filter((fact) => fact.statement)
283
275
  : undefined,
284
- }, { mission: input.mission || null })
276
+ })
285
277
  }
286
278
 
287
279
  export function buildWorkingStatePromptBlock(
288
280
  sessionId: string,
289
- options?: { mission?: Mission | null },
290
281
  ): string {
291
- const state = loadSessionWorkingState(sessionId, options)
282
+ const state = loadSessionWorkingState(sessionId)
292
283
  return buildWorkingStatePromptBlockFromState(state)
293
284
  }
@@ -31,7 +31,7 @@ describe('stripInternalJson', () => {
31
31
  })
32
32
 
33
33
  it('removes JSON with nested objects when internal keys are present', () => {
34
- const input = '{ "walletIntent": "send", "details": { "amount": 100 } }'
34
+ const input = '{ "isDeliverableTask": true, "details": { "amount": 100 } }'
35
35
  assert.equal(stripInternalJson(input).trim(), '')
36
36
  })
37
37
 
@@ -15,7 +15,7 @@
15
15
  // ---------------------------------------------------------------------------
16
16
 
17
17
  const INTERNAL_JSON_KEYS = [
18
- 'isDeliverableTask', 'quality_score', 'isBroadGoal', 'walletIntent',
18
+ 'isDeliverableTask', 'quality_score', 'isBroadGoal',
19
19
  'hasHumanSignals', 'explicitToolRequests', 'isResearchSynthesis', 'confidence',
20
20
  ]
21
21
 
@@ -23,7 +23,6 @@ export const AVAILABLE_TOOLS: ToolDefinition[] = [
23
23
  { id: 'delegate', label: 'Delegate', description: 'Delegate complex tasks to specialized backends (Claude Code, Codex, OpenCode)' },
24
24
  { id: 'browser', label: 'Browser', description: 'Playwright — browse, scrape, interact with web pages' },
25
25
  { id: 'memory', label: 'Memory', description: 'Store and retrieve long-term memories across conversations' },
26
- { id: 'wallet', label: 'Wallet', description: 'Manage agent crypto wallet — check balance, send SOL, view transactions', extensionId: 'wallet' },
27
26
  { id: 'monitor', label: 'Monitor', description: 'Durable watch jobs: monitor files, endpoints, tasks, and resume agents on triggers' },
28
27
  { id: 'extension_creator', label: 'Extension Creator', description: 'Design focused extensions for durable capabilities and recurring automations' },
29
28
  { id: 'image_gen', label: 'Image Generation', description: 'Generate images from text prompts using OpenAI, Stability AI, Replicate, fal.ai, and more', extensionId: 'image_gen' },
@@ -137,7 +137,7 @@ export const ConnectorCreateSchema = z.object({
137
137
  name: z.string().min(1, 'Connector name is required').optional(),
138
138
  platform: z.enum([
139
139
  'discord', 'telegram', 'slack', 'whatsapp', 'openclaw',
140
- 'bluebubbles', 'signal', 'teams', 'googlechat', 'matrix', 'email',
140
+ 'bluebubbles', 'signal', 'teams', 'googlechat', 'matrix', 'email', 'swarmdock',
141
141
  ]),
142
142
  agentId: z.string().nullable().optional().default(null),
143
143
  chatroomId: z.string().nullable().optional().default(null),
@@ -396,7 +396,6 @@ export const ProtocolRunCreateSchema = z.object({
396
396
  participantAgentIds: z.array(z.string()).min(1, 'Select at least one participant').default([]),
397
397
  facilitatorAgentId: z.string().nullable().optional().default(null),
398
398
  observerAgentIds: z.array(z.string()).optional().default([]),
399
- missionId: z.string().nullable().optional().default(null),
400
399
  taskId: z.string().nullable().optional().default(null),
401
400
  sessionId: z.string().nullable().optional().default(null),
402
401
  parentChatroomId: z.string().nullable().optional().default(null),
@@ -473,6 +472,38 @@ export const ProtocolRunActionSchema = z.object({
473
472
  workItemId: z.string().nullable().optional().default(null),
474
473
  })
475
474
 
475
+ const PortableAgentSchema = z.object({
476
+ originalId: z.string().min(1),
477
+ name: z.string().min(1),
478
+ description: z.string(),
479
+ systemPrompt: z.string(),
480
+ provider: z.string().min(1),
481
+ model: z.string().min(1),
482
+ createdAt: z.number().optional(),
483
+ updatedAt: z.number().optional(),
484
+ skillIds: z.array(z.string()).optional(),
485
+ }).passthrough()
486
+
487
+ const PortableSkillSchema = z.object({
488
+ originalId: z.string().min(1),
489
+ name: z.string().min(1),
490
+ content: z.string(),
491
+ }).passthrough()
492
+
493
+ const PortableScheduleSchema = z.object({
494
+ originalId: z.string().min(1),
495
+ originalAgentId: z.string().min(1),
496
+ name: z.string().min(1),
497
+ }).passthrough()
498
+
499
+ export const PortableManifestSchema = z.object({
500
+ formatVersion: z.number().int().nonnegative(),
501
+ exportedAt: z.string().optional(),
502
+ agents: z.array(PortableAgentSchema),
503
+ skills: z.array(PortableSkillSchema),
504
+ schedules: z.array(PortableScheduleSchema),
505
+ })
506
+
476
507
  /** Format ZodError into a 400-friendly payload */
477
508
  export function formatZodError(err: z.ZodError) {
478
509
  return { error: 'Validation failed', issues: err.issues.map((i) => ({ path: i.path.join('.'), message: i.message })) }
@@ -1,6 +1,6 @@
1
1
  import { StateCreator } from 'zustand'
2
2
  import type { AppState } from '../use-app-store'
3
- import type { NetworkInfo, Directory, ProviderInfo, Credentials, Schedule, AppSettings, StoredSecret, ProviderConfig, Skill, Connector, Webhook, McpServerConfig, ExtensionMeta, Project, ActivityEntry, AppNotification, GatewayProfile } from '../../types'
3
+ import type { NetworkInfo, Directory, ProviderInfo, Credentials, Schedule, AppSettings, StoredSecret, ProviderConfig, Skill, Connector, Webhook, McpServerConfig, ExtensionMeta, Project, ActivityEntry, AppNotification, GatewayProfile, SafeWallet } from '../../types'
4
4
  import { api } from '@/lib/app/api-client'
5
5
  import { safeStorageGetJson, safeStorageSet } from '@/lib/app/safe-storage'
6
6
  import { fetchDirs, fetchProviders, fetchCredentials } from '@/lib/chat/chats'
@@ -24,6 +24,8 @@ export interface DataSlice {
24
24
  updateSettings: (patch: Partial<AppSettings>) => Promise<void>
25
25
  secrets: Record<string, StoredSecret>
26
26
  loadSecrets: () => Promise<void>
27
+ wallets: Record<string, SafeWallet>
28
+ loadWallets: () => Promise<void>
27
29
  providerConfigs: ProviderConfig[]
28
30
  loadProviderConfigs: () => Promise<void>
29
31
  gatewayProfiles: GatewayProfile[]
@@ -78,6 +80,8 @@ export const createDataSlice: StateCreator<AppState, [], [], DataSlice> = (set,
78
80
  },
79
81
  secrets: {},
80
82
  loadSecrets: createLoader<AppState>(set, 'secrets', () => api<Record<string, StoredSecret>>('GET', '/secrets'), {}),
83
+ wallets: {},
84
+ loadWallets: createLoader<AppState>(set, 'wallets', () => api<Record<string, SafeWallet>>('GET', '/wallets'), {}),
81
85
  providerConfigs: [],
82
86
  loadProviderConfigs: createLoader<AppState>(set, 'providerConfigs', () => api<ProviderConfig[]>('GET', '/providers/configs'), []),
83
87
  gatewayProfiles: [],
@@ -95,8 +95,6 @@ export interface UiSlice {
95
95
  setFleetFilter: (filter: FleetFilter) => void
96
96
  chatFilter: 'all' | 'active' | 'recent'
97
97
  setChatFilter: (filter: 'all' | 'active' | 'recent') => void
98
- walletPanelAgentId: string | null
99
- setWalletPanelAgentId: (id: string | null) => void
100
98
  heartbeatHistoryOpen: boolean
101
99
  setHeartbeatHistoryOpen: (open: boolean) => void
102
100
  agentPrefill: Partial<Agent> | null
@@ -195,8 +193,6 @@ export const createUiSlice: StateCreator<AppState, [], [], UiSlice> = (set, get)
195
193
  setFleetFilter: (filter) => { safeStorageSet('sc_fleet_filter', filter); set({ fleetFilter: filter }) },
196
194
  chatFilter: 'all' as const,
197
195
  setChatFilter: (filter) => set({ chatFilter: filter }),
198
- walletPanelAgentId: null,
199
- setWalletPanelAgentId: (id) => set({ walletPanelAgentId: id }),
200
196
  heartbeatHistoryOpen: false,
201
197
  setHeartbeatHistoryOpen: (open) => set({ heartbeatHistoryOpen: open }),
202
198
  agentPrefill: null,
@@ -83,10 +83,6 @@ export interface Agent {
83
83
  trashedAt?: number
84
84
  openclawSkillMode?: SkillAllowlistMode
85
85
  openclawAllowedSkills?: string[]
86
- walletIds?: string[]
87
- activeWalletId?: string | null
88
- /** @deprecated Use walletIds + activeWalletId */
89
- walletId?: string | null
90
86
  responseStyle?: 'concise' | 'normal' | 'detailed' | null
91
87
  responseMaxChars?: number | null
92
88
  monthlyBudget?: number | null
@@ -171,86 +167,6 @@ export interface Agent {
171
167
  updatedAt: number
172
168
  }
173
169
 
174
- // --- Agent Wallets ---
175
-
176
- export type WalletChain = 'solana' | 'ethereum'
177
-
178
- export interface AgentWallet {
179
- id: string
180
- agentId: string
181
- chain: WalletChain
182
- publicKey: string
183
- encryptedPrivateKey: string // AES-256-GCM via encryptKey()
184
- label?: string
185
- spendingLimitAtomic?: string
186
- dailyLimitAtomic?: string
187
- /** @deprecated Use spendingLimitAtomic */
188
- spendingLimitLamports?: number
189
- /** @deprecated Use dailyLimitAtomic */
190
- dailyLimitLamports?: number
191
- requireApproval: boolean // default true; can be globally overridden by app settings
192
- createdAt: number
193
- updatedAt: number
194
- }
195
-
196
- export interface WalletAssetBalance {
197
- id: string
198
- chain: WalletChain
199
- networkId: string
200
- networkLabel: string
201
- symbol: string
202
- name?: string
203
- decimals: number
204
- balanceAtomic: string
205
- balanceFormatted?: string
206
- balanceDisplay?: string
207
- isNative: boolean
208
- contractAddress?: string
209
- tokenMint?: string
210
- explorerUrl?: string
211
- }
212
-
213
- export interface WalletPortfolioSummary {
214
- totalAssets: number
215
- nonZeroAssets: number
216
- tokenAssets: number
217
- networkCount: number
218
- }
219
-
220
- export type WalletTransactionType = 'send' | 'receive' | 'swap'
221
- export type WalletTransactionStatus = 'pending_approval' | 'pending' | 'confirmed' | 'failed' | 'denied'
222
-
223
- export interface WalletTransaction {
224
- id: string
225
- walletId: string
226
- agentId: string
227
- chain: WalletChain
228
- type: WalletTransactionType
229
- signature: string
230
- fromAddress: string
231
- toAddress: string
232
- amountAtomic?: string
233
- feeAtomic?: string
234
- /** @deprecated Use amountAtomic */
235
- amountLamports?: number
236
- /** @deprecated Use feeAtomic */
237
- feeLamports?: number
238
- status: WalletTransactionStatus
239
- memo?: string // agent's reason for tx
240
- approvedBy?: 'user' | 'auto'
241
- tokenMint?: string // null = native chain asset
242
- timestamp: number
243
- }
244
-
245
- export interface WalletBalanceSnapshot {
246
- id: string
247
- walletId: string
248
- balanceAtomic?: string
249
- /** @deprecated Use balanceAtomic */
250
- balanceLamports?: number
251
- timestamp: number
252
- }
253
-
254
170
  export type AgentTool = 'browser'
255
171
 
256
172
  export interface ClaudeSkill {
@@ -73,7 +73,6 @@ export interface AppSettings {
73
73
  safetyRequireApprovalForOutbound?: boolean
74
74
  safetyMaxDailySpendUsd?: number | null
75
75
  safetyBlockedTools?: string[]
76
- walletApprovalsEnabled?: boolean
77
76
  capabilityPolicyMode?: 'permissive' | 'balanced' | 'strict'
78
77
  capabilityBlockedTools?: string[]
79
78
  capabilityBlockedCategories?: string[]
@@ -96,7 +95,6 @@ export interface AppSettings {
96
95
  supervisorNoProgressLimit?: number
97
96
  supervisorRepeatedToolLimit?: number
98
97
  autonomyResumeApprovalsEnabled?: boolean
99
- missionHumanLoopEnabled?: boolean
100
98
  reflectionEnabled?: boolean
101
99
  reflectionAutoWriteMemory?: boolean
102
100
  memoryReferenceDepth?: number
@@ -2,8 +2,6 @@
2
2
 
3
3
  export type ApprovalCategory =
4
4
  | 'tool_access'
5
- | 'wallet_transfer'
6
- | 'wallet_action'
7
5
  | 'extension_scaffold'
8
6
  | 'extension_install'
9
7
  | 'task_tool'
@@ -28,6 +28,7 @@ export type ConnectorPlatform =
28
28
  | 'email'
29
29
  | 'webchat'
30
30
  | 'mockmail'
31
+ | 'swarmdock'
31
32
  export type ConnectorStatus = 'stopped' | 'running' | 'error'
32
33
 
33
34
  export interface MessageSource {
@@ -2,7 +2,6 @@ export * from './message'
2
2
  export * from './session'
3
3
  export * from './agent'
4
4
  export * from './working-state'
5
- export * from './mission'
6
5
  export * from './extension'
7
6
  export * from './connector'
8
7
  export * from './provider'
@@ -14,3 +13,4 @@ export * from './skill'
14
13
  export * from './run'
15
14
  export * from './approval'
16
15
  export * from './misc'
16
+ export * from './swarmdock'
@@ -15,7 +15,6 @@ export type MessageWorkType = 'coding' | 'research' | 'writing' | 'review' | 'op
15
15
  export interface MessageSemanticsSummary {
16
16
  taskIntent: MessageTaskIntent
17
17
  workType: MessageWorkType
18
- walletIntent: 'none' | 'read_only' | 'transactional'
19
18
  isDeliverableTask: boolean
20
19
  isBroadGoal: boolean
21
20
  isResearchSynthesis: boolean
package/src/types/misc.ts CHANGED
@@ -388,8 +388,6 @@ export interface DelegationJobRecord {
388
388
  kind: DelegationJobKind
389
389
  status: DelegationJobStatus
390
390
  backend?: 'claude' | 'codex' | 'opencode' | 'gemini' | null
391
- missionId?: string | null
392
- parentMissionId?: string | null
393
391
  parentSessionId?: string | null
394
392
  childSessionId?: string | null
395
393
  agentId?: string | null
@@ -122,7 +122,6 @@ export type ProtocolSourceRef =
122
122
  | { kind: 'api' }
123
123
  | { kind: 'session'; sessionId: string }
124
124
  | { kind: 'chatroom'; chatroomId: string }
125
- | { kind: 'mission'; missionId: string }
126
125
  | { kind: 'task'; taskId: string }
127
126
  | { kind: 'schedule'; scheduleId: string }
128
127
  | { kind: 'protocol_run'; runId: string; parentRunId?: string | null; stepId?: string | null; branchId?: string | null }
@@ -319,7 +318,6 @@ export interface ProtocolRun {
319
318
  participantAgentIds: string[]
320
319
  facilitatorAgentId?: string | null
321
320
  observerAgentIds?: string[]
322
- missionId?: string | null
323
321
  taskId?: string | null
324
322
  sessionId?: string | null
325
323
  parentRunId?: string | null
package/src/types/run.ts CHANGED
@@ -17,7 +17,6 @@ export type ExecutionOwnerType =
17
17
  | 'task'
18
18
  | 'protocol_run'
19
19
  | 'schedule'
20
- | 'mission'
21
20
  | 'agent'
22
21
  | 'subagent'
23
22
 
@@ -48,7 +47,6 @@ export interface SessionRunRecoveryPayload {
48
47
  export interface SessionRunRecord {
49
48
  id: string
50
49
  sessionId: string
51
- missionId?: string | null
52
50
  kind?: ExecutionKind
53
51
  ownerType?: ExecutionOwnerType | null
54
52
  ownerId?: string | null
@@ -78,7 +76,6 @@ export interface SessionRunRecord {
78
76
  export interface SessionQueuedTurn {
79
77
  runId: string
80
78
  sessionId: string
81
- missionId?: string | null
82
79
  text: string
83
80
  queuedAt: number
84
81
  position: number