ethagent 2.1.1 → 2.3.0

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 (177) hide show
  1. package/package.json +2 -1
  2. package/src/app/FirstRun.tsx +1 -7
  3. package/src/app/FirstRunTimeline.tsx +1 -1
  4. package/src/auth/openaiOAuth/credentials.ts +47 -0
  5. package/src/auth/openaiOAuth/crypto.ts +23 -0
  6. package/src/auth/openaiOAuth/index.ts +238 -0
  7. package/src/auth/openaiOAuth/landingPage.ts +125 -0
  8. package/src/auth/openaiOAuth/listener.ts +151 -0
  9. package/src/auth/openaiOAuth/refresh.ts +70 -0
  10. package/src/auth/openaiOAuth/shared.ts +115 -0
  11. package/src/chat/ChatBottomPane.tsx +20 -11
  12. package/src/chat/ChatScreen.tsx +160 -35
  13. package/src/chat/ConversationStack.tsx +1 -1
  14. package/src/chat/MessageList.tsx +185 -72
  15. package/src/chat/SessionStatus.tsx +3 -1
  16. package/src/chat/chatScreenUtils.ts +11 -15
  17. package/src/chat/chatSessionState.ts +3 -2
  18. package/src/chat/chatTurnOrchestrator.ts +1 -7
  19. package/src/chat/commands.ts +28 -27
  20. package/src/chat/display/DiffView.tsx +193 -0
  21. package/src/chat/display/SyntaxText.tsx +192 -0
  22. package/src/chat/display/toolCallDisplay.ts +103 -0
  23. package/src/chat/display/toolResultDisplay.ts +19 -0
  24. package/src/chat/{ChatInput.tsx → input/ChatInput.tsx} +36 -23
  25. package/src/chat/{TranscriptView.tsx → transcript/TranscriptView.tsx} +24 -50
  26. package/src/chat/{transcriptViewport.ts → transcript/transcriptViewport.ts} +12 -30
  27. package/src/chat/{ContextLimitView.tsx → views/ContextLimitView.tsx} +3 -3
  28. package/src/chat/{ContinuityEditReviewView.tsx → views/ContinuityEditReviewView.tsx} +11 -3
  29. package/src/chat/{CopyPicker.tsx → views/CopyPicker.tsx} +4 -5
  30. package/src/chat/{PermissionPrompt.tsx → views/PermissionPrompt.tsx} +16 -17
  31. package/src/chat/{PermissionsView.tsx → views/PermissionsView.tsx} +6 -6
  32. package/src/chat/{PlanApprovalView.tsx → views/PlanApprovalView.tsx} +4 -4
  33. package/src/chat/{ResumeView.tsx → views/ResumeView.tsx} +35 -35
  34. package/src/chat/views/RewindView.tsx +410 -0
  35. package/src/identity/continuity/privateEdit/diff.ts +2 -78
  36. package/src/identity/ens/agentRecords.ts +5 -19
  37. package/src/identity/ens/ensAutomation/setup.ts +0 -1
  38. package/src/identity/ens/ensAutomation/types.ts +0 -1
  39. package/src/identity/hub/OperationalRoutes.tsx +23 -32
  40. package/src/identity/hub/Routes.tsx +13 -13
  41. package/src/identity/hub/{flows/continuity → continuity}/ContinuityDashboardScreen.tsx +9 -9
  42. package/src/identity/hub/{flows/continuity → continuity}/RebackupStorageScreen.tsx +2 -2
  43. package/src/identity/hub/{flows/continuity → continuity}/RecoveryConfirmScreen.tsx +5 -5
  44. package/src/identity/hub/{flows/continuity → continuity}/SavePromptScreen.tsx +5 -5
  45. package/src/identity/hub/{effects/rebackup/runRebackup.ts → continuity/effects.ts} +19 -19
  46. package/src/identity/hub/{effects/rebackup → continuity}/index.ts +1 -1
  47. package/src/identity/hub/{effects/shared → continuity}/snapshot.ts +8 -8
  48. package/src/identity/hub/{effects/rebackup → continuity}/vault.ts +15 -15
  49. package/src/identity/hub/{flows/create → create}/CreateFlow.tsx +13 -13
  50. package/src/identity/hub/{effects/create.ts → create/effects.ts} +4 -4
  51. package/src/identity/hub/{flows/custody → custody}/CustodyEditFlow.tsx +10 -48
  52. package/src/identity/hub/{flows/custody/custodyFlowActions.ts → custody/actions.ts} +11 -9
  53. package/src/identity/hub/{flows/custody/custodyFlowHelpers.ts → custody/helpers.ts} +4 -4
  54. package/src/identity/hub/{effects/vault → custody}/preflight.ts +5 -5
  55. package/src/identity/hub/{flows/custody/custodyFlowRoutes.tsx → custody/routes.tsx} +8 -8
  56. package/src/identity/hub/{flows/custody/custodyEffects.ts → custody/transactions.ts} +9 -9
  57. package/src/identity/hub/{flows/custody/custodyFlowTypes.ts → custody/types.ts} +6 -6
  58. package/src/identity/hub/{flows/custody/custodyFlowEffects.ts → custody/useCustodyEffects.ts} +7 -7
  59. package/src/identity/hub/{flows/custody → custody}/useCustodyFlow.tsx +5 -5
  60. package/src/identity/hub/ens/EnsEditAdvancedScreens.tsx +241 -0
  61. package/src/identity/hub/{flows/ens → ens}/EnsEditFlow.tsx +27 -82
  62. package/src/identity/hub/{flows/ens → ens}/EnsEditMaintenanceScreens.tsx +25 -65
  63. package/src/identity/hub/{flows/ens → ens}/EnsEditReviewScreens.tsx +12 -30
  64. package/src/identity/hub/ens/EnsEditRunners.tsx +62 -0
  65. package/src/identity/hub/{flows/ens → ens}/EnsEditShared.tsx +15 -14
  66. package/src/identity/hub/{flows/ens → ens}/EnsEditSimpleScreens.tsx +68 -217
  67. package/src/identity/hub/{flows/ens/IdentityHubEnsFlow.tsx → ens/EnsFlow.tsx} +18 -11
  68. package/src/identity/hub/{flows/ens/OperatorWalletsScreen.tsx → ens/EnsOperatorWalletsScreen.tsx} +17 -48
  69. package/src/identity/hub/{advancedEnsValidation.ts → ens/advancedEnsValidation.ts} +2 -2
  70. package/src/identity/hub/{flows/ens/ensEditCopy.ts → ens/editCopy.ts} +4 -4
  71. package/src/identity/hub/{effects/ens/flows.ts → ens/effects.ts} +7 -7
  72. package/src/identity/hub/{effects/ens → ens}/index.ts +1 -1
  73. package/src/identity/hub/{model/ens.ts → ens/state.ts} +1 -1
  74. package/src/identity/hub/{effects/ens → ens}/transactions.ts +232 -232
  75. package/src/identity/hub/{flows/ens/ensEditTypes.ts → ens/types.ts} +12 -26
  76. package/src/identity/hub/identityHubReducer.ts +3 -3
  77. package/src/identity/hub/{flows/profile → profile}/EditProfileFlow.tsx +17 -10
  78. package/src/identity/hub/{effects/publicProfile/runPublicProfileSave.ts → profile/effects.ts} +55 -177
  79. package/src/identity/hub/{model → profile}/identity.ts +3 -3
  80. package/src/identity/hub/{effects/profile/profileState.ts → profile/state.ts} +181 -173
  81. package/src/identity/hub/{flows/restore → restore}/RestoreFlow.tsx +21 -21
  82. package/src/identity/hub/{effects/restore → restore}/apply.ts +10 -10
  83. package/src/identity/hub/{effects/restore → restore}/auth.ts +7 -7
  84. package/src/identity/hub/{effects/restore → restore}/discover.ts +6 -6
  85. package/src/identity/hub/{effects/restore → restore}/envelopes.ts +2 -2
  86. package/src/identity/hub/{effects/restore → restore}/fetch.ts +3 -3
  87. package/src/identity/hub/{effects/restore/shared.ts → restore/helpers.ts} +6 -6
  88. package/src/identity/hub/{effects/restore → restore}/recovery.ts +10 -10
  89. package/src/identity/hub/{effects/restore → restore}/resolve.ts +4 -4
  90. package/src/identity/hub/restore/restoreAdmin.ts +34 -0
  91. package/src/identity/hub/{flows/restore/useRestoreFlowEffects.ts → restore/useRestoreEffects.ts} +5 -5
  92. package/src/identity/hub/{flows/settings → settings}/StorageCredentialScreen.tsx +5 -5
  93. package/src/identity/hub/{components → shared/components}/BusyScreen.tsx +4 -4
  94. package/src/identity/hub/{components → shared/components}/DetailsScreen.tsx +4 -4
  95. package/src/identity/hub/{components → shared/components}/ErrorScreen.tsx +4 -4
  96. package/src/identity/hub/{components → shared/components}/FlowTimeline.tsx +1 -1
  97. package/src/identity/hub/{components → shared/components}/IdentitySummary.tsx +16 -11
  98. package/src/identity/hub/{components → shared/components}/MenuScreen.tsx +8 -9
  99. package/src/identity/hub/{components → shared/components}/NetworkScreen.tsx +4 -4
  100. package/src/identity/hub/{components → shared/components}/PinataJwtInput.tsx +4 -4
  101. package/src/identity/hub/{components → shared/components}/UnlinkedIdentityScreen.tsx +5 -5
  102. package/src/identity/hub/{components → shared/components}/WalletApprovalScreen.tsx +6 -6
  103. package/src/identity/hub/{components → shared/components}/menuFlagsFromReconciliation.ts +2 -4
  104. package/src/identity/hub/{effects/shared → shared/effects}/profilePrep.ts +1 -1
  105. package/src/identity/hub/{effects → shared/effects}/receipts.ts +2 -2
  106. package/src/identity/hub/{effects/shared → shared/effects}/sync.ts +6 -47
  107. package/src/identity/hub/{effects → shared/effects}/types.ts +3 -3
  108. package/src/identity/hub/{model → shared/model}/copy.ts +2 -2
  109. package/src/identity/hub/{model → shared/model}/errors.ts +5 -5
  110. package/src/identity/hub/{model → shared/model}/network.ts +3 -3
  111. package/src/identity/hub/{operatorWallets.ts → shared/operatorWallets.ts} +1 -1
  112. package/src/identity/hub/{reconciliation → shared/reconciliation}/agentReconciliation/hook.ts +1 -2
  113. package/src/identity/hub/{reconciliation → shared/reconciliation}/agentReconciliation/ownership.ts +2 -2
  114. package/src/identity/hub/{reconciliation → shared/reconciliation}/agentReconciliation/run.ts +7 -40
  115. package/src/identity/hub/{reconciliation → shared/reconciliation}/agentReconciliation/types.ts +0 -4
  116. package/src/identity/hub/{reconciliation → shared/reconciliation}/index.ts +0 -7
  117. package/src/identity/hub/shared/reconciliation/walletSetup.ts +27 -0
  118. package/src/identity/hub/{utils.ts → shared/utils.ts} +5 -5
  119. package/src/identity/hub/{flows/token-transfer/IdentityHubTokenTransferFlow.tsx → transfer/TokenTransferFlow.tsx} +8 -8
  120. package/src/identity/hub/{flows/token-transfer → transfer}/TokenTransferScreens.tsx +14 -14
  121. package/src/identity/hub/{effects/token-transfer/runTokenTransfer.ts → transfer/effects.ts} +16 -16
  122. package/src/identity/hub/{effects/token-transfer → transfer}/progress.ts +1 -1
  123. package/src/identity/hub/useIdentityHubController.ts +11 -11
  124. package/src/identity/hub/useIdentityHubSideEffects.ts +11 -11
  125. package/src/identity/wallet/browserWallet/types.ts +0 -5
  126. package/src/identity/wallet/page/copy.ts +1 -31
  127. package/src/identity/wallet/walletPurposeCompat.ts +0 -2
  128. package/src/models/ModelPicker.tsx +248 -8
  129. package/src/models/catalog.ts +29 -1
  130. package/src/models/modelPickerOptions.ts +12 -10
  131. package/src/models/providerDisplay.ts +16 -0
  132. package/src/providers/errors.ts +6 -4
  133. package/src/providers/openai-chat.ts +2 -1
  134. package/src/providers/openai-responses-format.ts +156 -0
  135. package/src/providers/openai-responses.ts +276 -0
  136. package/src/providers/registry.ts +85 -8
  137. package/src/runtime/sessionMode.ts +1 -1
  138. package/src/runtime/systemPrompt.ts +4 -2
  139. package/src/runtime/toolExecution.ts +9 -6
  140. package/src/runtime/turn.ts +29 -1
  141. package/src/storage/rewind.ts +20 -0
  142. package/src/storage/secrets.ts +4 -1
  143. package/src/storage/sessions.ts +2 -1
  144. package/src/tools/bashSafety.ts +7 -3
  145. package/src/tools/bashTool.ts +1 -1
  146. package/src/tools/contracts.ts +3 -0
  147. package/src/tools/deleteFileTool.ts +8 -3
  148. package/src/tools/editTool.ts +10 -5
  149. package/src/tools/fileDiff.ts +261 -0
  150. package/src/tools/privateContinuityEditTool.ts +11 -1
  151. package/src/tools/writeFileTool.ts +8 -3
  152. package/src/ui/Spinner.tsx +25 -3
  153. package/src/ui/TextInput.tsx +2 -2
  154. package/src/ui/theme.ts +17 -0
  155. package/src/utils/clipboard.ts +10 -7
  156. package/src/utils/openExternal.ts +20 -10
  157. package/src/chat/RewindView.tsx +0 -386
  158. package/src/chat/toolResultDisplay.ts +0 -8
  159. package/src/identity/ens/ensRegistration.ts +0 -199
  160. package/src/identity/hub/effects/index.ts +0 -74
  161. package/src/identity/hub/effects/publicProfile/index.ts +0 -5
  162. package/src/identity/hub/effects/restore/restoreEffects.ts +0 -22
  163. package/src/identity/hub/effects/restoreAdmin.ts +0 -93
  164. package/src/identity/hub/effects/token-transfer/index.ts +0 -6
  165. package/src/identity/hub/flows/ens/EnsEditAdvancedScreens.tsx +0 -336
  166. package/src/identity/hub/flows/ens/EnsEditRunners.tsx +0 -198
  167. package/src/identity/hub/reconciliation/walletSetup.ts +0 -220
  168. /package/src/chat/{chatInputState.ts → input/chatInputState.ts} +0 -0
  169. /package/src/chat/{chatPaste.ts → input/chatPaste.ts} +0 -0
  170. /package/src/chat/{textCursor.ts → input/textCursor.ts} +0 -0
  171. /package/src/identity/hub/{model/continuity.ts → continuity/state.ts} +0 -0
  172. /package/src/identity/hub/{model/custody.ts → custody/state.ts} +0 -0
  173. /package/src/identity/hub/{effects/restore → restore}/index.ts +0 -0
  174. /package/src/identity/hub/{model → shared/model}/format.ts +0 -0
  175. /package/src/identity/hub/{reconciliation → shared/reconciliation}/useAgentReconciliation.ts +0 -0
  176. /package/src/identity/hub/{txGuard.ts → shared/txGuard.ts} +0 -0
  177. /package/src/identity/hub/{model/transfer.ts → transfer/state.ts} +0 -0
@@ -4,13 +4,12 @@ import {
4
4
  erc8004ConfigForSupportedChain,
5
5
  validateErc8004TokenOwner,
6
6
  type Erc8004RegistryConfig,
7
- } from '../../../registry/erc8004.js'
8
- import { isAgentInVault, resolveConfiguredVaultAddress } from '../../../registry/vault.js'
9
- import type { EthagentConfig, EthagentIdentity } from '../../../../storage/config.js'
10
- import { readVaultAddressField } from '../../../identityCompat.js'
11
- import { reconcileWalletSetup, type RecordsFixPlan } from '../walletSetup.js'
12
- import { readCustodyMode } from '../../model/custody.js'
13
- import { continuityWorkingTreeStatus, type ContinuityWorkingTreeStatus } from '../../../continuity/storage.js'
7
+ } from '../../../../registry/erc8004.js'
8
+ import { isAgentInVault, resolveConfiguredVaultAddress } from '../../../../registry/vault.js'
9
+ import type { EthagentConfig, EthagentIdentity } from '../../../../../storage/config.js'
10
+ import { readVaultAddressField } from '../../../../identityCompat.js'
11
+ import { readCustodyMode } from '../../../custody/state.js'
12
+ import { continuityWorkingTreeStatus, type ContinuityWorkingTreeStatus } from '../../../../continuity/storage.js'
14
13
  import type { AgentReconciliation } from './types.js'
15
14
 
16
15
  export function emptyReconciliation(): AgentReconciliation {
@@ -18,7 +17,6 @@ export function emptyReconciliation(): AgentReconciliation {
18
17
  token: 'no-agent',
19
18
  custody: 'unknown',
20
19
  agentUri: 'unknown',
21
- ensRecords: 'unset',
22
20
  vault: 'unset',
23
21
  workingTree: 'unknown',
24
22
  rpc: 'reachable',
@@ -52,7 +50,6 @@ export async function runReconciliation(
52
50
  tokenDetail: `no rpcUrl configured for chain ${identity.chainId}`,
53
51
  custody: 'unknown',
54
52
  agentUri: 'unknown',
55
- ensRecords: 'unknown',
56
53
  vault: vaultAddress ? 'unknown' : 'unset',
57
54
  workingTree: 'unknown',
58
55
  rpc: 'failing',
@@ -67,14 +64,12 @@ export async function runReconciliation(
67
64
  tokenResult,
68
65
  custodyResult,
69
66
  agentUriResult,
70
- ensReconcileResult,
71
67
  vaultResult,
72
68
  workingTreeResult,
73
69
  ] = await Promise.allSettled([
74
70
  probeToken({ registry, agentId, expectedOwner, operatorVaults }),
75
71
  probeCustody({ client, registry, agentId, expectedOwner, vaultAddress, identity }),
76
72
  probeAgentUri({ client, registry, agentId, identity }),
77
- probeEnsRecords({ identity, registry, client }),
78
73
  probeVault({ client, vaultAddress }),
79
74
  probeWorkingTree(identity),
80
75
  ])
@@ -82,11 +77,10 @@ export async function runReconciliation(
82
77
  const token = unwrap(tokenResult, fallbackToken)
83
78
  const custody = unwrap(custodyResult, () => ({ kind: 'unknown' as const }))
84
79
  const agentUri = unwrap(agentUriResult, () => ({ kind: 'unknown' as const }))
85
- const ensRecords = unwrap(ensReconcileResult, () => ({ kind: 'unknown' as const }))
86
80
  const vault = unwrap(vaultResult, () => ({ kind: vaultAddress ? 'unknown' as const : 'unset' as const }))
87
81
  const workingTree = unwrap(workingTreeResult, () => ({ kind: 'unknown' as const }))
88
82
 
89
- const allFailed = [tokenResult, custodyResult, agentUriResult, ensReconcileResult, vaultResult]
83
+ const allFailed = [tokenResult, custodyResult, agentUriResult, vaultResult]
90
84
  .every(r => r.status === 'rejected')
91
85
  const rpc: 'reachable' | 'failing' = allFailed ? 'failing' : 'reachable'
92
86
 
@@ -99,8 +93,6 @@ export async function runReconciliation(
99
93
  ...(token.kind === 'unknown' && token.detail ? { tokenDetail: token.detail } : {}),
100
94
  custody: custody.kind,
101
95
  agentUri: agentUri.kind,
102
- ensRecords: ensRecords.kind,
103
- ...(ensRecords.kind === 'drift' || ensRecords.kind === 'aligned' ? { ensRecordsPlan: ensRecords.plan } : {}),
104
96
  vault: vault.kind,
105
97
  workingTree: workingTree.kind,
106
98
  rpc,
@@ -232,30 +224,6 @@ async function probeAgentUri(args: {
232
224
  }
233
225
  }
234
226
 
235
- type EnsRecordsProbe =
236
- | { kind: 'aligned'; plan: RecordsFixPlan }
237
- | { kind: 'drift'; plan: RecordsFixPlan }
238
- | { kind: 'unset' }
239
- | { kind: 'unknown' }
240
-
241
- async function probeEnsRecords(args: {
242
- identity: EthagentIdentity
243
- registry: Erc8004RegistryConfig
244
- client: PublicClient
245
- }): Promise<EnsRecordsProbe> {
246
- const baseState = (args.identity.state ?? {}) as Record<string, unknown>
247
- const ensName = typeof baseState.ensName === 'string' ? baseState.ensName.trim() : ''
248
- const custody = readCustodyMode(baseState)
249
- if (!ensName || custody !== 'advanced') return { kind: 'unset' }
250
- try {
251
- const plan = await reconcileWalletSetup({ identity: args.identity, registry: args.registry })
252
- if (plan.items.length === 0) return { kind: 'aligned', plan }
253
- const actionable = plan.items.some(item => item.kind === 'missing-approval' || item.kind === 'stale-approval')
254
- return actionable ? { kind: 'drift', plan } : { kind: 'aligned', plan }
255
- } catch {
256
- return { kind: 'unknown' }
257
- }
258
- }
259
227
 
260
228
  type VaultProbe = { kind: 'confirmed' | 'missing' | 'unset' | 'unknown' }
261
229
 
@@ -295,7 +263,6 @@ function computeDriftCount(r: AgentReconciliation): number {
295
263
  if (r.token === 'unlinked') n++
296
264
  if (r.custody === 'mid-flow-uri-pending') n++
297
265
  if (r.agentUri === 'local-newer' || r.agentUri === 'chain-newer') n++
298
- if (r.ensRecords === 'drift') n++
299
266
  if (r.vault === 'missing') n++
300
267
  if (r.workingTree === 'dirty') n++
301
268
  return n
@@ -1,5 +1,3 @@
1
- import type { RecordsFixPlan } from '../walletSetup.js'
2
-
3
1
  export type AgentReconciliation = {
4
2
  token: 'linked' | 'unlinked' | 'unknown' | 'no-agent'
5
3
  tokenDetail?: string
@@ -7,8 +5,6 @@ export type AgentReconciliation = {
7
5
  onChainOwner?: string
8
6
  custody: 'simple' | 'advanced' | 'withdrawn' | 'mid-flow-uri-pending' | 'unknown'
9
7
  agentUri: 'in-sync' | 'chain-newer' | 'local-newer' | 'unknown'
10
- ensRecords: 'aligned' | 'drift' | 'unset' | 'unknown'
11
- ensRecordsPlan?: RecordsFixPlan
12
8
  vault: 'confirmed' | 'missing' | 'unset' | 'unknown'
13
9
  workingTree: 'clean' | 'dirty' | 'unknown'
14
10
  rpc: 'reachable' | 'failing'
@@ -8,14 +8,7 @@ export type {
8
8
  } from './useAgentReconciliation.js'
9
9
  export {
10
10
  computeApprovalDiff,
11
- describeFixPlanItem,
12
- encodeResolverApprovalChanges,
13
- fixPlanRequiresOwnerWallet,
14
- reconcileWalletSetup,
15
- verifyResolverApprovalsLanded,
16
11
  } from './walletSetup.js'
17
12
  export type {
18
13
  ApprovalDiff,
19
- RecordsFixPlan,
20
- RecordsFixPlanItem,
21
14
  } from './walletSetup.js'
@@ -0,0 +1,27 @@
1
+ import { getAddress, type Address } from 'viem'
2
+
3
+ export type ApprovalDiff = {
4
+ added: Address[]
5
+ removed: Address[]
6
+ }
7
+
8
+ export function computeApprovalDiff(
9
+ beforeApproved: ReadonlyArray<{ address: string }>,
10
+ afterApproved: ReadonlyArray<{ address: string }>,
11
+ ): ApprovalDiff {
12
+ const before = new Set(beforeApproved.map(record => record.address.toLowerCase()))
13
+ const after = new Set(afterApproved.map(record => record.address.toLowerCase()))
14
+ const added: Address[] = []
15
+ const removed: Address[] = []
16
+ for (const record of afterApproved) {
17
+ if (!before.has(record.address.toLowerCase())) {
18
+ added.push(getAddress(record.address))
19
+ }
20
+ }
21
+ for (const record of beforeApproved) {
22
+ if (!after.has(record.address.toLowerCase())) {
23
+ removed.push(getAddress(record.address))
24
+ }
25
+ }
26
+ return { added, removed }
27
+ }
@@ -1,8 +1,8 @@
1
- import type { EthagentConfig, EthagentIdentity } from '../../storage/config.js'
2
- import { supportedErc8004ChainForId } from '../registry/erc8004.js'
3
- import { snapshotSaveRequiresOwnerSigner } from './effects/shared/snapshot.js'
4
- import type { IdentityHubInitialAction } from './types.js'
5
- import type { ProfileUpdates, Step } from './identityHubReducer.js'
1
+ import type { EthagentConfig, EthagentIdentity } from '../../../storage/config.js'
2
+ import { supportedErc8004ChainForId } from '../../registry/erc8004.js'
3
+ import { snapshotSaveRequiresOwnerSigner } from '../continuity/snapshot.js'
4
+ import type { IdentityHubInitialAction } from '../types.js'
5
+ import type { ProfileUpdates, Step } from '../identityHubReducer.js'
6
6
 
7
7
  const MIN_BUSY_ERROR_MS = 2000
8
8
 
@@ -1,16 +1,16 @@
1
1
  import React from 'react'
2
- import type { BrowserWalletReady } from '../../../wallet/browserWallet.js'
3
- import { supportedErc8004ChainForId } from '../../../registry/erc8004.js'
2
+ import type { BrowserWalletReady } from '../../wallet/browserWallet.js'
3
+ import { supportedErc8004ChainForId } from '../../registry/erc8004.js'
4
4
  import {
5
5
  runTokenTransferStorageSubmit,
6
6
  runTokenTransferTargetSubmit,
7
- } from '../../effects/token-transfer/runTokenTransfer.js'
7
+ } from './effects.js'
8
8
  import type {
9
9
  EffectCallbacks,
10
10
  TokenTransferProgress,
11
- } from '../../effects/types.js'
12
- import type { Step } from '../../identityHubReducer.js'
13
- import { BusyScreen } from '../../components/BusyScreen.js'
11
+ } from '../shared/effects/types.js'
12
+ import type { Step } from '../identityHubReducer.js'
13
+ import { BusyScreen } from '../shared/components/BusyScreen.js'
14
14
  import { RebackupStorageScreen } from '../continuity/RebackupStorageScreen.js'
15
15
  import {
16
16
  TokenTransferReadyScreen,
@@ -27,7 +27,7 @@ type TokenTransferStep = Extract<Step, {
27
27
  | 'token-transfer-ready'
28
28
  }>
29
29
 
30
- type IdentityHubTokenTransferFlowProps = {
30
+ type TokenTransferFlowProps = {
31
31
  step: TokenTransferStep
32
32
  callbacks: EffectCallbacks
33
33
  footer: React.ReactNode
@@ -45,7 +45,7 @@ export function isTokenTransferStep(step: Step): step is TokenTransferStep {
45
45
  || step.kind === 'token-transfer-ready'
46
46
  }
47
47
 
48
- export const IdentityHubTokenTransferFlow: React.FC<IdentityHubTokenTransferFlowProps> = ({
48
+ export const TokenTransferFlow: React.FC<TokenTransferFlowProps> = ({
49
49
  step,
50
50
  callbacks,
51
51
  footer,
@@ -1,19 +1,19 @@
1
1
  import React from 'react'
2
2
  import { Box, Text } from 'ink'
3
- import { Surface } from '../../../../ui/Surface.js'
4
- import { Select } from '../../../../ui/Select.js'
5
- import { Spinner } from '../../../../ui/Spinner.js'
6
- import { TextInput } from '../../../../ui/TextInput.js'
7
- import { theme } from '../../../../ui/theme.js'
8
- import { useAppInput } from '../../../../app/input/AppInputProvider.js'
9
- import { openExternalUrl } from '../../../../utils/openExternal.js'
10
- import type { EthagentIdentity } from '../../../../storage/config.js'
11
- import type { BrowserWalletReady } from '../../../wallet/browserWallet.js'
12
- import type { TokenTransferProgress } from '../../effects/types.js'
13
- import { readCustodyMode } from '../../model/custody.js'
14
- import { shortAddress, shortCid } from '../../model/format.js'
15
- import { FlowTimeline } from '../../components/FlowTimeline.js'
16
- import { OPEN_BROWSER_HINT } from '../../components/WalletApprovalScreen.js'
3
+ import { Surface } from '../../../ui/Surface.js'
4
+ import { Select } from '../../../ui/Select.js'
5
+ import { Spinner } from '../../../ui/Spinner.js'
6
+ import { TextInput } from '../../../ui/TextInput.js'
7
+ import { theme } from '../../../ui/theme.js'
8
+ import { useAppInput } from '../../../app/input/AppInputProvider.js'
9
+ import { openExternalUrl } from '../../../utils/openExternal.js'
10
+ import type { EthagentIdentity } from '../../../storage/config.js'
11
+ import type { BrowserWalletReady } from '../../wallet/browserWallet.js'
12
+ import type { TokenTransferProgress } from '../shared/effects/types.js'
13
+ import { readCustodyMode } from '../custody/state.js'
14
+ import { shortAddress, shortCid } from '../shared/model/format.js'
15
+ import { FlowTimeline } from '../shared/components/FlowTimeline.js'
16
+ import { OPEN_BROWSER_HINT } from '../shared/components/WalletApprovalScreen.js'
17
17
 
18
18
  const TRANSFER_STEPS = ['Choose Receiver', 'Sender Signs', 'Receiver Signs', 'Sender Updates URI', 'Transfer Token']
19
19
  const APPROVAL_GUARDRAIL = 'No approve(), setApprovalForAll(), transferFrom(), or token approval is requested.'
@@ -1,44 +1,44 @@
1
1
  import { getAddress, isAddress, type Address, type Hex } from 'viem'
2
- import type { EthagentIdentity } from '../../../../storage/config.js'
2
+ import type { EthagentIdentity } from '../../../storage/config.js'
3
3
  import {
4
4
  createTransferContinuitySnapshotChallenge,
5
5
  createTransferContinuitySnapshotEnvelope,
6
6
  serializeContinuitySnapshotEnvelope,
7
7
  transferSnapshotMetadataFromEnvelope,
8
- } from '../../../continuity/envelope.js'
8
+ } from '../../continuity/envelope.js'
9
9
  import {
10
10
  continuityAgentSnapshot,
11
11
  continuityVaultStatus,
12
12
  readContinuityFiles,
13
13
  readPublicSkillsFile,
14
14
  writePublicSkillsFile,
15
- } from '../../../continuity/storage.js'
15
+ } from '../../continuity/storage.js'
16
16
  import {
17
17
  createAgentCard,
18
18
  defaultPublicSkillsProfile,
19
19
  serializeAgentCard,
20
- } from '../../../continuity/publicSkills.js'
21
- import { recordPublishedContinuitySnapshot } from '../../../continuity/snapshots.js'
22
- import { addToIpfs, DEFAULT_IPFS_API_URL, isPinataUploadUrl } from '../../../storage/ipfs.js'
20
+ } from '../../continuity/publicSkills.js'
21
+ import { recordPublishedContinuitySnapshot } from '../../continuity/snapshots.js'
22
+ import { addToIpfs, DEFAULT_IPFS_API_URL, isPinataUploadUrl } from '../../storage/ipfs.js'
23
23
  import {
24
24
  createErc8004PublicClient,
25
25
  encodeSetAgentUri,
26
26
  preflightSetAgentUri,
27
27
  withEthagentPointers,
28
- } from '../../../registry/erc8004.js'
29
- import { resolveValidatedPinataJwt, savePinataJwt } from '../../../storage/pinataJwt.js'
30
- import { openBrowserWalletSession } from '../../../wallet/browserWallet.js'
31
- import { resolveEnsAddress } from '../../../ens/ensLookup.js'
32
- import type { Step } from '../../identityHubReducer.js'
33
- import type { EffectCallbacks } from '../types.js'
34
- import { awaitConfirmedReceipt } from '../receipts.js'
28
+ } from '../../registry/erc8004.js'
29
+ import { resolveValidatedPinataJwt, savePinataJwt } from '../../storage/pinataJwt.js'
30
+ import { openBrowserWalletSession } from '../../wallet/browserWallet.js'
31
+ import { resolveEnsAddress } from '../../ens/ensLookup.js'
32
+ import type { Step } from '../identityHubReducer.js'
33
+ import type { EffectCallbacks } from '../shared/effects/types.js'
34
+ import { awaitConfirmedReceipt } from '../shared/effects/receipts.js'
35
35
  import {
36
36
  assertVerifiedPin,
37
37
  deriveAgentName,
38
- } from '../shared/profilePrep.js'
39
- import { operatorsPointerFromState } from '../shared/snapshot.js'
38
+ } from '../shared/effects/profilePrep.js'
39
+ import { operatorsPointerFromState } from '../continuity/snapshot.js'
40
40
  import { tokenTransferProgressForPhase } from './progress.js'
41
- import { assertTokenNotInVault } from '../vault/preflight.js'
41
+ import { assertTokenNotInVault } from '../custody/preflight.js'
42
42
 
43
43
  type BackupMetadata = NonNullable<EthagentIdentity['backup']>
44
44
  type PublicSkillsMetadata = NonNullable<EthagentIdentity['publicSkills']>
@@ -1,5 +1,5 @@
1
1
  import { getAddress } from 'viem'
2
- import type { TokenTransferProgress } from '../types.js'
2
+ import type { TokenTransferProgress } from '../shared/effects/types.js'
3
3
 
4
4
  export function tokenTransferProgressForPhase(
5
5
  phase: TokenTransferProgress['phase'],
@@ -11,35 +11,35 @@ import {
11
11
  import {
12
12
  assertTokenNotInVault,
13
13
  TokenInVaultError,
14
- } from './effects/vault/preflight.js'
14
+ } from './custody/preflight.js'
15
15
  import {
16
16
  runPublicProfilePreflight,
17
- } from './effects/publicProfile/runPublicProfileSave.js'
17
+ } from './profile/effects.js'
18
18
  import {
19
19
  runRebackupPreflight,
20
- } from './effects/rebackup/runRebackup.js'
20
+ } from './continuity/effects.js'
21
21
  import type {
22
22
  EffectCallbacks,
23
23
  IdentityCompletionSource,
24
24
  RestoreProgress,
25
25
  TokenTransferProgress,
26
- } from './effects/types.js'
27
- import { resolveVaultAddress } from './flows/custody/custodyEffects.js'
28
- import { useCustodyFlow } from './flows/custody/useCustodyFlow.js'
29
- import { identityHubErrorView } from './model/errors.js'
30
- import { readCustodyMode } from './model/custody.js'
31
- import { selectEnsStatus } from './model/ens.js'
26
+ } from './shared/effects/types.js'
27
+ import { resolveVaultAddress } from './custody/transactions.js'
28
+ import { useCustodyFlow } from './custody/useCustodyFlow.js'
29
+ import { identityHubErrorView } from './shared/model/errors.js'
30
+ import { readCustodyMode } from './custody/state.js'
31
+ import { selectEnsStatus } from './ens/state.js'
32
32
  import { identityHubReducer, type ProfileUpdates, type Step } from './identityHubReducer.js'
33
33
  import type { IdentityHubProps } from './types.js'
34
34
  import {
35
35
  capitalizeFeedbackMessage,
36
36
  initialStepForAction,
37
37
  isWalletCancelled,
38
- } from './utils.js'
38
+ } from './shared/utils.js'
39
39
  import {
40
40
  preflightTokenOwnership,
41
41
  useAgentReconciliation,
42
- } from './reconciliation/index.js'
42
+ } from './shared/reconciliation/index.js'
43
43
  import { useIdentityHubContinuity } from './useIdentityHubContinuity.js'
44
44
  import { useIdentityHubSideEffects } from './useIdentityHubSideEffects.js'
45
45
 
@@ -1,36 +1,36 @@
1
1
  import { useEffect } from 'react'
2
2
  import type { EthagentConfig } from '../../storage/config.js'
3
3
  import { setTokenIdentity } from '../../storage/identity.js'
4
- import { isRegistrationPreflightError, pinataErrorText } from './model/errors.js'
4
+ import { isRegistrationPreflightError, pinataErrorText } from './shared/model/errors.js'
5
5
  import type { ProfileUpdates, Step } from './identityHubReducer.js'
6
6
  import {
7
7
  runCreatePreflight,
8
8
  runCreateSigning,
9
- } from './effects/create.js'
9
+ } from './create/effects.js'
10
10
  import {
11
11
  runRebackupSigning,
12
- } from './effects/rebackup/runRebackup.js'
12
+ } from './continuity/effects.js'
13
13
  import {
14
14
  runPublicProfileSigning,
15
- } from './effects/publicProfile/runPublicProfileSave.js'
15
+ } from './profile/effects.js'
16
16
  import {
17
17
  runTokenTransferSigning,
18
- } from './effects/token-transfer/runTokenTransfer.js'
18
+ } from './transfer/effects.js'
19
19
  import {
20
20
  runEnsSetupRecordsTransaction,
21
21
  runEnsSetupRegistryTransaction,
22
22
  runUpdateEnsRecords,
23
- } from './effects/ens/index.js'
23
+ } from './ens/index.js'
24
24
  import {
25
25
  runRecoveryRefetch,
26
- } from './effects/restore/index.js'
27
- import type { EffectCallbacks } from './effects/types.js'
28
- import { useRestoreFlowEffects } from './flows/restore/useRestoreFlowEffects.js'
26
+ } from './restore/index.js'
27
+ import type { EffectCallbacks } from './shared/effects/types.js'
28
+ import { useRestoreEffects } from './restore/useRestoreEffects.js'
29
29
  import {
30
30
  isStorageError,
31
31
  isWalletCancelled,
32
32
  waitForMinimumBusyTime,
33
- } from './utils.js'
33
+ } from './shared/utils.js'
34
34
 
35
35
  type TriggerRebackup = (
36
36
  backStep: Step,
@@ -104,7 +104,7 @@ export function useIdentityHubSideEffects({
104
104
  return () => { cancelled = true }
105
105
  }, [step])
106
106
 
107
- useRestoreFlowEffects({ step, config, callbacks, handleStepError })
107
+ useRestoreEffects({ step, config, callbacks, handleStepError })
108
108
 
109
109
  useEffect(() => {
110
110
  if (step.kind !== 'rebackup-signing') return
@@ -27,9 +27,6 @@ export type WalletPurpose =
27
27
  | 'set-agent-ens-records'
28
28
  | 'update-operators'
29
29
  | 'operator-proof'
30
- | 'authorize-operator-wallet-resolver'
31
- | 'revoke-operator-wallet-resolver'
32
- | 'reconcile-resolver-approvals'
33
30
  | 'sync-operator-vault'
34
31
  | 'refetch-snapshot'
35
32
  | 'prepare-transfer-sender'
@@ -41,8 +38,6 @@ export type WalletPurpose =
41
38
  | 'rotate-agent-uri-vault-owner'
42
39
  | 'rotate-agent-uri-vault-operator'
43
40
  | 'withdraw-vault'
44
- | 'register-root-commit'
45
- | 'register-root-tx'
46
41
  | 'delete-ens-subdomain'
47
42
 
48
43
  export type SignatureRequest = {
@@ -123,7 +123,7 @@ export const PURPOSE_COPY: Record<string, PurposeCopyEntry> = {
123
123
  flowTitle: "Operator Wallet Profile Update",
124
124
  sign: { text: "Sign With Operator Wallet", hint: "Signs the encrypted snapshot for restore access." },
125
125
  prepare: { text: "Preparing Profile Update...", hint: "Keep this page open." },
126
- transaction: { text: "Use Operator Wallet", hint: "Publishes the updated agent-card pointer to the ENS profile record on Ethereum Mainnet." },
126
+ transaction: { text: "Use Operator Wallet", hint: "Rotates the agent URI through the Vault. No ENS write." },
127
127
  },
128
128
  "update-profile-connected": {
129
129
  flowTitle: "Update Public Profile",
@@ -178,21 +178,6 @@ export const PURPOSE_COPY: Record<string, PurposeCopyEntry> = {
178
178
  sign: { text: "Sign With Operator Wallet", hint: "Creates restore access. No token approval." },
179
179
  prepare: { text: "Verifying Operator Wallet...", hint: "Return to the terminal." },
180
180
  },
181
- "authorize-operator-wallet-resolver": {
182
- flowTitle: "Owner Wallet Required",
183
- prepare: { text: "Preparing Resolver Approval...", hint: "Keep this page open." },
184
- transaction: { text: "Use Owner Wallet", hint: "Approves the operator wallet to write ENS records for this name. No token approval." },
185
- },
186
- "revoke-operator-wallet-resolver": {
187
- flowTitle: "Owner Wallet Required",
188
- prepare: { text: "Preparing Resolver Revocation...", hint: "Keep this page open." },
189
- transaction: { text: "Use Owner Wallet", hint: "Revokes the operator wallet's ENS record write access for this name." },
190
- },
191
- "reconcile-resolver-approvals": {
192
- flowTitle: "Owner Wallet Required",
193
- prepare: { text: "Preparing Records Fix...", hint: "Keep this page open." },
194
- transaction: { text: "Use Owner Wallet", hint: "Brings ENS resolver approvals in sync with the authorized operator wallet list." },
195
- },
196
181
  "sync-operator-vault": {
197
182
  flowTitle: "Owner Wallet Required",
198
183
  prepare: { text: "Preparing Vault Operator Update...", hint: "Keep this page open." },
@@ -253,18 +238,6 @@ export const PURPOSE_COPY: Record<string, PurposeCopyEntry> = {
253
238
  transaction: { text: "Use Owner Wallet", hint: "Temporarily returns the agent token from the vault to your owner wallet. Vault stays configured so you can redeposit later." },
254
239
  errorContext: "While submitting the Vault withdraw",
255
240
  },
256
- "register-root-commit": {
257
- flowTitle: "Commit ENS Name",
258
- prepare: { text: "Preparing ENS Commit...", hint: "Keep this page open." },
259
- transaction: { text: "Use Connected Wallet", hint: "Submits an ENS commitment, the first of two transactions. The actual registration runs about 60 seconds later." },
260
- errorContext: "While committing the ENS name registration",
261
- },
262
- "register-root-tx": {
263
- flowTitle: "Register ENS Name",
264
- prepare: { text: "Preparing ENS Registration...", hint: "Keep this page open." },
265
- transaction: { text: "Use Connected Wallet", hint: "Pays the 1-year rent and registers the name. The connected wallet becomes the owner." },
266
- errorContext: "While registering the ENS name",
267
- },
268
241
  "delete-ens-subdomain": {
269
242
  flowTitle: "Delete ENS Subdomain",
270
243
  prepare: { text: "Preparing Subdomain Deletion...", hint: "Keep this page open." },
@@ -301,9 +274,6 @@ export const ENS_PURPOSES: ReadonlySet<string> = new Set([
301
274
  "set-agent-ens-records",
302
275
  "update-ens-records",
303
276
  "clear-ens-records",
304
- "authorize-operator-wallet-resolver",
305
- "revoke-operator-wallet-resolver",
306
- "reconcile-resolver-approvals",
307
277
  ]);
308
278
  export function isEnsPurpose(purpose: string | undefined): boolean {
309
279
  return !!purpose && ENS_PURPOSES.has(purpose);
@@ -9,8 +9,6 @@ export const LEGACY_WALLET_PURPOSE_ALIASES: Record<string, string> = {
9
9
  [legacyWalletPurpose('connect', legacyOperatorRole)]: 'connect-operator-wallet',
10
10
  [legacyWalletPurpose('restore', legacyOwnerRole)]: 'restore-owner-wallet',
11
11
  [legacyWalletPurpose('restore', legacyOperatorRole)]: 'restore-operator-wallet',
12
- [legacyWalletPurpose('authorize', legacyOperatorRole, 'wallet-resolver')]: 'authorize-operator-wallet-resolver',
13
- [legacyWalletPurpose('revoke', legacyOperatorRole, 'wallet-resolver')]: 'revoke-operator-wallet-resolver',
14
12
  }
15
13
 
16
14
  export function normalizeWalletPurposeValue(value: unknown): string | undefined {