runwork 0.15.1 → 0.16.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 (404) hide show
  1. package/bundled-types/task-delegation/task-delegation/types.d.ts +6 -0
  2. package/dist/index.js +20237 -116
  3. package/package.json +4 -4
  4. package/dist/__tests__/curl-parser.test.d.ts +0 -1
  5. package/dist/__tests__/curl-parser.test.js +0 -250
  6. package/dist/__tests__/install-scripts.test.d.ts +0 -1
  7. package/dist/__tests__/install-scripts.test.js +0 -280
  8. package/dist/__tests__/types-manager.test.d.ts +0 -1
  9. package/dist/__tests__/types-manager.test.js +0 -89
  10. package/dist/agents/__tests__/chatgpt-registry.test.d.ts +0 -1
  11. package/dist/agents/__tests__/chatgpt-registry.test.js +0 -61
  12. package/dist/agents/__tests__/claude-code-managed-block.test.d.ts +0 -1
  13. package/dist/agents/__tests__/claude-code-managed-block.test.js +0 -105
  14. package/dist/agents/__tests__/claude-code-plugin.test.d.ts +0 -1
  15. package/dist/agents/__tests__/claude-code-plugin.test.js +0 -47
  16. package/dist/agents/__tests__/claude-code-stats.test.d.ts +0 -1
  17. package/dist/agents/__tests__/claude-code-stats.test.js +0 -390
  18. package/dist/agents/__tests__/claude-desktop-memory.test.d.ts +0 -1
  19. package/dist/agents/__tests__/claude-desktop-memory.test.js +0 -154
  20. package/dist/agents/__tests__/claude-desktop-plugin-tree.test.d.ts +0 -1
  21. package/dist/agents/__tests__/claude-desktop-plugin-tree.test.js +0 -161
  22. package/dist/agents/__tests__/claude-desktop-plugin.test.d.ts +0 -1
  23. package/dist/agents/__tests__/claude-desktop-plugin.test.js +0 -117
  24. package/dist/agents/__tests__/claude-desktop-rpm.test.d.ts +0 -1
  25. package/dist/agents/__tests__/claude-desktop-rpm.test.js +0 -126
  26. package/dist/agents/__tests__/claude-desktop-stats.test.d.ts +0 -1
  27. package/dist/agents/__tests__/claude-desktop-stats.test.js +0 -280
  28. package/dist/agents/__tests__/codex-instructions.test.d.ts +0 -1
  29. package/dist/agents/__tests__/codex-instructions.test.js +0 -57
  30. package/dist/agents/__tests__/codex-minimum-permissions.test.d.ts +0 -1
  31. package/dist/agents/__tests__/codex-minimum-permissions.test.js +0 -82
  32. package/dist/agents/__tests__/codex-stats.test.d.ts +0 -1
  33. package/dist/agents/__tests__/codex-stats.test.js +0 -370
  34. package/dist/agents/__tests__/cursor-merge.test.d.ts +0 -1
  35. package/dist/agents/__tests__/cursor-merge.test.js +0 -66
  36. package/dist/agents/__tests__/cursor-stats.test.d.ts +0 -1
  37. package/dist/agents/__tests__/cursor-stats.test.js +0 -183
  38. package/dist/agents/__tests__/defaults-merge.test.d.ts +0 -1
  39. package/dist/agents/__tests__/defaults-merge.test.js +0 -268
  40. package/dist/agents/__tests__/detection.test.d.ts +0 -1
  41. package/dist/agents/__tests__/detection.test.js +0 -89
  42. package/dist/agents/__tests__/graceful-degradation.test.d.ts +0 -1
  43. package/dist/agents/__tests__/graceful-degradation.test.js +0 -129
  44. package/dist/agents/__tests__/instruction-hint.test.d.ts +0 -1
  45. package/dist/agents/__tests__/instruction-hint.test.js +0 -69
  46. package/dist/agents/__tests__/intro-skill.test.d.ts +0 -1
  47. package/dist/agents/__tests__/intro-skill.test.js +0 -193
  48. package/dist/agents/__tests__/schema-validation.test.d.ts +0 -1
  49. package/dist/agents/__tests__/schema-validation.test.js +0 -212
  50. package/dist/agents/__tests__/skill-slug.test.d.ts +0 -1
  51. package/dist/agents/__tests__/skill-slug.test.js +0 -77
  52. package/dist/agents/claude-code.d.ts +0 -59
  53. package/dist/agents/claude-code.js +0 -753
  54. package/dist/agents/claude-desktop-plugin-tree.d.ts +0 -59
  55. package/dist/agents/claude-desktop-plugin-tree.js +0 -143
  56. package/dist/agents/claude-desktop.d.ts +0 -47
  57. package/dist/agents/claude-desktop.js +0 -684
  58. package/dist/agents/cline.d.ts +0 -15
  59. package/dist/agents/cline.js +0 -130
  60. package/dist/agents/codex.d.ts +0 -44
  61. package/dist/agents/codex.js +0 -453
  62. package/dist/agents/conversation-skills.d.ts +0 -18
  63. package/dist/agents/conversation-skills.js +0 -229
  64. package/dist/agents/cursor.d.ts +0 -35
  65. package/dist/agents/cursor.js +0 -294
  66. package/dist/agents/default-config.d.ts +0 -30
  67. package/dist/agents/default-config.js +0 -67
  68. package/dist/agents/defaults-merge.d.ts +0 -87
  69. package/dist/agents/defaults-merge.js +0 -150
  70. package/dist/agents/detect.d.ts +0 -4
  71. package/dist/agents/detect.js +0 -67
  72. package/dist/agents/detection.d.ts +0 -18
  73. package/dist/agents/detection.js +0 -94
  74. package/dist/agents/gemini.d.ts +0 -15
  75. package/dist/agents/gemini.js +0 -122
  76. package/dist/agents/generic-adapter.d.ts +0 -25
  77. package/dist/agents/generic-adapter.js +0 -151
  78. package/dist/agents/intro-skill.d.ts +0 -45
  79. package/dist/agents/intro-skill.js +0 -447
  80. package/dist/agents/registry-data.d.ts +0 -192
  81. package/dist/agents/registry-data.js +0 -669
  82. package/dist/agents/registry.d.ts +0 -13
  83. package/dist/agents/registry.js +0 -36
  84. package/dist/agents/runtime-detection.d.ts +0 -82
  85. package/dist/agents/runtime-detection.js +0 -271
  86. package/dist/agents/session-start-hook.d.ts +0 -37
  87. package/dist/agents/session-start-hook.js +0 -159
  88. package/dist/agents/types.d.ts +0 -171
  89. package/dist/agents/types.js +0 -75
  90. package/dist/agents/utils/instruction-hint.d.ts +0 -21
  91. package/dist/agents/utils/instruction-hint.js +0 -108
  92. package/dist/agents/utils/json-config.d.ts +0 -19
  93. package/dist/agents/utils/json-config.js +0 -69
  94. package/dist/agents/utils/toml-config.d.ts +0 -8
  95. package/dist/agents/utils/toml-config.js +0 -27
  96. package/dist/agents/windsurf.d.ts +0 -14
  97. package/dist/agents/windsurf.js +0 -102
  98. package/dist/api/__tests__/client.test.d.ts +0 -1
  99. package/dist/api/__tests__/client.test.js +0 -272
  100. package/dist/api/client.d.ts +0 -326
  101. package/dist/api/client.js +0 -427
  102. package/dist/auth/__tests__/login-flow.test.d.ts +0 -1
  103. package/dist/auth/__tests__/login-flow.test.js +0 -101
  104. package/dist/auth/__tests__/store.test.d.ts +0 -1
  105. package/dist/auth/__tests__/store.test.js +0 -132
  106. package/dist/auth/login-flow.d.ts +0 -26
  107. package/dist/auth/login-flow.js +0 -137
  108. package/dist/auth/store.d.ts +0 -5
  109. package/dist/auth/store.js +0 -62
  110. package/dist/commands/__tests__/clone-args.test.d.ts +0 -1
  111. package/dist/commands/__tests__/clone-args.test.js +0 -51
  112. package/dist/commands/__tests__/clone-source-result.test.d.ts +0 -1
  113. package/dist/commands/__tests__/clone-source-result.test.js +0 -45
  114. package/dist/commands/__tests__/info-merge.test.d.ts +0 -1
  115. package/dist/commands/__tests__/info-merge.test.js +0 -55
  116. package/dist/commands/__tests__/mcp-entries.test.d.ts +0 -1
  117. package/dist/commands/__tests__/mcp-entries.test.js +0 -48
  118. package/dist/commands/__tests__/setup-persona.test.d.ts +0 -1
  119. package/dist/commands/__tests__/setup-persona.test.js +0 -31
  120. package/dist/commands/__tests__/setup.test.d.ts +0 -1
  121. package/dist/commands/__tests__/setup.test.js +0 -81
  122. package/dist/commands/__tests__/sync-redetect.test.d.ts +0 -1
  123. package/dist/commands/__tests__/sync-redetect.test.js +0 -96
  124. package/dist/commands/__tests__/sync-telemetry.test.d.ts +0 -1
  125. package/dist/commands/__tests__/sync-telemetry.test.js +0 -281
  126. package/dist/commands/__tests__/upgrade.test.d.ts +0 -1
  127. package/dist/commands/__tests__/upgrade.test.js +0 -157
  128. package/dist/commands/agents.d.ts +0 -2
  129. package/dist/commands/agents.js +0 -160
  130. package/dist/commands/api-keys.d.ts +0 -2
  131. package/dist/commands/api-keys.js +0 -95
  132. package/dist/commands/apps.d.ts +0 -2
  133. package/dist/commands/apps.js +0 -82
  134. package/dist/commands/build-plugin.d.ts +0 -2
  135. package/dist/commands/build-plugin.js +0 -135
  136. package/dist/commands/clone.d.ts +0 -60
  137. package/dist/commands/clone.js +0 -271
  138. package/dist/commands/components.d.ts +0 -2
  139. package/dist/commands/components.js +0 -43
  140. package/dist/commands/deploy.d.ts +0 -2
  141. package/dist/commands/deploy.js +0 -279
  142. package/dist/commands/dev.d.ts +0 -11
  143. package/dist/commands/dev.js +0 -1011
  144. package/dist/commands/doctor.d.ts +0 -2
  145. package/dist/commands/doctor.js +0 -230
  146. package/dist/commands/endpoints.d.ts +0 -2
  147. package/dist/commands/endpoints.js +0 -189
  148. package/dist/commands/entities.d.ts +0 -2
  149. package/dist/commands/entities.js +0 -198
  150. package/dist/commands/files.d.ts +0 -2
  151. package/dist/commands/files.js +0 -193
  152. package/dist/commands/inbox.d.ts +0 -11
  153. package/dist/commands/inbox.js +0 -60
  154. package/dist/commands/info.d.ts +0 -178
  155. package/dist/commands/info.js +0 -455
  156. package/dist/commands/init.d.ts +0 -21
  157. package/dist/commands/init.js +0 -185
  158. package/dist/commands/integrations.d.ts +0 -2
  159. package/dist/commands/integrations.js +0 -233
  160. package/dist/commands/login.d.ts +0 -2
  161. package/dist/commands/login.js +0 -44
  162. package/dist/commands/logout.d.ts +0 -2
  163. package/dist/commands/logout.js +0 -13
  164. package/dist/commands/logs.d.ts +0 -2
  165. package/dist/commands/logs.js +0 -232
  166. package/dist/commands/mcp-entries.d.ts +0 -13
  167. package/dist/commands/mcp-entries.js +0 -26
  168. package/dist/commands/mcp.d.ts +0 -2
  169. package/dist/commands/mcp.js +0 -245
  170. package/dist/commands/open.d.ts +0 -2
  171. package/dist/commands/open.js +0 -53
  172. package/dist/commands/resume.d.ts +0 -2
  173. package/dist/commands/resume.js +0 -289
  174. package/dist/commands/save-convo.d.ts +0 -8
  175. package/dist/commands/save-convo.js +0 -20
  176. package/dist/commands/schedules.d.ts +0 -2
  177. package/dist/commands/schedules.js +0 -221
  178. package/dist/commands/setup.d.ts +0 -27
  179. package/dist/commands/setup.js +0 -177
  180. package/dist/commands/share-convo.d.ts +0 -24
  181. package/dist/commands/share-convo.js +0 -167
  182. package/dist/commands/skills.d.ts +0 -2
  183. package/dist/commands/skills.js +0 -352
  184. package/dist/commands/sync-telemetry.d.ts +0 -33
  185. package/dist/commands/sync-telemetry.js +0 -186
  186. package/dist/commands/sync.d.ts +0 -37
  187. package/dist/commands/sync.js +0 -702
  188. package/dist/commands/uninstall.d.ts +0 -2
  189. package/dist/commands/uninstall.js +0 -145
  190. package/dist/commands/upgrade.d.ts +0 -14
  191. package/dist/commands/upgrade.js +0 -217
  192. package/dist/commands/validate.d.ts +0 -2
  193. package/dist/commands/validate.js +0 -89
  194. package/dist/commands/welcome.d.ts +0 -1
  195. package/dist/commands/welcome.js +0 -86
  196. package/dist/commands/workflows.d.ts +0 -2
  197. package/dist/commands/workflows.js +0 -187
  198. package/dist/deploy/__tests__/deploy-state.test.d.ts +0 -1
  199. package/dist/deploy/__tests__/deploy-state.test.js +0 -80
  200. package/dist/deploy/__tests__/deploy-status.test.d.ts +0 -1
  201. package/dist/deploy/__tests__/deploy-status.test.js +0 -41
  202. package/dist/deploy/__tests__/detach-args.test.d.ts +0 -1
  203. package/dist/deploy/__tests__/detach-args.test.js +0 -30
  204. package/dist/deploy/deploy-state.d.ts +0 -36
  205. package/dist/deploy/deploy-state.js +0 -63
  206. package/dist/deploy/deploy-status.d.ts +0 -21
  207. package/dist/deploy/deploy-status.js +0 -36
  208. package/dist/deploy/detach.d.ts +0 -32
  209. package/dist/deploy/detach.js +0 -71
  210. package/dist/dev/__tests__/attach.test.d.ts +0 -1
  211. package/dist/dev/__tests__/attach.test.js +0 -296
  212. package/dist/dev/__tests__/detach.test.d.ts +0 -1
  213. package/dist/dev/__tests__/detach.test.js +0 -404
  214. package/dist/dev/__tests__/preview-url-poller.test.d.ts +0 -1
  215. package/dist/dev/__tests__/preview-url-poller.test.js +0 -149
  216. package/dist/dev/__tests__/session.test.d.ts +0 -1
  217. package/dist/dev/__tests__/session.test.js +0 -446
  218. package/dist/dev/__tests__/startup-sync.test.d.ts +0 -1
  219. package/dist/dev/__tests__/startup-sync.test.js +0 -32
  220. package/dist/dev/__tests__/stop.test.d.ts +0 -1
  221. package/dist/dev/__tests__/stop.test.js +0 -172
  222. package/dist/dev/attach.d.ts +0 -120
  223. package/dist/dev/attach.js +0 -269
  224. package/dist/dev/detach.d.ts +0 -187
  225. package/dist/dev/detach.js +0 -292
  226. package/dist/dev/preview-url-poller.d.ts +0 -35
  227. package/dist/dev/preview-url-poller.js +0 -50
  228. package/dist/dev/session.d.ts +0 -175
  229. package/dist/dev/session.js +0 -258
  230. package/dist/dev/startup-sync.d.ts +0 -23
  231. package/dist/dev/startup-sync.js +0 -14
  232. package/dist/dev/stop.d.ts +0 -52
  233. package/dist/dev/stop.js +0 -101
  234. package/dist/devtools/registry-data.d.ts +0 -46
  235. package/dist/devtools/registry-data.js +0 -40
  236. package/dist/generated/bundled-types.d.ts +0 -1
  237. package/dist/generated/bundled-types.js +0 -46
  238. package/dist/generated/version.d.ts +0 -1
  239. package/dist/generated/version.js +0 -2
  240. package/dist/git/__tests__/auto-commit.test.d.ts +0 -1
  241. package/dist/git/__tests__/auto-commit.test.js +0 -431
  242. package/dist/git/__tests__/classify-sync-error.test.d.ts +0 -1
  243. package/dist/git/__tests__/classify-sync-error.test.js +0 -57
  244. package/dist/git/__tests__/credential-helper-e2e.test.d.ts +0 -21
  245. package/dist/git/__tests__/credential-helper-e2e.test.js +0 -195
  246. package/dist/git/__tests__/credentials.test.d.ts +0 -1
  247. package/dist/git/__tests__/credentials.test.js +0 -141
  248. package/dist/git/__tests__/deploy-guard.test.d.ts +0 -1
  249. package/dist/git/__tests__/deploy-guard.test.js +0 -61
  250. package/dist/git/__tests__/ensure-git-credential-helper.test.d.ts +0 -1
  251. package/dist/git/__tests__/ensure-git-credential-helper.test.js +0 -133
  252. package/dist/git/__tests__/ensure-runwork-remote.test.d.ts +0 -1
  253. package/dist/git/__tests__/ensure-runwork-remote.test.js +0 -109
  254. package/dist/git/__tests__/identity.test.d.ts +0 -1
  255. package/dist/git/__tests__/identity.test.js +0 -146
  256. package/dist/git/__tests__/manifest.test.d.ts +0 -1
  257. package/dist/git/__tests__/manifest.test.js +0 -446
  258. package/dist/git/__tests__/preflight-resolution.test.d.ts +0 -1
  259. package/dist/git/__tests__/preflight-resolution.test.js +0 -366
  260. package/dist/git/__tests__/preflight.test.d.ts +0 -1
  261. package/dist/git/__tests__/preflight.test.js +0 -36
  262. package/dist/git/__tests__/repo-config.test.d.ts +0 -1
  263. package/dist/git/__tests__/repo-config.test.js +0 -26
  264. package/dist/git/__tests__/sync.test.d.ts +0 -1
  265. package/dist/git/__tests__/sync.test.js +0 -405
  266. package/dist/git/auto-commit.d.ts +0 -35
  267. package/dist/git/auto-commit.js +0 -293
  268. package/dist/git/classify-sync-error.d.ts +0 -21
  269. package/dist/git/classify-sync-error.js +0 -111
  270. package/dist/git/credentials.d.ts +0 -75
  271. package/dist/git/credentials.js +0 -164
  272. package/dist/git/critical-files.d.ts +0 -20
  273. package/dist/git/critical-files.js +0 -68
  274. package/dist/git/deploy-guard.d.ts +0 -53
  275. package/dist/git/deploy-guard.js +0 -78
  276. package/dist/git/identity.d.ts +0 -44
  277. package/dist/git/identity.js +0 -133
  278. package/dist/git/preflight.d.ts +0 -57
  279. package/dist/git/preflight.js +0 -276
  280. package/dist/git/remote.d.ts +0 -37
  281. package/dist/git/remote.js +0 -75
  282. package/dist/git/repo-config.d.ts +0 -8
  283. package/dist/git/repo-config.js +0 -29
  284. package/dist/git/sync.d.ts +0 -15
  285. package/dist/git/sync.js +0 -159
  286. package/dist/health/__tests__/checks.test.d.ts +0 -1
  287. package/dist/health/__tests__/checks.test.js +0 -357
  288. package/dist/health/__tests__/cli-distribution-checks.test.d.ts +0 -1
  289. package/dist/health/__tests__/cli-distribution-checks.test.js +0 -196
  290. package/dist/health/__tests__/fix.test.d.ts +0 -1
  291. package/dist/health/__tests__/fix.test.js +0 -72
  292. package/dist/health/__tests__/runner-filter.test.d.ts +0 -1
  293. package/dist/health/__tests__/runner-filter.test.js +0 -61
  294. package/dist/health/checks.d.ts +0 -42
  295. package/dist/health/checks.js +0 -636
  296. package/dist/health/fix.d.ts +0 -22
  297. package/dist/health/fix.js +0 -62
  298. package/dist/health/runner.d.ts +0 -8
  299. package/dist/health/runner.js +0 -47
  300. package/dist/health/types.d.ts +0 -12
  301. package/dist/health/types.js +0 -1
  302. package/dist/index.d.ts +0 -1
  303. package/dist/logs/__tests__/tailer-format.test.d.ts +0 -1
  304. package/dist/logs/__tests__/tailer-format.test.js +0 -43
  305. package/dist/logs/tailer.d.ts +0 -17
  306. package/dist/logs/tailer.js +0 -217
  307. package/dist/sync/__tests__/change-detect.test.d.ts +0 -1
  308. package/dist/sync/__tests__/change-detect.test.js +0 -123
  309. package/dist/sync/__tests__/hash.test.d.ts +0 -1
  310. package/dist/sync/__tests__/hash.test.js +0 -18
  311. package/dist/sync/change-detect.d.ts +0 -19
  312. package/dist/sync/change-detect.js +0 -136
  313. package/dist/sync/conflict-ui.d.ts +0 -5
  314. package/dist/sync/conflict-ui.js +0 -78
  315. package/dist/sync/executor.d.ts +0 -23
  316. package/dist/sync/executor.js +0 -102
  317. package/dist/sync/hash.d.ts +0 -1
  318. package/dist/sync/hash.js +0 -4
  319. package/dist/sync/types.d.ts +0 -24
  320. package/dist/sync/types.js +0 -1
  321. package/dist/template/manifest.d.ts +0 -17
  322. package/dist/template/manifest.js +0 -145
  323. package/dist/tools/types.d.ts +0 -52
  324. package/dist/tools/types.js +0 -8
  325. package/dist/types-manager.d.ts +0 -1
  326. package/dist/types-manager.js +0 -35
  327. package/dist/types.d.ts +0 -349
  328. package/dist/types.js +0 -1
  329. package/dist/ui/__tests__/banner.test.d.ts +0 -1
  330. package/dist/ui/__tests__/banner.test.js +0 -98
  331. package/dist/ui/__tests__/colors.test.d.ts +0 -1
  332. package/dist/ui/__tests__/colors.test.js +0 -22
  333. package/dist/ui/__tests__/keyboard.test.d.ts +0 -1
  334. package/dist/ui/__tests__/keyboard.test.js +0 -34
  335. package/dist/ui/__tests__/status-line.test.d.ts +0 -1
  336. package/dist/ui/__tests__/status-line.test.js +0 -54
  337. package/dist/ui/banner.d.ts +0 -29
  338. package/dist/ui/banner.js +0 -153
  339. package/dist/ui/colors.d.ts +0 -4
  340. package/dist/ui/colors.js +0 -7
  341. package/dist/ui/keyboard.d.ts +0 -12
  342. package/dist/ui/keyboard.js +0 -61
  343. package/dist/ui/status-line.d.ts +0 -6
  344. package/dist/ui/status-line.js +0 -53
  345. package/dist/utils/__tests__/format-error.test.d.ts +0 -1
  346. package/dist/utils/__tests__/format-error.test.js +0 -43
  347. package/dist/utils/__tests__/help-json.test.d.ts +0 -1
  348. package/dist/utils/__tests__/help-json.test.js +0 -39
  349. package/dist/utils/__tests__/http.test.d.ts +0 -1
  350. package/dist/utils/__tests__/http.test.js +0 -381
  351. package/dist/utils/__tests__/ignore-matcher.test.d.ts +0 -1
  352. package/dist/utils/__tests__/ignore-matcher.test.js +0 -205
  353. package/dist/utils/__tests__/output.test.d.ts +0 -1
  354. package/dist/utils/__tests__/output.test.js +0 -38
  355. package/dist/utils/__tests__/prompt.test.d.ts +0 -1
  356. package/dist/utils/__tests__/prompt.test.js +0 -27
  357. package/dist/utils/__tests__/resolve.test.d.ts +0 -1
  358. package/dist/utils/__tests__/resolve.test.js +0 -95
  359. package/dist/utils/__tests__/sqlite.test.d.ts +0 -1
  360. package/dist/utils/__tests__/sqlite.test.js +0 -89
  361. package/dist/utils/agent-guidance.d.ts +0 -47
  362. package/dist/utils/agent-guidance.js +0 -128
  363. package/dist/utils/app-info.d.ts +0 -70
  364. package/dist/utils/app-info.js +0 -167
  365. package/dist/utils/curl-parser.d.ts +0 -12
  366. package/dist/utils/curl-parser.js +0 -162
  367. package/dist/utils/data-input.d.ts +0 -1
  368. package/dist/utils/data-input.js +0 -38
  369. package/dist/utils/format-error.d.ts +0 -10
  370. package/dist/utils/format-error.js +0 -38
  371. package/dist/utils/fs.d.ts +0 -5
  372. package/dist/utils/fs.js +0 -23
  373. package/dist/utils/help-json.d.ts +0 -70
  374. package/dist/utils/help-json.js +0 -88
  375. package/dist/utils/http.d.ts +0 -46
  376. package/dist/utils/http.js +0 -421
  377. package/dist/utils/ignore-matcher.d.ts +0 -47
  378. package/dist/utils/ignore-matcher.js +0 -132
  379. package/dist/utils/output.d.ts +0 -17
  380. package/dist/utils/output.js +0 -27
  381. package/dist/utils/prompt.d.ts +0 -5
  382. package/dist/utils/prompt.js +0 -42
  383. package/dist/utils/resolve.d.ts +0 -12
  384. package/dist/utils/resolve.js +0 -52
  385. package/dist/utils/setup-state.d.ts +0 -3
  386. package/dist/utils/setup-state.js +0 -19
  387. package/dist/utils/sqlite-adapter.d.ts +0 -48
  388. package/dist/utils/sqlite-adapter.js +0 -147
  389. package/dist/utils/sqlite.d.ts +0 -14
  390. package/dist/utils/sqlite.js +0 -14
  391. package/dist/utils/subprocess.d.ts +0 -19
  392. package/dist/utils/subprocess.js +0 -27
  393. package/dist/utils/which.d.ts +0 -14
  394. package/dist/utils/which.js +0 -47
  395. package/dist/utils/zip.d.ts +0 -7
  396. package/dist/utils/zip.js +0 -42
  397. package/dist/validate/__tests__/validate.test.d.ts +0 -1
  398. package/dist/validate/__tests__/validate.test.js +0 -42
  399. package/dist/validate/freshness.d.ts +0 -28
  400. package/dist/validate/freshness.js +0 -48
  401. package/dist/validate/preview.d.ts +0 -21
  402. package/dist/validate/preview.js +0 -39
  403. package/dist/workspace/resolve.d.ts +0 -19
  404. package/dist/workspace/resolve.js +0 -100
@@ -1,151 +0,0 @@
1
- import { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from 'fs';
2
- import { join } from 'path';
3
- import { homedir } from 'os';
4
- import { buildSkillMd } from './types.js';
5
- import { mergeJsonMcpServers, removeRunworkMcpServers } from './utils/json-config.js';
6
- import { writeHintToFile, writeTeamInstructionsToFile, removeHintFromFile, removeTeamInstructionsFromFile } from './utils/instruction-hint.js';
7
- import { resolvePlatformString, resolveToAbsolute } from './registry.js';
8
- import { runAgentDetection } from './detection.js';
9
- /**
10
- * Generic adapter that handles any agent from the registry using its
11
- * skillsPaths, mcpConfigPath, and instructionFile metadata.
12
- *
13
- * This covers the long tail of community agents. Agents with custom behavior
14
- * (plugin systems, special config formats, usage stats reading) use their
15
- * own dedicated adapter classes instead.
16
- */
17
- export class GenericAgentAdapter {
18
- name;
19
- slug;
20
- mcpProvidesSkills = true;
21
- def;
22
- constructor(def) {
23
- this.def = def;
24
- this.name = def.name;
25
- this.slug = def.slug;
26
- }
27
- async detect() {
28
- return runAgentDetection(this.def.detection);
29
- }
30
- supportsMcpScope(scope) {
31
- if (!this.def.mcpConfigPath)
32
- return false;
33
- return scope === 'user';
34
- }
35
- supportsSkills() {
36
- return !!this.def.skillsPaths;
37
- }
38
- async writeMcpServers(servers, _scope) {
39
- if (!this.def.mcpConfigPath)
40
- return;
41
- const filePath = join(homedir(), resolvePlatformString(this.def.mcpConfigPath) || '');
42
- if (!filePath)
43
- return;
44
- const entries = {};
45
- for (const s of servers) {
46
- entries[s.name] = {
47
- type: 'http',
48
- url: s.url,
49
- ...(s.headers ? { headers: s.headers } : {}),
50
- };
51
- }
52
- mergeJsonMcpServers(filePath, entries, this.def.mcpConfigKey || 'mcpServers');
53
- }
54
- async writeSkills(skills, scope) {
55
- if (!this.def.skillsPaths)
56
- return;
57
- const pathTemplate = scope === 'project'
58
- ? this.def.skillsPaths.project
59
- : this.def.skillsPaths.global;
60
- if (!pathTemplate)
61
- return;
62
- const baseDir = resolveToAbsolute(pathTemplate, scope === 'project' ? 'project' : 'global');
63
- if (!baseDir)
64
- return;
65
- for (const skill of skills) {
66
- if (skill.name !== skill.filename) {
67
- const oldDir = join(baseDir, skill.name);
68
- if (existsSync(oldDir)) {
69
- try {
70
- rmSync(oldDir, { recursive: true, force: true });
71
- }
72
- catch { /* best-effort */ }
73
- }
74
- }
75
- const skillDir = join(baseDir, skill.filename);
76
- mkdirSync(skillDir, { recursive: true });
77
- writeFileSync(join(skillDir, 'SKILL.md'), buildSkillMd(skill));
78
- }
79
- }
80
- async writeInstructionHint(hint, scope) {
81
- if (!this.def.instructionFile)
82
- return;
83
- const pathTemplate = scope === 'project'
84
- ? this.def.instructionFile.project
85
- : this.def.instructionFile.global;
86
- if (!pathTemplate)
87
- return;
88
- const filePath = resolveToAbsolute(pathTemplate, scope === 'project' ? 'project' : 'global');
89
- if (!filePath)
90
- return;
91
- writeHintToFile(filePath, hint);
92
- }
93
- async writeTeamInstructions(instructions, scope) {
94
- if (!this.def.instructionFile)
95
- return;
96
- const pathTemplate = scope === 'project'
97
- ? this.def.instructionFile.project
98
- : this.def.instructionFile.global;
99
- if (!pathTemplate)
100
- return;
101
- const filePath = resolveToAbsolute(pathTemplate, scope === 'project' ? 'project' : 'global');
102
- if (!filePath)
103
- return;
104
- writeTeamInstructionsToFile(filePath, instructions);
105
- }
106
- // ── Cleanup (uninstall) ────────────────────────────────────────────
107
- async cleanup(scope, manifest) {
108
- // 1. Remove MCP entries
109
- if (this.def.mcpConfigPath && scope === 'user') {
110
- const resolved = resolvePlatformString(this.def.mcpConfigPath);
111
- if (resolved) {
112
- const filePath = join(homedir(), resolved);
113
- removeRunworkMcpServers(filePath, this.def.mcpConfigKey || 'mcpServers');
114
- }
115
- }
116
- // 2. Remove only skill directories that we synced (listed in manifest)
117
- if (this.def.skillsPaths && manifest?.skillFilenames.length) {
118
- const pathTemplate = scope === 'project'
119
- ? this.def.skillsPaths.project
120
- : this.def.skillsPaths.global;
121
- if (pathTemplate) {
122
- const baseDir = resolveToAbsolute(pathTemplate, scope === 'project' ? 'project' : 'global');
123
- if (baseDir && existsSync(baseDir)) {
124
- const allowed = new Set(manifest.skillFilenames);
125
- for (const entry of readdirSync(baseDir)) {
126
- if (!allowed.has(entry))
127
- continue;
128
- const entryPath = join(baseDir, entry);
129
- try {
130
- rmSync(entryPath, { recursive: true, force: true });
131
- }
132
- catch { /* best-effort */ }
133
- }
134
- }
135
- }
136
- }
137
- // 3. Remove instruction hints and team instructions
138
- if (this.def.instructionFile) {
139
- const pathTemplate = scope === 'project'
140
- ? this.def.instructionFile.project
141
- : this.def.instructionFile.global;
142
- if (pathTemplate) {
143
- const filePath = resolveToAbsolute(pathTemplate, scope === 'project' ? 'project' : 'global');
144
- if (filePath) {
145
- removeHintFromFile(filePath);
146
- removeTeamInstructionsFromFile(filePath);
147
- }
148
- }
149
- }
150
- }
151
- }
@@ -1,45 +0,0 @@
1
- import type { WorkspaceAllData } from '../types.js';
2
- import type { SkillFile } from './types.js';
3
- export interface IntroSkillContext {
4
- workspaceName: string;
5
- workspaceId: string;
6
- workspaceSlug?: string;
7
- registries: WorkspaceAllData | null;
8
- connectedIntegrations: string[];
9
- mcpServerCount: number;
10
- skillCount: number;
11
- /** Names of external MCP servers configured in the workspace */
12
- mcpServerNames?: string[];
13
- /** Names of skills (app + external) configured in the workspace */
14
- skillNames?: string[];
15
- }
16
- export interface InstructionHintContext {
17
- workspaceName: string;
18
- workspaceId: string;
19
- workspaceSlug?: string;
20
- registries: WorkspaceAllData | null;
21
- connectedIntegrations: string[];
22
- appCount: number;
23
- skillCount: number;
24
- mcpServerCount: number;
25
- /**
26
- * Technical-level classification from desktop onboarding. When present,
27
- * a persona-specific communication block is added to the instruction hint
28
- * so integrated agents match the user's experience level.
29
- */
30
- persona?: {
31
- level: 1 | 2 | 3;
32
- label: 'everyday' | 'curious' | 'engineer';
33
- };
34
- }
35
- export declare function buildAppSkillDescription(appName: string, registries: WorkspaceAllData | null): string;
36
- /**
37
- * Generate the dynamic Runwork intro skill that teaches agents what Runwork is
38
- * and what infrastructure is available in this workspace.
39
- */
40
- export declare function generateIntroSkill(ctx: IntroSkillContext): SkillFile;
41
- /**
42
- * Generate the minimal instruction hint that goes into agent instruction files.
43
- * Uses HTML comment delimiters so it can be found and replaced on sync.
44
- */
45
- export declare function generateInstructionHint(ctx: InstructionHintContext): string;
@@ -1,447 +0,0 @@
1
- /**
2
- * Build a persona-specific communication block for the instruction hint.
3
- * Returns an empty array for engineers (level 3), who need no special tone
4
- * handling, and for an absent/unknown persona.
5
- */
6
- function buildPersonaBlock(persona) {
7
- if (!persona || persona.level === 3)
8
- return [];
9
- if (persona.level === 1) {
10
- return [
11
- '',
12
- '### Communicating with this user',
13
- '',
14
- 'The person you are helping is new to AI tools and is not a software developer. Adapt how you work with them:',
15
- '',
16
- '- Explain things in plain, everyday language. Do not assume they know programming or technical concepts.',
17
- '- Do not ask them to run developer tooling (npm, bun, node, pnpm, yarn, git, build or package-manager commands). When a task needs technical steps, perform those steps yourself instead of instructing the user.',
18
- '- Avoid jargon. When a technical term is unavoidable, define it in one short sentence.',
19
- '- Work in small steps. Do one thing, confirm it landed, then continue.',
20
- '- Focus on what the user wants to accomplish, not on the implementation details.',
21
- ];
22
- }
23
- // Level 2: curious
24
- return [
25
- '',
26
- '### Communicating with this user',
27
- '',
28
- 'The person you are helping has some familiarity with AI tools but is not a professional developer. Adapt how you work with them:',
29
- '',
30
- '- Prefer plain language. When you use a technical term, briefly explain what it means.',
31
- '- Do not lean on developer tooling (npm, bun, node, git, build commands) unless it is genuinely required, and explain what any command does before suggesting it.',
32
- '- Keep explanations concise and outcome-focused.',
33
- ];
34
- }
35
- /** Format a list of names with truncation. Shows up to `max` items, then "+ N more". */
36
- function formatList(items, max = 8) {
37
- if (items.length <= max)
38
- return items.join(', ');
39
- return `${items.slice(0, max).join(', ')} + ${items.length - max} more`;
40
- }
41
- function buildInventoryLine(ctx) {
42
- const parts = [];
43
- if (ctx.appCount > 0)
44
- parts.push(`${ctx.appCount} app${ctx.appCount > 1 ? 's' : ''}`);
45
- if (ctx.registries) {
46
- const reg = ctx.registries;
47
- if (reg.entities.length > 0) {
48
- // Deduplicate entity names (same entity can be registered by multiple apps)
49
- const uniqueNames = [...new Set(reg.entities.map(e => e.entityName))];
50
- parts.push(`${uniqueNames.length} entit${uniqueNames.length > 1 ? 'ies' : 'y'} (${formatList(uniqueNames, 5)})`);
51
- }
52
- if (reg.fileStorages.length > 0)
53
- parts.push(`${reg.fileStorages.length} file storage${reg.fileStorages.length > 1 ? 's' : ''}`);
54
- if (reg.schedules.length > 0) {
55
- const names = reg.schedules.map(s => s.name).filter(Boolean);
56
- if (names.length > 0)
57
- parts.push(`${reg.schedules.length} schedule${reg.schedules.length > 1 ? 's' : ''} (${formatList(names, 3)})`);
58
- else
59
- parts.push(`${reg.schedules.length} schedule${reg.schedules.length > 1 ? 's' : ''}`);
60
- }
61
- if (reg.workflows.length > 0) {
62
- const names = reg.workflows.map(w => w.name).filter(Boolean);
63
- if (names.length > 0)
64
- parts.push(`${reg.workflows.length} workflow${reg.workflows.length > 1 ? 's' : ''} (${formatList(names, 3)})`);
65
- else
66
- parts.push(`${reg.workflows.length} workflow${reg.workflows.length > 1 ? 's' : ''}`);
67
- }
68
- if (reg.agents.length > 0) {
69
- // Filter out agents with empty/missing names
70
- const names = reg.agents.map(a => a.name).filter(Boolean);
71
- if (names.length > 0)
72
- parts.push(`${reg.agents.length} agent${reg.agents.length > 1 ? 's' : ''} (${formatList(names, 3)})`);
73
- else
74
- parts.push(`${reg.agents.length} agent${reg.agents.length > 1 ? 's' : ''}`);
75
- }
76
- if (reg.endpoints.length > 0)
77
- parts.push(`${reg.endpoints.length} endpoint${reg.endpoints.length > 1 ? 's' : ''}`);
78
- if (reg.components.length > 0)
79
- parts.push(`${reg.components.length} component${reg.components.length > 1 ? 's' : ''}`);
80
- }
81
- if (ctx.connectedIntegrations.length > 0) {
82
- parts.push(`${ctx.connectedIntegrations.length} integration${ctx.connectedIntegrations.length > 1 ? 's' : ''} (${formatList(ctx.connectedIntegrations, 5)})`);
83
- }
84
- if (ctx.skillCount > 0)
85
- parts.push(`${ctx.skillCount} skill${ctx.skillCount > 1 ? 's' : ''}`);
86
- if (ctx.mcpServerCount > 0)
87
- parts.push(`${ctx.mcpServerCount} MCP server${ctx.mcpServerCount > 1 ? 's' : ''}`);
88
- return parts.length > 0 ? parts.join(', ') : 'no resources deployed yet';
89
- }
90
- export function buildAppSkillDescription(appName, registries) {
91
- if (!registries)
92
- return `${appName} - Runwork workspace application`;
93
- const parts = [];
94
- const appEntities = registries.entities.filter(e => e.appName === appName);
95
- const appSchedules = registries.schedules.filter(s => s.appName === appName);
96
- const appWorkflows = registries.workflows.filter(w => w.appName === appName);
97
- const appAgents = registries.agents.filter(a => a.appName === appName);
98
- const appEndpoints = registries.endpoints.filter(e => e.appName === appName);
99
- const appFileStorages = registries.fileStorages.filter(f => f.appName === appName);
100
- const appComponents = registries.components.filter(c => c.appName === appName);
101
- if (appEntities.length > 0)
102
- parts.push(`entities (${appEntities.map(e => e.entityName).join(', ')})`);
103
- if (appFileStorages.length > 0)
104
- parts.push('file storage');
105
- if (appSchedules.length > 0)
106
- parts.push(`schedules (${appSchedules.map(s => s.name).join(', ')})`);
107
- if (appWorkflows.length > 0)
108
- parts.push(`workflows (${appWorkflows.map(w => w.name).join(', ')})`);
109
- if (appAgents.length > 0)
110
- parts.push(`agents (${appAgents.map(a => a.name).join(', ')})`);
111
- if (appEndpoints.length > 0)
112
- parts.push(`endpoints (${appEndpoints.map(e => e.path).join(', ')})`);
113
- if (appComponents.length > 0)
114
- parts.push(`components (${appComponents.map(c => c.componentName).join(', ')})`);
115
- if (parts.length === 0)
116
- return `${appName} - Runwork workspace application`;
117
- return `${appName} - Runwork workspace app with ${parts.join(', ')}. Use this skill when you need data or capabilities from this app.`;
118
- }
119
- /**
120
- * Generate the dynamic Runwork intro skill that teaches agents what Runwork is
121
- * and what infrastructure is available in this workspace.
122
- */
123
- export function generateIntroSkill(ctx) {
124
- const lines = [];
125
- lines.push('# Runwork');
126
- lines.push('');
127
- lines.push(`Runwork is this team's AI workspace platform. It connects AI agents, users, and tools to shared infrastructure: data stores, workflows, scheduled jobs, API endpoints, file storage, 3,200+ third-party integrations, and custom applications, all managed centrally. Runwork gives agents the ability to build real, deployed applications with coded workflows, schedules, pages, API routes, and endpoints in a central company AI work cloud. Skills, MCP servers, and settings sync across the team's agents.`);
128
- lines.push('');
129
- // Default Actions — the routing that actually matters, front-loaded so
130
- // agents see it the moment they trigger the skill. The hint in CLAUDE.md
131
- // carries a compact version; this is the full version with examples.
132
- lines.push('## Default Actions (READ FIRST)');
133
- lines.push('');
134
- lines.push('**Runwork is the default for every capability it supports.** When the user asks for any of the operations below, you MUST use the Runwork tool shown before considering local alternatives. These operations sync across every teammate and their AI agents — local files, one-off scripts, and native alternatives only work for the current user and break team collaboration.');
135
- lines.push('');
136
- lines.push('| User says | What to do | What NOT to do |');
137
- lines.push('|---|---|---|');
138
- lines.push('| "save a skill", "create a skill", "share this knowledge", "add this to my skills" | Call `save_skill` MCP tool with name, description, content | Create local `SKILL.md` files, write prompts to the filesystem |');
139
- lines.push('| "update a skill", "edit the skill", "change the skill instructions" | Call `save_skill` with the existing name (it upserts) or `update_app_skill` for app-owned skills | Edit local skill files |');
140
- lines.push('| "remember", "store", "save this data", "keep track of" (anything structured) | Use `entity_{Name}` MCP tools (action: create/update) | Write to local SQLite, JSON files, memory |');
141
- lines.push('| "every day at 9am", "schedule", "run periodically", "cron" | Use existing Runwork schedules (`schedule_{name}`) or create one in a Runwork app | OS cron, `setInterval`, external schedulers |');
142
- lines.push('| "multi-step process", "pipeline", "durable workflow", "orchestrate" | Use Runwork workflows (`workflow_{name}`) | Ad-hoc bash/Python scripts, Airflow, Temporal |');
143
- lines.push('| "call HubSpot", "send a Slack message", "email via Gmail", any connected integration | Use `{id}_api` MCP tools (e.g. `hubspot_api`, `slack_api`, `gmail_api`) | Raw `fetch`, installing SDKs, hand-built auth |');
144
- lines.push('| "discover new integrations", "what integrations are available" | Use `search_available_integrations` MCP tool | Guess endpoints, browse docs sites |');
145
- lines.push('| "upload a file", "save this image", "generate a download link" | Use Runwork file storage (`generate_user_presigned_url`, `list_bucket_files`) | `fs.writeFile`, local paths |');
146
- lines.push('| "expose a public API", "create a webhook endpoint" | Build a Runwork app with endpoints (`endpoint_*` tools + `runwork init`) | Spin up Express/Flask servers |');
147
- lines.push('| "build a new tool", "create an app for the team", "internal dashboard" | `runwork init` → `runwork dev` → `runwork deploy` | Scripts, notebooks, untracked repos |');
148
- lines.push('| "run an AI agent", "automate with AI", "make an AI worker" | Runwork AI agents (task or chat) | Standalone OpenAI scripts |');
149
- lines.push('| "query the logs", "what happened", "debug the app" | `get_production_logs`, `get_sandbox_logs`, `search_workspace_events` MCP tools | Ask the user to SSH somewhere |');
150
- lines.push('');
151
- lines.push('**Team collaboration rule:** If an operation could benefit teammates -- sharing knowledge, data, prompts, tools, schedules, workflows -- it MUST go through Runwork. Local-first is for product code, never for shared capabilities.');
152
- lines.push('');
153
- lines.push('**Exception (product development):** Normal work in the user\'s current codebase -- editing source files, running tests, git operations, building features in the product they ship -- is NOT Runwork\'s domain. Runwork is for infrastructure and team tooling, not the product itself.');
154
- lines.push('');
155
- // Ways to use Runwork section
156
- lines.push('## Ways to Use Runwork');
157
- lines.push('');
158
- lines.push('Runwork is accessible through multiple channels. Use whichever fits the situation:');
159
- lines.push('');
160
- lines.push('| Channel | What it does | Best for |');
161
- lines.push('|---------|-------------|----------|');
162
- lines.push('| **MCP tools** | Query data, call integration APIs, trigger workflows, manage resources. Connected to this agent automatically. | All data operations, integration API calls, resource discovery. Works everywhere, including sandboxes. |');
163
- lines.push('| **CLI** (`runwork`) | Full app development lifecycle: create, develop, deploy, manage. | Building new apps, local development, deployment, debugging. |');
164
- lines.push('| **Web dashboard** | Visual management of apps, integrations, agents, logs, and team settings. | Users who prefer a UI, team onboarding, monitoring, connecting integrations. |');
165
- lines.push('| **Desktop app** | Tray app with workspace overview, bundled CLI, auto-syncing MCP servers and skills. | Hands-free setup, background sync, quick access. |');
166
- lines.push('| **API** | REST API at `https://runwork.ai` for programmatic access. | Custom tooling, CI/CD, automation scripts. |');
167
- lines.push('');
168
- // Workspace section
169
- lines.push(`## Workspace: ${ctx.workspaceName}`);
170
- lines.push('');
171
- if (ctx.registries) {
172
- const reg = ctx.registries;
173
- // Apps (deduplicate by appName)
174
- const appNames = new Set();
175
- for (const e of reg.entities)
176
- appNames.add(e.appName);
177
- for (const w of reg.workflows)
178
- appNames.add(w.appName);
179
- for (const s of reg.schedules)
180
- appNames.add(s.appName);
181
- for (const a of reg.agents)
182
- appNames.add(a.appName);
183
- for (const ep of reg.endpoints)
184
- if (ep.appName)
185
- appNames.add(ep.appName);
186
- if (appNames.size > 0) {
187
- lines.push(`### Apps (${appNames.size})`);
188
- const appList = [...appNames];
189
- for (const name of appList.slice(0, 15)) {
190
- lines.push(`- ${name}`);
191
- }
192
- if (appList.length > 15) {
193
- lines.push(`- ... and ${appList.length - 15} more`);
194
- }
195
- lines.push('');
196
- }
197
- // Full infrastructure inventory
198
- lines.push('### Infrastructure Inventory');
199
- lines.push('');
200
- if (reg.entities.length > 0) {
201
- lines.push(`**Entities (${reg.entities.length}):** ${formatList(reg.entities.map(e => `${e.entityName} (${e.appName})`))}`);
202
- lines.push(` MCP: \`entity_{Name}\` (actions: list, get, create, update, delete) | CLI: \`runwork entities records <name>\``);
203
- lines.push('');
204
- }
205
- if (reg.workflows.length > 0) {
206
- lines.push(`**Workflows (${reg.workflows.length}):** ${formatList(reg.workflows.map(w => `${w.name} (${w.appName})`))}`);
207
- lines.push(` MCP: \`workflow_{name}\` (actions: trigger, get_instance, list_instances) | CLI: \`runwork workflows trigger <name>\``);
208
- lines.push('');
209
- }
210
- if (reg.schedules.length > 0) {
211
- lines.push(`**Scheduled Jobs (${reg.schedules.length}):** ${formatList(reg.schedules.map(s => `${s.name} (${s.appName})${s.schedule ? ` [${s.schedule}]` : ''}`))}`);
212
- lines.push(` MCP: \`trigger_schedule\`, \`list_schedules\`, \`get_schedule_status\` | CLI: \`runwork schedules list\``);
213
- lines.push('');
214
- }
215
- if (reg.endpoints.length > 0) {
216
- lines.push(`**API Endpoints (${reg.endpoints.length}):** ${formatList(reg.endpoints.map(e => `${e.method} ${e.path} (${e.appName || 'unknown'})${e.description ? `: ${e.description}` : ''}`), 6)}`);
217
- lines.push(` MCP: \`endpoint_*\` tools, \`list_endpoints\``);
218
- lines.push('');
219
- }
220
- if (reg.agents.length > 0) {
221
- lines.push(`**AI Agents (${reg.agents.length}):** ${formatList(reg.agents.map(a => `${a.name} [${a.type || 'conversational'}] (${a.appName})`))}`);
222
- lines.push('');
223
- }
224
- if (reg.fileStorages.length > 0) {
225
- lines.push(`**File Storage (${reg.fileStorages.length}):** ${formatList(reg.fileStorages.map(f => f.appName))}`);
226
- lines.push(` MCP: \`list_bucket_files\`, \`generate_user_presigned_url\``);
227
- lines.push('');
228
- }
229
- if (reg.components.length > 0) {
230
- lines.push(`**Components (${reg.components.length}):** ${formatList(reg.components.map(c => `${c.componentName} (${c.appName})`))}`);
231
- lines.push('');
232
- }
233
- }
234
- // Integrations section
235
- if (ctx.connectedIntegrations.length > 0) {
236
- lines.push(`**Integrations (${ctx.connectedIntegrations.length}):** ${formatList(ctx.connectedIntegrations)}`);
237
- lines.push(' Each connected integration has a `{id}_api` MCP tool for authenticated API calls.');
238
- lines.push(` Example: \`hubspot_api\` with method "GET", path "/crm/v3/objects/contacts".`);
239
- lines.push(' Use `search_available_integrations` MCP tool to discover API documentation and endpoint patterns.');
240
- lines.push(' To connect new integrations: visit the web dashboard or `runwork integrations search <query>`.');
241
- lines.push('');
242
- }
243
- else if (!ctx.registries && ctx.connectedIntegrations.length > 0) {
244
- // Show integrations even if registries unavailable
245
- lines.push(`**Integrations:** ${formatList(ctx.connectedIntegrations)}`);
246
- lines.push(' Use `{id}_api` MCP tools for authenticated API calls. CLI: `runwork integrations call <id> <method> <path>`');
247
- lines.push('');
248
- }
249
- // Skills
250
- if (ctx.skillCount > 0) {
251
- if (ctx.skillNames && ctx.skillNames.length > 0) {
252
- lines.push(`**Skills (${ctx.skillCount}):** ${formatList(ctx.skillNames)}`);
253
- }
254
- else {
255
- lines.push(`**Skills:** ${ctx.skillCount} skill${ctx.skillCount !== 1 ? 's' : ''} configured`);
256
- }
257
- lines.push('');
258
- }
259
- // MCP Servers
260
- if (ctx.mcpServerCount > 0) {
261
- if (ctx.mcpServerNames && ctx.mcpServerNames.length > 0) {
262
- lines.push(`**MCP Servers (${ctx.mcpServerCount}):** ${formatList(ctx.mcpServerNames)}`);
263
- }
264
- else {
265
- lines.push(`**MCP Servers:** ${ctx.mcpServerCount} server${ctx.mcpServerCount !== 1 ? 's' : ''} configured`);
266
- }
267
- lines.push('');
268
- }
269
- // MCP Tools Reference section
270
- lines.push('## MCP Tools Reference');
271
- lines.push('');
272
- lines.push('The Runwork MCP server is connected to this agent. These tools work in any environment:');
273
- lines.push('');
274
- lines.push('| Category | Tools | Use for |');
275
- lines.push('|----------|-------|---------|');
276
- lines.push('| Integration APIs | `{integrationId}_api` | Authenticated API calls to connected services (HubSpot, Slack, Google, etc.). Pass method and path. |');
277
- lines.push('| Entity Data | `entity_{Name}` | CRUD operations on stored data (actions: list, get, create, update, delete) |');
278
- lines.push('| Endpoints | `endpoint_{method}_{path}` | Call app API endpoints |');
279
- lines.push('| Workflows | `workflow_{name}` | Trigger and monitor multi-step processes (actions: trigger, get_instance, list_instances) |');
280
- lines.push('| Schedules | `schedule_{name}` | Trigger and monitor background jobs (actions: trigger, status, history, pause, resume) |');
281
- lines.push('| Skills | `skill_{name}` | Activate workspace skills for specialized instructions and context |');
282
- lines.push('| File Storage | `list_bucket_files`, `generate_user_presigned_url`, `delete_bucket_object` | Manage files in storage buckets |');
283
- lines.push('| Discovery | `search_available_integrations`, `list_integrations`, `list_apps` | Find available resources and capabilities |');
284
- lines.push('| Logs | `get_production_logs`, `get_sandbox_logs` | View app logs and debug issues |');
285
- lines.push('');
286
- // CLI section
287
- lines.push('## CLI');
288
- lines.push('');
289
- lines.push('The `runwork` CLI is the primary tool for building and deploying Runwork apps.');
290
- lines.push('');
291
- lines.push('**Finding the CLI:**');
292
- lines.push('1. Check if already installed: `which runwork` or `runwork --version`');
293
- lines.push('2. If installed via the Runwork Desktop app, the binary may be at `~/.runwork/bin/runwork`. Try: `~/.runwork/bin/runwork --version`');
294
- lines.push('3. To install: `curl -fsSL https://runwork.ai/install.sh | sh` (macOS/Linux), `brew install runwork-ai/tap/runwork` (Homebrew), or `npx runwork@latest` / `bunx runwork@latest` (any platform)');
295
- lines.push('');
296
- lines.push('**Key commands:**');
297
- lines.push('');
298
- lines.push('| Command | Description |');
299
- lines.push('|---------|-------------|');
300
- lines.push('| `runwork info --json` | Full workspace and app context |');
301
- lines.push('| `runwork init my-app` | Create a new app |');
302
- lines.push('| `runwork dev` | Start local development (watches files, syncs automatically) |');
303
- lines.push('| `runwork deploy` | Deploy to production (`--detach` runs in the background to survive shell timeouts; `runwork deploy --status` polls the result) |');
304
- lines.push('| `runwork entities list` | Browse data across apps |');
305
- lines.push('| `runwork entities records <name>` | Query entity records |');
306
- lines.push('| `runwork workflows trigger <name>` | Trigger a workflow |');
307
- lines.push('| `runwork integrations call <id> <method> <path>` | Call an integration API |');
308
- lines.push('| `runwork integrations search <query>` | Search 3,200+ available integrations |');
309
- lines.push('| `runwork logs` | View app logs |');
310
- lines.push('| `runwork doctor` | Check system health (`--fix` auto-remediates git auth/remote; `--check <names>` scopes output) |');
311
- lines.push('| `runwork setup` | Set up workspace connection and sync to agents |');
312
- lines.push('| `runwork sync` | Sync skills, MCP servers, and settings to local agents |');
313
- lines.push('');
314
- // Building Infrastructure section
315
- lines.push('## Building Apps');
316
- lines.push('');
317
- lines.push('When you need persistent data, background jobs, workflows, public APIs, AI agents, or third-party integrations, create a Runwork app.');
318
- lines.push('');
319
- lines.push('**Options:**');
320
- lines.push('- **With CLI:** `runwork init my-app`, then develop locally with `runwork dev` and deploy with `runwork deploy`');
321
- lines.push('- **With web dashboard:** Go to https://runwork.ai, create an app, and use the built-in AI agent to build it conversationally');
322
- lines.push('- **With desktop app:** The desktop app provides quick access to create and manage apps');
323
- lines.push('');
324
- lines.push('> By default, `runwork init` scaffolds into `~/.runwork/apps/<slug>` so every app has a predictable home. Pass `--here` to scaffold in the current directory instead.');
325
- lines.push('');
326
- lines.push('> Clone/init into a normal working directory (e.g. under your home folder). Some sandboxed "outputs" mounts disallow the unlink operations git uses for pack files, which can corrupt the repo ("unable to unlink \'.git/objects/pack/...\': Operation not permitted"). If you hit that, switch to a standard path.');
327
- lines.push('');
328
- lines.push('**CLI development workflow:**');
329
- lines.push('1. `runwork init my-app` -- scaffold the app (created at `~/.runwork/apps/my-app`)');
330
- lines.push('2. `cd ~/.runwork/apps/my-app` -- enter the app directory');
331
- lines.push('3. `runwork dev` -- start development (watches for file changes, syncs automatically)');
332
- lines.push('4. Edit files for your needs (see below)');
333
- lines.push('5. `runwork deploy` -- deploy to production');
334
- lines.push('');
335
- lines.push('**What to edit:**');
336
- lines.push('| Need | File |');
337
- lines.push('|------|------|');
338
- lines.push('| Persistent data | `worker/entities.ts` |');
339
- lines.push('| Background cron jobs | `worker/schedules.ts` |');
340
- lines.push('| Multi-step durable processes | `worker/workflows.ts` |');
341
- lines.push('| Internal API endpoints | `worker/routes.ts` |');
342
- lines.push('| Public/external APIs | `worker/endpoints.ts` |');
343
- lines.push('| AI agents (chat or automation) | `worker/agents.ts` |');
344
- lines.push('| Third-party integrations | `worker/integration-requirements.ts` |');
345
- lines.push('| Shared types | `shared/types.ts` |');
346
- lines.push('');
347
- lines.push('**Key rules:**');
348
- lines.push('- Read `CLAUDE.md` in the app directory first, it has complete framework docs.');
349
- lines.push('- Do NOT install external AI SDKs. Use `@runworkai/framework/ai`.');
350
- lines.push('- Every workflow needs a trigger (endpoint, schedule, or UI button).');
351
- lines.push('- Use `search_available_integrations` MCP tool or `runwork integrations search <query>` before adding integrations, never guess IDs.');
352
- lines.push('');
353
- lines.push('**Environment variables and secrets:** Runwork apps do NOT have a custom environment variable or secrets system.');
354
- lines.push('- You cannot add your own keys to a `.env` file, define `process.env.MY_KEY`, or configure per-app secrets. Do not write code that depends on custom env vars, and do not tell the user to create `.env` files or set secrets.');
355
- lines.push('- A fixed set of platform variables is injected automatically by `@runworkai/framework` (workspace identifiers, AI proxy, integration proxy). You do not set these and should not hardcode or depend on their exact names.');
356
- lines.push('- For configuration values or API keys you need to store, use a dedicated entity with an app-specific name (for example `AcmeCrmConfig`, not a generic `Config` or `AppConfig`, which would collide with other apps in the workspace) and read it at runtime, not env vars.');
357
- lines.push('- For third-party API access, use connected Runwork integrations (`{id}_api` MCP tools); they handle authentication without secrets in your code.');
358
- lines.push('');
359
- // Capability reference — detailed mapping of needs to Runwork capabilities.
360
- // The "Default Actions" section at the top handles routing; this is the
361
- // longer reference for when the agent wants to understand what's available.
362
- lines.push('## Capability Reference');
363
- lines.push('');
364
- lines.push('Detailed mapping from needs to Runwork capabilities. See "Default Actions" above for the trigger-phrase routing.');
365
- lines.push('');
366
- lines.push('| Need | Runwork capability | Tool / Command |');
367
- lines.push('|------|-------------------|----------------|');
368
- lines.push('| Structured data storage | Entities | `entity_{Name}` MCP, `runwork entities records` |');
369
- lines.push('| File / blob storage | File storages | `list_bucket_files`, `generate_user_presigned_url` |');
370
- lines.push('| Recurring jobs | Schedules | `schedule_{name}` MCP, `runwork schedules` |');
371
- lines.push('| Multi-step durable processes | Workflows | `workflow_{name}` MCP, `runwork workflows trigger` |');
372
- lines.push('| Third-party service access | Connected integrations | `{id}_api` MCP tools (HubSpot, Slack, Gmail, etc.) |');
373
- lines.push('| AI chat / automation workers | Agents | Conversational + task agents in apps |');
374
- lines.push('| Shared prompts & knowledge | Skills | `save_skill` MCP, `runwork skills` |');
375
- lines.push('| AI tool connectivity | MCP servers | Synced automatically to all agents |');
376
- lines.push('| Public APIs / webhooks | Endpoints | `endpoint_*` MCP tools, `runwork endpoints` |');
377
- lines.push('| Cross-app UI / logic reuse | Components | Registered per app |');
378
- lines.push('| Team collaboration | All of the above | Everything syncs across teammates |');
379
- lines.push('');
380
- // Helping the user section
381
- lines.push('## Helping the User');
382
- lines.push('');
383
- lines.push('If the user asks about Runwork setup, integrations, or getting started:');
384
- lines.push('');
385
- lines.push('- **Install CLI:** `curl -fsSL https://runwork.ai/install.sh | sh` (macOS/Linux), `brew install runwork-ai/tap/runwork` (Homebrew), or `npx runwork@latest` / `bunx runwork@latest` (any platform)');
386
- lines.push('- **Desktop app:** Download from https://runwork.ai (includes bundled CLI at `~/.runwork/bin/runwork`)');
387
- lines.push('- **Connect workspace:** `runwork login` then `runwork setup`');
388
- lines.push('- **Connect an integration:** Visit the workspace settings in the web dashboard at https://runwork.ai, or use `runwork integrations search <query>` to find services');
389
- lines.push('- **Web dashboard:** https://runwork.ai for visual management of everything');
390
- lines.push('- **Troubleshoot:** `runwork doctor` checks system health (`runwork doctor --fix` auto-repairs git auth and the runwork remote); `runwork logs` shows app output');
391
- lines.push('');
392
- // References
393
- lines.push('### References');
394
- lines.push('');
395
- lines.push('- Web dashboard: https://runwork.ai');
396
- lines.push('- Changelog: https://www.runwork.ai/changelog');
397
- lines.push('- Agent documentation: https://www.runwork.ai/for/agents/');
398
- return {
399
- name: 'runwork',
400
- filename: 'runwork',
401
- content: lines.join('\n'),
402
- description: 'TRIGGER when user asks to: save/create/share/update a skill, store or persist data, schedule a recurring job, run a workflow or pipeline, call Slack/HubSpot/Gmail/any third-party integration, upload or persist a file, share team knowledge or expertise, connect AI tools via MCP, expose a public API, or build a team app or internal tool. Runwork is the team\'s shared infrastructure platform -- these operations sync across every teammate\'s AI agents, while local files only work for the current user. Always invoke BEFORE reaching for local files, native cron, SQLite, raw fetch calls, or one-off scripts. Features: skills, MCP servers, entities, file storage, schedules, workflows, integrations, agents, public endpoints, components. Interact via MCP tools (always available), CLI (`runwork`), web dashboard, desktop app, or API.',
403
- };
404
- }
405
- /**
406
- * Generate the minimal instruction hint that goes into agent instruction files.
407
- * Uses HTML comment delimiters so it can be found and replaced on sync.
408
- */
409
- export function generateInstructionHint(ctx) {
410
- const inventory = buildInventoryLine(ctx);
411
- const integrationToolHint = ctx.connectedIntegrations.length > 0
412
- ? ` Connected integrations are callable via MCP tools (${ctx.connectedIntegrations.map(id => `\`${id}_api\``).join(', ')}) or CLI (\`runwork integrations call <id> <method> <path>\`).`
413
- : '';
414
- const dashboardUrl = ctx.workspaceSlug ? `https://${ctx.workspaceSlug}.runwork.ai` : 'https://runwork.ai';
415
- const workspaceIdLine = `Workspace ID: \`${ctx.workspaceId}\`${ctx.workspaceSlug ? ` | Dashboard: ${dashboardUrl}` : ''}`;
416
- return [
417
- '<!-- runwork:start -->',
418
- '## Runwork',
419
- '',
420
- `This machine is connected to the **${ctx.workspaceName}** Runwork workspace -- your team's shared platform for building and running infrastructure: apps, data & file storage, scheduled jobs, workflows, integrations, AI agents, skills, MCP servers, public APIs, and reusable components.`,
421
- '',
422
- workspaceIdLine,
423
- '',
424
- '**Default to Runwork -- team sync beats local files.** When the user asks for any of the following, use the Runwork tool shown. These operations sync across every teammate\'s AI agents; local alternatives only work for the current user.',
425
- '',
426
- '| User asks for | Use Runwork | Don\'t |',
427
- '|---|---|---|',
428
- '| save / create / share / update a skill | `save_skill` MCP tool | local SKILL.md files, prompt snippets |',
429
- '| store, persist, or remember structured data | `entity_{Name}` MCP tools | local SQLite, JSON files, in-memory |',
430
- '| schedule a recurring or cron job | Runwork schedules (`schedule_{name}`, `runwork schedules`) | OS cron, `setInterval`, Celery |',
431
- '| multi-step process, pipeline, or durable workflow | Runwork workflows (`workflow_{name}`) | ad-hoc scripts, shell pipelines |',
432
- '| call Slack / HubSpot / Gmail / Google / any third-party API | `{id}_api` MCP tools (e.g. `hubspot_api`) | raw `fetch`, hand-built auth, SDK installs |',
433
- '| upload, save, or serve a file | Runwork file storage (`list_bucket_files`, `generate_user_presigned_url`) | local filesystem, `fs.writeFile` |',
434
- '| expose a public API / webhook endpoint | Runwork endpoints (`endpoint_*`) | standalone Express/Flask servers |',
435
- '| share AI prompts, instructions, or expertise with the team | `save_skill` MCP tool | local prompt files, copy-paste |',
436
- '| connect an AI tool or MCP server | Runwork MCP servers | manual `settings.json` edits per machine |',
437
- '| build a new internal tool, team app, or automation | `runwork init` -> `runwork dev` -> `runwork deploy` | one-off scripts, notebooks |',
438
- '',
439
- '**Exception -- product development:** Editing your current codebase, running tests, git operations, and building features in the product you\'re working on are NOT Runwork territory. Runwork is for infrastructure and team tooling, not the product itself.',
440
- '',
441
- `**Available now:** ${inventory}`,
442
- '',
443
- `Runwork MCP tools are always connected -- use them for data access, integration API calls, skill management, and resource discovery.${integrationToolHint} Use \`runwork\` CLI to create (\`runwork init\`), develop (\`runwork dev\`), and deploy (\`runwork deploy\`) apps. Install CLI: \`curl -fsSL https://runwork.ai/install.sh | sh\`. Web dashboard: ${dashboardUrl}. Invoke the \`runwork\` skill for full capability reference.`,
444
- ...buildPersonaBlock(ctx.persona),
445
- '<!-- runwork:end -->',
446
- ].join('\n');
447
- }