@esso0428/pi-subagents 0.17.15 → 0.17.17

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 (359) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/ROADMAP.md +87 -0
  3. package/docs/post-0.17.6-agents-roster-viewer-spec.md +42 -0
  4. package/docs/post-0.17.6-durable-history-spec.md +41 -0
  5. package/docs/post-0.17.6-feature-specs.md +50 -0
  6. package/docs/post-0.17.6-nested-agents-spec.md +38 -0
  7. package/docs/post-0.17.6-recovery-shutdown-spec.md +46 -0
  8. package/docs/post-0.17.6-ui-latency-baseline-spec.md +46 -0
  9. package/docs/post-0.17.6-workflow-rpc-lifecycle-spec.md +54 -0
  10. package/package.json +2 -3
  11. package/src/agent-history.ts +2 -54
  12. package/src/agent-manager.ts +406 -1288
  13. package/src/agent-runner.ts +27 -251
  14. package/src/agent-types.ts +32 -188
  15. package/src/cross-extension-rpc.ts +20 -96
  16. package/src/custom-agents.ts +13 -170
  17. package/src/index.ts +480 -1920
  18. package/src/invocation-config.ts +3 -118
  19. package/src/model-resolver.ts +0 -18
  20. package/src/output-file.ts +6 -61
  21. package/src/prompts.ts +2 -45
  22. package/src/schedule.ts +14 -35
  23. package/src/settings.ts +2 -301
  24. package/src/status-note.ts +1 -66
  25. package/src/types.ts +10 -177
  26. package/src/ui/agent-widget.ts +57 -278
  27. package/src/ui/conversation-blocks.ts +0 -6
  28. package/src/ui/conversation-timeline.ts +25 -139
  29. package/src/ui/conversation-viewer.ts +48 -212
  30. package/src/ui/schedule-menu.ts +8 -9
  31. package/src/usage.ts +2 -109
  32. package/src/worktree.ts +55 -69
  33. package/dist/abortable.d.ts +0 -13
  34. package/dist/abortable.d.ts.map +0 -1
  35. package/dist/abortable.js +0 -43
  36. package/dist/abortable.js.map +0 -1
  37. package/dist/agent-color.d.ts +0 -36
  38. package/dist/agent-color.d.ts.map +0 -1
  39. package/dist/agent-color.js +0 -124
  40. package/dist/agent-color.js.map +0 -1
  41. package/dist/agent-file-toggle.d.ts +0 -126
  42. package/dist/agent-file-toggle.d.ts.map +0 -1
  43. package/dist/agent-file-toggle.js +0 -259
  44. package/dist/agent-file-toggle.js.map +0 -1
  45. package/dist/agent-history-list.d.ts +0 -19
  46. package/dist/agent-history-list.d.ts.map +0 -1
  47. package/dist/agent-history-list.js +0 -69
  48. package/dist/agent-history-list.js.map +0 -1
  49. package/dist/agent-history.d.ts +0 -35
  50. package/dist/agent-history.d.ts.map +0 -1
  51. package/dist/agent-history.js +0 -188
  52. package/dist/agent-history.js.map +0 -1
  53. package/dist/agent-manager.d.ts +0 -503
  54. package/dist/agent-manager.d.ts.map +0 -1
  55. package/dist/agent-manager.js +0 -1572
  56. package/dist/agent-manager.js.map +0 -1
  57. package/dist/agent-recovery.d.ts +0 -37
  58. package/dist/agent-recovery.d.ts.map +0 -1
  59. package/dist/agent-recovery.js +0 -171
  60. package/dist/agent-recovery.js.map +0 -1
  61. package/dist/agent-runner.d.ts +0 -303
  62. package/dist/agent-runner.d.ts.map +0 -1
  63. package/dist/agent-runner.js +0 -1003
  64. package/dist/agent-runner.js.map +0 -1
  65. package/dist/agent-types.d.ts +0 -120
  66. package/dist/agent-types.d.ts.map +0 -1
  67. package/dist/agent-types.js +0 -301
  68. package/dist/agent-types.js.map +0 -1
  69. package/dist/child-context.d.ts +0 -3
  70. package/dist/child-context.d.ts.map +0 -1
  71. package/dist/child-context.js +0 -13
  72. package/dist/child-context.js.map +0 -1
  73. package/dist/context.d.ts +0 -13
  74. package/dist/context.d.ts.map +0 -1
  75. package/dist/context.js +0 -57
  76. package/dist/context.js.map +0 -1
  77. package/dist/cross-extension-rpc.d.ts +0 -67
  78. package/dist/cross-extension-rpc.d.ts.map +0 -1
  79. package/dist/cross-extension-rpc.js +0 -139
  80. package/dist/cross-extension-rpc.js.map +0 -1
  81. package/dist/custom-agents.d.ts +0 -55
  82. package/dist/custom-agents.d.ts.map +0 -1
  83. package/dist/custom-agents.js +0 -309
  84. package/dist/custom-agents.js.map +0 -1
  85. package/dist/default-agents.d.ts +0 -8
  86. package/dist/default-agents.d.ts.map +0 -1
  87. package/dist/default-agents.js +0 -123
  88. package/dist/default-agents.js.map +0 -1
  89. package/dist/enabled-models.d.ts +0 -50
  90. package/dist/enabled-models.d.ts.map +0 -1
  91. package/dist/enabled-models.js +0 -146
  92. package/dist/enabled-models.js.map +0 -1
  93. package/dist/env.d.ts +0 -7
  94. package/dist/env.d.ts.map +0 -1
  95. package/dist/env.js +0 -29
  96. package/dist/env.js.map +0 -1
  97. package/dist/group-join.d.ts +0 -33
  98. package/dist/group-join.d.ts.map +0 -1
  99. package/dist/group-join.js +0 -117
  100. package/dist/group-join.js.map +0 -1
  101. package/dist/index.d.ts +0 -51
  102. package/dist/index.d.ts.map +0 -1
  103. package/dist/index.js +0 -3687
  104. package/dist/index.js.map +0 -1
  105. package/dist/invocation-config.d.ts +0 -108
  106. package/dist/invocation-config.d.ts.map +0 -1
  107. package/dist/invocation-config.js +0 -84
  108. package/dist/invocation-config.js.map +0 -1
  109. package/dist/memory.d.ts +0 -54
  110. package/dist/memory.d.ts.map +0 -1
  111. package/dist/memory.js +0 -166
  112. package/dist/memory.js.map +0 -1
  113. package/dist/mention-clone.d.ts +0 -88
  114. package/dist/mention-clone.d.ts.map +0 -1
  115. package/dist/mention-clone.js +0 -154
  116. package/dist/mention-clone.js.map +0 -1
  117. package/dist/mention.d.ts +0 -82
  118. package/dist/mention.d.ts.map +0 -1
  119. package/dist/mention.js +0 -132
  120. package/dist/mention.js.map +0 -1
  121. package/dist/model-resolver.d.ts +0 -37
  122. package/dist/model-resolver.d.ts.map +0 -1
  123. package/dist/model-resolver.js +0 -96
  124. package/dist/model-resolver.js.map +0 -1
  125. package/dist/model-scope.d.ts +0 -50
  126. package/dist/model-scope.d.ts.map +0 -1
  127. package/dist/model-scope.js +0 -49
  128. package/dist/model-scope.js.map +0 -1
  129. package/dist/nested-tools.d.ts +0 -57
  130. package/dist/nested-tools.d.ts.map +0 -1
  131. package/dist/nested-tools.js +0 -301
  132. package/dist/nested-tools.js.map +0 -1
  133. package/dist/nico-overrides.d.ts +0 -54
  134. package/dist/nico-overrides.d.ts.map +0 -1
  135. package/dist/nico-overrides.js +0 -170
  136. package/dist/nico-overrides.js.map +0 -1
  137. package/dist/output-file.d.ts +0 -44
  138. package/dist/output-file.d.ts.map +0 -1
  139. package/dist/output-file.js +0 -156
  140. package/dist/output-file.js.map +0 -1
  141. package/dist/prompts.d.ts +0 -56
  142. package/dist/prompts.d.ts.map +0 -1
  143. package/dist/prompts.js +0 -92
  144. package/dist/prompts.js.map +0 -1
  145. package/dist/schedule-store.d.ts +0 -39
  146. package/dist/schedule-store.d.ts.map +0 -1
  147. package/dist/schedule-store.js +0 -156
  148. package/dist/schedule-store.js.map +0 -1
  149. package/dist/schedule.d.ts +0 -110
  150. package/dist/schedule.d.ts.map +0 -1
  151. package/dist/schedule.js +0 -360
  152. package/dist/schedule.js.map +0 -1
  153. package/dist/settings.d.ts +0 -354
  154. package/dist/settings.d.ts.map +0 -1
  155. package/dist/settings.js +0 -247
  156. package/dist/settings.js.map +0 -1
  157. package/dist/skill-loader.d.ts +0 -25
  158. package/dist/skill-loader.d.ts.map +0 -1
  159. package/dist/skill-loader.js +0 -94
  160. package/dist/skill-loader.js.map +0 -1
  161. package/dist/status-note.d.ts +0 -62
  162. package/dist/status-note.d.ts.map +0 -1
  163. package/dist/status-note.js +0 -86
  164. package/dist/status-note.js.map +0 -1
  165. package/dist/structured-output.d.ts +0 -62
  166. package/dist/structured-output.d.ts.map +0 -1
  167. package/dist/structured-output.js +0 -113
  168. package/dist/structured-output.js.map +0 -1
  169. package/dist/types.d.ts +0 -372
  170. package/dist/types.d.ts.map +0 -1
  171. package/dist/types.js +0 -6
  172. package/dist/types.js.map +0 -1
  173. package/dist/ui/agent-mention.d.ts +0 -83
  174. package/dist/ui/agent-mention.d.ts.map +0 -1
  175. package/dist/ui/agent-mention.js +0 -188
  176. package/dist/ui/agent-mention.js.map +0 -1
  177. package/dist/ui/agent-widget.d.ts +0 -241
  178. package/dist/ui/agent-widget.d.ts.map +0 -1
  179. package/dist/ui/agent-widget.js +0 -992
  180. package/dist/ui/agent-widget.js.map +0 -1
  181. package/dist/ui/ccstyle/diff/ansi-utils.d.ts +0 -11
  182. package/dist/ui/ccstyle/diff/ansi-utils.d.ts.map +0 -1
  183. package/dist/ui/ccstyle/diff/ansi-utils.js +0 -145
  184. package/dist/ui/ccstyle/diff/ansi-utils.js.map +0 -1
  185. package/dist/ui/ccstyle/diff/diff-presentation.d.ts +0 -12
  186. package/dist/ui/ccstyle/diff/diff-presentation.d.ts.map +0 -1
  187. package/dist/ui/ccstyle/diff/diff-presentation.js +0 -48
  188. package/dist/ui/ccstyle/diff/diff-presentation.js.map +0 -1
  189. package/dist/ui/ccstyle/diff/diff-renderer.d.ts +0 -46
  190. package/dist/ui/ccstyle/diff/diff-renderer.d.ts.map +0 -1
  191. package/dist/ui/ccstyle/diff/diff-renderer.js +0 -2049
  192. package/dist/ui/ccstyle/diff/diff-renderer.js.map +0 -1
  193. package/dist/ui/ccstyle/diff/line-width-safety.d.ts +0 -12
  194. package/dist/ui/ccstyle/diff/line-width-safety.d.ts.map +0 -1
  195. package/dist/ui/ccstyle/diff/line-width-safety.js +0 -58
  196. package/dist/ui/ccstyle/diff/line-width-safety.js.map +0 -1
  197. package/dist/ui/ccstyle/diff/render-utils.d.ts +0 -6
  198. package/dist/ui/ccstyle/diff/render-utils.d.ts.map +0 -1
  199. package/dist/ui/ccstyle/diff/render-utils.js +0 -25
  200. package/dist/ui/ccstyle/diff/render-utils.js.map +0 -1
  201. package/dist/ui/ccstyle/diff/shiki-highlight.d.ts +0 -19
  202. package/dist/ui/ccstyle/diff/shiki-highlight.d.ts.map +0 -1
  203. package/dist/ui/ccstyle/diff/shiki-highlight.js +0 -85
  204. package/dist/ui/ccstyle/diff/shiki-highlight.js.map +0 -1
  205. package/dist/ui/ccstyle/diff/types.d.ts +0 -22
  206. package/dist/ui/ccstyle/diff/types.d.ts.map +0 -1
  207. package/dist/ui/ccstyle/diff/types.js +0 -10
  208. package/dist/ui/ccstyle/diff/types.js.map +0 -1
  209. package/dist/ui/ccstyle/diff/write-display-utils.d.ts +0 -2
  210. package/dist/ui/ccstyle/diff/write-display-utils.d.ts.map +0 -1
  211. package/dist/ui/ccstyle/diff/write-display-utils.js +0 -12
  212. package/dist/ui/ccstyle/diff/write-display-utils.js.map +0 -1
  213. package/dist/ui/ccstyle/tool-renderer.d.ts +0 -17
  214. package/dist/ui/ccstyle/tool-renderer.d.ts.map +0 -1
  215. package/dist/ui/ccstyle/tool-renderer.js +0 -74
  216. package/dist/ui/ccstyle/tool-renderer.js.map +0 -1
  217. package/dist/ui/ccstyle/tool-result.d.ts +0 -44
  218. package/dist/ui/ccstyle/tool-result.d.ts.map +0 -1
  219. package/dist/ui/ccstyle/tool-result.js +0 -423
  220. package/dist/ui/ccstyle/tool-result.js.map +0 -1
  221. package/dist/ui/conversation-blocks.d.ts +0 -46
  222. package/dist/ui/conversation-blocks.d.ts.map +0 -1
  223. package/dist/ui/conversation-blocks.js +0 -313
  224. package/dist/ui/conversation-blocks.js.map +0 -1
  225. package/dist/ui/conversation-nvim.d.ts +0 -8
  226. package/dist/ui/conversation-nvim.d.ts.map +0 -1
  227. package/dist/ui/conversation-nvim.js +0 -117
  228. package/dist/ui/conversation-nvim.js.map +0 -1
  229. package/dist/ui/conversation-role.d.ts +0 -13
  230. package/dist/ui/conversation-role.d.ts.map +0 -1
  231. package/dist/ui/conversation-role.js +0 -39
  232. package/dist/ui/conversation-role.js.map +0 -1
  233. package/dist/ui/conversation-search.d.ts +0 -39
  234. package/dist/ui/conversation-search.d.ts.map +0 -1
  235. package/dist/ui/conversation-search.js +0 -124
  236. package/dist/ui/conversation-search.js.map +0 -1
  237. package/dist/ui/conversation-timeline.d.ts +0 -102
  238. package/dist/ui/conversation-timeline.d.ts.map +0 -1
  239. package/dist/ui/conversation-timeline.js +0 -555
  240. package/dist/ui/conversation-timeline.js.map +0 -1
  241. package/dist/ui/conversation-viewer.d.ts +0 -138
  242. package/dist/ui/conversation-viewer.d.ts.map +0 -1
  243. package/dist/ui/conversation-viewer.js +0 -1175
  244. package/dist/ui/conversation-viewer.js.map +0 -1
  245. package/dist/ui/schedule-menu.d.ts +0 -17
  246. package/dist/ui/schedule-menu.d.ts.map +0 -1
  247. package/dist/ui/schedule-menu.js +0 -95
  248. package/dist/ui/schedule-menu.js.map +0 -1
  249. package/dist/ui/select-item.d.ts +0 -28
  250. package/dist/ui/select-item.d.ts.map +0 -1
  251. package/dist/ui/select-item.js +0 -35
  252. package/dist/ui/select-item.js.map +0 -1
  253. package/dist/ui/viewer-keys.d.ts +0 -21
  254. package/dist/ui/viewer-keys.d.ts.map +0 -1
  255. package/dist/ui/viewer-keys.js +0 -18
  256. package/dist/ui/viewer-keys.js.map +0 -1
  257. package/dist/ui/workflow-card.d.ts +0 -176
  258. package/dist/ui/workflow-card.d.ts.map +0 -1
  259. package/dist/ui/workflow-card.js +0 -333
  260. package/dist/ui/workflow-card.js.map +0 -1
  261. package/dist/ui/workflow-dialog.d.ts +0 -306
  262. package/dist/ui/workflow-dialog.d.ts.map +0 -1
  263. package/dist/ui/workflow-dialog.js +0 -844
  264. package/dist/ui/workflow-dialog.js.map +0 -1
  265. package/dist/ui/workflow-menu.d.ts +0 -42
  266. package/dist/ui/workflow-menu.d.ts.map +0 -1
  267. package/dist/ui/workflow-menu.js +0 -127
  268. package/dist/ui/workflow-menu.js.map +0 -1
  269. package/dist/usage.d.ts +0 -136
  270. package/dist/usage.d.ts.map +0 -1
  271. package/dist/usage.js +0 -121
  272. package/dist/usage.js.map +0 -1
  273. package/dist/workflow/collisions.d.ts +0 -96
  274. package/dist/workflow/collisions.d.ts.map +0 -1
  275. package/dist/workflow/collisions.js +0 -89
  276. package/dist/workflow/collisions.js.map +0 -1
  277. package/dist/workflow/entry.d.ts +0 -33
  278. package/dist/workflow/entry.d.ts.map +0 -1
  279. package/dist/workflow/entry.js +0 -30
  280. package/dist/workflow/entry.js.map +0 -1
  281. package/dist/workflow/host.d.ts +0 -63
  282. package/dist/workflow/host.d.ts.map +0 -1
  283. package/dist/workflow/host.js +0 -363
  284. package/dist/workflow/host.js.map +0 -1
  285. package/dist/workflow/journal.d.ts +0 -98
  286. package/dist/workflow/journal.d.ts.map +0 -1
  287. package/dist/workflow/journal.js +0 -121
  288. package/dist/workflow/journal.js.map +0 -1
  289. package/dist/workflow/json-schema.d.ts +0 -52
  290. package/dist/workflow/json-schema.d.ts.map +0 -1
  291. package/dist/workflow/json-schema.js +0 -112
  292. package/dist/workflow/json-schema.js.map +0 -1
  293. package/dist/workflow/meta.d.ts +0 -68
  294. package/dist/workflow/meta.d.ts.map +0 -1
  295. package/dist/workflow/meta.js +0 -318
  296. package/dist/workflow/meta.js.map +0 -1
  297. package/dist/workflow/progress.d.ts +0 -225
  298. package/dist/workflow/progress.d.ts.map +0 -1
  299. package/dist/workflow/progress.js +0 -362
  300. package/dist/workflow/progress.js.map +0 -1
  301. package/dist/workflow/runtime.d.ts +0 -335
  302. package/dist/workflow/runtime.d.ts.map +0 -1
  303. package/dist/workflow/runtime.js +0 -831
  304. package/dist/workflow/runtime.js.map +0 -1
  305. package/dist/workflow/saved.d.ts +0 -91
  306. package/dist/workflow/saved.d.ts.map +0 -1
  307. package/dist/workflow/saved.js +0 -204
  308. package/dist/workflow/saved.js.map +0 -1
  309. package/dist/workflow/task.d.ts +0 -137
  310. package/dist/workflow/task.d.ts.map +0 -1
  311. package/dist/workflow/task.js +0 -208
  312. package/dist/workflow/task.js.map +0 -1
  313. package/dist/workflow/tool-description.d.ts +0 -39
  314. package/dist/workflow/tool-description.d.ts.map +0 -1
  315. package/dist/workflow/tool-description.js +0 -200
  316. package/dist/workflow/tool-description.js.map +0 -1
  317. package/dist/workflow/worker-source.d.ts +0 -48
  318. package/dist/workflow/worker-source.d.ts.map +0 -1
  319. package/dist/workflow/worker-source.js +0 -779
  320. package/dist/workflow/worker-source.js.map +0 -1
  321. package/dist/worktree.d.ts +0 -53
  322. package/dist/worktree.d.ts.map +0 -1
  323. package/dist/worktree.js +0 -165
  324. package/dist/worktree.js.map +0 -1
  325. package/dist/write-execution.d.ts +0 -42
  326. package/dist/write-execution.d.ts.map +0 -1
  327. package/dist/write-execution.js +0 -138
  328. package/dist/write-execution.js.map +0 -1
  329. package/dist/xml.d.ts +0 -11
  330. package/dist/xml.d.ts.map +0 -1
  331. package/dist/xml.js +0 -13
  332. package/dist/xml.js.map +0 -1
  333. package/src/abortable.ts +0 -43
  334. package/src/agent-color.ts +0 -161
  335. package/src/agent-file-toggle.ts +0 -269
  336. package/src/child-context.ts +0 -15
  337. package/src/mention-clone.ts +0 -196
  338. package/src/mention.ts +0 -141
  339. package/src/model-scope.ts +0 -70
  340. package/src/nested-tools.ts +0 -424
  341. package/src/structured-output.ts +0 -130
  342. package/src/ui/agent-mention.ts +0 -216
  343. package/src/ui/select-item.ts +0 -45
  344. package/src/ui/workflow-card.ts +0 -470
  345. package/src/ui/workflow-dialog.ts +0 -1115
  346. package/src/ui/workflow-menu.ts +0 -166
  347. package/src/workflow/collisions.ts +0 -123
  348. package/src/workflow/entry.ts +0 -47
  349. package/src/workflow/host.ts +0 -403
  350. package/src/workflow/journal.ts +0 -164
  351. package/src/workflow/json-schema.ts +0 -128
  352. package/src/workflow/meta.ts +0 -325
  353. package/src/workflow/progress.ts +0 -550
  354. package/src/workflow/runtime.ts +0 -1219
  355. package/src/workflow/saved.ts +0 -217
  356. package/src/workflow/task.ts +0 -302
  357. package/src/workflow/tool-description.ts +0 -200
  358. package/src/workflow/worker-source.ts +0 -781
  359. package/src/xml.ts +0 -13
package/dist/memory.js DELETED
@@ -1,166 +0,0 @@
1
- /**
2
- * memory.ts — Persistent agent memory: per-agent memory directories that persist across sessions.
3
- *
4
- * Memory scopes:
5
- * - "user" → getAgentDir()/agent-memory/{agent-name}/ (default ~/.pi/agent/agent-memory/, honors $PI_CODING_AGENT_DIR)
6
- * - "project" → .pi/agent-memory/{agent-name}/
7
- * - "local" → .pi/agent-memory-local/{agent-name}/
8
- *
9
- * The user scope previously hardcoded ~/.pi/agent-memory/. That legacy location
10
- * is still honored (read + write) when it exists and the new location doesn't,
11
- * so existing memories aren't orphaned.
12
- */
13
- import { existsSync, lstatSync, mkdirSync, readFileSync } from "node:fs";
14
- import { homedir } from "node:os";
15
- import { join, } from "node:path";
16
- import { getAgentDir } from "@earendil-works/pi-coding-agent";
17
- /** Maximum lines to read from MEMORY.md */
18
- const MAX_MEMORY_LINES = 200;
19
- /**
20
- * Returns true if a name contains characters not allowed in agent/skill names.
21
- * Uses a whitelist: only alphanumeric, hyphens, underscores, and dots (no leading dot).
22
- */
23
- export function isUnsafeName(name) {
24
- if (!name || name.length > 128)
25
- return true;
26
- return !/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(name);
27
- }
28
- /**
29
- * Returns true if the given path is a symlink (defense against symlink attacks).
30
- */
31
- export function isSymlink(filePath) {
32
- try {
33
- return lstatSync(filePath).isSymbolicLink();
34
- }
35
- catch {
36
- return false;
37
- }
38
- }
39
- /**
40
- * Safely read a file, rejecting symlinks.
41
- * Returns undefined if the file doesn't exist, is a symlink, or can't be read.
42
- */
43
- export function safeReadFile(filePath) {
44
- if (!existsSync(filePath))
45
- return undefined;
46
- if (isSymlink(filePath))
47
- return undefined;
48
- try {
49
- return readFileSync(filePath, "utf-8");
50
- }
51
- catch {
52
- return undefined;
53
- }
54
- }
55
- /**
56
- * Resolve the memory directory path for a given agent + scope + cwd.
57
- * Throws if agentName contains path traversal characters.
58
- */
59
- export function resolveMemoryDir(agentName, scope, cwd) {
60
- if (isUnsafeName(agentName)) {
61
- throw new Error(`Unsafe agent name for memory directory: "${agentName}"`);
62
- }
63
- switch (scope) {
64
- case "user": {
65
- const current = join(getAgentDir(), "agent-memory", agentName);
66
- // Legacy location from when this path was hardcoded. Keep using it if it
67
- // already holds this agent's memory and the new location hasn't been
68
- // created yet — otherwise existing memories would be silently orphaned.
69
- const legacy = join(homedir(), ".pi", "agent-memory", agentName);
70
- if (!existsSync(current) && existsSync(legacy) && !isSymlink(legacy)) {
71
- return legacy;
72
- }
73
- return current;
74
- }
75
- case "project":
76
- return join(cwd, ".pi", "agent-memory", agentName);
77
- case "local":
78
- return join(cwd, ".pi", "agent-memory-local", agentName);
79
- }
80
- }
81
- /**
82
- * Ensure the memory directory exists, creating it if needed.
83
- * Refuses to create directories if any component in the path is a symlink
84
- * to prevent symlink-based directory traversal attacks.
85
- */
86
- export function ensureMemoryDir(memoryDir) {
87
- // If the directory already exists, verify it's not a symlink
88
- if (existsSync(memoryDir)) {
89
- if (isSymlink(memoryDir)) {
90
- throw new Error(`Refusing to use symlinked memory directory: ${memoryDir}`);
91
- }
92
- return;
93
- }
94
- mkdirSync(memoryDir, { recursive: true });
95
- }
96
- /**
97
- * Read the first N lines of MEMORY.md from the memory directory, if it exists.
98
- * Returns undefined if no MEMORY.md exists or if the path is a symlink.
99
- */
100
- export function readMemoryIndex(memoryDir) {
101
- // Reject symlinked memory directories
102
- if (isSymlink(memoryDir))
103
- return undefined;
104
- const memoryFile = join(memoryDir, "MEMORY.md");
105
- const content = safeReadFile(memoryFile);
106
- if (content === undefined)
107
- return undefined;
108
- const lines = content.split("\n");
109
- if (lines.length > MAX_MEMORY_LINES) {
110
- return lines.slice(0, MAX_MEMORY_LINES).join("\n") + "\n... (truncated at 200 lines)";
111
- }
112
- return content;
113
- }
114
- /**
115
- * Build the memory block to inject into the agent's system prompt.
116
- * Also ensures the memory directory exists (creates it if needed).
117
- */
118
- export function buildMemoryBlock(agentName, scope, cwd) {
119
- const memoryDir = resolveMemoryDir(agentName, scope, cwd);
120
- // Create the memory directory so the agent can immediately write to it
121
- ensureMemoryDir(memoryDir);
122
- const existingMemory = readMemoryIndex(memoryDir);
123
- const header = `# Agent Memory
124
-
125
- You have a persistent memory directory at: ${memoryDir}/
126
- Memory scope: ${scope}
127
-
128
- This memory persists across sessions. Use it to build up knowledge over time.`;
129
- const memoryContent = existingMemory
130
- ? `\n\n## Current MEMORY.md\n${existingMemory}`
131
- : `\n\nNo MEMORY.md exists yet. Create one at ${join(memoryDir, "MEMORY.md")} to start building persistent memory.`;
132
- const instructions = `
133
-
134
- ## Memory Instructions
135
- - MEMORY.md is an index file — keep it concise (under 200 lines). Lines after 200 are truncated.
136
- - Store detailed memories in separate files within ${memoryDir}/ and link to them from MEMORY.md.
137
- - Each memory file should use this frontmatter format:
138
- \`\`\`markdown
139
- ---
140
- name: <memory name>
141
- description: <one-line description>
142
- type: <user|feedback|project|reference>
143
- ---
144
- <memory content>
145
- \`\`\`
146
- - Update or remove memories that become outdated. Check for existing memories before creating duplicates.
147
- - You have Read, Write, and Edit tools available for managing memory files.`;
148
- return header + memoryContent + instructions;
149
- }
150
- /**
151
- * Build a read-only memory block for agents that lack write/edit tools.
152
- * Does NOT create the memory directory — agents can only consume existing memory.
153
- */
154
- export function buildReadOnlyMemoryBlock(agentName, scope, cwd) {
155
- const memoryDir = resolveMemoryDir(agentName, scope, cwd);
156
- const existingMemory = readMemoryIndex(memoryDir);
157
- const header = `# Agent Memory (read-only)
158
-
159
- Memory scope: ${scope}
160
- You have read-only access to memory. You can reference existing memories but cannot create or modify them.`;
161
- const memoryContent = existingMemory
162
- ? `\n\n## Current MEMORY.md\n${existingMemory}`
163
- : `\n\nNo memory is available yet. Other agents or sessions with write access can create memories for you to consume.`;
164
- return header + memoryContent;
165
- }
166
- //# sourceMappingURL=memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,GAAG,MAAM,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,aAAa,CAAC;AAChC,CAAC"}
@@ -1,88 +0,0 @@
1
- /**
2
- * mention-clone.ts — start a mentioned agent through a clone of this
3
- * conversation, without putting anything in the chat.
4
- *
5
- * Claude Code routes `@agent-<type>` through the main model: the mention
6
- * becomes a `<system-reminder>` appended to the prompt and the model makes the
7
- * tool call (see `agentMentionReminder`). That buys the spawned agent a prompt
8
- * written with conversation context, and costs a visible turn — the model's
9
- * reasoning and its tool block land in the transcript, for a decision the user
10
- * already made when they typed the handle.
11
- *
12
- * So the turn happens somewhere else. The conversation is cloned into a
13
- * throwaway in-memory session — same messages, same system prompt, same model —
14
- * and that copy takes the turn off-screen. A literal clone: the session's own
15
- * entries, projected by pi's own `sessionEntryToContextMessages`, not
16
- * `inherit_context`'s text rendering of them.
17
- *
18
- * Cloned from memory rather than from the session file, which cannot be relied
19
- * on: `SessionManager._persist` withholds every write until the first assistant
20
- * message lands, so a fork taken before then reads an empty file and throws.
21
- * `buildSessionContext()` has no such timing, and is compaction-aware — it walks
22
- * the leaf path and substitutes the summary for entries folded into it, so a
23
- * long conversation clones as what the main model is actually working from. A
24
- * conversation with nothing in it yet clones to nothing in it yet, which is the
25
- * correct answer rather than a failure.
26
- *
27
- * It is also the oldest of the equivalent Pi APIs — `buildContextEntries` on
28
- * ReadonlySessionManager and the `sessionEntryToContextMessages` export both
29
- * arrived in 0.80.5 — where this one has been exported unchanged from before
30
- * the declared peer floor, and is the same code path (`byId` is only an index
31
- * cache, so passing it or not cannot change the result). Keeping the floor
32
- * honest costs nothing here: see the `compat-floor-pi` job.
33
- *
34
- * Its `thinkingLevel` is NOT used, and is the one place the newer API would be
35
- * better. `getSessionContextSettings` starts at "off" and moves only on an
36
- * explicit `thinking_level_change` entry, so a session where nobody ran
37
- * `/think` reports "off" rather than the level it is really using. Omitting the
38
- * field instead lets `createAgentSession` resolve it from settings, which is
39
- * that real level.
40
- *
41
- * Three details make the spawn belong to the real session rather than the
42
- * clone:
43
- *
44
- * - the clone is handed the *registered* `Agent` tool, whose handler closes
45
- * over the main activation, so it spawns top-level: widget, fleet row,
46
- * handle, completion notification, all as if the main model had called it;
47
- * - that tool is re-bound to the main `ExtensionContext`, because the handler
48
- * reads `cwd`, `model` and `sessionManager.getSessionId()` off it to place
49
- * the transcript and the `rootSessionId`. The clone's own context would
50
- * file both under the throwaway fork;
51
- * - it is called with no tool-call id. The clone's turn produces one, but the
52
- * real session never issued it, and a `<tool-use-id>` pointing at nothing
53
- * is exactly the bug the mention-resume path had to fix;
54
- * - and it is forced into the background. A foreground agent returns its
55
- * answer as the tool result and is marked `resultConsumed` so no completion
56
- * notification is sent — correct when the caller is the real conversation,
57
- * silent loss when the caller is a fork about to be discarded. Background
58
- * delivery is the only route from a mention back to the main model.
59
- *
60
- * The clone gets one tool and one job. It cannot read, write or run anything —
61
- * an invisible turn with the full toolset could do invisible work.
62
- */
63
- import { type ExtensionContext, type ToolDefinition } from "@earendil-works/pi-coding-agent";
64
- import type { SubagentType } from "./types.js";
65
- export interface MentionCloneOptions {
66
- /** The MAIN session's context — what the spawn is attributed to, and the
67
- * source of both the conversation and the live system prompt. */
68
- ctx: ExtensionContext;
69
- /** Agent type the handle resolved to. */
70
- type: SubagentType;
71
- /** What the user typed after the handle. */
72
- message: string;
73
- /** The registered `Agent` tool, reused so the spawn is an ordinary one. */
74
- agentTool: ToolDefinition;
75
- }
76
- export interface MentionCloneResult {
77
- /** True once the clone actually called `Agent`. */
78
- spawned: boolean;
79
- /** Why not, when it didn't. Absent on success. */
80
- error?: string;
81
- }
82
- /**
83
- * Fork the conversation, let the copy make the tool call, throw the copy away.
84
- * Never rejects: a clone that cannot run is reported so the caller can fall
85
- * back to starting the agent directly.
86
- */
87
- export declare function runMentionClone(opts: MentionCloneOptions): Promise<MentionCloneResult>;
88
- //# sourceMappingURL=mention-clone.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mention-clone.d.ts","sourceRoot":"","sources":["../src/mention-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,OAAO,EAGL,KAAK,gBAAgB,EAErB,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,YAAY,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC;qEACiE;IACjE,GAAG,EAAE,gBAAgB,CAAC;IACtB,yCAAyC;IACzC,IAAI,EAAE,YAAY,CAAC;IACnB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAgG5F"}
@@ -1,154 +0,0 @@
1
- /**
2
- * mention-clone.ts — start a mentioned agent through a clone of this
3
- * conversation, without putting anything in the chat.
4
- *
5
- * Claude Code routes `@agent-<type>` through the main model: the mention
6
- * becomes a `<system-reminder>` appended to the prompt and the model makes the
7
- * tool call (see `agentMentionReminder`). That buys the spawned agent a prompt
8
- * written with conversation context, and costs a visible turn — the model's
9
- * reasoning and its tool block land in the transcript, for a decision the user
10
- * already made when they typed the handle.
11
- *
12
- * So the turn happens somewhere else. The conversation is cloned into a
13
- * throwaway in-memory session — same messages, same system prompt, same model —
14
- * and that copy takes the turn off-screen. A literal clone: the session's own
15
- * entries, projected by pi's own `sessionEntryToContextMessages`, not
16
- * `inherit_context`'s text rendering of them.
17
- *
18
- * Cloned from memory rather than from the session file, which cannot be relied
19
- * on: `SessionManager._persist` withholds every write until the first assistant
20
- * message lands, so a fork taken before then reads an empty file and throws.
21
- * `buildSessionContext()` has no such timing, and is compaction-aware — it walks
22
- * the leaf path and substitutes the summary for entries folded into it, so a
23
- * long conversation clones as what the main model is actually working from. A
24
- * conversation with nothing in it yet clones to nothing in it yet, which is the
25
- * correct answer rather than a failure.
26
- *
27
- * It is also the oldest of the equivalent Pi APIs — `buildContextEntries` on
28
- * ReadonlySessionManager and the `sessionEntryToContextMessages` export both
29
- * arrived in 0.80.5 — where this one has been exported unchanged from before
30
- * the declared peer floor, and is the same code path (`byId` is only an index
31
- * cache, so passing it or not cannot change the result). Keeping the floor
32
- * honest costs nothing here: see the `compat-floor-pi` job.
33
- *
34
- * Its `thinkingLevel` is NOT used, and is the one place the newer API would be
35
- * better. `getSessionContextSettings` starts at "off" and moves only on an
36
- * explicit `thinking_level_change` entry, so a session where nobody ran
37
- * `/think` reports "off" rather than the level it is really using. Omitting the
38
- * field instead lets `createAgentSession` resolve it from settings, which is
39
- * that real level.
40
- *
41
- * Three details make the spawn belong to the real session rather than the
42
- * clone:
43
- *
44
- * - the clone is handed the *registered* `Agent` tool, whose handler closes
45
- * over the main activation, so it spawns top-level: widget, fleet row,
46
- * handle, completion notification, all as if the main model had called it;
47
- * - that tool is re-bound to the main `ExtensionContext`, because the handler
48
- * reads `cwd`, `model` and `sessionManager.getSessionId()` off it to place
49
- * the transcript and the `rootSessionId`. The clone's own context would
50
- * file both under the throwaway fork;
51
- * - it is called with no tool-call id. The clone's turn produces one, but the
52
- * real session never issued it, and a `<tool-use-id>` pointing at nothing
53
- * is exactly the bug the mention-resume path had to fix;
54
- * - and it is forced into the background. A foreground agent returns its
55
- * answer as the tool result and is marked `resultConsumed` so no completion
56
- * notification is sent — correct when the caller is the real conversation,
57
- * silent loss when the caller is a fork about to be discarded. Background
58
- * delivery is the only route from a mention back to the main model.
59
- *
60
- * The clone gets one tool and one job. It cannot read, write or run anything —
61
- * an invisible turn with the full toolset could do invisible work.
62
- */
63
- import { buildSessionContext, createAgentSession, SessionManager, } from "@earendil-works/pi-coding-agent";
64
- import { runInChildSessionContext } from "./child-context.js";
65
- import { agentMentionReminder } from "./mention.js";
66
- /**
67
- * Fork the conversation, let the copy make the tool call, throw the copy away.
68
- * Never rejects: a clone that cannot run is reported so the caller can fall
69
- * back to starting the agent directly.
70
- */
71
- export async function runMentionClone(opts) {
72
- const { ctx, type, message, agentTool } = opts;
73
- let spawned = false;
74
- const cloneAgentTool = {
75
- ...agentTool,
76
- execute: (_cloneToolCallId, params, signal, onUpdate, _cloneCtx) => {
77
- // One spawn per mention. The clone has a single tool and every reason to
78
- // stop after using it, but a model that decides to "also" launch a second
79
- // agent would do it where nobody can see and nobody asked.
80
- if (spawned) {
81
- return Promise.resolve({
82
- content: [{ type: "text", text: "Already started an agent for this mention. Stop here." }],
83
- details: undefined,
84
- isError: true,
85
- });
86
- }
87
- spawned = true;
88
- // undefined tool-call id + the main ctx: see the header. Background is
89
- // forced rather than left to the clone: `run_in_background` defaults to
90
- // false, and a foreground agent answers through its TOOL RESULT — which
91
- // here is delivered into a session that is disposed moments later, so the
92
- // agent would run, appear in the widget and the fleet, and reach nobody.
93
- return agentTool.execute(undefined, { ...params, run_in_background: true }, signal, onUpdate, ctx);
94
- },
95
- };
96
- let session;
97
- try {
98
- // Pi 0.80.8 moved createAgentSession from modelRegistry to modelRuntime;
99
- // agent-runner.ts carries the same shim for the same reason — pass both so
100
- // the clone keeps the parent's providers across the supported range.
101
- const parentModelRuntime = ctx.modelRegistry.runtime;
102
- // The conversation as the main session resolves it: compaction applied,
103
- // branch summaries substituted.
104
- const conversation = buildSessionContext(ctx.sessionManager.getEntries(), ctx.sessionManager.getLeafId());
105
- // Pi 0.82.0 added this; below it the field is absent and the clone takes
106
- // the settings level instead, which is what a session that never ran
107
- // `/think` is on anyway. Same shim shape as `modelRuntime` below.
108
- const thinkingLevel = ctx.thinkingLevel;
109
- const created = await runInChildSessionContext(() => createAgentSession({
110
- cwd: ctx.cwd,
111
- // Nothing about the copy is worth persisting, and an in-memory manager
112
- // is also what keeps the real session untouched.
113
- sessionManager: SessionManager.inMemory(ctx.cwd),
114
- model: ctx.model,
115
- ...(thinkingLevel && { thinkingLevel }),
116
- modelRegistry: ctx.modelRegistry,
117
- ...(parentModelRuntime !== undefined && { modelRuntime: parentModelRuntime }),
118
- // An allowlist naming exactly the clone's own tool. NOT `noTools:
119
- // "all"`, whose doc comment ("start with no tools enabled") reads like
120
- // it spares custom tools and does not: it resolves to an EMPTY
121
- // allowlist, and `isAllowedTool` then drops every tool from the
122
- // registry — the custom one included. The clone would be prompted with
123
- // nothing to call, answer in prose, and every mention would fall
124
- // through to the direct start with a warning. Same idiom as
125
- // agent-runner's `tools: sessionTools` beside its nested `customTools`.
126
- tools: [cloneAgentTool.name],
127
- customTools: [cloneAgentTool],
128
- }));
129
- session = created.session;
130
- // The clone rebuilds a system prompt from cwd and agentDir, which is close
131
- // but not the live one — extensions contribute to it per turn. Copy the
132
- // real thing, so the copy reasons under the instructions the user's model
133
- // is actually working under.
134
- const systemPrompt = ctx.getSystemPrompt?.();
135
- if (systemPrompt)
136
- session.agent.state.systemPrompt = systemPrompt;
137
- // The conversation itself. Pushed rather than assigned so the array the
138
- // session was built around stays the one it goes on using.
139
- session.agent.state.messages.push(...conversation.messages);
140
- // User text first, reminder after — the order Claude Code's attachment
141
- // renderer produces, where the reminder trails the message it is about.
142
- await session.prompt(`${message}\n\n${agentMentionReminder(type)}`);
143
- }
144
- catch (err) {
145
- return { spawned, error: err instanceof Error ? err.message : String(err) };
146
- }
147
- finally {
148
- session?.dispose?.();
149
- }
150
- return spawned
151
- ? { spawned: true }
152
- : { spawned: false, error: "the conversation clone did not start it" };
153
- }
154
- //# sourceMappingURL=mention-clone.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mention-clone.js","sourceRoot":"","sources":["../src/mention-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,OAAO,EACL,mBAAmB,EACnB,kBAAk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E5D,uEAAuE;QACvE,wEAAwE;QACxE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,OAAO,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IAC9E,CAAC;YAAS,CAAC;QACT,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,OAAO;QACZ,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;QACnB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,yCAAyC,EAAE,CAAC;AAC3E,CAAC"}
package/dist/mention.d.ts DELETED
@@ -1,82 +0,0 @@
1
- /**
2
- * mention.ts — the `@handle` grammar for messaging a subagent from the prompt.
3
- *
4
- * Claude Code lets you type `@code-review take another look` at the prompt and
5
- * routes the message to that agent instead of the main model. Its grammar is
6
- * reproduced here so the two behave identically:
7
- *
8
- * - suggestions fire on `@` at the start of the input or after whitespace,
9
- * followed by `[\w-]*` (so `@src/foo.ts` is a file, never an agent);
10
- * - a send is recognized only at the START of the input, and only with a
11
- * non-empty message after the handle. That is why a bare `@code-review`
12
- * goes to the main model rather than anywhere near the agent.
13
- *
14
- * A record's own identity is a UUID plus a deliberately non-unique description,
15
- * neither of which is typeable, so the handle is derived from the agent type.
16
- * Colliding handles are numbered (`explore`, `explore-2`), which is also what
17
- * Claude Code's `allocateName` does — it recycles a name only once the task
18
- * behind it is gone. Its SendMessage prompt describes the *registry* as
19
- * latest-wins, which is a different thing and not how names are allocated.
20
- */
21
- /**
22
- * Suggestion trigger: `@` at a token boundary plus the partial handle typed so
23
- * far. Ported from Claude Code, including the CJK sentence-ending punctuation
24
- * it accepts as a boundary.
25
- */
26
- export declare const MENTION_TRIGGER: RegExp;
27
- /** Whether `@handle` names the main conversation rather than any subagent. */
28
- export declare function isReservedHandle(handle: string): boolean;
29
- /** Slug of an agent type or name, restricted to the `[\w-]` the grammar allows. */
30
- export declare function handleBase(type: string): string;
31
- /**
32
- * `base`, else `base-2`, `base-3`, … — the first form that is neither `taken`
33
- * nor reserved. Callers pass one shared `taken` set covering type-derived
34
- * handles and model-supplied aliases alike, so the two can never collide.
35
- */
36
- export declare function assignHandle(base: string, taken: ReadonlySet<string>): string;
37
- /**
38
- * Map a typed handle back to a registered agent type, so `@explore fix it`
39
- * reaches the Explore agent even when no instance has ever run. `handleBase` is
40
- * the single source of truth in both directions, so a type is addressable by
41
- * exactly the handle its instances would be given.
42
- */
43
- export declare function resolveHandleToType(handle: string, types: readonly string[]): string | undefined;
44
- /**
45
- * Claude Code documents `@agent-<name>` as the form you type by hand when the
46
- * picker isn't involved. Accepted here as an exact synonym: the caller tries the
47
- * handle as written first, so an agent genuinely called `agent-foo` still wins
48
- * over `@agent-` + `foo`, and only falls back to this when that finds nothing.
49
- * Returns undefined when the prefix is absent or is the whole handle.
50
- */
51
- export declare function stripAgentPrefix(handle: string): string | undefined;
52
- /**
53
- * A spawn needs the short description every agent surface renders. A mention
54
- * carries no separate label, so the message itself becomes one: first line,
55
- * whitespace collapsed, clipped to roughly the 3-5 words the Agent tool asks of
56
- * the model.
57
- */
58
- export declare function describeMention(message: string): string;
59
- /**
60
- * What Claude Code sends the main model when a mention names an agent it could
61
- * start. Its `@agent-<type>` mention is not a spawn at all: it becomes an
62
- * `agent_mention` attachment, which renders to a synthetic `isMeta` user
63
- * message placed after the user's own untouched text — no tool forcing, no
64
- * allowed-tools narrowing, and the Task tool is not even named. The model reads
65
- * this and calls the tool itself.
66
- *
67
- * Ported verbatim from the 2.1.233 bundle's attachment renderer, trailing space
68
- * before the closing newline included, so the wording the model was trained
69
- * against is the wording it gets. The one substitution is ours: pi's equivalent
70
- * of Task is the `Agent` tool, and the agent listing that teaches valid
71
- * `subagent_type` values is the tool spec rather than a separate attachment.
72
- */
73
- export declare function agentMentionReminder(type: string): string;
74
- /**
75
- * Split `@handle message` into its parts, or null when the text isn't a send —
76
- * a bare handle, a leading file path, or a mention that isn't at the start.
77
- */
78
- export declare function parseMention(text: string): {
79
- handle: string;
80
- message: string;
81
- } | null;
82
- //# sourceMappingURL=mention.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mention.d.ts","sourceRoot":"","sources":["../src/mention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAA2B,CAAC;AAmBxD,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ/C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAQ7E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAMhG;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAKrF"}
package/dist/mention.js DELETED
@@ -1,132 +0,0 @@
1
- /**
2
- * mention.ts — the `@handle` grammar for messaging a subagent from the prompt.
3
- *
4
- * Claude Code lets you type `@code-review take another look` at the prompt and
5
- * routes the message to that agent instead of the main model. Its grammar is
6
- * reproduced here so the two behave identically:
7
- *
8
- * - suggestions fire on `@` at the start of the input or after whitespace,
9
- * followed by `[\w-]*` (so `@src/foo.ts` is a file, never an agent);
10
- * - a send is recognized only at the START of the input, and only with a
11
- * non-empty message after the handle. That is why a bare `@code-review`
12
- * goes to the main model rather than anywhere near the agent.
13
- *
14
- * A record's own identity is a UUID plus a deliberately non-unique description,
15
- * neither of which is typeable, so the handle is derived from the agent type.
16
- * Colliding handles are numbered (`explore`, `explore-2`), which is also what
17
- * Claude Code's `allocateName` does — it recycles a name only once the task
18
- * behind it is gone. Its SendMessage prompt describes the *registry* as
19
- * latest-wins, which is a different thing and not how names are allocated.
20
- */
21
- /**
22
- * Suggestion trigger: `@` at a token boundary plus the partial handle typed so
23
- * far. Ported from Claude Code, including the CJK sentence-ending punctuation
24
- * it accepts as a boundary.
25
- */
26
- export const MENTION_TRIGGER = /(^|[\s。、?!])@([\w-]*)$/;
27
- /** Send grammar: leading `@handle`, then a non-empty message. */
28
- const MENTION_SEND = /^@([\w-]+)\s+([\s\S]+)$/;
29
- /**
30
- * Upper bound on a handle, matching Claude Code's `dSS`. Nothing here generates
31
- * a name this long, but an agent type or a model-supplied name can be arbitrary
32
- * text, and an unbounded handle would wrap the suggestion popup.
33
- */
34
- const MAX_HANDLE_LENGTH = 64;
35
- /**
36
- * Handles that address something other than a subagent, and so can never be
37
- * allocated to one. Claude Code reserves exactly this name (`Vq = "main"`),
38
- * refusing it at spawn and routing it to the main conversation instead.
39
- */
40
- const RESERVED_HANDLES = new Set(["main"]);
41
- /** Whether `@handle` names the main conversation rather than any subagent. */
42
- export function isReservedHandle(handle) {
43
- return RESERVED_HANDLES.has(handle.toLowerCase());
44
- }
45
- /** Slug of an agent type or name, restricted to the `[\w-]` the grammar allows. */
46
- export function handleBase(type) {
47
- const slug = type.toLowerCase()
48
- .replace(/[^a-z0-9_-]+/g, "-")
49
- .replace(/^-+|-+$/g, "")
50
- .slice(0, MAX_HANDLE_LENGTH)
51
- // The slice can land mid-run and leave the trailing hyphen back.
52
- .replace(/-+$/, "");
53
- return slug || "agent";
54
- }
55
- /**
56
- * `base`, else `base-2`, `base-3`, … — the first form that is neither `taken`
57
- * nor reserved. Callers pass one shared `taken` set covering type-derived
58
- * handles and model-supplied aliases alike, so the two can never collide.
59
- */
60
- export function assignHandle(base, taken) {
61
- let candidate = base;
62
- let n = 1;
63
- while (taken.has(candidate) || RESERVED_HANDLES.has(candidate)) {
64
- n++;
65
- candidate = `${base}-${n}`;
66
- }
67
- return candidate;
68
- }
69
- /**
70
- * Map a typed handle back to a registered agent type, so `@explore fix it`
71
- * reaches the Explore agent even when no instance has ever run. `handleBase` is
72
- * the single source of truth in both directions, so a type is addressable by
73
- * exactly the handle its instances would be given.
74
- */
75
- export function resolveHandleToType(handle, types) {
76
- const wanted = handle.toLowerCase();
77
- // A type slugging to a reserved name is unaddressable rather than shadowing
78
- // it — `assignHandle` refuses that name too, so its instances never hold one.
79
- if (RESERVED_HANDLES.has(wanted))
80
- return undefined;
81
- return types.find(type => handleBase(type) === wanted);
82
- }
83
- /**
84
- * Claude Code documents `@agent-<name>` as the form you type by hand when the
85
- * picker isn't involved. Accepted here as an exact synonym: the caller tries the
86
- * handle as written first, so an agent genuinely called `agent-foo` still wins
87
- * over `@agent-` + `foo`, and only falls back to this when that finds nothing.
88
- * Returns undefined when the prefix is absent or is the whole handle.
89
- */
90
- export function stripAgentPrefix(handle) {
91
- const rest = /^agent-(.+)$/i.exec(handle)?.[1];
92
- return rest || undefined;
93
- }
94
- /**
95
- * A spawn needs the short description every agent surface renders. A mention
96
- * carries no separate label, so the message itself becomes one: first line,
97
- * whitespace collapsed, clipped to roughly the 3-5 words the Agent tool asks of
98
- * the model.
99
- */
100
- export function describeMention(message) {
101
- const oneLine = message.split("\n", 1)[0].replace(/\s+/g, " ").trim();
102
- return oneLine.length > 40 ? `${oneLine.slice(0, 39).trimEnd()}…` : oneLine;
103
- }
104
- /**
105
- * What Claude Code sends the main model when a mention names an agent it could
106
- * start. Its `@agent-<type>` mention is not a spawn at all: it becomes an
107
- * `agent_mention` attachment, which renders to a synthetic `isMeta` user
108
- * message placed after the user's own untouched text — no tool forcing, no
109
- * allowed-tools narrowing, and the Task tool is not even named. The model reads
110
- * this and calls the tool itself.
111
- *
112
- * Ported verbatim from the 2.1.233 bundle's attachment renderer, trailing space
113
- * before the closing newline included, so the wording the model was trained
114
- * against is the wording it gets. The one substitution is ours: pi's equivalent
115
- * of Task is the `Agent` tool, and the agent listing that teaches valid
116
- * `subagent_type` values is the tool spec rather than a separate attachment.
117
- */
118
- export function agentMentionReminder(type) {
119
- return `<system-reminder>\nThe user has expressed a desire to invoke the agent "${type}". Please invoke the agent appropriately, passing in the required context to it. \n</system-reminder>`;
120
- }
121
- /**
122
- * Split `@handle message` into its parts, or null when the text isn't a send —
123
- * a bare handle, a leading file path, or a mention that isn't at the start.
124
- */
125
- export function parseMention(text) {
126
- const match = MENTION_SEND.exec(text);
127
- if (!match)
128
- return null;
129
- const message = match[2].trim();
130
- return message ? { handle: match[1], message } : null;
131
- }
132
- //# sourceMappingURL=mention.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mention.js","sourceRoot":"","sources":["../src/mention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AAExD,iEAAiE;AACjE,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B;;;;GAIG;AACH,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CA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