@code-yeongyu/senpi 2026.5.20-4 → 2026.5.21

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 (794) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +4 -10
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +10 -4
  7. package/dist/config.js.map +1 -1
  8. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  9. package/dist/core/agent-session-runtime.js +2 -3
  10. package/dist/core/agent-session-runtime.js.map +1 -1
  11. package/dist/core/http-dispatcher.d.ts +21 -0
  12. package/dist/core/http-dispatcher.d.ts.map +1 -0
  13. package/dist/core/http-dispatcher.js +48 -0
  14. package/dist/core/http-dispatcher.js.map +1 -0
  15. package/dist/core/package-manager.d.ts.map +1 -1
  16. package/dist/core/package-manager.js +2 -1
  17. package/dist/core/package-manager.js.map +1 -1
  18. package/dist/core/settings-manager.d.ts +3 -0
  19. package/dist/core/settings-manager.d.ts.map +1 -1
  20. package/dist/core/settings-manager.js +20 -0
  21. package/dist/core/settings-manager.js.map +1 -1
  22. package/dist/main.d.ts.map +1 -1
  23. package/dist/main.js +2 -0
  24. package/dist/main.js.map +1 -1
  25. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  26. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  27. package/dist/modes/interactive/components/settings-selector.js +15 -0
  28. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  29. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  30. package/dist/modes/interactive/interactive-mode.js +10 -1
  31. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  32. package/dist/senpi +4 -10
  33. package/dist/utils/paths.d.ts +1 -0
  34. package/dist/utils/paths.d.ts.map +1 -1
  35. package/dist/utils/paths.js +16 -0
  36. package/dist/utils/paths.js.map +1 -1
  37. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  38. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  39. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  40. package/examples/extensions/sandbox/package-lock.json +2 -2
  41. package/examples/extensions/sandbox/package.json +2 -2
  42. package/examples/extensions/with-deps/package-lock.json +2 -2
  43. package/examples/extensions/with-deps/package.json +3 -3
  44. package/node_modules/@earendil-works/pi-agent-core/README.md +488 -0
  45. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +24 -0
  46. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
  47. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +610 -0
  48. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -0
  49. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +120 -0
  50. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -0
  51. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +405 -0
  52. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -0
  53. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +92 -0
  54. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
  55. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +904 -0
  56. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -0
  57. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
  58. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
  59. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +174 -0
  60. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
  61. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +95 -0
  62. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
  63. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +533 -0
  64. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -0
  65. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +25 -0
  66. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
  67. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +131 -0
  68. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -0
  69. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +51 -0
  70. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
  71. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +486 -0
  72. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -0
  73. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +52 -0
  74. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -0
  75. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  76. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -0
  77. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +48 -0
  78. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
  79. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +230 -0
  80. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -0
  81. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
  82. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
  83. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +101 -0
  84. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
  85. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +33 -0
  86. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
  87. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +231 -0
  88. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
  89. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
  90. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
  91. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
  92. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -0
  93. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
  94. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
  95. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +114 -0
  96. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -0
  97. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
  98. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
  99. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
  100. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -0
  101. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +32 -0
  102. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -0
  103. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +197 -0
  104. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -0
  105. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts +2 -0
  106. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
  107. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js +50 -0
  108. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js.map +1 -0
  109. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +44 -0
  110. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -0
  111. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +311 -0
  112. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -0
  113. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +3 -0
  114. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
  115. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  116. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -0
  117. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +604 -0
  118. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -0
  119. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +103 -0
  120. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -0
  121. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
  122. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
  123. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +126 -0
  124. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -0
  125. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +70 -0
  126. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
  127. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +290 -0
  128. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -0
  129. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +20 -0
  130. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -0
  131. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +25 -0
  132. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -0
  133. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts +3 -0
  134. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -0
  135. package/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
  136. package/node_modules/@earendil-works/pi-agent-core/dist/node.js.map +1 -0
  137. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +69 -0
  138. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -0
  139. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +278 -0
  140. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -0
  141. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +394 -0
  142. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -0
  143. package/node_modules/@earendil-works/pi-agent-core/dist/types.js +2 -0
  144. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -0
  145. package/node_modules/@earendil-works/pi-agent-core/package.json +61 -0
  146. package/node_modules/@earendil-works/pi-ai/README.md +1386 -0
  147. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +20 -0
  148. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -0
  149. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +44 -0
  150. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -0
  151. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +5 -0
  152. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
  153. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js +6 -0
  154. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -0
  155. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts +3 -0
  156. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -0
  157. package/node_modules/@earendil-works/pi-ai/dist/cli.js +116 -0
  158. package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -0
  159. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +18 -0
  160. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -0
  161. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +178 -0
  162. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -0
  163. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +10 -0
  164. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -0
  165. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +440 -0
  166. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -0
  167. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +442 -0
  168. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -0
  169. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  170. package/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -0
  171. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +14 -0
  172. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -0
  173. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  174. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -0
  175. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts +4 -0
  176. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -0
  177. package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  178. package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -0
  179. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +33 -0
  180. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -0
  181. package/node_modules/@earendil-works/pi-ai/dist/index.js +21 -0
  182. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -0
  183. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +37 -0
  184. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -0
  185. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +17658 -0
  186. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -0
  187. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +16510 -0
  188. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -0
  189. package/node_modules/@earendil-works/pi-ai/dist/models.js +114 -0
  190. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -0
  191. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +2 -0
  192. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -0
  193. package/node_modules/@earendil-works/pi-ai/dist/oauth.js +2 -0
  194. package/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -0
  195. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +38 -0
  196. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  197. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +787 -0
  198. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
  199. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +52 -0
  200. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
  201. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1127 -0
  202. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -0
  203. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +15 -0
  204. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  205. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +229 -0
  206. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
  207. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts +13 -0
  208. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +1 -0
  209. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js +26 -0
  210. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +1 -0
  211. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +66 -0
  212. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -0
  213. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +401 -0
  214. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -0
  215. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts +8 -0
  216. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  217. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js +29 -0
  218. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +1 -0
  219. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +73 -0
  220. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -0
  221. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js +359 -0
  222. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -0
  223. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +15 -0
  224. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
  225. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +465 -0
  226. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -0
  227. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +13 -0
  228. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -0
  229. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js +431 -0
  230. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -0
  231. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts +3 -0
  232. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -0
  233. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
  234. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -0
  235. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +4 -0
  236. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
  237. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  238. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -0
  239. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +25 -0
  240. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -0
  241. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +542 -0
  242. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -0
  243. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts +30 -0
  244. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  245. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +1112 -0
  246. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -0
  247. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts +22 -0
  248. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -0
  249. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +977 -0
  250. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -0
  251. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts +3 -0
  252. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
  253. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
  254. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +1 -0
  255. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts +19 -0
  256. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  257. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +579 -0
  258. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -0
  259. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts +13 -0
  260. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -0
  261. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +651 -0
  262. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -0
  263. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts +35 -0
  264. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -0
  265. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +254 -0
  266. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -0
  267. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +38 -0
  268. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -0
  269. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +174 -0
  270. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -0
  271. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts +16 -0
  272. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +1 -0
  273. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js +186 -0
  274. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +1 -0
  275. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +4 -0
  276. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts.map +1 -0
  277. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js +22 -0
  278. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js.map +1 -0
  279. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts +8 -0
  280. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -0
  281. package/node_modules/@earendil-works/pi-ai/dist/stream.js +42 -0
  282. package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -0
  283. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts +22 -0
  284. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -0
  285. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js +161 -0
  286. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -0
  287. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts +13 -0
  288. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -0
  289. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js +23 -0
  290. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -0
  291. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts +21 -0
  292. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts.map +1 -0
  293. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js +559 -0
  294. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js.map +1 -0
  295. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts +21 -0
  296. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts.map +1 -0
  297. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js +69 -0
  298. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js.map +1 -0
  299. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts +12 -0
  300. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts.map +1 -0
  301. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js +570 -0
  302. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js.map +1 -0
  303. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts +15 -0
  304. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts.map +1 -0
  305. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js +935 -0
  306. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js.map +1 -0
  307. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts +14 -0
  308. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts.map +1 -0
  309. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js +54 -0
  310. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js.map +1 -0
  311. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts +8 -0
  312. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts.map +1 -0
  313. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js +295 -0
  314. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js.map +1 -0
  315. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts +4 -0
  316. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts.map +1 -0
  317. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js +336 -0
  318. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js.map +1 -0
  319. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts +103 -0
  320. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -0
  321. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js +2 -0
  322. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js.map +1 -0
  323. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +543 -0
  324. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -0
  325. package/node_modules/@earendil-works/pi-ai/dist/types.js +2 -0
  326. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -0
  327. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
  328. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts.map +1 -0
  329. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js +25 -0
  330. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js.map +1 -0
  331. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +21 -0
  332. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
  333. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +81 -0
  334. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -0
  335. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts +3 -0
  336. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts.map +1 -0
  337. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js +14 -0
  338. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js.map +1 -0
  339. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts +2 -0
  340. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -0
  341. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +8 -0
  342. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -0
  343. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +16 -0
  344. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
  345. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js +113 -0
  346. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js.map +1 -0
  347. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts +10 -0
  348. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
  349. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +97 -0
  350. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -0
  351. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +25 -0
  352. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  353. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js +335 -0
  354. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -0
  355. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  356. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  357. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +292 -0
  358. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -0
  359. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +57 -0
  360. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -0
  361. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +121 -0
  362. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -0
  363. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  364. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  365. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js +105 -0
  366. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js.map +1 -0
  367. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  368. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  369. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +385 -0
  370. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -0
  371. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts +13 -0
  372. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  373. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js +31 -0
  374. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js.map +1 -0
  375. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts +57 -0
  376. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +1 -0
  377. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js +2 -0
  378. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js.map +1 -0
  379. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +56 -0
  380. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -0
  381. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +151 -0
  382. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -0
  383. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
  384. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  385. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js +26 -0
  386. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
  387. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts +5 -0
  388. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts.map +1 -0
  389. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js +49 -0
  390. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js.map +1 -0
  391. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
  392. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  393. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +21 -0
  394. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
  395. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +18 -0
  396. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -0
  397. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +281 -0
  398. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -0
  399. package/node_modules/@earendil-works/pi-ai/package.json +113 -0
  400. package/node_modules/@earendil-works/pi-tui/README.md +779 -0
  401. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +54 -0
  402. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -0
  403. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +632 -0
  404. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -0
  405. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +22 -0
  406. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -0
  407. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +104 -0
  408. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -0
  409. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
  410. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
  411. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +35 -0
  412. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -0
  413. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +249 -0
  414. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -0
  415. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +1916 -0
  416. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -0
  417. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +28 -0
  418. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -0
  419. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +89 -0
  420. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -0
  421. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +37 -0
  422. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -0
  423. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +426 -0
  424. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -0
  425. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +40 -0
  426. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -0
  427. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +95 -0
  428. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -0
  429. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +90 -0
  430. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -0
  431. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +634 -0
  432. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -0
  433. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +50 -0
  434. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -0
  435. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +159 -0
  436. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -0
  437. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
  438. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -0
  439. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +185 -0
  440. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -0
  441. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +12 -0
  442. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -0
  443. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +23 -0
  444. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -0
  445. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +19 -0
  446. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -0
  447. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +89 -0
  448. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -0
  449. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +13 -0
  450. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
  451. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +51 -0
  452. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -0
  453. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +39 -0
  454. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -0
  455. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +2 -0
  456. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +1 -0
  457. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +16 -0
  458. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -0
  459. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +110 -0
  460. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -0
  461. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +23 -0
  462. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -0
  463. package/node_modules/@earendil-works/pi-tui/dist/index.js +32 -0
  464. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -0
  465. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +193 -0
  466. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -0
  467. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +174 -0
  468. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -0
  469. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +184 -0
  470. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -0
  471. package/node_modules/@earendil-works/pi-tui/dist/keys.js +1173 -0
  472. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -0
  473. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +28 -0
  474. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +1 -0
  475. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +44 -0
  476. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +1 -0
  477. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +50 -0
  478. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
  479. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +361 -0
  480. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -0
  481. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +90 -0
  482. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -0
  483. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +336 -0
  484. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -0
  485. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +88 -0
  486. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -0
  487. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +329 -0
  488. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -0
  489. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +231 -0
  490. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -0
  491. package/node_modules/@earendil-works/pi-tui/dist/tui.js +1230 -0
  492. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -0
  493. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +17 -0
  494. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +1 -0
  495. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +25 -0
  496. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +1 -0
  497. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +79 -0
  498. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -0
  499. package/node_modules/@earendil-works/pi-tui/dist/utils.js +1031 -0
  500. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -0
  501. package/node_modules/@earendil-works/pi-tui/package.json +48 -0
  502. package/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  503. package/node_modules/@smithy/node-http-handler/README.md +9 -0
  504. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +724 -0
  505. package/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  506. package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
  507. package/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  508. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +216 -0
  509. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +87 -0
  510. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
  511. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +170 -0
  512. package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +21 -0
  513. package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +88 -0
  514. package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  515. package/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  516. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  517. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  518. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +8 -0
  519. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +41 -0
  520. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +21 -0
  521. package/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  522. package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +56 -0
  523. package/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
  524. package/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
  525. package/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
  526. package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +46 -0
  527. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +24 -0
  528. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +12 -0
  529. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +63 -0
  530. package/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +13 -0
  531. package/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +12 -0
  532. package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
  533. package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
  534. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
  535. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
  536. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +5 -0
  537. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +6 -0
  538. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +13 -0
  539. package/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +8 -0
  540. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
  541. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
  542. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
  543. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +46 -0
  544. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
  545. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +12 -0
  546. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +63 -0
  547. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +13 -0
  548. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +12 -0
  549. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
  550. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
  551. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
  552. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
  553. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +5 -0
  554. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +6 -0
  555. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +13 -0
  556. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +8 -0
  557. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +11 -0
  558. package/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +11 -0
  559. package/node_modules/@smithy/node-http-handler/package.json +68 -0
  560. package/node_modules/@smithy/types/LICENSE +201 -0
  561. package/node_modules/@smithy/types/README.md +115 -0
  562. package/node_modules/@smithy/types/dist-cjs/index.js +91 -0
  563. package/node_modules/@smithy/types/dist-es/abort-handler.js +1 -0
  564. package/node_modules/@smithy/types/dist-es/abort.js +1 -0
  565. package/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +5 -0
  566. package/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +1 -0
  567. package/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +1 -0
  568. package/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +1 -0
  569. package/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +1 -0
  570. package/node_modules/@smithy/types/dist-es/auth/auth.js +5 -0
  571. package/node_modules/@smithy/types/dist-es/auth/index.js +6 -0
  572. package/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +1 -0
  573. package/node_modules/@smithy/types/dist-es/checksum.js +1 -0
  574. package/node_modules/@smithy/types/dist-es/client.js +1 -0
  575. package/node_modules/@smithy/types/dist-es/command.js +1 -0
  576. package/node_modules/@smithy/types/dist-es/connection/config.js +1 -0
  577. package/node_modules/@smithy/types/dist-es/connection/index.js +3 -0
  578. package/node_modules/@smithy/types/dist-es/connection/manager.js +1 -0
  579. package/node_modules/@smithy/types/dist-es/connection/pool.js +1 -0
  580. package/node_modules/@smithy/types/dist-es/crypto.js +1 -0
  581. package/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +1 -0
  582. package/node_modules/@smithy/types/dist-es/encode.js +1 -0
  583. package/node_modules/@smithy/types/dist-es/endpoint.js +5 -0
  584. package/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +1 -0
  585. package/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +1 -0
  586. package/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +1 -0
  587. package/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +1 -0
  588. package/node_modules/@smithy/types/dist-es/endpoints/index.js +5 -0
  589. package/node_modules/@smithy/types/dist-es/endpoints/shared.js +1 -0
  590. package/node_modules/@smithy/types/dist-es/eventStream.js +1 -0
  591. package/node_modules/@smithy/types/dist-es/extensions/checksum.js +38 -0
  592. package/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +7 -0
  593. package/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +1 -0
  594. package/node_modules/@smithy/types/dist-es/extensions/index.js +3 -0
  595. package/node_modules/@smithy/types/dist-es/extensions/retry.js +1 -0
  596. package/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +1 -0
  597. package/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
  598. package/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +1 -0
  599. package/node_modules/@smithy/types/dist-es/http.js +5 -0
  600. package/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +1 -0
  601. package/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +1 -0
  602. package/node_modules/@smithy/types/dist-es/identity/identity.js +1 -0
  603. package/node_modules/@smithy/types/dist-es/identity/index.js +4 -0
  604. package/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +1 -0
  605. package/node_modules/@smithy/types/dist-es/index.js +42 -0
  606. package/node_modules/@smithy/types/dist-es/logger.js +1 -0
  607. package/node_modules/@smithy/types/dist-es/middleware.js +1 -0
  608. package/node_modules/@smithy/types/dist-es/pagination.js +1 -0
  609. package/node_modules/@smithy/types/dist-es/profile.js +6 -0
  610. package/node_modules/@smithy/types/dist-es/response.js +1 -0
  611. package/node_modules/@smithy/types/dist-es/retry.js +1 -0
  612. package/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
  613. package/node_modules/@smithy/types/dist-es/schema/schema.js +1 -0
  614. package/node_modules/@smithy/types/dist-es/schema/sentinels.js +1 -0
  615. package/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
  616. package/node_modules/@smithy/types/dist-es/schema/traits.js +1 -0
  617. package/node_modules/@smithy/types/dist-es/serde.js +1 -0
  618. package/node_modules/@smithy/types/dist-es/shapes.js +1 -0
  619. package/node_modules/@smithy/types/dist-es/signature.js +1 -0
  620. package/node_modules/@smithy/types/dist-es/stream.js +1 -0
  621. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +1 -0
  622. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +1 -0
  623. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +1 -0
  624. package/node_modules/@smithy/types/dist-es/transfer.js +6 -0
  625. package/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +1 -0
  626. package/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +1 -0
  627. package/node_modules/@smithy/types/dist-es/transform/exact.js +1 -0
  628. package/node_modules/@smithy/types/dist-es/transform/mutable.js +1 -0
  629. package/node_modules/@smithy/types/dist-es/transform/no-undefined.js +1 -0
  630. package/node_modules/@smithy/types/dist-es/transform/type-transform.js +1 -0
  631. package/node_modules/@smithy/types/dist-es/uri.js +1 -0
  632. package/node_modules/@smithy/types/dist-es/util.js +1 -0
  633. package/node_modules/@smithy/types/dist-es/waiter.js +1 -0
  634. package/node_modules/@smithy/types/dist-types/abort-handler.d.ts +7 -0
  635. package/node_modules/@smithy/types/dist-types/abort.d.ts +50 -0
  636. package/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +7 -0
  637. package/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +49 -0
  638. package/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +20 -0
  639. package/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +41 -0
  640. package/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +14 -0
  641. package/node_modules/@smithy/types/dist-types/auth/auth.d.ts +57 -0
  642. package/node_modules/@smithy/types/dist-types/auth/index.d.ts +6 -0
  643. package/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +40 -0
  644. package/node_modules/@smithy/types/dist-types/checksum.d.ts +63 -0
  645. package/node_modules/@smithy/types/dist-types/client.d.ts +57 -0
  646. package/node_modules/@smithy/types/dist-types/command.d.ts +28 -0
  647. package/node_modules/@smithy/types/dist-types/connection/config.d.ts +10 -0
  648. package/node_modules/@smithy/types/dist-types/connection/index.d.ts +3 -0
  649. package/node_modules/@smithy/types/dist-types/connection/manager.d.ts +34 -0
  650. package/node_modules/@smithy/types/dist-types/connection/pool.d.ts +32 -0
  651. package/node_modules/@smithy/types/dist-types/crypto.d.ts +60 -0
  652. package/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +25 -0
  653. package/node_modules/@smithy/types/dist-types/encode.d.ts +31 -0
  654. package/node_modules/@smithy/types/dist-types/endpoint.d.ts +77 -0
  655. package/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +27 -0
  656. package/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +10 -0
  657. package/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +28 -0
  658. package/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +16 -0
  659. package/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +5 -0
  660. package/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +55 -0
  661. package/node_modules/@smithy/types/dist-types/eventStream.d.ts +137 -0
  662. package/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +58 -0
  663. package/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +33 -0
  664. package/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +9 -0
  665. package/node_modules/@smithy/types/dist-types/extensions/index.d.ts +4 -0
  666. package/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +18 -0
  667. package/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +35 -0
  668. package/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
  669. package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +128 -0
  670. package/node_modules/@smithy/types/dist-types/http.d.ts +112 -0
  671. package/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +14 -0
  672. package/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +31 -0
  673. package/node_modules/@smithy/types/dist-types/identity/identity.d.ts +15 -0
  674. package/node_modules/@smithy/types/dist-types/identity/index.d.ts +4 -0
  675. package/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +14 -0
  676. package/node_modules/@smithy/types/dist-types/index.d.ts +42 -0
  677. package/node_modules/@smithy/types/dist-types/logger.d.ts +13 -0
  678. package/node_modules/@smithy/types/dist-types/middleware.d.ts +534 -0
  679. package/node_modules/@smithy/types/dist-types/pagination.d.ts +33 -0
  680. package/node_modules/@smithy/types/dist-types/profile.d.ts +30 -0
  681. package/node_modules/@smithy/types/dist-types/response.d.ts +40 -0
  682. package/node_modules/@smithy/types/dist-types/retry.d.ts +133 -0
  683. package/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +136 -0
  684. package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +230 -0
  685. package/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +65 -0
  686. package/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +82 -0
  687. package/node_modules/@smithy/types/dist-types/schema/traits.d.ts +46 -0
  688. package/node_modules/@smithy/types/dist-types/serde.d.ts +114 -0
  689. package/node_modules/@smithy/types/dist-types/shapes.d.ts +82 -0
  690. package/node_modules/@smithy/types/dist-types/signature.d.ts +155 -0
  691. package/node_modules/@smithy/types/dist-types/stream.d.ts +22 -0
  692. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  693. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  694. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  695. package/node_modules/@smithy/types/dist-types/transfer.d.ts +41 -0
  696. package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +26 -0
  697. package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +77 -0
  698. package/node_modules/@smithy/types/dist-types/transform/exact.d.ts +6 -0
  699. package/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +6 -0
  700. package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +68 -0
  701. package/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +34 -0
  702. package/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +7 -0
  703. package/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +50 -0
  704. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +7 -0
  705. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +49 -0
  706. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +20 -0
  707. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +41 -0
  708. package/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +14 -0
  709. package/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +57 -0
  710. package/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +6 -0
  711. package/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +40 -0
  712. package/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +63 -0
  713. package/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +57 -0
  714. package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +28 -0
  715. package/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +10 -0
  716. package/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +3 -0
  717. package/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +34 -0
  718. package/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +32 -0
  719. package/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +60 -0
  720. package/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +41 -0
  721. package/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +31 -0
  722. package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +77 -0
  723. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +27 -0
  724. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +10 -0
  725. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +28 -0
  726. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +16 -0
  727. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +5 -0
  728. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +55 -0
  729. package/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +137 -0
  730. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +58 -0
  731. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +33 -0
  732. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +9 -0
  733. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +4 -0
  734. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +18 -0
  735. package/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +35 -0
  736. package/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
  737. package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +128 -0
  738. package/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +112 -0
  739. package/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +14 -0
  740. package/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +31 -0
  741. package/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +15 -0
  742. package/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +4 -0
  743. package/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +14 -0
  744. package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +42 -0
  745. package/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +13 -0
  746. package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +534 -0
  747. package/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +33 -0
  748. package/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +30 -0
  749. package/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +40 -0
  750. package/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +133 -0
  751. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +142 -0
  752. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +245 -0
  753. package/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +65 -0
  754. package/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +101 -0
  755. package/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +46 -0
  756. package/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +114 -0
  757. package/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +82 -0
  758. package/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +155 -0
  759. package/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +22 -0
  760. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  761. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  762. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  763. package/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +41 -0
  764. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +26 -0
  765. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +81 -0
  766. package/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +14 -0
  767. package/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +6 -0
  768. package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +88 -0
  769. package/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +41 -0
  770. package/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +17 -0
  771. package/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +192 -0
  772. package/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +35 -0
  773. package/node_modules/@smithy/types/dist-types/uri.d.ts +17 -0
  774. package/node_modules/@smithy/types/dist-types/util.d.ts +176 -0
  775. package/node_modules/@smithy/types/dist-types/waiter.d.ts +35 -0
  776. package/node_modules/@smithy/types/package.json +61 -0
  777. package/node_modules/marked/LICENSE.md +44 -0
  778. package/node_modules/marked/README.md +106 -0
  779. package/node_modules/marked/bin/main.js +282 -0
  780. package/node_modules/marked/bin/marked.js +15 -0
  781. package/node_modules/marked/lib/marked.cjs +2211 -0
  782. package/node_modules/marked/lib/marked.cjs.map +7 -0
  783. package/node_modules/marked/lib/marked.d.cts +728 -0
  784. package/node_modules/marked/lib/marked.d.ts +728 -0
  785. package/node_modules/marked/lib/marked.esm.js +2189 -0
  786. package/node_modules/marked/lib/marked.esm.js.map +7 -0
  787. package/node_modules/marked/lib/marked.umd.js +2213 -0
  788. package/node_modules/marked/lib/marked.umd.js.map +7 -0
  789. package/node_modules/marked/man/marked.1 +111 -0
  790. package/node_modules/marked/man/marked.1.md +92 -0
  791. package/node_modules/marked/marked.min.js +69 -0
  792. package/node_modules/marked/package.json +111 -0
  793. package/npm-shrinkwrap.json +1841 -0
  794. package/package.json +49 -31
@@ -0,0 +1,39 @@
1
+ import { SessionError, } from "../types.js";
2
+ import { Session } from "./session.js";
3
+ import { uuidv7 } from "./uuid.js";
4
+ export function createSessionId() {
5
+ return uuidv7();
6
+ }
7
+ export function createTimestamp() {
8
+ return new Date().toISOString();
9
+ }
10
+ export function toSession(storage) {
11
+ return new Session(storage);
12
+ }
13
+ export function getFileSystemResultOrThrow(result, message) {
14
+ if (!result.ok) {
15
+ const code = result.error.code === "not_found" ? "not_found" : "storage";
16
+ throw new SessionError(code, `${message}: ${result.error.message}`, result.error);
17
+ }
18
+ return result.value;
19
+ }
20
+ export async function getEntriesToFork(storage, options) {
21
+ if (!options.entryId)
22
+ return storage.getEntries();
23
+ const target = await storage.getEntry(options.entryId);
24
+ if (!target) {
25
+ throw new SessionError("invalid_fork_target", `Entry ${options.entryId} not found`);
26
+ }
27
+ let effectiveLeafId;
28
+ if ((options.position ?? "before") === "at") {
29
+ effectiveLeafId = target.id;
30
+ }
31
+ else {
32
+ if (target.type !== "message" || target.message.role !== "user") {
33
+ throw new SessionError("invalid_fork_target", `Entry ${options.entryId} is not a user message`);
34
+ }
35
+ effectiveLeafId = target.parentId;
36
+ }
37
+ return storage.getPathToRoot(effectiveLeafId);
38
+ }
39
+ //# sourceMappingURL=repo-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-utils.js","sourceRoot":"","sources":["../../../src/harness/session/repo-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,YAAY,GAIZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,UAAU,eAAe,GAAW;IACzC,OAAO,MAAM,EAAE,CAAC;AAAA,CAChB;AAED,MAAM,UAAU,eAAe,GAAW;IACzC,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAAA,CAChC;AAED,MAAM,UAAU,SAAS,CAAoC,OAAkC,EAAsB;IACpH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;AAAA,CAC5B;AAED,MAAM,UAAU,0BAA0B,CAAS,MAAiC,EAAE,OAAe,EAAU;IAC9G,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QACzE,MAAM,IAAI,YAAY,CAAC,IAAI,EAAE,GAAG,OAAO,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC;AAAA,CACpB;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,OAAuB,EACvB,OAAyD,EAC3B;IAC9B,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,YAAY,CAAC,qBAAqB,EAAE,SAAS,OAAO,CAAC,OAAO,YAAY,CAAC,CAAC;IACrF,CAAC;IACD,IAAI,eAA8B,CAAC;IACnC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7C,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B,CAAC;SAAM,CAAC;QACP,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACjE,MAAM,IAAI,YAAY,CAAC,qBAAqB,EAAE,SAAS,OAAO,CAAC,OAAO,wBAAwB,CAAC,CAAC;QACjG,CAAC;QACD,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC;IACnC,CAAC;IACD,OAAO,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;AAAA,CAC9C","sourcesContent":["import {\n\ttype FileError,\n\ttype Result,\n\tSessionError,\n\ttype SessionMetadata,\n\ttype SessionStorage,\n\ttype SessionTreeEntry,\n} from \"../types.ts\";\nimport { Session } from \"./session.ts\";\nimport { uuidv7 } from \"./uuid.ts\";\n\nexport function createSessionId(): string {\n\treturn uuidv7();\n}\n\nexport function createTimestamp(): string {\n\treturn new Date().toISOString();\n}\n\nexport function toSession<TMetadata extends SessionMetadata>(storage: SessionStorage<TMetadata>): Session<TMetadata> {\n\treturn new Session(storage);\n}\n\nexport function getFileSystemResultOrThrow<TValue>(result: Result<TValue, FileError>, message: string): TValue {\n\tif (!result.ok) {\n\t\tconst code = result.error.code === \"not_found\" ? \"not_found\" : \"storage\";\n\t\tthrow new SessionError(code, `${message}: ${result.error.message}`, result.error);\n\t}\n\treturn result.value;\n}\n\nexport async function getEntriesToFork(\n\tstorage: SessionStorage,\n\toptions: { entryId?: string; position?: \"before\" | \"at\" },\n): Promise<SessionTreeEntry[]> {\n\tif (!options.entryId) return storage.getEntries();\n\tconst target = await storage.getEntry(options.entryId);\n\tif (!target) {\n\t\tthrow new SessionError(\"invalid_fork_target\", `Entry ${options.entryId} not found`);\n\t}\n\tlet effectiveLeafId: string | null;\n\tif ((options.position ?? \"before\") === \"at\") {\n\t\teffectiveLeafId = target.id;\n\t} else {\n\t\tif (target.type !== \"message\" || target.message.role !== \"user\") {\n\t\t\tthrow new SessionError(\"invalid_fork_target\", `Entry ${options.entryId} is not a user message`);\n\t\t}\n\t\teffectiveLeafId = target.parentId;\n\t}\n\treturn storage.getPathToRoot(effectiveLeafId);\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
2
+ import type { AgentMessage } from "../../types.ts";
3
+ import type { SessionContext, SessionMetadata, SessionStorage, SessionTreeEntry } from "../types.ts";
4
+ export declare function buildSessionContext(pathEntries: SessionTreeEntry[]): SessionContext;
5
+ export declare class Session<TMetadata extends SessionMetadata = SessionMetadata> {
6
+ private storage;
7
+ constructor(storage: SessionStorage<TMetadata>);
8
+ getMetadata(): Promise<TMetadata>;
9
+ getStorage(): SessionStorage<TMetadata>;
10
+ getLeafId(): Promise<string | null>;
11
+ getEntry(id: string): Promise<SessionTreeEntry | undefined>;
12
+ getEntries(): Promise<SessionTreeEntry[]>;
13
+ getBranch(fromId?: string): Promise<SessionTreeEntry[]>;
14
+ buildContext(): Promise<SessionContext>;
15
+ getLabel(id: string): Promise<string | undefined>;
16
+ getSessionName(): Promise<string | undefined>;
17
+ private appendTypedEntry;
18
+ appendMessage(message: AgentMessage): Promise<string>;
19
+ appendThinkingLevelChange(thinkingLevel: string): Promise<string>;
20
+ appendModelChange(provider: string, modelId: string): Promise<string>;
21
+ appendCompaction<T = unknown>(summary: string, firstKeptEntryId: string, tokensBefore: number, details?: T, fromHook?: boolean): Promise<string>;
22
+ appendCustomEntry(customType: string, data?: unknown): Promise<string>;
23
+ appendCustomMessageEntry<T = unknown>(customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details?: T): Promise<string>;
24
+ appendLabel(targetId: string, label: string | undefined): Promise<string>;
25
+ appendSessionName(name: string): Promise<string>;
26
+ moveTo(entryId: string | null, summary?: {
27
+ summary: string;
28
+ details?: unknown;
29
+ fromHook?: boolean;
30
+ }): Promise<string | undefined>;
31
+ }
32
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/harness/session/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAQX,cAAc,EAEd,eAAe,EACf,cAAc,EACd,gBAAgB,EAEhB,MAAM,aAAa,CAAC;AAGrB,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,EAAE,GAAG,cAAc,CAuDnF;AAED,qBAAa,OAAO,CAAC,SAAS,SAAS,eAAe,GAAG,eAAe;IACvE,OAAO,CAAC,OAAO,CAA4B;IAE3C,YAAY,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,EAE7C;IAED,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC,CAEhC;IAED,UAAU,IAAI,cAAc,CAAC,SAAS,CAAC,CAEtC;IAED,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAElC;IAED,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,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AE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAY9E;IAEK,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQrD;IAEK,MAAM,CACX,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAClE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAgB7B;CACD","sourcesContent":["import type { ImageContent, TextContent } from \"@earendil-works/pi-ai\";\nimport type { AgentMessage } from \"../../types.ts\";\nimport { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage } from \"../messages.ts\";\nimport type {\n\tBranchSummaryEntry,\n\tCompactionEntry,\n\tCustomEntry,\n\tCustomMessageEntry,\n\tLabelEntry,\n\tMessageEntry,\n\tModelChangeEntry,\n\tSessionContext,\n\tSessionInfoEntry,\n\tSessionMetadata,\n\tSessionStorage,\n\tSessionTreeEntry,\n\tThinkingLevelChangeEntry,\n} from \"../types.ts\";\nimport { SessionError } from \"../types.ts\";\n\nexport function buildSessionContext(pathEntries: SessionTreeEntry[]): SessionContext {\n\tlet thinkingLevel = \"off\";\n\tlet model: { provider: string; modelId: string } | null = null;\n\tlet compaction: CompactionEntry | null = null;\n\n\tfor (const entry of pathEntries) {\n\t\tif (entry.type === \"thinking_level_change\") {\n\t\t\tthinkingLevel = entry.thinkingLevel;\n\t\t} else if (entry.type === \"model_change\") {\n\t\t\tmodel = { provider: entry.provider, modelId: entry.modelId };\n\t\t} else if (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\tmodel = { provider: entry.message.provider, modelId: entry.message.model };\n\t\t} else if (entry.type === \"compaction\") {\n\t\t\tcompaction = entry;\n\t\t}\n\t}\n\n\tconst messages: AgentMessage[] = [];\n\tconst appendMessage = (entry: SessionTreeEntry) => {\n\t\tif (entry.type === \"message\") {\n\t\t\tmessages.push(entry.message as AgentMessage);\n\t\t} else if (entry.type === \"custom_message\") {\n\t\t\tmessages.push(\n\t\t\t\tcreateCustomMessage(\n\t\t\t\t\tentry.customType,\n\t\t\t\t\tentry.content as string | (TextContent | ImageContent)[],\n\t\t\t\t\tentry.display,\n\t\t\t\t\tentry.details,\n\t\t\t\t\tentry.timestamp,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (entry.type === \"branch_summary\" && entry.summary) {\n\t\t\tmessages.push(createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp));\n\t\t}\n\t};\n\n\tif (compaction) {\n\t\tmessages.push(createCompactionSummaryMessage(compaction.summary, compaction.tokensBefore, compaction.timestamp));\n\t\tconst compactionIdx = pathEntries.findIndex((e) => e.type === \"compaction\" && e.id === compaction.id);\n\t\tlet foundFirstKept = false;\n\t\tfor (let i = 0; i < compactionIdx; i++) {\n\t\t\tconst entry = pathEntries[i]!;\n\t\t\tif (entry.id === compaction.firstKeptEntryId) foundFirstKept = true;\n\t\t\tif (foundFirstKept) appendMessage(entry);\n\t\t}\n\t\tfor (let i = compactionIdx + 1; i < pathEntries.length; i++) {\n\t\t\tappendMessage(pathEntries[i]!);\n\t\t}\n\t} else {\n\t\tfor (const entry of pathEntries) {\n\t\t\tappendMessage(entry);\n\t\t}\n\t}\n\n\treturn { messages, thinkingLevel, model };\n}\n\nexport class Session<TMetadata extends SessionMetadata = SessionMetadata> {\n\tprivate storage: SessionStorage<TMetadata>;\n\n\tconstructor(storage: SessionStorage<TMetadata>) {\n\t\tthis.storage = storage;\n\t}\n\n\tgetMetadata(): Promise<TMetadata> {\n\t\treturn this.storage.getMetadata();\n\t}\n\n\tgetStorage(): SessionStorage<TMetadata> {\n\t\treturn this.storage;\n\t}\n\n\tgetLeafId(): Promise<string | null> {\n\t\treturn this.storage.getLeafId();\n\t}\n\n\tgetEntry(id: string): Promise<SessionTreeEntry | undefined> {\n\t\treturn this.storage.getEntry(id);\n\t}\n\n\tgetEntries(): Promise<SessionTreeEntry[]> {\n\t\treturn this.storage.getEntries();\n\t}\n\n\tasync getBranch(fromId?: string): Promise<SessionTreeEntry[]> {\n\t\tconst leafId = fromId ?? (await this.storage.getLeafId());\n\t\treturn this.storage.getPathToRoot(leafId);\n\t}\n\n\tasync buildContext(): Promise<SessionContext> {\n\t\treturn buildSessionContext(await this.getBranch());\n\t}\n\n\tgetLabel(id: string): Promise<string | undefined> {\n\t\treturn this.storage.getLabel(id);\n\t}\n\n\tasync getSessionName(): Promise<string | undefined> {\n\t\tconst entries = await this.storage.findEntries(\"session_info\");\n\t\treturn entries[entries.length - 1]?.name?.trim() || undefined;\n\t}\n\n\tprivate async appendTypedEntry<TEntry extends SessionTreeEntry>(entry: TEntry): Promise<string> {\n\t\tawait this.storage.appendEntry(entry);\n\t\treturn entry.id;\n\t}\n\n\tasync appendMessage(message: AgentMessage): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"message\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tmessage,\n\t\t} satisfies MessageEntry);\n\t}\n\n\tasync appendThinkingLevelChange(thinkingLevel: string): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"thinking_level_change\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tthinkingLevel,\n\t\t} satisfies ThinkingLevelChangeEntry);\n\t}\n\n\tasync appendModelChange(provider: string, modelId: string): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"model_change\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tprovider,\n\t\t\tmodelId,\n\t\t} satisfies ModelChangeEntry);\n\t}\n\n\tasync appendCompaction<T = unknown>(\n\t\tsummary: string,\n\t\tfirstKeptEntryId: string,\n\t\ttokensBefore: number,\n\t\tdetails?: T,\n\t\tfromHook?: boolean,\n\t): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"compaction\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tsummary,\n\t\t\tfirstKeptEntryId,\n\t\t\ttokensBefore,\n\t\t\tdetails,\n\t\t\tfromHook,\n\t\t} satisfies CompactionEntry<T>);\n\t}\n\n\tasync appendCustomEntry(customType: string, data?: unknown): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"custom\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tcustomType,\n\t\t\tdata,\n\t\t} satisfies CustomEntry);\n\t}\n\n\tasync appendCustomMessageEntry<T = unknown>(\n\t\tcustomType: string,\n\t\tcontent: string | (TextContent | ImageContent)[],\n\t\tdisplay: boolean,\n\t\tdetails?: T,\n\t): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"custom_message\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tcustomType,\n\t\t\tcontent,\n\t\t\tdisplay,\n\t\t\tdetails,\n\t\t} satisfies CustomMessageEntry<T>);\n\t}\n\n\tasync appendLabel(targetId: string, label: string | undefined): Promise<string> {\n\t\tif (!(await this.storage.getEntry(targetId))) {\n\t\t\tthrow new SessionError(\"not_found\", `Entry ${targetId} not found`);\n\t\t}\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"label\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\ttargetId,\n\t\t\tlabel,\n\t\t} satisfies LabelEntry);\n\t}\n\n\tasync appendSessionName(name: string): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"session_info\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tname: name.trim(),\n\t\t} satisfies SessionInfoEntry);\n\t}\n\n\tasync moveTo(\n\t\tentryId: string | null,\n\t\tsummary?: { summary: string; details?: unknown; fromHook?: boolean },\n\t): Promise<string | undefined> {\n\t\tif (entryId !== null && !(await this.storage.getEntry(entryId))) {\n\t\t\tthrow new SessionError(\"not_found\", `Entry ${entryId} not found`);\n\t\t}\n\t\tawait this.storage.setLeafId(entryId);\n\t\tif (!summary) return undefined;\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"branch_summary\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: entryId,\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tfromId: entryId ?? \"root\",\n\t\t\tsummary: summary.summary,\n\t\t\tdetails: summary.details,\n\t\t\tfromHook: summary.fromHook,\n\t\t} satisfies BranchSummaryEntry);\n\t}\n}\n"]}
@@ -0,0 +1,197 @@
1
+ import { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage } from "../messages.js";
2
+ import { SessionError } from "../types.js";
3
+ export function buildSessionContext(pathEntries) {
4
+ let thinkingLevel = "off";
5
+ let model = null;
6
+ let compaction = null;
7
+ for (const entry of pathEntries) {
8
+ if (entry.type === "thinking_level_change") {
9
+ thinkingLevel = entry.thinkingLevel;
10
+ }
11
+ else if (entry.type === "model_change") {
12
+ model = { provider: entry.provider, modelId: entry.modelId };
13
+ }
14
+ else if (entry.type === "message" && entry.message.role === "assistant") {
15
+ model = { provider: entry.message.provider, modelId: entry.message.model };
16
+ }
17
+ else if (entry.type === "compaction") {
18
+ compaction = entry;
19
+ }
20
+ }
21
+ const messages = [];
22
+ const appendMessage = (entry) => {
23
+ if (entry.type === "message") {
24
+ messages.push(entry.message);
25
+ }
26
+ else if (entry.type === "custom_message") {
27
+ messages.push(createCustomMessage(entry.customType, entry.content, entry.display, entry.details, entry.timestamp));
28
+ }
29
+ else if (entry.type === "branch_summary" && entry.summary) {
30
+ messages.push(createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp));
31
+ }
32
+ };
33
+ if (compaction) {
34
+ messages.push(createCompactionSummaryMessage(compaction.summary, compaction.tokensBefore, compaction.timestamp));
35
+ const compactionIdx = pathEntries.findIndex((e) => e.type === "compaction" && e.id === compaction.id);
36
+ let foundFirstKept = false;
37
+ for (let i = 0; i < compactionIdx; i++) {
38
+ const entry = pathEntries[i];
39
+ if (entry.id === compaction.firstKeptEntryId)
40
+ foundFirstKept = true;
41
+ if (foundFirstKept)
42
+ appendMessage(entry);
43
+ }
44
+ for (let i = compactionIdx + 1; i < pathEntries.length; i++) {
45
+ appendMessage(pathEntries[i]);
46
+ }
47
+ }
48
+ else {
49
+ for (const entry of pathEntries) {
50
+ appendMessage(entry);
51
+ }
52
+ }
53
+ return { messages, thinkingLevel, model };
54
+ }
55
+ export class Session {
56
+ storage;
57
+ constructor(storage) {
58
+ this.storage = storage;
59
+ }
60
+ getMetadata() {
61
+ return this.storage.getMetadata();
62
+ }
63
+ getStorage() {
64
+ return this.storage;
65
+ }
66
+ getLeafId() {
67
+ return this.storage.getLeafId();
68
+ }
69
+ getEntry(id) {
70
+ return this.storage.getEntry(id);
71
+ }
72
+ getEntries() {
73
+ return this.storage.getEntries();
74
+ }
75
+ async getBranch(fromId) {
76
+ const leafId = fromId ?? (await this.storage.getLeafId());
77
+ return this.storage.getPathToRoot(leafId);
78
+ }
79
+ async buildContext() {
80
+ return buildSessionContext(await this.getBranch());
81
+ }
82
+ getLabel(id) {
83
+ return this.storage.getLabel(id);
84
+ }
85
+ async getSessionName() {
86
+ const entries = await this.storage.findEntries("session_info");
87
+ return entries[entries.length - 1]?.name?.trim() || undefined;
88
+ }
89
+ async appendTypedEntry(entry) {
90
+ await this.storage.appendEntry(entry);
91
+ return entry.id;
92
+ }
93
+ async appendMessage(message) {
94
+ return this.appendTypedEntry({
95
+ type: "message",
96
+ id: await this.storage.createEntryId(),
97
+ parentId: await this.storage.getLeafId(),
98
+ timestamp: new Date().toISOString(),
99
+ message,
100
+ });
101
+ }
102
+ async appendThinkingLevelChange(thinkingLevel) {
103
+ return this.appendTypedEntry({
104
+ type: "thinking_level_change",
105
+ id: await this.storage.createEntryId(),
106
+ parentId: await this.storage.getLeafId(),
107
+ timestamp: new Date().toISOString(),
108
+ thinkingLevel,
109
+ });
110
+ }
111
+ async appendModelChange(provider, modelId) {
112
+ return this.appendTypedEntry({
113
+ type: "model_change",
114
+ id: await this.storage.createEntryId(),
115
+ parentId: await this.storage.getLeafId(),
116
+ timestamp: new Date().toISOString(),
117
+ provider,
118
+ modelId,
119
+ });
120
+ }
121
+ async appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook) {
122
+ return this.appendTypedEntry({
123
+ type: "compaction",
124
+ id: await this.storage.createEntryId(),
125
+ parentId: await this.storage.getLeafId(),
126
+ timestamp: new Date().toISOString(),
127
+ summary,
128
+ firstKeptEntryId,
129
+ tokensBefore,
130
+ details,
131
+ fromHook,
132
+ });
133
+ }
134
+ async appendCustomEntry(customType, data) {
135
+ return this.appendTypedEntry({
136
+ type: "custom",
137
+ id: await this.storage.createEntryId(),
138
+ parentId: await this.storage.getLeafId(),
139
+ timestamp: new Date().toISOString(),
140
+ customType,
141
+ data,
142
+ });
143
+ }
144
+ async appendCustomMessageEntry(customType, content, display, details) {
145
+ return this.appendTypedEntry({
146
+ type: "custom_message",
147
+ id: await this.storage.createEntryId(),
148
+ parentId: await this.storage.getLeafId(),
149
+ timestamp: new Date().toISOString(),
150
+ customType,
151
+ content,
152
+ display,
153
+ details,
154
+ });
155
+ }
156
+ async appendLabel(targetId, label) {
157
+ if (!(await this.storage.getEntry(targetId))) {
158
+ throw new SessionError("not_found", `Entry ${targetId} not found`);
159
+ }
160
+ return this.appendTypedEntry({
161
+ type: "label",
162
+ id: await this.storage.createEntryId(),
163
+ parentId: await this.storage.getLeafId(),
164
+ timestamp: new Date().toISOString(),
165
+ targetId,
166
+ label,
167
+ });
168
+ }
169
+ async appendSessionName(name) {
170
+ return this.appendTypedEntry({
171
+ type: "session_info",
172
+ id: await this.storage.createEntryId(),
173
+ parentId: await this.storage.getLeafId(),
174
+ timestamp: new Date().toISOString(),
175
+ name: name.trim(),
176
+ });
177
+ }
178
+ async moveTo(entryId, summary) {
179
+ if (entryId !== null && !(await this.storage.getEntry(entryId))) {
180
+ throw new SessionError("not_found", `Entry ${entryId} not found`);
181
+ }
182
+ await this.storage.setLeafId(entryId);
183
+ if (!summary)
184
+ return undefined;
185
+ return this.appendTypedEntry({
186
+ type: "branch_summary",
187
+ id: await this.storage.createEntryId(),
188
+ parentId: entryId,
189
+ timestamp: new Date().toISOString(),
190
+ fromId: entryId ?? "root",
191
+ summary: summary.summary,
192
+ details: summary.details,
193
+ fromHook: summary.fromHook,
194
+ });
195
+ }
196
+ }
197
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/harness/session/session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAgBjH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,UAAU,mBAAmB,CAAC,WAA+B,EAAkB;IACpF,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,KAAK,GAAiD,IAAI,CAAC;IAC/D,IAAI,UAAU,GAA2B,IAAI,CAAC;IAE9C,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QACjC,IAAI,KAAK,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;YAC5C,aAAa,GAAG,KAAK,CAAC,aAAa,CA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,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SACG,CAAC,CAAC;IAAA,CAChC;CACD","sourcesContent":["import type { ImageContent, TextContent } from \"@earendil-works/pi-ai\";\nimport type { AgentMessage } from \"../../types.ts\";\nimport { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage } from \"../messages.ts\";\nimport type {\n\tBranchSummaryEntry,\n\tCompactionEntry,\n\tCustomEntry,\n\tCustomMessageEntry,\n\tLabelEntry,\n\tMessageEntry,\n\tModelChangeEntry,\n\tSessionContext,\n\tSessionInfoEntry,\n\tSessionMetadata,\n\tSessionStorage,\n\tSessionTreeEntry,\n\tThinkingLevelChangeEntry,\n} from \"../types.ts\";\nimport { SessionError } from \"../types.ts\";\n\nexport function buildSessionContext(pathEntries: SessionTreeEntry[]): SessionContext {\n\tlet thinkingLevel = \"off\";\n\tlet model: { provider: string; modelId: string } | null = null;\n\tlet compaction: CompactionEntry | null = null;\n\n\tfor (const entry of pathEntries) {\n\t\tif (entry.type === \"thinking_level_change\") {\n\t\t\tthinkingLevel = entry.thinkingLevel;\n\t\t} else if (entry.type === \"model_change\") {\n\t\t\tmodel = { provider: entry.provider, modelId: entry.modelId };\n\t\t} else if (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\tmodel = { provider: entry.message.provider, modelId: entry.message.model };\n\t\t} else if (entry.type === \"compaction\") {\n\t\t\tcompaction = entry;\n\t\t}\n\t}\n\n\tconst messages: AgentMessage[] = [];\n\tconst appendMessage = (entry: SessionTreeEntry) => {\n\t\tif (entry.type === \"message\") {\n\t\t\tmessages.push(entry.message as AgentMessage);\n\t\t} else if (entry.type === \"custom_message\") {\n\t\t\tmessages.push(\n\t\t\t\tcreateCustomMessage(\n\t\t\t\t\tentry.customType,\n\t\t\t\t\tentry.content as string | (TextContent | ImageContent)[],\n\t\t\t\t\tentry.display,\n\t\t\t\t\tentry.details,\n\t\t\t\t\tentry.timestamp,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (entry.type === \"branch_summary\" && entry.summary) {\n\t\t\tmessages.push(createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp));\n\t\t}\n\t};\n\n\tif (compaction) {\n\t\tmessages.push(createCompactionSummaryMessage(compaction.summary, compaction.tokensBefore, compaction.timestamp));\n\t\tconst compactionIdx = pathEntries.findIndex((e) => e.type === \"compaction\" && e.id === compaction.id);\n\t\tlet foundFirstKept = false;\n\t\tfor (let i = 0; i < compactionIdx; i++) {\n\t\t\tconst entry = pathEntries[i]!;\n\t\t\tif (entry.id === compaction.firstKeptEntryId) foundFirstKept = true;\n\t\t\tif (foundFirstKept) appendMessage(entry);\n\t\t}\n\t\tfor (let i = compactionIdx + 1; i < pathEntries.length; i++) {\n\t\t\tappendMessage(pathEntries[i]!);\n\t\t}\n\t} else {\n\t\tfor (const entry of pathEntries) {\n\t\t\tappendMessage(entry);\n\t\t}\n\t}\n\n\treturn { messages, thinkingLevel, model };\n}\n\nexport class Session<TMetadata extends SessionMetadata = SessionMetadata> {\n\tprivate storage: SessionStorage<TMetadata>;\n\n\tconstructor(storage: SessionStorage<TMetadata>) {\n\t\tthis.storage = storage;\n\t}\n\n\tgetMetadata(): Promise<TMetadata> {\n\t\treturn this.storage.getMetadata();\n\t}\n\n\tgetStorage(): SessionStorage<TMetadata> {\n\t\treturn this.storage;\n\t}\n\n\tgetLeafId(): Promise<string | null> {\n\t\treturn this.storage.getLeafId();\n\t}\n\n\tgetEntry(id: string): Promise<SessionTreeEntry | undefined> {\n\t\treturn this.storage.getEntry(id);\n\t}\n\n\tgetEntries(): Promise<SessionTreeEntry[]> {\n\t\treturn this.storage.getEntries();\n\t}\n\n\tasync getBranch(fromId?: string): Promise<SessionTreeEntry[]> {\n\t\tconst leafId = fromId ?? (await this.storage.getLeafId());\n\t\treturn this.storage.getPathToRoot(leafId);\n\t}\n\n\tasync buildContext(): Promise<SessionContext> {\n\t\treturn buildSessionContext(await this.getBranch());\n\t}\n\n\tgetLabel(id: string): Promise<string | undefined> {\n\t\treturn this.storage.getLabel(id);\n\t}\n\n\tasync getSessionName(): Promise<string | undefined> {\n\t\tconst entries = await this.storage.findEntries(\"session_info\");\n\t\treturn entries[entries.length - 1]?.name?.trim() || undefined;\n\t}\n\n\tprivate async appendTypedEntry<TEntry extends SessionTreeEntry>(entry: TEntry): Promise<string> {\n\t\tawait this.storage.appendEntry(entry);\n\t\treturn entry.id;\n\t}\n\n\tasync appendMessage(message: AgentMessage): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"message\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tmessage,\n\t\t} satisfies MessageEntry);\n\t}\n\n\tasync appendThinkingLevelChange(thinkingLevel: string): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"thinking_level_change\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tthinkingLevel,\n\t\t} satisfies ThinkingLevelChangeEntry);\n\t}\n\n\tasync appendModelChange(provider: string, modelId: string): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"model_change\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tprovider,\n\t\t\tmodelId,\n\t\t} satisfies ModelChangeEntry);\n\t}\n\n\tasync appendCompaction<T = unknown>(\n\t\tsummary: string,\n\t\tfirstKeptEntryId: string,\n\t\ttokensBefore: number,\n\t\tdetails?: T,\n\t\tfromHook?: boolean,\n\t): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"compaction\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tsummary,\n\t\t\tfirstKeptEntryId,\n\t\t\ttokensBefore,\n\t\t\tdetails,\n\t\t\tfromHook,\n\t\t} satisfies CompactionEntry<T>);\n\t}\n\n\tasync appendCustomEntry(customType: string, data?: unknown): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"custom\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tcustomType,\n\t\t\tdata,\n\t\t} satisfies CustomEntry);\n\t}\n\n\tasync appendCustomMessageEntry<T = unknown>(\n\t\tcustomType: string,\n\t\tcontent: string | (TextContent | ImageContent)[],\n\t\tdisplay: boolean,\n\t\tdetails?: T,\n\t): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"custom_message\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tcustomType,\n\t\t\tcontent,\n\t\t\tdisplay,\n\t\t\tdetails,\n\t\t} satisfies CustomMessageEntry<T>);\n\t}\n\n\tasync appendLabel(targetId: string, label: string | undefined): Promise<string> {\n\t\tif (!(await this.storage.getEntry(targetId))) {\n\t\t\tthrow new SessionError(\"not_found\", `Entry ${targetId} not found`);\n\t\t}\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"label\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\ttargetId,\n\t\t\tlabel,\n\t\t} satisfies LabelEntry);\n\t}\n\n\tasync appendSessionName(name: string): Promise<string> {\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"session_info\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: await this.storage.getLeafId(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tname: name.trim(),\n\t\t} satisfies SessionInfoEntry);\n\t}\n\n\tasync moveTo(\n\t\tentryId: string | null,\n\t\tsummary?: { summary: string; details?: unknown; fromHook?: boolean },\n\t): Promise<string | undefined> {\n\t\tif (entryId !== null && !(await this.storage.getEntry(entryId))) {\n\t\t\tthrow new SessionError(\"not_found\", `Entry ${entryId} not found`);\n\t\t}\n\t\tawait this.storage.setLeafId(entryId);\n\t\tif (!summary) return undefined;\n\t\treturn this.appendTypedEntry({\n\t\t\ttype: \"branch_summary\",\n\t\t\tid: await this.storage.createEntryId(),\n\t\t\tparentId: entryId,\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tfromId: entryId ?? \"root\",\n\t\t\tsummary: summary.summary,\n\t\t\tdetails: summary.details,\n\t\t\tfromHook: summary.fromHook,\n\t\t} satisfies BranchSummaryEntry);\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function uuidv7(): string;
2
+ //# sourceMappingURL=uuid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/harness/session/uuid.ts"],"names":[],"mappings":"AAcA,wBAAgB,MAAM,IAAI,MAAM,CAkC/B","sourcesContent":["let lastTimestamp = -Infinity;\nlet sequence = 0;\n\nfunction fillRandomBytes(bytes: Uint8Array): void {\n\tconst crypto = globalThis.crypto;\n\tif (crypto?.getRandomValues) {\n\t\tcrypto.getRandomValues(bytes);\n\t\treturn;\n\t}\n\tfor (let i = 0; i < bytes.length; i++) {\n\t\tbytes[i] = Math.floor(Math.random() * 256);\n\t}\n}\n\nexport function uuidv7(): string {\n\tconst random = new Uint8Array(16);\n\tfillRandomBytes(random);\n\tconst timestamp = Date.now();\n\n\tif (timestamp > lastTimestamp) {\n\t\tsequence = random[6] * 0x1000000 + random[7] * 0x10000 + random[8] * 0x100 + random[9];\n\t\tlastTimestamp = timestamp;\n\t} else {\n\t\tsequence = (sequence + 1) >>> 0;\n\t\tif (sequence === 0) {\n\t\t\tlastTimestamp++;\n\t\t}\n\t}\n\n\tconst bytes = new Uint8Array(16);\n\tbytes[0] = (lastTimestamp / 0x10000000000) & 0xff;\n\tbytes[1] = (lastTimestamp / 0x100000000) & 0xff;\n\tbytes[2] = (lastTimestamp / 0x1000000) & 0xff;\n\tbytes[3] = (lastTimestamp / 0x10000) & 0xff;\n\tbytes[4] = (lastTimestamp / 0x100) & 0xff;\n\tbytes[5] = lastTimestamp & 0xff;\n\tbytes[6] = 0x70 | ((sequence >>> 28) & 0x0f);\n\tbytes[7] = (sequence >>> 20) & 0xff;\n\tbytes[8] = 0x80 | ((sequence >>> 14) & 0x3f);\n\tbytes[9] = (sequence >>> 6) & 0xff;\n\tbytes[10] = ((sequence & 0x3f) << 2) | (random[10] & 0x03);\n\tbytes[11] = random[11];\n\tbytes[12] = random[12];\n\tbytes[13] = random[13];\n\tbytes[14] = random[14];\n\tbytes[15] = random[15];\n\n\treturn formatUuid(bytes);\n}\n\nfunction formatUuid(bytes: Uint8Array): string {\n\tconst hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\"));\n\treturn `${hex.slice(0, 4).join(\"\")}-${hex.slice(4, 6).join(\"\")}-${hex.slice(6, 8).join(\"\")}-${hex.slice(8, 10).join(\"\")}-${hex.slice(10, 16).join(\"\")}`;\n}\n"]}
@@ -0,0 +1,50 @@
1
+ let lastTimestamp = -Infinity;
2
+ let sequence = 0;
3
+ function fillRandomBytes(bytes) {
4
+ const crypto = globalThis.crypto;
5
+ if (crypto?.getRandomValues) {
6
+ crypto.getRandomValues(bytes);
7
+ return;
8
+ }
9
+ for (let i = 0; i < bytes.length; i++) {
10
+ bytes[i] = Math.floor(Math.random() * 256);
11
+ }
12
+ }
13
+ export function uuidv7() {
14
+ const random = new Uint8Array(16);
15
+ fillRandomBytes(random);
16
+ const timestamp = Date.now();
17
+ if (timestamp > lastTimestamp) {
18
+ sequence = random[6] * 0x1000000 + random[7] * 0x10000 + random[8] * 0x100 + random[9];
19
+ lastTimestamp = timestamp;
20
+ }
21
+ else {
22
+ sequence = (sequence + 1) >>> 0;
23
+ if (sequence === 0) {
24
+ lastTimestamp++;
25
+ }
26
+ }
27
+ const bytes = new Uint8Array(16);
28
+ bytes[0] = (lastTimestamp / 0x10000000000) & 0xff;
29
+ bytes[1] = (lastTimestamp / 0x100000000) & 0xff;
30
+ bytes[2] = (lastTimestamp / 0x1000000) & 0xff;
31
+ bytes[3] = (lastTimestamp / 0x10000) & 0xff;
32
+ bytes[4] = (lastTimestamp / 0x100) & 0xff;
33
+ bytes[5] = lastTimestamp & 0xff;
34
+ bytes[6] = 0x70 | ((sequence >>> 28) & 0x0f);
35
+ bytes[7] = (sequence >>> 20) & 0xff;
36
+ bytes[8] = 0x80 | ((sequence >>> 14) & 0x3f);
37
+ bytes[9] = (sequence >>> 6) & 0xff;
38
+ bytes[10] = ((sequence & 0x3f) << 2) | (random[10] & 0x03);
39
+ bytes[11] = random[11];
40
+ bytes[12] = random[12];
41
+ bytes[13] = random[13];
42
+ bytes[14] = random[14];
43
+ bytes[15] = random[15];
44
+ return formatUuid(bytes);
45
+ }
46
+ function formatUuid(bytes) {
47
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
48
+ return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10, 16).join("")}`;
49
+ }
50
+ //# sourceMappingURL=uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../src/harness/session/uuid.ts"],"names":[],"mappings":"AAAA,IAAI,aAAa,GAAG,CAAC,QAAQ,CAAC;AAC9B,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB,SAAS,eAAe,CAAC,KAAiB,EAAQ;IACjD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACjC,IAAI,MAAM,EAAE,eAAe,EAAE,CAAC;QAC7B,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC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AE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC5E,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAAA,CACxJ","sourcesContent":["let lastTimestamp = -Infinity;\nlet sequence = 0;\n\nfunction fillRandomBytes(bytes: Uint8Array): void {\n\tconst crypto = globalThis.crypto;\n\tif (crypto?.getRandomValues) {\n\t\tcrypto.getRandomValues(bytes);\n\t\treturn;\n\t}\n\tfor (let i = 0; i < bytes.length; i++) {\n\t\tbytes[i] = Math.floor(Math.random() * 256);\n\t}\n}\n\nexport function uuidv7(): string {\n\tconst random = new Uint8Array(16);\n\tfillRandomBytes(random);\n\tconst timestamp = Date.now();\n\n\tif (timestamp > lastTimestamp) {\n\t\tsequence = random[6] * 0x1000000 + random[7] * 0x10000 + random[8] * 0x100 + random[9];\n\t\tlastTimestamp = timestamp;\n\t} else {\n\t\tsequence = (sequence + 1) >>> 0;\n\t\tif (sequence === 0) {\n\t\t\tlastTimestamp++;\n\t\t}\n\t}\n\n\tconst bytes = new Uint8Array(16);\n\tbytes[0] = (lastTimestamp / 0x10000000000) & 0xff;\n\tbytes[1] = (lastTimestamp / 0x100000000) & 0xff;\n\tbytes[2] = (lastTimestamp / 0x1000000) & 0xff;\n\tbytes[3] = (lastTimestamp / 0x10000) & 0xff;\n\tbytes[4] = (lastTimestamp / 0x100) & 0xff;\n\tbytes[5] = lastTimestamp & 0xff;\n\tbytes[6] = 0x70 | ((sequence >>> 28) & 0x0f);\n\tbytes[7] = (sequence >>> 20) & 0xff;\n\tbytes[8] = 0x80 | ((sequence >>> 14) & 0x3f);\n\tbytes[9] = (sequence >>> 6) & 0xff;\n\tbytes[10] = ((sequence & 0x3f) << 2) | (random[10] & 0x03);\n\tbytes[11] = random[11];\n\tbytes[12] = random[12];\n\tbytes[13] = random[13];\n\tbytes[14] = random[14];\n\tbytes[15] = random[15];\n\n\treturn formatUuid(bytes);\n}\n\nfunction formatUuid(bytes: Uint8Array): string {\n\tconst hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\"));\n\treturn `${hex.slice(0, 4).join(\"\")}-${hex.slice(4, 6).join(\"\")}-${hex.slice(6, 8).join(\"\")}-${hex.slice(8, 10).join(\"\")}-${hex.slice(10, 16).join(\"\")}`;\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import { type ExecutionEnv, type Skill } from "./types.ts";
2
+ export type SkillDiagnosticCode = "file_info_failed" | "list_failed" | "read_failed" | "parse_failed" | "invalid_metadata";
3
+ /** Warning produced while loading skills. */
4
+ export interface SkillDiagnostic {
5
+ /** Diagnostic severity. Currently only warnings are emitted. */
6
+ type: "warning";
7
+ /** Stable diagnostic code. */
8
+ code: SkillDiagnosticCode;
9
+ /** Human-readable diagnostic message. */
10
+ message: string;
11
+ /** Path associated with the diagnostic. */
12
+ path: string;
13
+ }
14
+ /** Format a skill invocation prompt, optionally appending additional user instructions. */
15
+ export declare function formatSkillInvocation(skill: Skill, additionalInstructions?: string): string;
16
+ /**
17
+ * Load skills from one or more directories.
18
+ *
19
+ * Traverses directories recursively, loads `SKILL.md` files, loads direct root `.md` files as skills, honors ignore files,
20
+ * and returns diagnostics for invalid skill files. Missing input directories are skipped.
21
+ */
22
+ export declare function loadSkills(env: ExecutionEnv, dirs: string | string[]): Promise<{
23
+ skills: Skill[];
24
+ diagnostics: SkillDiagnostic[];
25
+ }>;
26
+ /**
27
+ * Load skills from source-tagged directories.
28
+ *
29
+ * Source values are preserved exactly and attached to every loaded skill and diagnostic. The agent package does not
30
+ * interpret source values; applications define their own provenance shape.
31
+ */
32
+ export declare function loadSourcedSkills<TSource, TSkill extends Skill = Skill>(env: ExecutionEnv, inputs: Array<{
33
+ path: string;
34
+ source: TSource;
35
+ }>, mapSkill?: (skill: Skill, source: TSource) => TSkill): Promise<{
36
+ skills: Array<{
37
+ skill: TSkill;
38
+ source: TSource;
39
+ }>;
40
+ diagnostics: Array<SkillDiagnostic & {
41
+ source: TSource;
42
+ }>;
43
+ }>;
44
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/harness/skills.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAA8B,KAAK,KAAK,EAAW,MAAM,YAAY,CAAC;AAQhG,MAAM,MAAM,mBAAmB,GAC5B,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,cAAc,GACd,kBAAkB,CAAC;AAEtB,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC/B,gEAAgE;IAChE,IAAI,EAAE,SAAS,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;CACb;AASD,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3F;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC/B,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GACrB,OAAO,CAAC;IAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,WAAW,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC,CAuB9D;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5E,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,EAChD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK,MAAM,GAClD,OAAO,CAAC;IACV,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClD,WAAW,EAAE,KAAK,CAAC,eAAe,GAAG;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC1D,CAAC,CAWD","sourcesContent":["import ignore from \"ignore\";\nimport { parse } from \"yaml\";\nimport { type ExecutionEnv, type FileInfo, type Result, type Skill, toError } from \"./types.ts\";\n\nconst MAX_NAME_LENGTH = 64;\nconst MAX_DESCRIPTION_LENGTH = 1024;\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nexport type SkillDiagnosticCode =\n\t| \"file_info_failed\"\n\t| \"list_failed\"\n\t| \"read_failed\"\n\t| \"parse_failed\"\n\t| \"invalid_metadata\";\n\n/** Warning produced while loading skills. */\nexport interface SkillDiagnostic {\n\t/** Diagnostic severity. Currently only warnings are emitted. */\n\ttype: \"warning\";\n\t/** Stable diagnostic code. */\n\tcode: SkillDiagnosticCode;\n\t/** Human-readable diagnostic message. */\n\tmessage: string;\n\t/** Path associated with the diagnostic. */\n\tpath: string;\n}\n\ninterface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\n/** Format a skill invocation prompt, optionally appending additional user instructions. */\nexport function formatSkillInvocation(skill: Skill, additionalInstructions?: string): string {\n\tconst skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${dirnameEnvPath(skill.filePath)}.\\n\\n${skill.content}\\n</skill>`;\n\treturn additionalInstructions ? `${skillBlock}\\n\\n${additionalInstructions}` : skillBlock;\n}\n\n/**\n * Load skills from one or more directories.\n *\n * Traverses directories recursively, loads `SKILL.md` files, loads direct root `.md` files as skills, honors ignore files,\n * and returns diagnostics for invalid skill files. Missing input directories are skipped.\n */\nexport async function loadSkills(\n\tenv: ExecutionEnv,\n\tdirs: string | string[],\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tfor (const dir of Array.isArray(dirs) ? dirs : [dirs]) {\n\t\tconst rootInfoResult = await env.fileInfo(dir);\n\t\tif (!rootInfoResult.ok) {\n\t\t\tif (rootInfoResult.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: rootInfoResult.error.message,\n\t\t\t\t\tpath: dir,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst rootInfo = rootInfoResult.value;\n\t\tif ((await resolveKind(env, rootInfo, diagnostics)) !== \"directory\") continue;\n\t\tconst result = await loadSkillsFromDirInternal(env, rootInfo.path, true, ignore(), rootInfo.path);\n\t\tskills.push(...result.skills);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\treturn { skills, diagnostics };\n}\n\n/**\n * Load skills from source-tagged directories.\n *\n * Source values are preserved exactly and attached to every loaded skill and diagnostic. The agent package does not\n * interpret source values; applications define their own provenance shape.\n */\nexport async function loadSourcedSkills<TSource, TSkill extends Skill = Skill>(\n\tenv: ExecutionEnv,\n\tinputs: Array<{ path: string; source: TSource }>,\n\tmapSkill?: (skill: Skill, source: TSource) => TSkill,\n): Promise<{\n\tskills: Array<{ skill: TSkill; source: TSource }>;\n\tdiagnostics: Array<SkillDiagnostic & { source: TSource }>;\n}> {\n\tconst skills: Array<{ skill: TSkill; source: TSource }> = [];\n\tconst diagnostics: Array<SkillDiagnostic & { source: TSource }> = [];\n\tfor (const input of inputs) {\n\t\tconst result = await loadSkills(env, input.path);\n\t\tfor (const skill of result.skills) {\n\t\t\tskills.push({ skill: mapSkill ? mapSkill(skill, input.source) : (skill as TSkill), source: input.source });\n\t\t}\n\t\tfor (const diagnostic of result.diagnostics) diagnostics.push({ ...diagnostic, source: input.source });\n\t}\n\treturn { skills, diagnostics };\n}\n\nasync function loadSkillsFromDirInternal(\n\tenv: ExecutionEnv,\n\tdir: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher: IgnoreMatcher,\n\trootDir: string,\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\n\tconst dirInfoResult = await env.fileInfo(dir);\n\tif (!dirInfoResult.ok) {\n\t\tif (dirInfoResult.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: dirInfoResult.error.message,\n\t\t\t\tpath: dir,\n\t\t\t});\n\t\t}\n\t\treturn { skills, diagnostics };\n\t}\n\tconst dirInfo = dirInfoResult.value;\n\tif ((await resolveKind(env, dirInfo, diagnostics)) !== \"directory\") return { skills, diagnostics };\n\n\tawait addIgnoreRules(env, ignoreMatcher, dir, rootDir, diagnostics);\n\n\tconst entriesResult = await env.listDir(dir);\n\tif (!entriesResult.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"list_failed\", message: entriesResult.error.message, path: dir });\n\t\treturn { skills, diagnostics };\n\t}\n\tconst entries = entriesResult.value;\n\n\tfor (const entry of entries) {\n\t\tif (entry.name !== \"SKILL.md\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics);\n\t\tif (kind !== \"file\") continue;\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tif (ignoreMatcher.ignores(relPath)) continue;\n\n\t\tconst result = await loadSkillFromFile(env, fullPath);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t\treturn { skills, diagnostics };\n\t}\n\n\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics);\n\t\tif (!kind) continue;\n\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tconst ignorePath = kind === \"directory\" ? `${relPath}/` : relPath;\n\t\tif (ignoreMatcher.ignores(ignorePath)) continue;\n\n\t\tif (kind === \"directory\") {\n\t\t\tconst result = await loadSkillsFromDirInternal(env, fullPath, false, ignoreMatcher, rootDir);\n\t\t\tskills.push(...result.skills);\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (kind !== \"file\" || !includeRootFiles || !entry.name.endsWith(\".md\")) continue;\n\t\tconst result = await loadSkillFromFile(env, fullPath);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\n\treturn { skills, diagnostics };\n}\n\nasync function addIgnoreRules(\n\tenv: ExecutionEnv,\n\tig: IgnoreMatcher,\n\tdir: string,\n\trootDir: string,\n\tdiagnostics: SkillDiagnostic[],\n): Promise<void> {\n\tconst relativeDir = relativeEnvPath(rootDir, dir);\n\tconst prefix = relativeDir ? `${relativeDir}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = joinEnvPath(dir, filename);\n\t\tconst info = await env.fileInfo(ignorePath);\n\t\tif (!info.ok) {\n\t\t\tif (info.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: info.error.message,\n\t\t\t\t\tpath: ignorePath,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (info.value.kind !== \"file\") continue;\n\t\tconst content = await env.readTextFile(ignorePath);\n\t\tif (!content.ok) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: content.error.message, path: ignorePath });\n\t\t\tcontinue;\n\t\t}\n\t\tconst patterns = content.value\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t.filter((line): line is string => Boolean(line));\n\t\tif (patterns.length > 0) ig.add(patterns);\n\t}\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\tif (pattern.startsWith(\"/\")) pattern = pattern.slice(1);\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nasync function loadSkillFromFile(\n\tenv: ExecutionEnv,\n\tfilePath: string,\n): Promise<{ skill: Skill | null; diagnostics: SkillDiagnostic[] }> {\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tconst rawContent = await env.readTextFile(filePath);\n\tif (!rawContent.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: rawContent.error.message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst parsed = parseFrontmatter<SkillFrontmatter>(rawContent.value);\n\tif (!parsed.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"parse_failed\", message: parsed.error.message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst { frontmatter, body } = parsed.value;\n\tconst skillDir = dirnameEnvPath(filePath);\n\tconst parentDirName = basenameEnvPath(skillDir);\n\tconst description = typeof frontmatter.description === \"string\" ? frontmatter.description : undefined;\n\n\tfor (const error of validateDescription(description)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tconst frontmatterName = typeof frontmatter.name === \"string\" ? frontmatter.name : undefined;\n\tconst name = frontmatterName || parentDirName;\n\tfor (const error of validateName(name, parentDirName)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tif (!description || description.trim() === \"\") {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\treturn {\n\t\tskill: {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tcontent: body,\n\t\t\tfilePath,\n\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n\nfunction validateName(name: string, parentDirName: string): string[] {\n\tconst errors: string[] = [];\n\tif (name !== parentDirName) errors.push(`name \"${name}\" does not match parent directory \"${parentDirName}\"`);\n\tif (name.length > MAX_NAME_LENGTH) errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(\"name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)\");\n\t}\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) errors.push(\"name must not start or end with a hyphen\");\n\tif (name.includes(\"--\")) errors.push(\"name must not contain consecutive hyphens\");\n\treturn errors;\n}\n\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\treturn errors;\n}\n\nfunction parseFrontmatter<T extends Record<string, unknown>>(\n\tcontent: string,\n): Result<{ frontmatter: T; body: string }, Error> {\n\ttry {\n\t\tconst normalized = content.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\t\tif (!normalized.startsWith(\"---\")) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\t\tif (endIndex === -1) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst yamlString = normalized.slice(4, endIndex);\n\t\tconst body = normalized.slice(endIndex + 4).trim();\n\t\treturn { ok: true, value: { frontmatter: (parse(yamlString) ?? {}) as T, body } };\n\t} catch (error) {\n\t\treturn { ok: false, error: toError(error) };\n\t}\n}\n\nasync function resolveKind(\n\tenv: ExecutionEnv,\n\tinfo: FileInfo,\n\tdiagnostics: SkillDiagnostic[],\n): Promise<\"file\" | \"directory\" | undefined> {\n\tif (info.kind === \"file\" || info.kind === \"directory\") return info.kind;\n\tconst canonicalPath = await env.canonicalPath(info.path);\n\tif (!canonicalPath.ok) {\n\t\tif (canonicalPath.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: canonicalPath.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\tconst target = await env.fileInfo(canonicalPath.value);\n\tif (!target.ok) {\n\t\tif (target.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: target.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn target.value.kind === \"file\" || target.value.kind === \"directory\" ? target.value.kind : undefined;\n}\n\nfunction joinEnvPath(base: string, child: string): string {\n\treturn `${base.replace(/\\/+$/, \"\")}/${child.replace(/^\\/+/, \"\")}`;\n}\n\nfunction dirnameEnvPath(path: string): string {\n\tconst normalized = path.replace(/\\/+$/, \"\");\n\tconst slashIndex = normalized.lastIndexOf(\"/\");\n\treturn slashIndex <= 0 ? \"/\" : normalized.slice(0, slashIndex);\n}\n\nfunction basenameEnvPath(path: string): string {\n\tconst normalized = path.replace(/\\/+$/, \"\");\n\tconst slashIndex = normalized.lastIndexOf(\"/\");\n\treturn slashIndex === -1 ? normalized : normalized.slice(slashIndex + 1);\n}\n\nfunction relativeEnvPath(root: string, path: string): string {\n\tconst normalizedRoot = root.replace(/\\/+$/, \"\");\n\tconst normalizedPath = path.replace(/\\/+$/, \"\");\n\tif (normalizedPath === normalizedRoot) return \"\";\n\treturn normalizedPath.startsWith(`${normalizedRoot}/`)\n\t\t? normalizedPath.slice(normalizedRoot.length + 1)\n\t\t: normalizedPath.replace(/^\\/+/, \"\");\n}\n"]}