dfcode 1.0.0 → 1.0.2

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 (345) hide show
  1. package/bin/dfcode +13 -0
  2. package/bin/dfcode-bin +0 -0
  3. package/package.json +24 -101
  4. package/LICENSE +0 -21
  5. package/packages/dfcode/README.md +0 -15
  6. package/packages/dfcode/bin/dfcode +0 -84
  7. package/packages/dfcode/package.json +0 -115
  8. package/packages/dfcode/src/acp/README.md +0 -164
  9. package/packages/dfcode/src/acp/agent.ts +0 -1437
  10. package/packages/dfcode/src/acp/session.ts +0 -105
  11. package/packages/dfcode/src/acp/types.ts +0 -22
  12. package/packages/dfcode/src/agent/agent.ts +0 -332
  13. package/packages/dfcode/src/agent/generate.txt +0 -75
  14. package/packages/dfcode/src/agent/prompt/compaction.txt +0 -12
  15. package/packages/dfcode/src/agent/prompt/explore.txt +0 -18
  16. package/packages/dfcode/src/agent/prompt/summary.txt +0 -11
  17. package/packages/dfcode/src/agent/prompt/title.txt +0 -44
  18. package/packages/dfcode/src/auth/index.ts +0 -73
  19. package/packages/dfcode/src/bun/index.ts +0 -134
  20. package/packages/dfcode/src/bus/bus-event.ts +0 -43
  21. package/packages/dfcode/src/bus/global.ts +0 -10
  22. package/packages/dfcode/src/bus/index.ts +0 -105
  23. package/packages/dfcode/src/cli/bootstrap.ts +0 -17
  24. package/packages/dfcode/src/cli/cmd/acp.ts +0 -69
  25. package/packages/dfcode/src/cli/cmd/agent.ts +0 -257
  26. package/packages/dfcode/src/cli/cmd/auth.ts +0 -400
  27. package/packages/dfcode/src/cli/cmd/cmd.ts +0 -7
  28. package/packages/dfcode/src/cli/cmd/debug/agent.ts +0 -166
  29. package/packages/dfcode/src/cli/cmd/debug/config.ts +0 -16
  30. package/packages/dfcode/src/cli/cmd/debug/file.ts +0 -97
  31. package/packages/dfcode/src/cli/cmd/debug/index.ts +0 -48
  32. package/packages/dfcode/src/cli/cmd/debug/lsp.ts +0 -52
  33. package/packages/dfcode/src/cli/cmd/debug/ripgrep.ts +0 -87
  34. package/packages/dfcode/src/cli/cmd/debug/scrap.ts +0 -16
  35. package/packages/dfcode/src/cli/cmd/debug/skill.ts +0 -16
  36. package/packages/dfcode/src/cli/cmd/debug/snapshot.ts +0 -52
  37. package/packages/dfcode/src/cli/cmd/export.ts +0 -88
  38. package/packages/dfcode/src/cli/cmd/generate.ts +0 -38
  39. package/packages/dfcode/src/cli/cmd/github.ts +0 -1548
  40. package/packages/dfcode/src/cli/cmd/import.ts +0 -98
  41. package/packages/dfcode/src/cli/cmd/mcp.ts +0 -755
  42. package/packages/dfcode/src/cli/cmd/models.ts +0 -77
  43. package/packages/dfcode/src/cli/cmd/pr.ts +0 -112
  44. package/packages/dfcode/src/cli/cmd/run.ts +0 -395
  45. package/packages/dfcode/src/cli/cmd/serve.ts +0 -20
  46. package/packages/dfcode/src/cli/cmd/session.ts +0 -135
  47. package/packages/dfcode/src/cli/cmd/stats.ts +0 -402
  48. package/packages/dfcode/src/cli/cmd/tui/app.tsx +0 -750
  49. package/packages/dfcode/src/cli/cmd/tui/attach.ts +0 -39
  50. package/packages/dfcode/src/cli/cmd/tui/component/border.tsx +0 -21
  51. package/packages/dfcode/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
  52. package/packages/dfcode/src/cli/cmd/tui/component/dialog-command.tsx +0 -148
  53. package/packages/dfcode/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
  54. package/packages/dfcode/src/cli/cmd/tui/component/dialog-model.tsx +0 -234
  55. package/packages/dfcode/src/cli/cmd/tui/component/dialog-provider.tsx +0 -256
  56. package/packages/dfcode/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -114
  57. package/packages/dfcode/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
  58. package/packages/dfcode/src/cli/cmd/tui/component/dialog-stash.tsx +0 -87
  59. package/packages/dfcode/src/cli/cmd/tui/component/dialog-status.tsx +0 -164
  60. package/packages/dfcode/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
  61. package/packages/dfcode/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
  62. package/packages/dfcode/src/cli/cmd/tui/component/logo.tsx +0 -88
  63. package/packages/dfcode/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -653
  64. package/packages/dfcode/src/cli/cmd/tui/component/prompt/frecency.tsx +0 -89
  65. package/packages/dfcode/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
  66. package/packages/dfcode/src/cli/cmd/tui/component/prompt/index.tsx +0 -1102
  67. package/packages/dfcode/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
  68. package/packages/dfcode/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
  69. package/packages/dfcode/src/cli/cmd/tui/component/tips.tsx +0 -153
  70. package/packages/dfcode/src/cli/cmd/tui/component/todo-item.tsx +0 -32
  71. package/packages/dfcode/src/cli/cmd/tui/context/args.tsx +0 -14
  72. package/packages/dfcode/src/cli/cmd/tui/context/directory.ts +0 -13
  73. package/packages/dfcode/src/cli/cmd/tui/context/exit.tsx +0 -23
  74. package/packages/dfcode/src/cli/cmd/tui/context/helper.tsx +0 -25
  75. package/packages/dfcode/src/cli/cmd/tui/context/keybind.tsx +0 -101
  76. package/packages/dfcode/src/cli/cmd/tui/context/kv.tsx +0 -52
  77. package/packages/dfcode/src/cli/cmd/tui/context/local.tsx +0 -402
  78. package/packages/dfcode/src/cli/cmd/tui/context/prompt.tsx +0 -18
  79. package/packages/dfcode/src/cli/cmd/tui/context/route.tsx +0 -46
  80. package/packages/dfcode/src/cli/cmd/tui/context/sdk.tsx +0 -94
  81. package/packages/dfcode/src/cli/cmd/tui/context/sync.tsx +0 -445
  82. package/packages/dfcode/src/cli/cmd/tui/context/theme/aura.json +0 -69
  83. package/packages/dfcode/src/cli/cmd/tui/context/theme/ayu.json +0 -80
  84. package/packages/dfcode/src/cli/cmd/tui/context/theme/carbonfox.json +0 -248
  85. package/packages/dfcode/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
  86. package/packages/dfcode/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
  87. package/packages/dfcode/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
  88. package/packages/dfcode/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
  89. package/packages/dfcode/src/cli/cmd/tui/context/theme/cursor.json +0 -249
  90. package/packages/dfcode/src/cli/cmd/tui/context/theme/dfcode.json +0 -245
  91. package/packages/dfcode/src/cli/cmd/tui/context/theme/dracula.json +0 -219
  92. package/packages/dfcode/src/cli/cmd/tui/context/theme/everforest.json +0 -241
  93. package/packages/dfcode/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
  94. package/packages/dfcode/src/cli/cmd/tui/context/theme/github.json +0 -233
  95. package/packages/dfcode/src/cli/cmd/tui/context/theme/gruvbox.json +0 -242
  96. package/packages/dfcode/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
  97. package/packages/dfcode/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -237
  98. package/packages/dfcode/src/cli/cmd/tui/context/theme/material.json +0 -235
  99. package/packages/dfcode/src/cli/cmd/tui/context/theme/matrix.json +0 -77
  100. package/packages/dfcode/src/cli/cmd/tui/context/theme/mercury.json +0 -252
  101. package/packages/dfcode/src/cli/cmd/tui/context/theme/monokai.json +0 -221
  102. package/packages/dfcode/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
  103. package/packages/dfcode/src/cli/cmd/tui/context/theme/nord.json +0 -223
  104. package/packages/dfcode/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
  105. package/packages/dfcode/src/cli/cmd/tui/context/theme/orng.json +0 -249
  106. package/packages/dfcode/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
  107. package/packages/dfcode/src/cli/cmd/tui/context/theme/palenight.json +0 -222
  108. package/packages/dfcode/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
  109. package/packages/dfcode/src/cli/cmd/tui/context/theme/solarized.json +0 -223
  110. package/packages/dfcode/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
  111. package/packages/dfcode/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
  112. package/packages/dfcode/src/cli/cmd/tui/context/theme/vercel.json +0 -245
  113. package/packages/dfcode/src/cli/cmd/tui/context/theme/vesper.json +0 -218
  114. package/packages/dfcode/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
  115. package/packages/dfcode/src/cli/cmd/tui/context/theme.tsx +0 -1152
  116. package/packages/dfcode/src/cli/cmd/tui/event.ts +0 -48
  117. package/packages/dfcode/src/cli/cmd/tui/routes/home.tsx +0 -140
  118. package/packages/dfcode/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
  119. package/packages/dfcode/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
  120. package/packages/dfcode/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
  121. package/packages/dfcode/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
  122. package/packages/dfcode/src/cli/cmd/tui/routes/session/footer.tsx +0 -91
  123. package/packages/dfcode/src/cli/cmd/tui/routes/session/header.tsx +0 -142
  124. package/packages/dfcode/src/cli/cmd/tui/routes/session/index.tsx +0 -2050
  125. package/packages/dfcode/src/cli/cmd/tui/routes/session/permission.tsx +0 -508
  126. package/packages/dfcode/src/cli/cmd/tui/routes/session/question.tsx +0 -453
  127. package/packages/dfcode/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -313
  128. package/packages/dfcode/src/cli/cmd/tui/thread.ts +0 -165
  129. package/packages/dfcode/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -57
  130. package/packages/dfcode/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -83
  131. package/packages/dfcode/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -204
  132. package/packages/dfcode/src/cli/cmd/tui/ui/dialog-help.tsx +0 -43
  133. package/packages/dfcode/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -77
  134. package/packages/dfcode/src/cli/cmd/tui/ui/dialog-select.tsx +0 -384
  135. package/packages/dfcode/src/cli/cmd/tui/ui/dialog.tsx +0 -167
  136. package/packages/dfcode/src/cli/cmd/tui/ui/link.tsx +0 -28
  137. package/packages/dfcode/src/cli/cmd/tui/ui/spinner.ts +0 -368
  138. package/packages/dfcode/src/cli/cmd/tui/ui/toast.tsx +0 -100
  139. package/packages/dfcode/src/cli/cmd/tui/util/clipboard.ts +0 -160
  140. package/packages/dfcode/src/cli/cmd/tui/util/editor.ts +0 -32
  141. package/packages/dfcode/src/cli/cmd/tui/util/signal.ts +0 -7
  142. package/packages/dfcode/src/cli/cmd/tui/util/terminal.ts +0 -114
  143. package/packages/dfcode/src/cli/cmd/tui/util/transcript.ts +0 -98
  144. package/packages/dfcode/src/cli/cmd/tui/worker.ts +0 -152
  145. package/packages/dfcode/src/cli/cmd/uninstall.ts +0 -357
  146. package/packages/dfcode/src/cli/cmd/upgrade.ts +0 -73
  147. package/packages/dfcode/src/cli/cmd/web.ts +0 -81
  148. package/packages/dfcode/src/cli/error.ts +0 -57
  149. package/packages/dfcode/src/cli/network.ts +0 -53
  150. package/packages/dfcode/src/cli/ui.ts +0 -83
  151. package/packages/dfcode/src/cli/upgrade.ts +0 -25
  152. package/packages/dfcode/src/command/index.ts +0 -131
  153. package/packages/dfcode/src/command/template/initialize.txt +0 -10
  154. package/packages/dfcode/src/command/template/review.txt +0 -99
  155. package/packages/dfcode/src/config/config.ts +0 -1367
  156. package/packages/dfcode/src/config/markdown.ts +0 -93
  157. package/packages/dfcode/src/env/index.ts +0 -26
  158. package/packages/dfcode/src/file/ignore.ts +0 -83
  159. package/packages/dfcode/src/file/index.ts +0 -411
  160. package/packages/dfcode/src/file/ripgrep.ts +0 -407
  161. package/packages/dfcode/src/file/time.ts +0 -69
  162. package/packages/dfcode/src/file/watcher.ts +0 -127
  163. package/packages/dfcode/src/flag/flag.ts +0 -79
  164. package/packages/dfcode/src/format/formatter.ts +0 -357
  165. package/packages/dfcode/src/format/index.ts +0 -137
  166. package/packages/dfcode/src/global/index.ts +0 -55
  167. package/packages/dfcode/src/id/id.ts +0 -83
  168. package/packages/dfcode/src/ide/index.ts +0 -76
  169. package/packages/dfcode/src/index.ts +0 -159
  170. package/packages/dfcode/src/installation/index.ts +0 -246
  171. package/packages/dfcode/src/lsp/client.ts +0 -252
  172. package/packages/dfcode/src/lsp/index.ts +0 -485
  173. package/packages/dfcode/src/lsp/language.ts +0 -119
  174. package/packages/dfcode/src/lsp/server.ts +0 -2046
  175. package/packages/dfcode/src/mcp/auth.ts +0 -135
  176. package/packages/dfcode/src/mcp/index.ts +0 -934
  177. package/packages/dfcode/src/mcp/oauth-callback.ts +0 -200
  178. package/packages/dfcode/src/mcp/oauth-provider.ts +0 -154
  179. package/packages/dfcode/src/patch/index.ts +0 -680
  180. package/packages/dfcode/src/permission/arity.ts +0 -163
  181. package/packages/dfcode/src/permission/index.ts +0 -210
  182. package/packages/dfcode/src/permission/next.ts +0 -280
  183. package/packages/dfcode/src/plugin/codex.ts +0 -506
  184. package/packages/dfcode/src/plugin/copilot.ts +0 -283
  185. package/packages/dfcode/src/plugin/index.ts +0 -135
  186. package/packages/dfcode/src/project/bootstrap.ts +0 -35
  187. package/packages/dfcode/src/project/instance.ts +0 -91
  188. package/packages/dfcode/src/project/project.ts +0 -371
  189. package/packages/dfcode/src/project/state.ts +0 -66
  190. package/packages/dfcode/src/project/vcs.ts +0 -76
  191. package/packages/dfcode/src/provider/auth.ts +0 -147
  192. package/packages/dfcode/src/provider/models.ts +0 -136
  193. package/packages/dfcode/src/provider/provider.ts +0 -1219
  194. package/packages/dfcode/src/provider/sdk/openai-compatible/src/README.md +0 -5
  195. package/packages/dfcode/src/provider/sdk/openai-compatible/src/index.ts +0 -2
  196. package/packages/dfcode/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +0 -100
  197. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +0 -303
  198. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +0 -22
  199. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +0 -18
  200. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +0 -22
  201. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +0 -207
  202. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +0 -1732
  203. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +0 -177
  204. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +0 -1
  205. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +0 -88
  206. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +0 -128
  207. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +0 -115
  208. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +0 -65
  209. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +0 -104
  210. package/packages/dfcode/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +0 -103
  211. package/packages/dfcode/src/provider/transform.ts +0 -741
  212. package/packages/dfcode/src/pty/index.ts +0 -241
  213. package/packages/dfcode/src/question/index.ts +0 -171
  214. package/packages/dfcode/src/scheduler/index.ts +0 -61
  215. package/packages/dfcode/src/server/error.ts +0 -36
  216. package/packages/dfcode/src/server/event.ts +0 -7
  217. package/packages/dfcode/src/server/mdns.ts +0 -59
  218. package/packages/dfcode/src/server/routes/config.ts +0 -92
  219. package/packages/dfcode/src/server/routes/experimental.ts +0 -208
  220. package/packages/dfcode/src/server/routes/file.ts +0 -197
  221. package/packages/dfcode/src/server/routes/global.ts +0 -135
  222. package/packages/dfcode/src/server/routes/mcp.ts +0 -225
  223. package/packages/dfcode/src/server/routes/permission.ts +0 -68
  224. package/packages/dfcode/src/server/routes/project.ts +0 -82
  225. package/packages/dfcode/src/server/routes/provider.ts +0 -165
  226. package/packages/dfcode/src/server/routes/pty.ts +0 -169
  227. package/packages/dfcode/src/server/routes/question.ts +0 -98
  228. package/packages/dfcode/src/server/routes/session.ts +0 -939
  229. package/packages/dfcode/src/server/routes/tui.ts +0 -379
  230. package/packages/dfcode/src/server/server.ts +0 -574
  231. package/packages/dfcode/src/session/compaction.ts +0 -225
  232. package/packages/dfcode/src/session/index.ts +0 -498
  233. package/packages/dfcode/src/session/llm.ts +0 -288
  234. package/packages/dfcode/src/session/message-v2.ts +0 -740
  235. package/packages/dfcode/src/session/message.ts +0 -189
  236. package/packages/dfcode/src/session/processor.ts +0 -406
  237. package/packages/dfcode/src/session/prompt/anthropic-20250930.txt +0 -164
  238. package/packages/dfcode/src/session/prompt/anthropic.txt +0 -102
  239. package/packages/dfcode/src/session/prompt/anthropic_spoof.txt +0 -1
  240. package/packages/dfcode/src/session/prompt/beast.txt +0 -147
  241. package/packages/dfcode/src/session/prompt/build-switch.txt +0 -5
  242. package/packages/dfcode/src/session/prompt/codex_header.txt +0 -79
  243. package/packages/dfcode/src/session/prompt/copilot-gpt-5.txt +0 -143
  244. package/packages/dfcode/src/session/prompt/gemini.txt +0 -155
  245. package/packages/dfcode/src/session/prompt/max-steps.txt +0 -16
  246. package/packages/dfcode/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  247. package/packages/dfcode/src/session/prompt/plan.txt +0 -26
  248. package/packages/dfcode/src/session/prompt/qwen.txt +0 -107
  249. package/packages/dfcode/src/session/prompt.ts +0 -1815
  250. package/packages/dfcode/src/session/retry.ts +0 -90
  251. package/packages/dfcode/src/session/revert.ts +0 -121
  252. package/packages/dfcode/src/session/status.ts +0 -76
  253. package/packages/dfcode/src/session/summary.ts +0 -150
  254. package/packages/dfcode/src/session/system.ts +0 -157
  255. package/packages/dfcode/src/session/todo.ts +0 -37
  256. package/packages/dfcode/src/share/share-next.ts +0 -200
  257. package/packages/dfcode/src/share/share.ts +0 -92
  258. package/packages/dfcode/src/shell/shell.ts +0 -67
  259. package/packages/dfcode/src/skill/index.ts +0 -1
  260. package/packages/dfcode/src/skill/skill.ts +0 -135
  261. package/packages/dfcode/src/snapshot/index.ts +0 -236
  262. package/packages/dfcode/src/storage/storage.ts +0 -227
  263. package/packages/dfcode/src/tool/apply_patch.ts +0 -280
  264. package/packages/dfcode/src/tool/apply_patch.txt +0 -33
  265. package/packages/dfcode/src/tool/bash.ts +0 -258
  266. package/packages/dfcode/src/tool/bash.txt +0 -115
  267. package/packages/dfcode/src/tool/batch.ts +0 -175
  268. package/packages/dfcode/src/tool/batch.txt +0 -24
  269. package/packages/dfcode/src/tool/codesearch.ts +0 -132
  270. package/packages/dfcode/src/tool/codesearch.txt +0 -12
  271. package/packages/dfcode/src/tool/edit.ts +0 -645
  272. package/packages/dfcode/src/tool/edit.txt +0 -10
  273. package/packages/dfcode/src/tool/external-directory.ts +0 -32
  274. package/packages/dfcode/src/tool/glob.ts +0 -77
  275. package/packages/dfcode/src/tool/glob.txt +0 -6
  276. package/packages/dfcode/src/tool/grep.ts +0 -154
  277. package/packages/dfcode/src/tool/grep.txt +0 -8
  278. package/packages/dfcode/src/tool/invalid.ts +0 -17
  279. package/packages/dfcode/src/tool/ls.ts +0 -121
  280. package/packages/dfcode/src/tool/ls.txt +0 -1
  281. package/packages/dfcode/src/tool/lsp.ts +0 -96
  282. package/packages/dfcode/src/tool/lsp.txt +0 -19
  283. package/packages/dfcode/src/tool/multiedit.ts +0 -46
  284. package/packages/dfcode/src/tool/multiedit.txt +0 -41
  285. package/packages/dfcode/src/tool/plan-enter.txt +0 -14
  286. package/packages/dfcode/src/tool/plan-exit.txt +0 -13
  287. package/packages/dfcode/src/tool/plan.ts +0 -130
  288. package/packages/dfcode/src/tool/question.ts +0 -33
  289. package/packages/dfcode/src/tool/question.txt +0 -10
  290. package/packages/dfcode/src/tool/read.ts +0 -202
  291. package/packages/dfcode/src/tool/read.txt +0 -12
  292. package/packages/dfcode/src/tool/registry.ts +0 -158
  293. package/packages/dfcode/src/tool/skill.ts +0 -82
  294. package/packages/dfcode/src/tool/task.ts +0 -191
  295. package/packages/dfcode/src/tool/task.txt +0 -60
  296. package/packages/dfcode/src/tool/todo.ts +0 -53
  297. package/packages/dfcode/src/tool/todoread.txt +0 -14
  298. package/packages/dfcode/src/tool/todowrite.txt +0 -167
  299. package/packages/dfcode/src/tool/tool.ts +0 -88
  300. package/packages/dfcode/src/tool/truncation.ts +0 -106
  301. package/packages/dfcode/src/tool/webfetch.ts +0 -188
  302. package/packages/dfcode/src/tool/webfetch.txt +0 -13
  303. package/packages/dfcode/src/tool/websearch.ts +0 -150
  304. package/packages/dfcode/src/tool/websearch.txt +0 -14
  305. package/packages/dfcode/src/tool/write.ts +0 -80
  306. package/packages/dfcode/src/tool/write.txt +0 -8
  307. package/packages/dfcode/src/util/archive.ts +0 -16
  308. package/packages/dfcode/src/util/color.ts +0 -19
  309. package/packages/dfcode/src/util/context.ts +0 -25
  310. package/packages/dfcode/src/util/defer.ts +0 -12
  311. package/packages/dfcode/src/util/eventloop.ts +0 -20
  312. package/packages/dfcode/src/util/filesystem.ts +0 -93
  313. package/packages/dfcode/src/util/fn.ts +0 -11
  314. package/packages/dfcode/src/util/format.ts +0 -20
  315. package/packages/dfcode/src/util/iife.ts +0 -3
  316. package/packages/dfcode/src/util/keybind.ts +0 -103
  317. package/packages/dfcode/src/util/lazy.ts +0 -18
  318. package/packages/dfcode/src/util/locale.ts +0 -81
  319. package/packages/dfcode/src/util/lock.ts +0 -98
  320. package/packages/dfcode/src/util/log.ts +0 -180
  321. package/packages/dfcode/src/util/queue.ts +0 -32
  322. package/packages/dfcode/src/util/rpc.ts +0 -66
  323. package/packages/dfcode/src/util/scrap.ts +0 -10
  324. package/packages/dfcode/src/util/signal.ts +0 -12
  325. package/packages/dfcode/src/util/timeout.ts +0 -14
  326. package/packages/dfcode/src/util/token.ts +0 -7
  327. package/packages/dfcode/src/util/wildcard.ts +0 -56
  328. package/packages/dfcode/src/worktree/index.ts +0 -524
  329. package/packages/plugin/package.json +0 -28
  330. package/packages/plugin/src/example.ts +0 -18
  331. package/packages/plugin/src/index.ts +0 -226
  332. package/packages/plugin/src/shell.ts +0 -136
  333. package/packages/plugin/src/tool.ts +0 -28
  334. package/packages/util/package.json +0 -20
  335. package/packages/util/src/array.ts +0 -10
  336. package/packages/util/src/binary.ts +0 -41
  337. package/packages/util/src/encode.ts +0 -30
  338. package/packages/util/src/error.ts +0 -54
  339. package/packages/util/src/fn.ts +0 -11
  340. package/packages/util/src/identifier.ts +0 -48
  341. package/packages/util/src/iife.ts +0 -3
  342. package/packages/util/src/lazy.ts +0 -11
  343. package/packages/util/src/path.ts +0 -37
  344. package/packages/util/src/retry.ts +0 -41
  345. package/packages/util/src/slug.ts +0 -74
@@ -1,226 +0,0 @@
1
- import type {
2
- Event,
3
- createDfcodeClient,
4
- Project,
5
- Model,
6
- Provider,
7
- Permission,
8
- UserMessage,
9
- Message,
10
- Part,
11
- Auth,
12
- Config,
13
- } from "@dfcode/sdk"
14
-
15
- import type { BunShell } from "./shell"
16
- import { type ToolDefinition } from "./tool"
17
-
18
- export * from "./tool"
19
-
20
- export type ProviderContext = {
21
- source: "env" | "config" | "custom" | "api"
22
- info: Provider
23
- options: Record<string, any>
24
- }
25
-
26
- export type PluginInput = {
27
- client: ReturnType<typeof createDfcodeClient>
28
- project: Project
29
- directory: string
30
- worktree: string
31
- serverUrl: URL
32
- $: BunShell
33
- }
34
-
35
- export type Plugin = (input: PluginInput) => Promise<Hooks>
36
-
37
- export type AuthHook = {
38
- provider: string
39
- loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, any>>
40
- methods: (
41
- | {
42
- type: "oauth"
43
- label: string
44
- prompts?: Array<
45
- | {
46
- type: "text"
47
- key: string
48
- message: string
49
- placeholder?: string
50
- validate?: (value: string) => string | undefined
51
- condition?: (inputs: Record<string, string>) => boolean
52
- }
53
- | {
54
- type: "select"
55
- key: string
56
- message: string
57
- options: Array<{
58
- label: string
59
- value: string
60
- hint?: string
61
- }>
62
- condition?: (inputs: Record<string, string>) => boolean
63
- }
64
- >
65
- authorize(inputs?: Record<string, string>): Promise<AuthOuathResult>
66
- }
67
- | {
68
- type: "api"
69
- label: string
70
- prompts?: Array<
71
- | {
72
- type: "text"
73
- key: string
74
- message: string
75
- placeholder?: string
76
- validate?: (value: string) => string | undefined
77
- condition?: (inputs: Record<string, string>) => boolean
78
- }
79
- | {
80
- type: "select"
81
- key: string
82
- message: string
83
- options: Array<{
84
- label: string
85
- value: string
86
- hint?: string
87
- }>
88
- condition?: (inputs: Record<string, string>) => boolean
89
- }
90
- >
91
- authorize?(inputs?: Record<string, string>): Promise<
92
- | {
93
- type: "success"
94
- key: string
95
- provider?: string
96
- }
97
- | {
98
- type: "failed"
99
- }
100
- >
101
- }
102
- )[]
103
- }
104
-
105
- export type AuthOuathResult = { url: string; instructions: string } & (
106
- | {
107
- method: "auto"
108
- callback(): Promise<
109
- | ({
110
- type: "success"
111
- provider?: string
112
- } & (
113
- | {
114
- refresh: string
115
- access: string
116
- expires: number
117
- accountId?: string
118
- }
119
- | { key: string }
120
- ))
121
- | {
122
- type: "failed"
123
- }
124
- >
125
- }
126
- | {
127
- method: "code"
128
- callback(code: string): Promise<
129
- | ({
130
- type: "success"
131
- provider?: string
132
- } & (
133
- | {
134
- refresh: string
135
- access: string
136
- expires: number
137
- accountId?: string
138
- }
139
- | { key: string }
140
- ))
141
- | {
142
- type: "failed"
143
- }
144
- >
145
- }
146
- )
147
-
148
- export interface Hooks {
149
- event?: (input: { event: Event }) => Promise<void>
150
- config?: (input: Config) => Promise<void>
151
- tool?: {
152
- [key: string]: ToolDefinition
153
- }
154
- auth?: AuthHook
155
- /**
156
- * Called when a new message is received
157
- */
158
- "chat.message"?: (
159
- input: {
160
- sessionID: string
161
- agent?: string
162
- model?: { providerID: string; modelID: string }
163
- messageID?: string
164
- variant?: string
165
- },
166
- output: { message: UserMessage; parts: Part[] },
167
- ) => Promise<void>
168
- /**
169
- * Modify parameters sent to LLM
170
- */
171
- "chat.params"?: (
172
- input: { sessionID: string; agent: string; model: Model; provider: ProviderContext; message: UserMessage },
173
- output: { temperature: number; topP: number; topK: number; options: Record<string, any> },
174
- ) => Promise<void>
175
- "chat.headers"?: (
176
- input: { sessionID: string; agent: string; model: Model; provider: ProviderContext; message: UserMessage },
177
- output: { headers: Record<string, string> },
178
- ) => Promise<void>
179
- "permission.ask"?: (input: Permission, output: { status: "ask" | "deny" | "allow" }) => Promise<void>
180
- "command.execute.before"?: (
181
- input: { command: string; sessionID: string; arguments: string },
182
- output: { parts: Part[] },
183
- ) => Promise<void>
184
- "tool.execute.before"?: (
185
- input: { tool: string; sessionID: string; callID: string },
186
- output: { args: any },
187
- ) => Promise<void>
188
- "tool.execute.after"?: (
189
- input: { tool: string; sessionID: string; callID: string },
190
- output: {
191
- title: string
192
- output: string
193
- metadata: any
194
- },
195
- ) => Promise<void>
196
- "experimental.chat.messages.transform"?: (
197
- input: {},
198
- output: {
199
- messages: {
200
- info: Message
201
- parts: Part[]
202
- }[]
203
- },
204
- ) => Promise<void>
205
- "experimental.chat.system.transform"?: (
206
- input: { sessionID: string },
207
- output: {
208
- system: string[]
209
- },
210
- ) => Promise<void>
211
- /**
212
- * Called before session compaction starts. Allows plugins to customize
213
- * the compaction prompt.
214
- *
215
- * - `context`: Additional context strings appended to the default prompt
216
- * - `prompt`: If set, replaces the default compaction prompt entirely
217
- */
218
- "experimental.session.compacting"?: (
219
- input: { sessionID: string },
220
- output: { context: string[]; prompt?: string },
221
- ) => Promise<void>
222
- "experimental.text.complete"?: (
223
- input: { sessionID: string; messageID: string; partID: string },
224
- output: { text: string },
225
- ) => Promise<void>
226
- }
@@ -1,136 +0,0 @@
1
- export type ShellFunction = (input: Uint8Array) => Uint8Array
2
-
3
- export type ShellExpression =
4
- | { toString(): string }
5
- | Array<ShellExpression>
6
- | string
7
- | { raw: string }
8
- | ReadableStream
9
-
10
- export interface BunShell {
11
- (strings: TemplateStringsArray, ...expressions: ShellExpression[]): BunShellPromise
12
-
13
- /**
14
- * Perform bash-like brace expansion on the given pattern.
15
- * @param pattern - Brace pattern to expand
16
- */
17
- braces(pattern: string): string[]
18
-
19
- /**
20
- * Escape strings for input into shell commands.
21
- */
22
- escape(input: string): string
23
-
24
- /**
25
- * Change the default environment variables for shells created by this instance.
26
- */
27
- env(newEnv?: Record<string, string | undefined>): BunShell
28
-
29
- /**
30
- * Default working directory to use for shells created by this instance.
31
- */
32
- cwd(newCwd?: string): BunShell
33
-
34
- /**
35
- * Configure the shell to not throw an exception on non-zero exit codes.
36
- */
37
- nothrow(): BunShell
38
-
39
- /**
40
- * Configure whether or not the shell should throw an exception on non-zero exit codes.
41
- */
42
- throws(shouldThrow: boolean): BunShell
43
- }
44
-
45
- export interface BunShellPromise extends Promise<BunShellOutput> {
46
- readonly stdin: WritableStream
47
-
48
- /**
49
- * Change the current working directory of the shell.
50
- */
51
- cwd(newCwd: string): this
52
-
53
- /**
54
- * Set environment variables for the shell.
55
- */
56
- env(newEnv: Record<string, string> | undefined): this
57
-
58
- /**
59
- * By default, the shell will write to the current process's stdout and stderr, as well as buffering that output.
60
- * This configures the shell to only buffer the output.
61
- */
62
- quiet(): this
63
-
64
- /**
65
- * Read from stdout as a string, line by line
66
- * Automatically calls quiet() to disable echoing to stdout.
67
- */
68
- lines(): AsyncIterable<string>
69
-
70
- /**
71
- * Read from stdout as a string.
72
- * Automatically calls quiet() to disable echoing to stdout.
73
- */
74
- text(encoding?: BufferEncoding): Promise<string>
75
-
76
- /**
77
- * Read from stdout as a JSON object
78
- * Automatically calls quiet()
79
- */
80
- json(): Promise<any>
81
-
82
- /**
83
- * Read from stdout as an ArrayBuffer
84
- * Automatically calls quiet()
85
- */
86
- arrayBuffer(): Promise<ArrayBuffer>
87
-
88
- /**
89
- * Read from stdout as a Blob
90
- * Automatically calls quiet()
91
- */
92
- blob(): Promise<Blob>
93
-
94
- /**
95
- * Configure the shell to not throw an exception on non-zero exit codes.
96
- */
97
- nothrow(): this
98
-
99
- /**
100
- * Configure whether or not the shell should throw an exception on non-zero exit codes.
101
- */
102
- throws(shouldThrow: boolean): this
103
- }
104
-
105
- export interface BunShellOutput {
106
- readonly stdout: Buffer
107
- readonly stderr: Buffer
108
- readonly exitCode: number
109
-
110
- /**
111
- * Read from stdout as a string
112
- */
113
- text(encoding?: BufferEncoding): string
114
-
115
- /**
116
- * Read from stdout as a JSON object
117
- */
118
- json(): any
119
-
120
- /**
121
- * Read from stdout as an ArrayBuffer
122
- */
123
- arrayBuffer(): ArrayBuffer
124
-
125
- /**
126
- * Read from stdout as an Uint8Array
127
- */
128
- bytes(): Uint8Array
129
-
130
- /**
131
- * Read from stdout as a Blob
132
- */
133
- blob(): Blob
134
- }
135
-
136
- export type BunShellError = Error & BunShellOutput
@@ -1,28 +0,0 @@
1
- import { z } from "zod"
2
-
3
- export type ToolContext = {
4
- sessionID: string
5
- messageID: string
6
- agent: string
7
- abort: AbortSignal
8
- metadata(input: { title?: string; metadata?: { [key: string]: any } }): void
9
- ask(input: AskInput): Promise<void>
10
- }
11
-
12
- type AskInput = {
13
- permission: string
14
- patterns: string[]
15
- always: string[]
16
- metadata: { [key: string]: any }
17
- }
18
-
19
- export function tool<Args extends z.ZodRawShape>(input: {
20
- description: string
21
- args: Args
22
- execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<string>
23
- }) {
24
- return input
25
- }
26
- tool.schema = z
27
-
28
- export type ToolDefinition = ReturnType<typeof tool>
@@ -1,20 +0,0 @@
1
- {
2
- "name": "@dfcode/util",
3
- "version": "1.0.0",
4
- "private": true,
5
- "type": "module",
6
- "license": "MIT",
7
- "exports": {
8
- "./*": "./src/*.ts"
9
- },
10
- "scripts": {
11
- "typecheck": "tsc --noEmit"
12
- },
13
- "dependencies": {
14
- "zod": "catalog:"
15
- },
16
- "devDependencies": {
17
- "typescript": "catalog:",
18
- "@types/bun": "catalog:"
19
- }
20
- }
@@ -1,10 +0,0 @@
1
- export function findLast<T>(
2
- items: readonly T[],
3
- predicate: (item: T, index: number, items: readonly T[]) => boolean,
4
- ): T | undefined {
5
- for (let i = items.length - 1; i >= 0; i -= 1) {
6
- const item = items[i]
7
- if (predicate(item, i, items)) return item
8
- }
9
- return undefined
10
- }
@@ -1,41 +0,0 @@
1
- export namespace Binary {
2
- export function search<T>(array: T[], id: string, compare: (item: T) => string): { found: boolean; index: number } {
3
- let left = 0
4
- let right = array.length - 1
5
-
6
- while (left <= right) {
7
- const mid = Math.floor((left + right) / 2)
8
- const midId = compare(array[mid])
9
-
10
- if (midId === id) {
11
- return { found: true, index: mid }
12
- } else if (midId < id) {
13
- left = mid + 1
14
- } else {
15
- right = mid - 1
16
- }
17
- }
18
-
19
- return { found: false, index: left }
20
- }
21
-
22
- export function insert<T>(array: T[], item: T, compare: (item: T) => string): T[] {
23
- const id = compare(item)
24
- let left = 0
25
- let right = array.length
26
-
27
- while (left < right) {
28
- const mid = Math.floor((left + right) / 2)
29
- const midId = compare(array[mid])
30
-
31
- if (midId < id) {
32
- left = mid + 1
33
- } else {
34
- right = mid
35
- }
36
- }
37
-
38
- array.splice(left, 0, item)
39
- return array
40
- }
41
- }
@@ -1,30 +0,0 @@
1
- export function base64Encode(value: string) {
2
- const bytes = new TextEncoder().encode(value)
3
- const binary = Array.from(bytes, (b) => String.fromCharCode(b)).join("")
4
- return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "")
5
- }
6
-
7
- export function base64Decode(value: string) {
8
- const binary = atob(value.replace(/-/g, "+").replace(/_/g, "/"))
9
- const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0))
10
- return new TextDecoder().decode(bytes)
11
- }
12
-
13
- export async function hash(content: string, algorithm = "SHA-256"): Promise<string> {
14
- const encoder = new TextEncoder()
15
- const data = encoder.encode(content)
16
- const hashBuffer = await crypto.subtle.digest(algorithm, data)
17
- const hashArray = Array.from(new Uint8Array(hashBuffer))
18
- const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("")
19
- return hashHex
20
- }
21
-
22
- export function checksum(content: string): string | undefined {
23
- if (!content) return undefined
24
- let hash = 0x811c9dc5
25
- for (let i = 0; i < content.length; i++) {
26
- hash ^= content.charCodeAt(i)
27
- hash = Math.imul(hash, 0x01000193)
28
- }
29
- return (hash >>> 0).toString(36)
30
- }
@@ -1,54 +0,0 @@
1
- import z from "zod"
2
-
3
- export abstract class NamedError extends Error {
4
- abstract schema(): z.core.$ZodType
5
- abstract toObject(): { name: string; data: any }
6
-
7
- static create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data) {
8
- const schema = z
9
- .object({
10
- name: z.literal(name),
11
- data,
12
- })
13
- .meta({
14
- ref: name,
15
- })
16
- const result = class extends NamedError {
17
- public static readonly Schema = schema
18
-
19
- public override readonly name = name as Name
20
-
21
- constructor(
22
- public readonly data: z.input<Data>,
23
- options?: ErrorOptions,
24
- ) {
25
- super(name, options)
26
- this.name = name
27
- }
28
-
29
- static isInstance(input: any): input is InstanceType<typeof result> {
30
- return typeof input === "object" && "name" in input && input.name === name
31
- }
32
-
33
- schema() {
34
- return schema
35
- }
36
-
37
- toObject() {
38
- return {
39
- name: name,
40
- data: this.data,
41
- }
42
- }
43
- }
44
- Object.defineProperty(result, "name", { value: name })
45
- return result
46
- }
47
-
48
- public static readonly Unknown = NamedError.create(
49
- "UnknownError",
50
- z.object({
51
- message: z.string(),
52
- }),
53
- )
54
- }
@@ -1,11 +0,0 @@
1
- import { z } from "zod"
2
-
3
- export function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) {
4
- const result = (input: z.infer<T>) => {
5
- const parsed = schema.parse(input)
6
- return cb(parsed)
7
- }
8
- result.force = (input: z.infer<T>) => cb(input)
9
- result.schema = schema
10
- return result
11
- }
@@ -1,48 +0,0 @@
1
- import { randomBytes } from "crypto"
2
-
3
- export namespace Identifier {
4
- const LENGTH = 26
5
-
6
- // State for monotonic ID generation
7
- let lastTimestamp = 0
8
- let counter = 0
9
-
10
- export function ascending() {
11
- return create(false)
12
- }
13
-
14
- export function descending() {
15
- return create(true)
16
- }
17
-
18
- function randomBase62(length: number): string {
19
- const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
20
- let result = ""
21
- const bytes = randomBytes(length)
22
- for (let i = 0; i < length; i++) {
23
- result += chars[bytes[i] % 62]
24
- }
25
- return result
26
- }
27
-
28
- export function create(descending: boolean, timestamp?: number): string {
29
- const currentTimestamp = timestamp ?? Date.now()
30
-
31
- if (currentTimestamp !== lastTimestamp) {
32
- lastTimestamp = currentTimestamp
33
- counter = 0
34
- }
35
- counter++
36
-
37
- let now = BigInt(currentTimestamp) * BigInt(0x1000) + BigInt(counter)
38
-
39
- now = descending ? ~now : now
40
-
41
- const timeBytes = Buffer.alloc(6)
42
- for (let i = 0; i < 6; i++) {
43
- timeBytes[i] = Number((now >> BigInt(40 - 8 * i)) & BigInt(0xff))
44
- }
45
-
46
- return timeBytes.toString("hex") + randomBase62(LENGTH - 12)
47
- }
48
- }
@@ -1,3 +0,0 @@
1
- export function iife<T>(fn: () => T) {
2
- return fn()
3
- }
@@ -1,11 +0,0 @@
1
- export function lazy<T>(fn: () => T) {
2
- let value: T | undefined
3
- let loaded = false
4
-
5
- return (): T => {
6
- if (loaded) return value as T
7
- loaded = true
8
- value = fn()
9
- return value as T
10
- }
11
- }
@@ -1,37 +0,0 @@
1
- export function getFilename(path: string | undefined) {
2
- if (!path) return ""
3
- const trimmed = path.replace(/[\/\\]+$/, "")
4
- const parts = trimmed.split(/[\/\\]/)
5
- return parts[parts.length - 1] ?? ""
6
- }
7
-
8
- export function getDirectory(path: string | undefined) {
9
- if (!path) return ""
10
- const trimmed = path.replace(/[\/\\]+$/, "")
11
- const parts = trimmed.split(/[\/\\]/)
12
- return parts.slice(0, parts.length - 1).join("/") + "/"
13
- }
14
-
15
- export function getFileExtension(path: string | undefined) {
16
- if (!path) return ""
17
- const parts = path.split(".")
18
- return parts[parts.length - 1]
19
- }
20
-
21
- export function getFilenameTruncated(path: string | undefined, maxLength: number = 20) {
22
- const filename = getFilename(path)
23
- if (filename.length <= maxLength) return filename
24
- const lastDot = filename.lastIndexOf(".")
25
- const ext = lastDot <= 0 ? "" : filename.slice(lastDot)
26
- const available = maxLength - ext.length - 1 // -1 for ellipsis
27
- if (available <= 0) return filename.slice(0, maxLength - 1) + "…"
28
- return filename.slice(0, available) + "…" + ext
29
- }
30
-
31
- export function truncateMiddle(text: string, maxLength: number = 20) {
32
- if (text.length <= maxLength) return text
33
- const available = maxLength - 1 // -1 for ellipsis
34
- const start = Math.ceil(available / 2)
35
- const end = Math.floor(available / 2)
36
- return text.slice(0, start) + "…" + text.slice(-end)
37
- }