ethagent 3.3.3 → 4.0.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 (322) hide show
  1. package/.claude-plugin/marketplace.json +11 -0
  2. package/.claude-plugin/plugin.json +35 -0
  3. package/LICENSE +1 -1
  4. package/README.md +64 -104
  5. package/commands/ethagent.md +40 -0
  6. package/package.json +16 -16
  7. package/src/app/keybindings/KeybindingProvider.tsx +1 -6
  8. package/src/app/keybindings/types.ts +1 -6
  9. package/src/cli/ResetConfirmView.tsx +54 -53
  10. package/src/cli/demo.ts +86 -0
  11. package/src/cli/hookIo.ts +45 -0
  12. package/src/cli/main.tsx +94 -123
  13. package/src/cli/memoryGuard.ts +49 -0
  14. package/src/cli/reset.ts +28 -70
  15. package/src/cli/sessionStart.ts +33 -0
  16. package/src/cli/status.ts +46 -0
  17. package/src/cli/sync.ts +167 -0
  18. package/src/cli/syncAdapters/claude-code.ts +86 -0
  19. package/src/cli/syncAdapters/codex.ts +66 -0
  20. package/src/cli/syncAdapters/index.ts +45 -0
  21. package/src/cli/syncAdapters/managedBlock.ts +175 -0
  22. package/src/cli/syncAdapters/shared.ts +63 -0
  23. package/src/identity/continuity/envelopeParse.ts +20 -1
  24. package/src/identity/continuity/publicSkills.ts +3 -1
  25. package/src/identity/continuity/skills/publicSkillsSync.ts +2 -1
  26. package/src/identity/continuity/skills/scaffold.ts +5 -2
  27. package/src/identity/continuity/snapshots.ts +12 -5
  28. package/src/identity/continuity/storage/defaults.ts +20 -19
  29. package/src/identity/continuity/storage/status.ts +1 -1
  30. package/src/identity/ens/ensLookup/constants.ts +1 -1
  31. package/src/identity/manager/IdentityManager.tsx +33 -0
  32. package/src/identity/{hub → manager}/OperationalRoutes.tsx +37 -18
  33. package/src/identity/{hub → manager}/Routes.tsx +48 -34
  34. package/src/identity/{hub → manager}/continuity/ContinuityDashboardScreen.tsx +9 -19
  35. package/src/identity/{hub → manager}/continuity/RebackupStorageScreen.tsx +3 -3
  36. package/src/identity/manager/continuity/RecoveryConfirmScreen.tsx +102 -0
  37. package/src/identity/{hub → manager}/continuity/SavePromptScreen.tsx +2 -3
  38. package/src/identity/{hub → manager}/continuity/completion.ts +1 -1
  39. package/src/identity/{hub → manager}/continuity/effects.ts +1 -1
  40. package/src/identity/{hub → manager}/continuity/skills/DeleteSkillConfirmScreen.tsx +2 -2
  41. package/src/identity/{hub → manager}/continuity/skills/NewSkillScreen.tsx +0 -5
  42. package/src/identity/{hub → manager}/continuity/skills/NewSkillVisibilityScreen.tsx +4 -4
  43. package/src/identity/{hub → manager}/continuity/skills/SkillActionsScreen.tsx +6 -22
  44. package/src/identity/{hub → manager}/continuity/skills/SkillsTreeScreen.tsx +5 -17
  45. package/src/identity/{hub → manager}/continuity/snapshot.ts +1 -1
  46. package/src/identity/{hub → manager}/continuity/vault.ts +1 -1
  47. package/src/identity/{hub → manager}/create/CreateFlow.tsx +59 -32
  48. package/src/identity/{hub → manager}/create/effects.ts +19 -10
  49. package/src/identity/manager/create/importScan.ts +122 -0
  50. package/src/identity/{hub → manager}/custody/CustodyEditFlow.tsx +17 -61
  51. package/src/identity/{hub → manager}/custody/actions.ts +1 -15
  52. package/src/identity/{hub → manager}/custody/routes.tsx +20 -40
  53. package/src/identity/{hub → manager}/custody/transactions.ts +1 -0
  54. package/src/identity/{hub → manager}/custody/types.ts +1 -2
  55. package/src/identity/{hub → manager}/custody/useCustodyEffects.ts +1 -1
  56. package/src/identity/{hub → manager}/ens/EnsEditAdvancedScreens.tsx +2 -2
  57. package/src/identity/{hub → manager}/ens/EnsEditMaintenanceScreens.tsx +12 -23
  58. package/src/identity/{hub → manager}/ens/EnsEditReviewScreens.tsx +18 -42
  59. package/src/identity/{hub → manager}/ens/EnsEditRunners.tsx +1 -1
  60. package/src/identity/{hub → manager}/ens/EnsEditShared.tsx +0 -2
  61. package/src/identity/{hub → manager}/ens/EnsEditSimpleScreens.tsx +10 -19
  62. package/src/identity/{hub → manager}/ens/EnsFlow.tsx +133 -41
  63. package/src/identity/{hub → manager}/ens/EnsOperatorWalletsScreen.tsx +14 -19
  64. package/src/identity/{hub → manager}/ens/editCopy.ts +1 -14
  65. package/src/identity/{hub → manager}/profile/EditProfileFlow.tsx +99 -66
  66. package/src/identity/{hub → manager}/profile/effects.ts +1 -3
  67. package/src/identity/{hub → manager}/profile/operatorSave.ts +1 -1
  68. package/src/identity/{hub → manager}/profile/state.ts +1 -1
  69. package/src/identity/{hub/identityHubReducer.ts → manager/reducer.ts} +25 -26
  70. package/src/identity/{hub → manager}/restore/RestoreFlow.tsx +16 -24
  71. package/src/identity/{hub → manager}/restore/apply.ts +1 -1
  72. package/src/identity/{hub → manager}/restore/auth.ts +1 -1
  73. package/src/identity/{hub → manager}/restore/discover.ts +1 -1
  74. package/src/identity/{hub → manager}/restore/fetch.ts +1 -1
  75. package/src/identity/{hub → manager}/restore/restoreAdmin.ts +1 -1
  76. package/src/identity/{hub → manager}/restore/useRestoreEffects.ts +2 -9
  77. package/src/identity/{hub → manager}/settings/StorageCredentialScreen.tsx +10 -25
  78. package/src/identity/{hub → manager}/shared/components/DetailsScreen.tsx +5 -7
  79. package/src/identity/{hub → manager}/shared/components/ErrorScreen.tsx +6 -10
  80. package/src/identity/{hub → manager}/shared/components/FlowTimeline.tsx +4 -3
  81. package/src/identity/{hub → manager}/shared/components/IdentitySummary.tsx +19 -59
  82. package/src/identity/manager/shared/components/LazyMenu.tsx +147 -0
  83. package/src/identity/manager/shared/components/MenuScreen.tsx +220 -0
  84. package/src/identity/manager/shared/components/OperationCompleteScreen.tsx +28 -0
  85. package/src/identity/{hub → manager}/shared/components/UnlinkedIdentityScreen.tsx +9 -10
  86. package/src/identity/{hub → manager}/shared/components/WalletApprovalScreen.tsx +1 -2
  87. package/src/identity/manager/shared/components/Wordmark.tsx +54 -0
  88. package/src/identity/{hub → manager}/shared/components/menuFlagsFromReconciliation.ts +39 -15
  89. package/src/identity/{hub → manager}/shared/effects/profilePrep.ts +1 -1
  90. package/src/identity/manager/shared/effects/types.ts +30 -0
  91. package/src/identity/{hub → manager}/shared/model/copy.ts +0 -4
  92. package/src/identity/{hub → manager}/shared/model/errors.ts +32 -3
  93. package/src/identity/{hub → manager}/shared/model/network.ts +2 -2
  94. package/src/identity/{hub → manager}/shared/reconciliation/agentReconciliation/hook.ts +5 -0
  95. package/src/identity/{hub → manager}/shared/reconciliation/agentReconciliation/run.ts +1 -1
  96. package/src/identity/{hub/shared/reconciliation/useAgentReconciliation.ts → manager/shared/reconciliation/index.ts} +6 -0
  97. package/src/identity/{hub → manager}/shared/utils.ts +6 -10
  98. package/src/identity/{hub → manager}/transfer/TokenTransferFlow.tsx +3 -3
  99. package/src/identity/{hub → manager}/transfer/TokenTransferScreens.tsx +4 -10
  100. package/src/identity/{hub → manager}/transfer/effects.ts +1 -1
  101. package/src/identity/{hub → manager}/types.ts +5 -6
  102. package/src/identity/{hub/useIdentityHubContinuity.ts → manager/useContinuity.ts} +59 -27
  103. package/src/identity/{hub/useIdentityHubController.ts → manager/useController.ts} +38 -35
  104. package/src/identity/{hub/useIdentityHubSideEffects.ts → manager/useSideEffects.ts} +40 -4
  105. package/src/identity/registry/erc8004/discovery.ts +3 -17
  106. package/src/identity/registry/erc8004/utils.ts +1 -1
  107. package/src/identity/storage/ipfs.ts +21 -1
  108. package/src/identity/wallet/browserWallet/html.ts +10 -2
  109. package/src/identity/wallet/browserWallet/http.ts +18 -0
  110. package/src/identity/wallet/browserWallet/requestServer.ts +5 -1
  111. package/src/identity/wallet/browserWallet/requests.ts +10 -28
  112. package/src/identity/wallet/browserWallet/session.ts +26 -33
  113. package/src/identity/wallet/browserWallet/validation.ts +14 -0
  114. package/src/identity/wallet/browserWallet/walletPageSource.ts +22 -40
  115. package/src/identity/wallet/page/boot.ts +43 -0
  116. package/src/identity/wallet/page/config.ts +59 -0
  117. package/src/identity/wallet/page/constants.ts +12 -0
  118. package/src/identity/wallet/page/copy.ts +47 -68
  119. package/src/identity/wallet/page/css.ts +638 -0
  120. package/src/identity/wallet/page/{errorView.ts → errors.ts} +5 -14
  121. package/src/identity/wallet/page/{controller.ts → flow.ts} +4 -71
  122. package/src/identity/wallet/page/markup.ts +44 -34
  123. package/src/identity/wallet/page/{walletProvider.ts → provider.ts} +0 -3
  124. package/src/identity/wallet/page/resize.ts +95 -0
  125. package/src/identity/wallet/page/state.ts +135 -8
  126. package/src/identity/wallet/page/timeline.ts +161 -0
  127. package/src/identity/wallet/page/view.ts +22 -302
  128. package/src/storage/config.ts +30 -80
  129. package/src/storage/reset.ts +31 -0
  130. package/src/storage/secrets.ts +1 -16
  131. package/src/ui/Select.tsx +27 -5
  132. package/src/ui/Spinner.tsx +16 -15
  133. package/src/ui/Surface.tsx +21 -17
  134. package/src/ui/TextArea.tsx +173 -0
  135. package/src/ui/TextInput.tsx +31 -133
  136. package/src/ui/theme.ts +22 -13
  137. package/src/utils/clipboard.ts +0 -140
  138. package/src/app/FirstRun.tsx +0 -577
  139. package/src/app/FirstRunTimeline.tsx +0 -51
  140. package/src/app/firstRunConfig.ts +0 -26
  141. package/src/app/hooks/useCancelRequest.ts +0 -22
  142. package/src/app/hooks/useDoublePress.ts +0 -46
  143. package/src/app/hooks/useExitOnCtrlC.ts +0 -36
  144. package/src/auth/openaiOAuth/credentials.ts +0 -47
  145. package/src/auth/openaiOAuth/crypto.ts +0 -23
  146. package/src/auth/openaiOAuth/index.ts +0 -238
  147. package/src/auth/openaiOAuth/landingPage.ts +0 -116
  148. package/src/auth/openaiOAuth/listener.ts +0 -151
  149. package/src/auth/openaiOAuth/refresh.ts +0 -70
  150. package/src/auth/openaiOAuth/shared.ts +0 -115
  151. package/src/chat/ChatBottomPane.tsx +0 -296
  152. package/src/chat/ChatScreen.tsx +0 -1685
  153. package/src/chat/ConversationStack.tsx +0 -56
  154. package/src/chat/MessageList.tsx +0 -638
  155. package/src/chat/SessionStatus.tsx +0 -53
  156. package/src/chat/chatEnvironment.ts +0 -16
  157. package/src/chat/chatScreenUtils.ts +0 -194
  158. package/src/chat/chatSessionState.ts +0 -146
  159. package/src/chat/chatTurnContext.ts +0 -50
  160. package/src/chat/chatTurnOrchestrator.ts +0 -603
  161. package/src/chat/chatTurnRows.ts +0 -64
  162. package/src/chat/commands.ts +0 -494
  163. package/src/chat/continuityEditReview.ts +0 -42
  164. package/src/chat/display/DiffView.tsx +0 -193
  165. package/src/chat/display/SyntaxText.tsx +0 -192
  166. package/src/chat/display/toolCallDisplay.ts +0 -103
  167. package/src/chat/display/toolResultDisplay.ts +0 -19
  168. package/src/chat/input/ChatInput.tsx +0 -625
  169. package/src/chat/input/chatInputHelpers.ts +0 -62
  170. package/src/chat/input/chatInputState.ts +0 -247
  171. package/src/chat/input/chatPaste.ts +0 -49
  172. package/src/chat/input/imageRefs.ts +0 -30
  173. package/src/chat/input/inputRendering.tsx +0 -93
  174. package/src/chat/input/textCursor.ts +0 -212
  175. package/src/chat/messageMarkdown.ts +0 -220
  176. package/src/chat/messageRows.ts +0 -43
  177. package/src/chat/planImplementation.ts +0 -62
  178. package/src/chat/slashCommandHandlers.ts +0 -122
  179. package/src/chat/slashCommandViews.ts +0 -120
  180. package/src/chat/transcript/TranscriptView.tsx +0 -184
  181. package/src/chat/transcript/transcriptViewport.ts +0 -295
  182. package/src/chat/views/ContextLimitView.tsx +0 -95
  183. package/src/chat/views/ContinuityEditReviewView.tsx +0 -50
  184. package/src/chat/views/CopyPicker.tsx +0 -50
  185. package/src/chat/views/PermissionPrompt.tsx +0 -156
  186. package/src/chat/views/PermissionsView.tsx +0 -165
  187. package/src/chat/views/PlanApprovalView.tsx +0 -91
  188. package/src/chat/views/ResumeView.tsx +0 -273
  189. package/src/chat/views/RewindView.tsx +0 -412
  190. package/src/cli/preview.tsx +0 -14
  191. package/src/cli/updateNotice.ts +0 -54
  192. package/src/identity/continuity/privateEdit/apply.ts +0 -170
  193. package/src/identity/continuity/privateEdit/diff.ts +0 -6
  194. package/src/identity/continuity/privateEdit/files.ts +0 -23
  195. package/src/identity/continuity/privateEdit/types.ts +0 -28
  196. package/src/identity/continuity/privateEdit.ts +0 -46
  197. package/src/identity/hub/IdentityHub.tsx +0 -14
  198. package/src/identity/hub/continuity/RecoveryConfirmScreen.tsx +0 -104
  199. package/src/identity/hub/ens/effects.ts +0 -218
  200. package/src/identity/hub/shared/components/MenuScreen.tsx +0 -241
  201. package/src/identity/hub/shared/effects/types.ts +0 -53
  202. package/src/identity/hub/shared/reconciliation/index.ts +0 -14
  203. package/src/identity/wallet/page/grainient.ts +0 -278
  204. package/src/identity/wallet/page/html.ts +0 -28
  205. package/src/identity/wallet/page/styles/base.ts +0 -259
  206. package/src/identity/wallet/page/styles/components.ts +0 -262
  207. package/src/identity/wallet/page/styles/index.ts +0 -5
  208. package/src/identity/wallet/page/styles/responsive.ts +0 -247
  209. package/src/identity/wallet/page.tsx +0 -38
  210. package/src/mcp/approvals.ts +0 -113
  211. package/src/mcp/config.ts +0 -235
  212. package/src/mcp/manager.ts +0 -482
  213. package/src/mcp/managerHelpers.ts +0 -70
  214. package/src/mcp/names.ts +0 -19
  215. package/src/mcp/output.ts +0 -96
  216. package/src/models/ModelPicker.tsx +0 -1009
  217. package/src/models/catalog.ts +0 -327
  218. package/src/models/huggingface.ts +0 -712
  219. package/src/models/huggingfaceStorage.ts +0 -136
  220. package/src/models/llamacpp.ts +0 -848
  221. package/src/models/llamacppCommands.ts +0 -44
  222. package/src/models/llamacppConfig.ts +0 -34
  223. package/src/models/llamacppDiscovery.ts +0 -176
  224. package/src/models/llamacppOutput.ts +0 -65
  225. package/src/models/llamacppPreflight.ts +0 -158
  226. package/src/models/modelDisplay.ts +0 -180
  227. package/src/models/modelPickerCatalogFlow.ts +0 -56
  228. package/src/models/modelPickerCredentials.ts +0 -166
  229. package/src/models/modelPickerData.ts +0 -41
  230. package/src/models/modelPickerDisplay.tsx +0 -132
  231. package/src/models/modelPickerHfFlow.ts +0 -192
  232. package/src/models/modelPickerLocalRunnerFlow.ts +0 -115
  233. package/src/models/modelPickerOptions.ts +0 -457
  234. package/src/models/modelPickerTypes.ts +0 -69
  235. package/src/models/modelPickerUninstallFlow.ts +0 -48
  236. package/src/models/modelPickerViewHelpers.ts +0 -174
  237. package/src/models/modelRecommendation.ts +0 -139
  238. package/src/models/providerDisplay.ts +0 -16
  239. package/src/models/runtimeDetection.ts +0 -81
  240. package/src/models/uncensoredCatalog.ts +0 -86
  241. package/src/providers/anthropic.ts +0 -290
  242. package/src/providers/contracts.ts +0 -71
  243. package/src/providers/errors.ts +0 -80
  244. package/src/providers/gemini.ts +0 -391
  245. package/src/providers/openai-chat.ts +0 -474
  246. package/src/providers/openai-responses-format.ts +0 -177
  247. package/src/providers/openai-responses.ts +0 -306
  248. package/src/providers/openaiChatWire.ts +0 -124
  249. package/src/providers/registry.ts +0 -120
  250. package/src/providers/retry.ts +0 -58
  251. package/src/providers/sse.ts +0 -93
  252. package/src/runtime/compaction.ts +0 -395
  253. package/src/runtime/cwd.ts +0 -43
  254. package/src/runtime/providerTurn.ts +0 -38
  255. package/src/runtime/sessionMode.ts +0 -55
  256. package/src/runtime/systemPrompt.ts +0 -213
  257. package/src/runtime/textToolParser.ts +0 -161
  258. package/src/runtime/toolClaimGuards.ts +0 -143
  259. package/src/runtime/toolExecution.ts +0 -304
  260. package/src/runtime/toolIntent.ts +0 -143
  261. package/src/runtime/turn.ts +0 -369
  262. package/src/runtime/turnNudges.ts +0 -223
  263. package/src/runtime/turnTypes.ts +0 -86
  264. package/src/storage/factoryReset.ts +0 -127
  265. package/src/storage/history.ts +0 -58
  266. package/src/storage/permissions.ts +0 -76
  267. package/src/storage/rewind.ts +0 -266
  268. package/src/storage/sessionExport.ts +0 -49
  269. package/src/storage/sessions.ts +0 -495
  270. package/src/tools/bashSafety.ts +0 -186
  271. package/src/tools/bashTool.ts +0 -140
  272. package/src/tools/changeDirectoryTool.ts +0 -213
  273. package/src/tools/contracts.ts +0 -192
  274. package/src/tools/deleteFileTool.ts +0 -116
  275. package/src/tools/editTool.ts +0 -165
  276. package/src/tools/editUtils.ts +0 -170
  277. package/src/tools/fileDiff.ts +0 -261
  278. package/src/tools/listDirectoryTool.ts +0 -55
  279. package/src/tools/listSkillFilesTool.ts +0 -77
  280. package/src/tools/listSkillsTool.ts +0 -68
  281. package/src/tools/mcpResourceTools.ts +0 -95
  282. package/src/tools/permissionRules.ts +0 -85
  283. package/src/tools/privateContinuityEditTool.ts +0 -187
  284. package/src/tools/privateContinuityReadTool.ts +0 -106
  285. package/src/tools/readSkillTool.ts +0 -107
  286. package/src/tools/readTool.ts +0 -85
  287. package/src/tools/registry.ts +0 -103
  288. package/src/tools/writeFileTool.ts +0 -167
  289. package/src/ui/BrandSplash.tsx +0 -133
  290. package/src/ui/terminalTitle.ts +0 -30
  291. package/src/utils/images.ts +0 -140
  292. package/src/utils/markdownSegments.ts +0 -51
  293. package/src/utils/messages.ts +0 -37
  294. package/src/utils/withRetry.ts +0 -324
  295. /package/src/identity/{hub → manager}/continuity/state.ts +0 -0
  296. /package/src/identity/{hub → manager}/custody/helpers.ts +0 -0
  297. /package/src/identity/{hub → manager}/custody/preflight.ts +0 -0
  298. /package/src/identity/{hub → manager}/custody/state.ts +0 -0
  299. /package/src/identity/{hub → manager}/custody/useCustodyFlow.tsx +0 -0
  300. /package/src/identity/{hub → manager}/ens/EnsEditFlow.tsx +0 -0
  301. /package/src/identity/{hub → manager}/ens/advancedEnsValidation.ts +0 -0
  302. /package/src/identity/{hub → manager}/ens/state.ts +0 -0
  303. /package/src/identity/{hub → manager}/ens/transactions.ts +0 -0
  304. /package/src/identity/{hub → manager}/ens/types.ts +0 -0
  305. /package/src/identity/{hub → manager}/profile/identity.ts +0 -0
  306. /package/src/identity/{hub → manager}/restore/envelopes.ts +0 -0
  307. /package/src/identity/{hub → manager}/restore/helpers.ts +0 -0
  308. /package/src/identity/{hub → manager}/restore/recovery.ts +0 -0
  309. /package/src/identity/{hub → manager}/restore/resolve.ts +0 -0
  310. /package/src/identity/{hub → manager}/shared/components/BusyScreen.tsx +0 -0
  311. /package/src/identity/{hub → manager}/shared/components/NetworkScreen.tsx +0 -0
  312. /package/src/identity/{hub → manager}/shared/components/PinataJwtInput.tsx +0 -0
  313. /package/src/identity/{hub → manager}/shared/effects/receipts.ts +0 -0
  314. /package/src/identity/{hub → manager}/shared/effects/sync.ts +0 -0
  315. /package/src/identity/{hub → manager}/shared/model/format.ts +0 -0
  316. /package/src/identity/{hub → manager}/shared/operatorWallets.ts +0 -0
  317. /package/src/identity/{hub → manager}/shared/reconciliation/agentReconciliation/ownership.ts +0 -0
  318. /package/src/identity/{hub → manager}/shared/reconciliation/agentReconciliation/types.ts +0 -0
  319. /package/src/identity/{hub → manager}/shared/reconciliation/walletSetup.ts +0 -0
  320. /package/src/identity/{hub → manager}/shared/txGuard.ts +0 -0
  321. /package/src/identity/{hub → manager}/transfer/progress.ts +0 -0
  322. /package/src/identity/{hub → manager}/transfer/state.ts +0 -0
@@ -1,107 +0,0 @@
1
- import path from 'node:path'
2
- import { z } from 'zod'
3
- import {
4
- continuityVaultRef,
5
- } from '../identity/continuity/storage.js'
6
- import {
7
- readSkill,
8
- readSkillFile,
9
- } from '../identity/continuity/skills/loadSkills.js'
10
- import type { Tool } from './contracts.js'
11
-
12
- const schema = z.object({
13
- name: z.string().min(1),
14
- file: z.string().min(1).optional(),
15
- })
16
-
17
- export const readSkillTool: Tool<typeof schema> = {
18
- name: 'read_private_skill',
19
- kind: 'private-continuity-read',
20
- readOnly: true,
21
- description: [
22
- 'Read a file from the owner-authored private skill folder for the active identity.',
23
- 'Pass the skill folder name as `name` (e.g. "writing-obit"). Without `file`, returns the SKILL.md entry point.',
24
- 'With `file`, returns a supporting file from the same folder (e.g. file: "references/api.md"). Supporting-file responses include an absolute filesystem `path=` attribute; run executable scripts via run_bash using that absolute path.',
25
- 'List available supporting files with list_private_skill_files. Bodies are markdown and may include private instructions; treat them like SOUL.md guidance.',
26
- ].join(' '),
27
- inputSchema: schema,
28
- inputSchemaJson: {
29
- type: 'object',
30
- properties: {
31
- name: { type: 'string', description: 'Skill folder name from the private skills index, e.g. "writing-obit".' },
32
- file: { type: 'string', description: 'Optional supporting file path inside the skill folder. Defaults to SKILL.md.' },
33
- },
34
- required: ['name'],
35
- additionalProperties: false,
36
- },
37
- parse(input) {
38
- return schema.parse(input)
39
- },
40
- async buildPermissionRequest(input, context) {
41
- const identity = context.config?.identity
42
- if (!identity) throw new Error('No active identity; create or load an identity before reading a private skill')
43
- const ref = continuityVaultRef(identity)
44
- const folder = input.name.replace(/^.*:/, '')
45
- const file = input.file ?? 'SKILL.md'
46
- const skillPath = path.join(ref.skillsDir, folder, file)
47
- const display = input.file ? `${folder}/${input.file}` : `${folder}/SKILL.md`
48
- return {
49
- kind: 'private-skill-read',
50
- path: skillPath,
51
- relativePath: `identity-vault/skills/${display}`,
52
- directoryPath: path.dirname(skillPath),
53
- title: 'Allow private skill read?',
54
- subtitle: `Load ${display}`,
55
- skillName: input.name,
56
- mode: 'read',
57
- }
58
- },
59
- async execute(input, context) {
60
- const identity = context.config?.identity
61
- if (!identity) {
62
- return { ok: false, summary: 'no active identity', content: 'No active identity; cannot read private skill.' }
63
- }
64
- try {
65
- const folder = input.name.replace(/^.*:/, '')
66
- if (input.file && input.file !== 'SKILL.md') {
67
- const result = await readSkillFile(identity, folder, input.file)
68
- return {
69
- ok: true,
70
- summary: `read ${result.relativePath}`,
71
- content: [
72
- `<private_skill_file name="${folder}" file="${input.file}" path="${result.absolutePath}">`,
73
- result.content,
74
- '</private_skill_file>',
75
- ].join('\n'),
76
- }
77
- }
78
- const skill = await readSkill(identity, folder)
79
- const meta: string[] = []
80
- meta.push(`name: ${skill.displayName ?? skill.name}`)
81
- if (skill.whenToUse) meta.push(`when_to_use: ${skill.whenToUse}`)
82
- if (skill.argumentHint) meta.push(`argument_hint: ${skill.argumentHint}`)
83
- if (skill.version) meta.push(`version: ${skill.version}`)
84
- if (skill.tags && skill.tags.length > 0) meta.push(`tags: ${skill.tags.join(', ')}`)
85
- meta.push(`visibility: ${skill.visibility}`)
86
- const content = [
87
- `<private_skill name="${skill.name}" visibility="${skill.visibility}">`,
88
- ...meta,
89
- '',
90
- skill.body,
91
- '</private_skill>',
92
- ].join('\n')
93
- return {
94
- ok: true,
95
- summary: `read private skill ${skill.name}`,
96
- content,
97
- }
98
- } catch (err: unknown) {
99
- const message = (err as Error).message
100
- return {
101
- ok: false,
102
- summary: 'read failed',
103
- content: message,
104
- }
105
- }
106
- },
107
- }
@@ -1,85 +0,0 @@
1
- import fs from 'node:fs/promises'
2
- import os from 'node:os'
3
- import path from 'node:path'
4
- import { z } from 'zod'
5
- import type { EthagentConfig } from '../storage/config.js'
6
- import type { Tool } from './contracts.js'
7
-
8
- const schema = z.object({
9
- path: z.string().min(1),
10
- startLine: z.number().int().positive().optional(),
11
- endLine: z.number().int().positive().optional(),
12
- })
13
-
14
- export const readTool: Tool<typeof schema> = {
15
- name: 'read_file',
16
- kind: 'read',
17
- description: 'Read a text file from the current workspace. Use startLine and endLine to limit the range when the file is large.',
18
- inputSchema: schema,
19
- inputSchemaJson: {
20
- type: 'object',
21
- properties: {
22
- path: { type: 'string', description: 'Path to the file to read.' },
23
- startLine: { type: 'number', description: 'Optional 1-based starting line.' },
24
- endLine: { type: 'number', description: 'Optional 1-based ending line.' },
25
- },
26
- required: ['path'],
27
- },
28
- parse(input) {
29
- return schema.parse(input)
30
- },
31
- async buildPermissionRequest(input, context) {
32
- assertNotPrivateContinuityWorkspacePath(input.path, context.config)
33
- const fullPath = resolveWorkspacePath(context.workspaceRoot, input.path)
34
- const relativePath = path.relative(context.workspaceRoot, fullPath) || path.basename(fullPath)
35
- return {
36
- kind: 'read',
37
- path: fullPath,
38
- relativePath,
39
- directoryPath: path.dirname(fullPath),
40
- title: 'Allow file read?',
41
- subtitle: input.startLine || input.endLine
42
- ? `${fullPath} · lines ${input.startLine ?? 1}-${input.endLine ?? 'end'}`
43
- : fullPath,
44
- }
45
- },
46
- async execute(input, context) {
47
- assertNotPrivateContinuityWorkspacePath(input.path, context.config)
48
- const fullPath = resolveWorkspacePath(context.workspaceRoot, input.path)
49
- const raw = await fs.readFile(fullPath, 'utf8')
50
- const lines = raw.replace(/\r\n/g, '\n').split('\n')
51
- const start = Math.max(1, input.startLine ?? 1)
52
- const end = Math.max(start, input.endLine ?? lines.length)
53
- const slice = lines.slice(start - 1, end)
54
- const numbered = slice.map((line, i) => `${start + i}: ${line}`).join('\n')
55
- return {
56
- ok: true,
57
- summary: `read ${path.relative(context.workspaceRoot, fullPath) || path.basename(fullPath)}`,
58
- content: numbered,
59
- }
60
- },
61
- }
62
-
63
- function assertNotPrivateContinuityWorkspacePath(
64
- requestedPath: string,
65
- config: EthagentConfig | undefined,
66
- ): void {
67
- if (!config?.identity) return
68
- const basename = path.basename(requestedPath.replaceAll('\\', '/')).toUpperCase()
69
- if (basename !== 'SOUL.MD' && basename !== 'MEMORY.MD') return
70
- throw new Error(
71
- `read_file must not read ${basename} from the workspace; use read_private_continuity_file with file "${basename === 'SOUL.MD' ? 'SOUL.md' : 'MEMORY.md'}"`,
72
- )
73
- }
74
-
75
- export function resolveWorkspacePath(workspaceRoot: string, requestedPath: string): string {
76
- const expandedPath = requestedPath.startsWith('~')
77
- ? path.join(os.homedir(), requestedPath.slice(1))
78
- : requestedPath
79
- const fullPath = path.resolve(workspaceRoot, expandedPath)
80
- const rel = path.relative(workspaceRoot, fullPath)
81
- if (rel.startsWith('..') || path.isAbsolute(rel)) {
82
- throw new Error(`path escapes workspace: ${requestedPath}`)
83
- }
84
- return fullPath
85
- }
@@ -1,103 +0,0 @@
1
- import type { AnthropicToolDefinition } from '../providers/anthropic.js'
2
- import type { GeminiToolDefinition } from '../providers/gemini.js'
3
- import type { OpenAIToolDefinition } from '../providers/openai-chat.js'
4
- import type { Tool } from './contracts.js'
5
- import { modePolicy, type SessionMode } from '../runtime/sessionMode.js'
6
- import { bashTool } from './bashTool.js'
7
- import { changeDirectoryTool } from './changeDirectoryTool.js'
8
- import { deleteFileTool } from './deleteFileTool.js'
9
- import { editTool } from './editTool.js'
10
- import { listDirectoryTool } from './listDirectoryTool.js'
11
- import { listSkillsTool } from './listSkillsTool.js'
12
- import { listSkillFilesTool } from './listSkillFilesTool.js'
13
- import { privateContinuityEditTool } from './privateContinuityEditTool.js'
14
- import { privateContinuityReadTool } from './privateContinuityReadTool.js'
15
- import { readSkillTool } from './readSkillTool.js'
16
- import { readTool } from './readTool.js'
17
- import { listMcpResourcesTool, readMcpResourceTool } from './mcpResourceTools.js'
18
- import { writeFileTool } from './writeFileTool.js'
19
-
20
- export const BUILTIN_TOOLS: Tool[] = [
21
- changeDirectoryTool,
22
- listDirectoryTool,
23
- readTool,
24
- privateContinuityReadTool,
25
- listSkillsTool,
26
- listSkillFilesTool,
27
- readSkillTool,
28
- listMcpResourcesTool,
29
- readMcpResourceTool,
30
- writeFileTool,
31
- editTool,
32
- privateContinuityEditTool,
33
- deleteFileTool,
34
- bashTool,
35
- ]
36
-
37
- export type ToolAvailabilityContext = {
38
- hasIdentity?: boolean
39
- dynamicTools?: Tool[]
40
- }
41
-
42
- export function getTool(name: string, context: ToolAvailabilityContext = {}): Tool | undefined {
43
- return [...(context.dynamicTools ?? []), ...BUILTIN_TOOLS].find(tool => tool.name === name)
44
- }
45
-
46
- export function toolsForMode(mode: SessionMode = 'chat', context: ToolAvailabilityContext = {}): Tool[] {
47
- const policy = modePolicy(mode)
48
- const allTools = [...BUILTIN_TOOLS, ...(context.dynamicTools ?? [])]
49
- return allTools.filter(tool => {
50
- if (mode === 'plan' && tool.kind === 'mcp' && tool.readOnly !== true) return false
51
- if (!policy.exposesToolKind(tool.kind)) return false
52
- if ((tool.kind === 'private-continuity-read' || tool.kind === 'private-continuity-edit') && !context.hasIdentity) return false
53
- return true
54
- })
55
- }
56
-
57
- export function anthropicTools(mode: SessionMode = 'chat', context: ToolAvailabilityContext = {}): AnthropicToolDefinition[] {
58
- return toolsForMode(mode, context).map(tool => ({
59
- name: tool.name,
60
- description: tool.description,
61
- input_schema: tool.inputSchemaJson,
62
- }))
63
- }
64
-
65
- export function openAITools(mode: SessionMode = 'chat', context: ToolAvailabilityContext = {}): OpenAIToolDefinition[] {
66
- return toolsForMode(mode, context).map(tool => ({
67
- type: 'function',
68
- function: {
69
- name: tool.name,
70
- description: tool.description,
71
- parameters: tool.inputSchemaJson,
72
- },
73
- }))
74
- }
75
-
76
- const GEMINI_DROP_KEYS = new Set([
77
- 'additionalProperties',
78
- '$schema',
79
- '$ref',
80
- '$defs',
81
- 'definitions',
82
- ])
83
-
84
- function sanitizeForGemini(schema: unknown): unknown {
85
- if (Array.isArray(schema)) return schema.map(sanitizeForGemini)
86
- if (schema && typeof schema === 'object') {
87
- const out: Record<string, unknown> = {}
88
- for (const [k, v] of Object.entries(schema as Record<string, unknown>)) {
89
- if (GEMINI_DROP_KEYS.has(k)) continue
90
- out[k] = sanitizeForGemini(v)
91
- }
92
- return out
93
- }
94
- return schema
95
- }
96
-
97
- export function geminiTools(mode: SessionMode = 'chat', context: ToolAvailabilityContext = {}): GeminiToolDefinition[] {
98
- return toolsForMode(mode, context).map(tool => ({
99
- name: tool.name,
100
- description: tool.description,
101
- parameters: sanitizeForGemini(tool.inputSchemaJson) as GeminiToolDefinition['parameters'],
102
- }))
103
- }
@@ -1,167 +0,0 @@
1
- import fs from 'node:fs/promises'
2
- import path from 'node:path'
3
- import { z } from 'zod'
4
- import { recordRewindSnapshot } from '../storage/rewind.js'
5
- import type { EthagentConfig } from '../storage/config.js'
6
- import type { Tool } from './contracts.js'
7
- import { formatFileChangeResult, renderUnifiedFileDiff } from './fileDiff.js'
8
- import { resolveWorkspacePath } from './readTool.js'
9
-
10
- const schema = z.object({
11
- path: z.string().min(1),
12
- content: z.string(),
13
- overwrite: z.boolean().optional(),
14
- })
15
-
16
- export const writeFileTool: Tool<typeof schema> = {
17
- name: 'write_file',
18
- kind: 'write',
19
- description: 'Create a new text file, or replace an entire existing file only when overwrite is true. Prefer edit_file for targeted changes to existing files.',
20
- inputSchema: schema,
21
- inputSchemaJson: {
22
- type: 'object',
23
- properties: {
24
- path: { type: 'string', description: 'Workspace-relative file path to write.' },
25
- content: { type: 'string', description: 'Complete file contents to write.' },
26
- overwrite: { type: 'boolean', description: 'Set true only when intentionally replacing an existing file.' },
27
- },
28
- required: ['path', 'content'],
29
- },
30
- parse(input) {
31
- return schema.parse(normalizeWriteFileInput(input))
32
- },
33
- async buildPermissionRequest(input, context) {
34
- const prepared = await prepareWrite(input, context)
35
- return {
36
- kind: 'write',
37
- path: prepared.fullPath,
38
- relativePath: prepared.relativePath,
39
- directoryPath: path.dirname(prepared.fullPath),
40
- title: prepared.existedBefore ? 'Allow file rewrite?' : 'Allow file creation?',
41
- subtitle: prepared.fullPath,
42
- before: previewText(prepared.before),
43
- after: previewText(input.content),
44
- diff: renderUnifiedFileDiff({ filePath: prepared.relativePath, before: prepared.before, after: input.content }),
45
- changeSummary: prepared.existedBefore ? `replace entire ${prepared.relativePath}` : `create ${prepared.relativePath}`,
46
- }
47
- },
48
- async execute(input, context) {
49
- const prepared = await prepareWrite(input, context)
50
- const rewindWarning = await tryRecordRewindSnapshot({
51
- workspaceRoot: context.workspaceRoot,
52
- filePath: prepared.fullPath,
53
- relativePath: prepared.relativePath,
54
- existedBefore: prepared.existedBefore,
55
- previousContent: prepared.before,
56
- changeSummary: prepared.existedBefore ? `replace entire ${prepared.relativePath}` : `create ${prepared.relativePath}`,
57
- createdAt: new Date().toISOString(),
58
- sessionId: context.checkpoint?.sessionId,
59
- turnId: context.checkpoint?.turnId,
60
- messageRole: context.checkpoint?.messageRole,
61
- promptSnippet: context.checkpoint?.promptSnippet,
62
- checkpointLabel: context.checkpoint?.checkpointLabel,
63
- })
64
- await fs.mkdir(path.dirname(prepared.fullPath), { recursive: true })
65
- await fs.writeFile(prepared.fullPath, input.content, 'utf8')
66
- return {
67
- ok: true,
68
- summary: prepared.existedBefore ? `replace entire ${prepared.relativePath}` : `create ${prepared.relativePath}`,
69
- content: formatFileChangeResult(
70
- rewindWarning
71
- ? `updated ${prepared.fullPath}\nwarning: ${rewindWarning}`
72
- : `updated ${prepared.fullPath}`,
73
- renderUnifiedFileDiff({ filePath: prepared.relativePath, before: prepared.before, after: input.content }),
74
- ),
75
- }
76
- },
77
- }
78
-
79
- function normalizeWriteFileInput(input: unknown): unknown {
80
- let value: unknown = input
81
- if (typeof value === 'string') {
82
- const trimmed = value.trim()
83
- if (trimmed.startsWith('{')) {
84
- try {
85
- value = JSON.parse(trimmed)
86
- } catch {
87
- return input
88
- }
89
- }
90
- }
91
- if (!value || typeof value !== 'object' || Array.isArray(value)) return value
92
- const normalized: Record<string, unknown> = { ...(value as Record<string, unknown>) }
93
- if (typeof normalized.path === 'string' && normalized.path.trim() === '') {
94
- normalized.path = undefined
95
- }
96
- return normalized
97
- }
98
-
99
- async function prepareWrite(
100
- input: z.infer<typeof schema>,
101
- context: { workspaceRoot: string; config?: EthagentConfig },
102
- ) {
103
- assertSafeWritePath(input.path)
104
- assertNotPrivateContinuityWorkspacePath(input.path, context.config, 'write_file')
105
- if (input.content.length === 0) {
106
- throw new Error('Tool write_file content is empty; provide non-empty file contents')
107
- }
108
-
109
- const fullPath = resolveWorkspacePath(context.workspaceRoot, input.path)
110
- const relativePath = path.relative(context.workspaceRoot, fullPath) || path.basename(fullPath)
111
- const { before, existedBefore } = await readExistingFile(fullPath)
112
-
113
- return { fullPath, relativePath, before, existedBefore }
114
- }
115
-
116
- async function readExistingFile(fullPath: string): Promise<{ before: string; existedBefore: boolean }> {
117
- try {
118
- const stats = await fs.stat(fullPath)
119
- if (stats.isDirectory()) throw new Error('Tool write_file path points to a directory; provide a file path')
120
- return { before: await fs.readFile(fullPath, 'utf8'), existedBefore: true }
121
- } catch (error: unknown) {
122
- if ((error as NodeJS.ErrnoException).code === 'ENOENT') return { before: '', existedBefore: false }
123
- throw error
124
- }
125
- }
126
-
127
- async function tryRecordRewindSnapshot(
128
- snapshot: Parameters<typeof recordRewindSnapshot>[0],
129
- ): Promise<string | undefined> {
130
- try {
131
- await recordRewindSnapshot(snapshot)
132
- return undefined
133
- } catch (error: unknown) {
134
- return `rewind checkpoint was not recorded (${(error as Error).message || 'unknown error'})`
135
- }
136
- }
137
-
138
- function assertSafeWritePath(requestedPath: string): void {
139
- const trimmed = requestedPath.trim()
140
- if (trimmed !== requestedPath || trimmed.length === 0) {
141
- throw new Error('Tool write_file path must be a clean workspace-relative file path')
142
- }
143
- if (/[|;&<>`]/.test(trimmed)) {
144
- throw new Error('Tool write_file path must not contain shell operators')
145
- }
146
- if (/^(?:rm|del|erase|rmdir|remove-item|mkdir|type|cat|echo|copy|move|mv|cp)\b/i.test(trimmed)) {
147
- throw new Error('Tool write_file path looks like a shell command; pass only the file path')
148
- }
149
- }
150
-
151
- function assertNotPrivateContinuityWorkspacePath(
152
- requestedPath: string,
153
- config: EthagentConfig | undefined,
154
- toolName: string,
155
- ): void {
156
- if (!config?.identity) return
157
- const basename = path.basename(requestedPath.replaceAll('\\', '/')).toUpperCase()
158
- if (basename !== 'SOUL.MD' && basename !== 'MEMORY.MD') return
159
- throw new Error(
160
- `${toolName} must not create or overwrite ${basename}; use propose_private_continuity_edit to patch the existing identity-vault scaffold`,
161
- )
162
- }
163
-
164
- function previewText(text: string, max = 700): string {
165
- if (text.length <= max) return text
166
- return `${text.slice(0, max - 3)}...`
167
- }
@@ -1,133 +0,0 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { Text, Box } from 'ink'
3
- import { theme } from './theme.js'
4
-
5
- const glyphs = {
6
- ethagent: `░░░░░░░╗░░░░░░░░╗░░╗ ░░╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗
7
- ░░╔════╝╚══░░╔══╝░░║ ░░║██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝
8
- ░░░░░╗ ░░║ ░░░░░░░║███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║
9
- ░░╔══╝ ░░║ ░░╔══░░║██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║
10
- ░░░░░░░╗ ░░║ ░░║ ░░║██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║
11
- ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ `,
12
- eyes: `
13
- -+:
14
- :=- -%@@@%.
15
- *@@@@@#- *@@-
16
- +@@. +@
17
- @@= -#=-+++=+:
18
- #% .:===-: -@* +@@@@%
19
- *@-+@@@@@: %@@+ @@@=#@
20
- *@= @@@@@@@- .@.@@@@@@@ :
21
- @@+=@@@@@@@@@@@@: .% *@@@@@*-=
22
- #:-@ -@@@@@@@@@-+% @ -@@@- #
23
- : #+ @@@@@@@- -% =# =
24
- -@: *@ .+%%
25
- :%#: --
26
- .-:
27
- `,
28
- tagline: ' privacy-first AI agent with a portable Ethereum identity ',
29
- ellipsis: '…',
30
- frame: {
31
- topLeft: '╔═',
32
- topRight: '╗',
33
- side: '║',
34
- bottomLeft: '╚═',
35
- bottomRight: '╝',
36
- horizontal: '═',
37
- },
38
- } as const
39
-
40
- const Eyes = () => {
41
- const lines = glyphs.eyes.split('\n')
42
- return (
43
- <Box flexDirection="column">
44
- {lines.map((line, li) => (
45
- <Text key={li} color={theme.text}>{line}</Text>
46
- ))}
47
- </Box>
48
- )
49
- }
50
-
51
- type SplashProps = {
52
- contextLine?: string
53
- tipLine?: string
54
- updateNotice?: string | null
55
- compact?: boolean
56
- showTagline?: boolean
57
- }
58
-
59
- export const BrandSplash: React.FC<SplashProps> = ({ contextLine, tipLine, updateNotice, compact, showTagline }) => {
60
- const [width, setWidth] = useState<number>(() => process.stdout.columns ?? 80)
61
-
62
- useEffect(() => {
63
- const stdout = process.stdout
64
- const handleResize = () => setWidth(stdout.columns ?? 80)
65
- stdout.on('resize', handleResize)
66
- return () => {
67
- stdout.off('resize', handleResize)
68
- }
69
- }, [])
70
-
71
- const renderCompact = compact ?? width < 72
72
-
73
- if (renderCompact) {
74
- return (
75
- <Box flexDirection="column" alignSelf="flex-start" padding={1}>
76
- <Eyes />
77
- <Text bold color={theme.accentWhite}>ethagent</Text>
78
- {contextLine ? <Text color={theme.dim}>{contextLine}</Text> : null}
79
- {tipLine ? <Text color={theme.dim}>{tipLine}</Text> : null}
80
- {updateNotice ? <Text color={theme.accentPeriwinkle}>{updateNotice}</Text> : null}
81
- </Box>
82
- )
83
- }
84
-
85
- const w = 69
86
- const logoLines = glyphs.ethagent.split('\n').map(line => line.padEnd(w, ' '))
87
-
88
- const bottomInline = contextLine ? ` ${truncateToFit(contextLine, w - 4)} ` : ''
89
- const bottomPad = Math.max(0, w - bottomInline.length - 1)
90
-
91
- return (
92
- <Box flexDirection="column" alignSelf="flex-start" padding={1}>
93
- <Eyes />
94
- {showTagline ? (
95
- <Text>
96
- <Text color={theme.accentWhite}>{glyphs.frame.topLeft}</Text>
97
- <Text color={theme.accentPeriwinkle}>{glyphs.tagline}</Text>
98
- <Text color={theme.accentWhite}>{glyphs.frame.horizontal.repeat(Math.max(0, w - glyphs.tagline.length - 1))}{glyphs.frame.topRight}</Text>
99
- </Text>
100
- ) : (
101
- <Text color={theme.accentWhite}>{glyphs.frame.topLeft.slice(0, 1) + glyphs.frame.horizontal.repeat(w) + glyphs.frame.topRight}</Text>
102
- )}
103
- {logoLines.map((line, i) => (
104
- <Box key={i}>
105
- <Text color={theme.accentWhite}>{glyphs.frame.side}</Text>
106
- <Text color={theme.accentWhite}>{line}</Text>
107
- <Text color={theme.accentWhite}>{glyphs.frame.side}</Text>
108
- </Box>
109
- ))}
110
- {bottomInline ? (
111
- <Text>
112
- <Text color={theme.accentWhite}>{glyphs.frame.bottomLeft}</Text>
113
- <Text color={theme.accentPeriwinkle}>{bottomInline}</Text>
114
- <Text color={theme.accentWhite}>{glyphs.frame.horizontal.repeat(bottomPad)}{glyphs.frame.bottomRight}</Text>
115
- </Text>
116
- ) : (
117
- <Text color={theme.accentWhite}>{glyphs.frame.bottomLeft.slice(0, 1) + glyphs.frame.horizontal.repeat(w) + glyphs.frame.bottomRight}</Text>
118
- )}
119
- {tipLine || updateNotice ? (
120
- <Box marginTop={1} flexDirection="column">
121
- {tipLine ? <Text color={theme.dim}>{tipLine}</Text> : null}
122
- {updateNotice ? <Text color={theme.accentPeriwinkle}>{updateNotice}</Text> : null}
123
- </Box>
124
- ) : null}
125
- </Box>
126
- )
127
- }
128
-
129
- function truncateToFit(text: string, max: number): string {
130
- if (text.length <= max) return text
131
- if (max <= 1) return text.slice(0, Math.max(0, max))
132
- return text.slice(0, max - 1) + glyphs.ellipsis
133
- }
@@ -1,30 +0,0 @@
1
- export const TITLE_STATIC = 'ethagent'
2
- export const TITLE_ANIMATION_FRAMES = [
3
- 'ethagent ⠋',
4
- 'ethagent ⠙',
5
- 'ethagent ⠹',
6
- 'ethagent ⠸',
7
- 'ethagent ⠼',
8
- 'ethagent ⠴',
9
- 'ethagent ⠦',
10
- 'ethagent ⠧',
11
- 'ethagent ⠇',
12
- 'ethagent ⠏',
13
- ] as const
14
- export const TITLE_ANIMATION_INTERVAL_MS = 80
15
-
16
- export function setTerminalTitle(title: string): void {
17
- const clean = title.replace(/[\x00-\x1f]/g, '')
18
- if (process.platform === 'win32') {
19
- process.title = clean
20
- }
21
- if (process.stdout.isTTY) {
22
- process.stdout.write(`\x1b]0;${clean}\x07`)
23
- }
24
- }
25
-
26
- export function clearTerminalTitle(): void {
27
- if (process.stdout.isTTY) {
28
- process.stdout.write('\x1b]0;\x07')
29
- }
30
- }