@psnext/slingcli 2.4.20260507-3 → 2.4.20260509-1

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 (393) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bin/sling.js +12 -12
  4. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +2 -2
  5. package/node_modules/@aws-sdk/token-providers/package.json +1 -1
  6. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/agent-loop.js +1 -1
  7. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/agent.js +4 -3
  8. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +526 -0
  9. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +243 -0
  10. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +616 -0
  11. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +348 -0
  12. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +3 -0
  13. package/node_modules/@earendil-works/pi-agent-core/dist/harness/factory.js +9 -0
  14. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  15. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +194 -0
  16. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +92 -0
  17. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +42 -0
  18. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +31 -0
  19. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +196 -0
  20. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +170 -0
  21. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +90 -0
  22. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +258 -0
  23. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  24. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +16 -0
  25. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +97 -0
  26. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +26 -0
  27. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/proxy.js +1 -1
  28. package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/package.json +7 -5
  29. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/cli.js +6 -6
  30. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/env-api-keys.js +1 -0
  31. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +307 -0
  32. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  33. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  34. package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  35. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/index.js +4 -0
  36. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/models.generated.js +427 -122
  37. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
  38. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  39. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-codex-responses.js +1 -1
  40. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-completions.js +150 -122
  41. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-responses-shared.js +14 -1
  42. package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/openai-codex.js +25 -14
  43. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/overflow.js +3 -0
  44. package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/package.json +5 -4
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/bun/register-bedrock.js +4 -0
  46. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/args.js +1 -0
  47. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/config-selector.js +1 -1
  48. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/list-models.js +1 -1
  49. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/session-picker.js +1 -1
  50. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/config.js +52 -30
  51. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session.js +1 -1
  52. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/auth-storage.js +2 -2
  53. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/branch-summarization.js +1 -1
  54. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/compaction.js +1 -1
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +153 -0
  56. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.css +45 -1
  57. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.js +68 -4
  58. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/loader.js +26 -12
  59. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/keybindings.js +1 -1
  60. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/model-registry.js +3 -2
  61. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/model-resolver.js +2 -1
  62. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/package-manager.js +22 -5
  63. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/provider-display-names.js +1 -0
  64. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/sdk.js +3 -3
  65. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/bash.js +1 -1
  66. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/edit.js +1 -1
  67. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/find.js +1 -1
  68. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/grep.js +1 -1
  69. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/ls.js +1 -1
  70. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/read.js +3 -2
  71. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/render-utils.js +1 -1
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +205 -0
  73. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/write.js +1 -1
  74. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/main.js +2 -2
  75. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/migrations.js +3 -3
  76. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +1 -1
  77. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +1 -1
  78. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js +1 -1
  79. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +1 -1
  80. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  81. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/config-selector.js +25 -3
  82. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/custom-editor.js +1 -1
  83. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/custom-message.js +1 -1
  84. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/earendil-announcement.js +1 -1
  85. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +1 -1
  86. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-input.js +1 -1
  87. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +1 -1
  88. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/footer.js +1 -1
  89. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +36 -0
  90. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +4 -3
  91. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/model-selector.js +2 -2
  92. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +1 -1
  93. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  94. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +1 -1
  95. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/session-selector.js +1 -1
  96. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +4 -2
  97. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js +1 -1
  98. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +1 -1
  99. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/theme-selector.js +1 -1
  100. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js +1 -1
  101. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -1
  102. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +3 -2
  103. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js +1 -1
  104. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
  105. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js +1 -1
  106. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/interactive-mode.js +47 -32
  107. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/dark.json +1 -1
  108. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/light.json +1 -1
  109. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/theme.js +1 -1
  110. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/package-manager-cli.js +42 -39
  111. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard.js +9 -2
  112. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/paths.js +16 -0
  113. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/version-check.js +9 -2
  114. package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/package.json +9 -8
  115. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/image.js +14 -7
  116. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/markdown.js +24 -84
  117. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/terminal-image.js +10 -4
  118. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/tui.js +73 -4
  119. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/utils.js +33 -7
  120. package/node_modules/{@mariozechner → @earendil-works}/pi-tui/package.json +3 -3
  121. package/node_modules/@mariozechner/clipboard/README.md +58 -0
  122. package/node_modules/@mariozechner/clipboard/index.d.ts +23 -0
  123. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/README.md +3 -0
  124. package/node_modules/@types/node/README.md +1 -1
  125. package/node_modules/@types/node/http2.d.ts +4 -1
  126. package/node_modules/@types/node/package.json +2 -2
  127. package/node_modules/@types/node/stream/web.d.ts +4 -0
  128. package/node_modules/brace-expansion/dist/commonjs/index.js +1 -1
  129. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  130. package/node_modules/brace-expansion/dist/esm/index.js +1 -1
  131. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  132. package/node_modules/brace-expansion/package.json +1 -1
  133. package/node_modules/fast-xml-builder/CHANGELOG.md +4 -0
  134. package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -1
  135. package/node_modules/fast-xml-builder/lib/fxb.d.cts +91 -1
  136. package/node_modules/fast-xml-builder/lib/fxb.min.js +1 -1
  137. package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -1
  138. package/node_modules/fast-xml-builder/package.json +3 -2
  139. package/node_modules/fast-xml-builder/src/fxb.d.ts +92 -3
  140. package/node_modules/fast-xml-builder/src/fxb.js +92 -31
  141. package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +87 -33
  142. package/node_modules/get-east-asian-width/lookup-data.js +15 -12
  143. package/node_modules/get-east-asian-width/lookup.js +25 -22
  144. package/node_modules/get-east-asian-width/package.json +1 -1
  145. package/node_modules/jiti/README.md +258 -0
  146. package/node_modules/jiti/dist/babel.cjs +257 -0
  147. package/node_modules/jiti/dist/jiti.cjs +1 -0
  148. package/node_modules/jiti/lib/jiti.mjs +29 -0
  149. package/node_modules/jiti/lib/types.d.ts +420 -0
  150. package/node_modules/jiti/package.json +146 -0
  151. package/node_modules/protobufjs/dist/light/protobuf.js +5 -3
  152. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  153. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  154. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  155. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  156. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  157. package/node_modules/protobufjs/dist/protobuf.js +5 -3
  158. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  159. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  160. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  161. package/node_modules/protobufjs/package.json +1 -1
  162. package/node_modules/protobufjs/src/namespace.js +3 -1
  163. package/node_modules/semver/README.md +19 -4
  164. package/node_modules/semver/bin/semver.js +14 -10
  165. package/node_modules/semver/functions/truncate.js +48 -0
  166. package/node_modules/semver/index.js +2 -0
  167. package/node_modules/semver/internal/re.js +1 -1
  168. package/node_modules/semver/package.json +3 -3
  169. package/node_modules/semver/range.bnf +5 -4
  170. package/node_modules/socks/package.json +2 -2
  171. package/node_modules/xml-naming/README.md +189 -0
  172. package/node_modules/xml-naming/package.json +54 -0
  173. package/node_modules/xml-naming/src/index.d.ts +74 -0
  174. package/node_modules/xml-naming/src/index.js +270 -0
  175. package/package.json +6 -6
  176. package/sling-default-packages.json +2 -1
  177. package/slingshot/index.js +442 -23
  178. package/node_modules/@mariozechner/jiti/dist/babel.cjs +0 -246
  179. package/node_modules/@mariozechner/jiti/dist/jiti.cjs +0 -1
  180. package/node_modules/@mariozechner/jiti/package.json +0 -96
  181. package/node_modules/@mariozechner/pi-agent-core/dist/index.js +0 -9
  182. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/cli.js +0 -116
  183. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/env-api-keys.js +0 -166
  184. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/index.js +0 -15
  185. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/models.generated.js +0 -16568
  186. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/amazon-bedrock.js +0 -753
  187. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/openai-codex-responses.js +0 -909
  188. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses-shared.js +0 -479
  189. package/node_modules/@mariozechner/pi-agent-core/node_modules/@mariozechner/pi-ai/dist/utils/oauth/openai-codex.js +0 -374
  190. package/node_modules/@mariozechner/pi-ai/dist/api-registry.js +0 -44
  191. package/node_modules/@mariozechner/pi-ai/dist/bedrock-provider.js +0 -6
  192. package/node_modules/@mariozechner/pi-ai/dist/models.js +0 -71
  193. package/node_modules/@mariozechner/pi-ai/dist/oauth.js +0 -2
  194. package/node_modules/@mariozechner/pi-ai/dist/providers/anthropic.js +0 -951
  195. package/node_modules/@mariozechner/pi-ai/dist/providers/azure-openai-responses.js +0 -208
  196. package/node_modules/@mariozechner/pi-ai/dist/providers/cloudflare.js +0 -26
  197. package/node_modules/@mariozechner/pi-ai/dist/providers/faux.js +0 -368
  198. package/node_modules/@mariozechner/pi-ai/dist/providers/github-copilot-headers.js +0 -29
  199. package/node_modules/@mariozechner/pi-ai/dist/providers/google-shared.js +0 -329
  200. package/node_modules/@mariozechner/pi-ai/dist/providers/google-vertex.js +0 -442
  201. package/node_modules/@mariozechner/pi-ai/dist/providers/google.js +0 -400
  202. package/node_modules/@mariozechner/pi-ai/dist/providers/mistral.js +0 -535
  203. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-completions.js +0 -908
  204. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses.js +0 -220
  205. package/node_modules/@mariozechner/pi-ai/dist/providers/register-builtins.js +0 -243
  206. package/node_modules/@mariozechner/pi-ai/dist/providers/simple-options.js +0 -39
  207. package/node_modules/@mariozechner/pi-ai/dist/providers/transform-messages.js +0 -184
  208. package/node_modules/@mariozechner/pi-ai/dist/stream.js +0 -27
  209. package/node_modules/@mariozechner/pi-ai/dist/types.js +0 -2
  210. package/node_modules/@mariozechner/pi-ai/dist/utils/event-stream.js +0 -81
  211. package/node_modules/@mariozechner/pi-ai/dist/utils/hash.js +0 -14
  212. package/node_modules/@mariozechner/pi-ai/dist/utils/headers.js +0 -8
  213. package/node_modules/@mariozechner/pi-ai/dist/utils/json-parse.js +0 -113
  214. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/anthropic.js +0 -335
  215. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/github-copilot.js +0 -292
  216. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/index.js +0 -121
  217. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/oauth-page.js +0 -105
  218. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/pkce.js +0 -31
  219. package/node_modules/@mariozechner/pi-ai/dist/utils/oauth/types.js +0 -2
  220. package/node_modules/@mariozechner/pi-ai/dist/utils/overflow.js +0 -146
  221. package/node_modules/@mariozechner/pi-ai/dist/utils/sanitize-unicode.js +0 -26
  222. package/node_modules/@mariozechner/pi-ai/dist/utils/typebox-helpers.js +0 -21
  223. package/node_modules/@mariozechner/pi-ai/dist/utils/validation.js +0 -281
  224. package/node_modules/@mariozechner/pi-ai/package.json +0 -108
  225. package/node_modules/@mariozechner/pi-coding-agent/dist/bun/register-bedrock.js +0 -4
  226. package/node_modules/@mariozechner/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +0 -22
  227. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/agent-loop.js +0 -458
  228. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/agent.js +0 -398
  229. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/index.js +0 -9
  230. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/proxy.js +0 -278
  231. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/dist/types.js +0 -2
  232. package/node_modules/@mariozechner/pi-coding-agent/node_modules/@mariozechner/pi-agent-core/package.json +0 -45
  233. package/node_modules/socks/.claude/settings.local.json +0 -26
  234. package/node_modules/std-env/LICENCE +0 -22
  235. package/node_modules/std-env/README.md +0 -118
  236. package/node_modules/std-env/dist/index.cjs +0 -1
  237. package/node_modules/std-env/dist/index.d.cts +0 -92
  238. package/node_modules/std-env/dist/index.d.mts +0 -92
  239. package/node_modules/std-env/dist/index.d.ts +0 -92
  240. package/node_modules/std-env/dist/index.mjs +0 -1
  241. package/node_modules/std-env/package.json +0 -46
  242. package/node_modules/yoctocolors/base.d.ts +0 -47
  243. package/node_modules/yoctocolors/base.js +0 -94
  244. package/node_modules/yoctocolors/index.d.ts +0 -2
  245. package/node_modules/yoctocolors/index.js +0 -2
  246. package/node_modules/yoctocolors/license +0 -9
  247. package/node_modules/yoctocolors/package.json +0 -69
  248. package/node_modules/yoctocolors/readme.md +0 -138
  249. /package/node_modules/{@mariozechner/pi-coding-agent/dist/core → @earendil-works/pi-agent-core/dist/harness}/compaction/utils.js +0 -0
  250. /package/node_modules/{@mariozechner/pi-coding-agent/dist/core/tools → @earendil-works/pi-agent-core/dist/harness/utils}/truncate.js +0 -0
  251. /package/node_modules/{@mariozechner → @earendil-works}/pi-agent-core/dist/types.js +0 -0
  252. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/api-registry.js +0 -0
  253. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/bedrock-provider.js +0 -0
  254. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/models.js +0 -0
  255. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/oauth.js +0 -0
  256. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/providers/amazon-bedrock.js +0 -0
  257. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/anthropic.js +0 -0
  258. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/azure-openai-responses.js +0 -0
  259. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/cloudflare.js +0 -0
  260. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/faux.js +0 -0
  261. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/github-copilot-headers.js +0 -0
  262. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google-shared.js +0 -0
  263. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google-vertex.js +0 -0
  264. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/google.js +0 -0
  265. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/mistral.js +0 -0
  266. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/openai-responses.js +0 -0
  267. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/register-builtins.js +0 -0
  268. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/simple-options.js +0 -0
  269. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/providers/transform-messages.js +0 -0
  270. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/session-resources.js +0 -0
  271. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/stream.js +0 -0
  272. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/types.js +0 -0
  273. /package/node_modules/{@mariozechner → @earendil-works}/pi-ai/dist/utils/diagnostics.js +0 -0
  274. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/event-stream.js +0 -0
  275. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/hash.js +0 -0
  276. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/headers.js +0 -0
  277. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/json-parse.js +0 -0
  278. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/anthropic.js +0 -0
  279. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/github-copilot.js +0 -0
  280. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/index.js +0 -0
  281. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/oauth-page.js +0 -0
  282. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/pkce.js +0 -0
  283. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/oauth/types.js +0 -0
  284. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/sanitize-unicode.js +0 -0
  285. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/typebox-helpers.js +0 -0
  286. /package/node_modules/{@mariozechner/pi-agent-core/node_modules/@mariozechner → @earendil-works}/pi-ai/dist/utils/validation.js +0 -0
  287. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/bun/cli.js +0 -0
  288. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/bun/restore-sandbox-env.js +0 -0
  289. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/file-processor.js +0 -0
  290. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli/initial-message.js +0 -0
  291. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/cli.js +0 -0
  292. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session-runtime.js +0 -0
  293. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/agent-session-services.js +0 -0
  294. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/auth-guidance.js +0 -0
  295. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/bash-executor.js +0 -0
  296. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/compaction/index.js +0 -0
  297. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/defaults.js +0 -0
  298. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/diagnostics.js +0 -0
  299. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/event-bus.js +0 -0
  300. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/exec.js +0 -0
  301. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/ansi-to-html.js +0 -0
  302. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/index.js +0 -0
  303. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/template.html +0 -0
  304. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/tool-renderer.js +0 -0
  305. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/vendor/highlight.min.js +0 -0
  306. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/export-html/vendor/marked.min.js +0 -0
  307. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/index.js +0 -0
  308. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/runner.js +0 -0
  309. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/types.js +0 -0
  310. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/extensions/wrapper.js +0 -0
  311. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/footer-data-provider.js +0 -0
  312. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/index.js +0 -0
  313. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/messages.js +0 -0
  314. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/output-guard.js +0 -0
  315. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/prompt-templates.js +0 -0
  316. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/resolve-config-value.js +0 -0
  317. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/resource-loader.js +0 -0
  318. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/session-cwd.js +0 -0
  319. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/session-manager.js +0 -0
  320. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/settings-manager.js +0 -0
  321. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/skills.js +0 -0
  322. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/slash-commands.js +0 -0
  323. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/source-info.js +0 -0
  324. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/system-prompt.js +0 -0
  325. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/telemetry.js +0 -0
  326. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/timings.js +0 -0
  327. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/edit-diff.js +0 -0
  328. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/file-mutation-queue.js +0 -0
  329. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/index.js +0 -0
  330. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/output-accumulator.js +0 -0
  331. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/path-utils.js +0 -0
  332. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/core/tools/tool-definition-wrapper.js +0 -0
  333. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/index.js +0 -0
  334. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/index.js +0 -0
  335. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/assets/clankolas.png +0 -0
  336. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/armin.js +0 -0
  337. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +0 -0
  338. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/daxnuts.js +0 -0
  339. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/diff.js +0 -0
  340. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +0 -0
  341. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/components/index.js +0 -0
  342. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -0
  343. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/print-mode.js +0 -0
  344. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/jsonl.js +0 -0
  345. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-client.js +0 -0
  346. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-mode.js +0 -0
  347. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/modes/rpc/rpc-types.js +0 -0
  348. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/changelog.js +0 -0
  349. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/child-process.js +0 -0
  350. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard-image.js +0 -0
  351. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/clipboard-native.js +0 -0
  352. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/exif-orientation.js +0 -0
  353. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/frontmatter.js +0 -0
  354. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/fs-watch.js +0 -0
  355. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/git.js +0 -0
  356. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/image-convert.js +0 -0
  357. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/image-resize.js +0 -0
  358. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/mime.js +0 -0
  359. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/photon.js +0 -0
  360. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/pi-user-agent.js +0 -0
  361. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/shell.js +0 -0
  362. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/sleep.js +0 -0
  363. /package/node_modules/{@mariozechner → @earendil-works}/pi-coding-agent/dist/utils/tools-manager.js +0 -0
  364. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/autocomplete.js +0 -0
  365. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/box.js +0 -0
  366. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/cancellable-loader.js +0 -0
  367. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/editor.js +0 -0
  368. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/input.js +0 -0
  369. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/loader.js +0 -0
  370. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/select-list.js +0 -0
  371. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/settings-list.js +0 -0
  372. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/spacer.js +0 -0
  373. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/text.js +0 -0
  374. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/components/truncated-text.js +0 -0
  375. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/editor-component.js +0 -0
  376. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/fuzzy.js +0 -0
  377. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/index.js +0 -0
  378. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/keybindings.js +0 -0
  379. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/keys.js +0 -0
  380. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/kill-ring.js +0 -0
  381. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/stdin-buffer.js +0 -0
  382. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/terminal.js +0 -0
  383. /package/node_modules/{@mariozechner → @earendil-works}/pi-tui/dist/undo-stack.js +0 -0
  384. /package/node_modules/{@mariozechner/jiti → jiti}/LICENSE +0 -0
  385. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-cli.mjs +0 -0
  386. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-hooks.mjs +0 -0
  387. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-native.mjs +0 -0
  388. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-register.d.mts +0 -0
  389. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti-register.mjs +0 -0
  390. /package/node_modules/{@mariozechner/jiti/lib/jiti.mjs → jiti/lib/jiti-static.mjs} +0 -0
  391. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.cjs +0 -0
  392. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.d.cts +0 -0
  393. /package/node_modules/{@mariozechner/jiti → jiti}/lib/jiti.d.mts +0 -0
@@ -0,0 +1,92 @@
1
+ import { constants } from "node:fs";
2
+ import { access, mkdir, readdir, rm } from "node:fs/promises";
3
+ import { join, resolve } from "node:path";
4
+ import { JsonlSessionStorage, loadJsonlSessionMetadata } from "../storage/jsonl.js";
5
+ import { createSessionId, createTimestamp, getEntriesToFork, toSession } from "./shared.js";
6
+ async function exists(path) {
7
+ try {
8
+ await access(path, constants.F_OK);
9
+ return true;
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ function encodeCwd(cwd) {
16
+ return `--${cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
17
+ }
18
+ export class JsonlSessionRepo {
19
+ sessionsRoot;
20
+ constructor(options) {
21
+ this.sessionsRoot = resolve(options.sessionsRoot);
22
+ }
23
+ getSessionDir(cwd) {
24
+ return join(this.sessionsRoot, encodeCwd(cwd));
25
+ }
26
+ createSessionFilePath(cwd, sessionId, timestamp) {
27
+ return join(this.getSessionDir(cwd), `${timestamp.replace(/[:.]/g, "-")}_${sessionId}.jsonl`);
28
+ }
29
+ async create(options) {
30
+ await mkdir(this.sessionsRoot, { recursive: true });
31
+ const id = options.id ?? createSessionId();
32
+ const createdAt = createTimestamp();
33
+ const filePath = this.createSessionFilePath(options.cwd, id, createdAt);
34
+ const storage = await JsonlSessionStorage.create(filePath, {
35
+ cwd: options.cwd,
36
+ sessionId: id,
37
+ parentSessionPath: options.parentSessionPath,
38
+ });
39
+ return toSession(storage);
40
+ }
41
+ async open(metadata) {
42
+ if (!(await exists(metadata.path))) {
43
+ throw new Error(`Session not found: ${metadata.path}`);
44
+ }
45
+ const storage = await JsonlSessionStorage.open(metadata.path);
46
+ return toSession(storage);
47
+ }
48
+ async list(options = {}) {
49
+ const dirs = options.cwd ? [this.getSessionDir(options.cwd)] : await this.listSessionDirs();
50
+ const sessions = [];
51
+ for (const dir of dirs) {
52
+ if (!(await exists(dir)))
53
+ continue;
54
+ const files = (await readdir(dir)).filter((file) => file.endsWith(".jsonl")).map((file) => join(dir, file));
55
+ for (const filePath of files) {
56
+ try {
57
+ sessions.push(await loadJsonlSessionMetadata(filePath));
58
+ }
59
+ catch {
60
+ // Ignore invalid session files when listing a directory.
61
+ }
62
+ }
63
+ }
64
+ sessions.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
65
+ return sessions;
66
+ }
67
+ async delete(metadata) {
68
+ await rm(metadata.path, { force: true });
69
+ }
70
+ async fork(sourceMetadata, options) {
71
+ const source = await this.open(sourceMetadata);
72
+ const forkedEntries = await getEntriesToFork(source.getStorage(), options);
73
+ const id = options.id ?? createSessionId();
74
+ const createdAt = createTimestamp();
75
+ const storage = await JsonlSessionStorage.create(this.createSessionFilePath(options.cwd, id, createdAt), {
76
+ cwd: options.cwd,
77
+ sessionId: id,
78
+ parentSessionPath: options.parentSessionPath ?? sourceMetadata.path,
79
+ });
80
+ for (const entry of forkedEntries) {
81
+ await storage.appendEntry(entry);
82
+ }
83
+ return toSession(storage);
84
+ }
85
+ async listSessionDirs() {
86
+ if (!(await exists(this.sessionsRoot)))
87
+ return [];
88
+ const entries = await readdir(this.sessionsRoot, { withFileTypes: true });
89
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => join(this.sessionsRoot, entry.name));
90
+ }
91
+ }
92
+ //# sourceMappingURL=jsonl.js.map
@@ -0,0 +1,42 @@
1
+ import { InMemorySessionStorage } from "../storage/memory.js";
2
+ import { createSessionId, createTimestamp, getEntriesToFork, toSession } from "./shared.js";
3
+ export class InMemorySessionRepo {
4
+ sessions = new Map();
5
+ async create(options = {}) {
6
+ const metadata = {
7
+ id: options.id ?? createSessionId(),
8
+ createdAt: createTimestamp(),
9
+ };
10
+ const storage = new InMemorySessionStorage({ metadata });
11
+ const session = toSession(storage);
12
+ this.sessions.set(metadata.id, session);
13
+ return session;
14
+ }
15
+ async open(metadata) {
16
+ const session = this.sessions.get(metadata.id);
17
+ if (!session) {
18
+ throw new Error(`Session not found: ${metadata.id}`);
19
+ }
20
+ return session;
21
+ }
22
+ async list() {
23
+ return Promise.all([...this.sessions.values()].map((session) => session.getMetadata()));
24
+ }
25
+ async delete(metadata) {
26
+ this.sessions.delete(metadata.id);
27
+ }
28
+ async fork(sourceMetadata, options) {
29
+ const source = await this.open(sourceMetadata);
30
+ const forkedEntries = await getEntriesToFork(source.getStorage(), options);
31
+ const metadata = {
32
+ id: options.id ?? createSessionId(),
33
+ createdAt: createTimestamp(),
34
+ };
35
+ const leafId = forkedEntries[forkedEntries.length - 1]?.id ?? null;
36
+ const storage = new InMemorySessionStorage({ metadata, entries: forkedEntries, leafId });
37
+ const session = toSession(storage);
38
+ this.sessions.set(metadata.id, session);
39
+ return session;
40
+ }
41
+ }
42
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1,31 @@
1
+ import { v7 as uuidv7 } from "uuid";
2
+ import { Session } from "../session.js";
3
+ export function createSessionId() {
4
+ return uuidv7();
5
+ }
6
+ export function createTimestamp() {
7
+ return new Date().toISOString();
8
+ }
9
+ export function toSession(storage) {
10
+ return new Session(storage);
11
+ }
12
+ export async function getEntriesToFork(storage, options) {
13
+ if (!options.entryId)
14
+ return storage.getEntries();
15
+ const target = await storage.getEntry(options.entryId);
16
+ if (!target) {
17
+ throw new Error(`Entry ${options.entryId} not found`);
18
+ }
19
+ let effectiveLeafId;
20
+ if ((options.position ?? "before") === "at") {
21
+ effectiveLeafId = target.id;
22
+ }
23
+ else {
24
+ if (target.type !== "message" || target.message.role !== "user") {
25
+ throw new Error(`Entry ${options.entryId} is not a user message`);
26
+ }
27
+ effectiveLeafId = target.parentId;
28
+ }
29
+ return storage.getPathToRoot(effectiveLeafId);
30
+ }
31
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1,196 @@
1
+ import { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage } from "../messages.js";
2
+ export function buildSessionContext(pathEntries) {
3
+ let thinkingLevel = "off";
4
+ let model = null;
5
+ let compaction = null;
6
+ for (const entry of pathEntries) {
7
+ if (entry.type === "thinking_level_change") {
8
+ thinkingLevel = entry.thinkingLevel;
9
+ }
10
+ else if (entry.type === "model_change") {
11
+ model = { provider: entry.provider, modelId: entry.modelId };
12
+ }
13
+ else if (entry.type === "message" && entry.message.role === "assistant") {
14
+ model = { provider: entry.message.provider, modelId: entry.message.model };
15
+ }
16
+ else if (entry.type === "compaction") {
17
+ compaction = entry;
18
+ }
19
+ }
20
+ const messages = [];
21
+ const appendMessage = (entry) => {
22
+ if (entry.type === "message") {
23
+ messages.push(entry.message);
24
+ }
25
+ else if (entry.type === "custom_message") {
26
+ messages.push(createCustomMessage(entry.customType, entry.content, entry.display, entry.details, entry.timestamp));
27
+ }
28
+ else if (entry.type === "branch_summary" && entry.summary) {
29
+ messages.push(createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp));
30
+ }
31
+ };
32
+ if (compaction) {
33
+ messages.push(createCompactionSummaryMessage(compaction.summary, compaction.tokensBefore, compaction.timestamp));
34
+ const compactionIdx = pathEntries.findIndex((e) => e.type === "compaction" && e.id === compaction.id);
35
+ let foundFirstKept = false;
36
+ for (let i = 0; i < compactionIdx; i++) {
37
+ const entry = pathEntries[i];
38
+ if (entry.id === compaction.firstKeptEntryId)
39
+ foundFirstKept = true;
40
+ if (foundFirstKept)
41
+ appendMessage(entry);
42
+ }
43
+ for (let i = compactionIdx + 1; i < pathEntries.length; i++) {
44
+ appendMessage(pathEntries[i]);
45
+ }
46
+ }
47
+ else {
48
+ for (const entry of pathEntries) {
49
+ appendMessage(entry);
50
+ }
51
+ }
52
+ return { messages, thinkingLevel, model };
53
+ }
54
+ export class Session {
55
+ storage;
56
+ constructor(storage) {
57
+ this.storage = storage;
58
+ }
59
+ getMetadata() {
60
+ return this.storage.getMetadata();
61
+ }
62
+ getStorage() {
63
+ return this.storage;
64
+ }
65
+ getLeafId() {
66
+ return this.storage.getLeafId();
67
+ }
68
+ getEntry(id) {
69
+ return this.storage.getEntry(id);
70
+ }
71
+ getEntries() {
72
+ return this.storage.getEntries();
73
+ }
74
+ async getBranch(fromId) {
75
+ const leafId = fromId ?? (await this.storage.getLeafId());
76
+ return this.storage.getPathToRoot(leafId);
77
+ }
78
+ async buildContext() {
79
+ return buildSessionContext(await this.getBranch());
80
+ }
81
+ getLabel(id) {
82
+ return this.storage.getLabel(id);
83
+ }
84
+ async getSessionName() {
85
+ const entries = await this.storage.findEntries("session_info");
86
+ return entries[entries.length - 1]?.name?.trim() || undefined;
87
+ }
88
+ async appendTypedEntry(entry) {
89
+ await this.storage.appendEntry(entry);
90
+ return entry.id;
91
+ }
92
+ async appendMessage(message) {
93
+ return this.appendTypedEntry({
94
+ type: "message",
95
+ id: await this.storage.createEntryId(),
96
+ parentId: await this.storage.getLeafId(),
97
+ timestamp: new Date().toISOString(),
98
+ message,
99
+ });
100
+ }
101
+ async appendThinkingLevelChange(thinkingLevel) {
102
+ return this.appendTypedEntry({
103
+ type: "thinking_level_change",
104
+ id: await this.storage.createEntryId(),
105
+ parentId: await this.storage.getLeafId(),
106
+ timestamp: new Date().toISOString(),
107
+ thinkingLevel,
108
+ });
109
+ }
110
+ async appendModelChange(provider, modelId) {
111
+ return this.appendTypedEntry({
112
+ type: "model_change",
113
+ id: await this.storage.createEntryId(),
114
+ parentId: await this.storage.getLeafId(),
115
+ timestamp: new Date().toISOString(),
116
+ provider,
117
+ modelId,
118
+ });
119
+ }
120
+ async appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook) {
121
+ return this.appendTypedEntry({
122
+ type: "compaction",
123
+ id: await this.storage.createEntryId(),
124
+ parentId: await this.storage.getLeafId(),
125
+ timestamp: new Date().toISOString(),
126
+ summary,
127
+ firstKeptEntryId,
128
+ tokensBefore,
129
+ details,
130
+ fromHook,
131
+ });
132
+ }
133
+ async appendCustomEntry(customType, data) {
134
+ return this.appendTypedEntry({
135
+ type: "custom",
136
+ id: await this.storage.createEntryId(),
137
+ parentId: await this.storage.getLeafId(),
138
+ timestamp: new Date().toISOString(),
139
+ customType,
140
+ data,
141
+ });
142
+ }
143
+ async appendCustomMessageEntry(customType, content, display, details) {
144
+ return this.appendTypedEntry({
145
+ type: "custom_message",
146
+ id: await this.storage.createEntryId(),
147
+ parentId: await this.storage.getLeafId(),
148
+ timestamp: new Date().toISOString(),
149
+ customType,
150
+ content,
151
+ display,
152
+ details,
153
+ });
154
+ }
155
+ async appendLabel(targetId, label) {
156
+ if (!(await this.storage.getEntry(targetId))) {
157
+ throw new Error(`Entry ${targetId} not found`);
158
+ }
159
+ return this.appendTypedEntry({
160
+ type: "label",
161
+ id: await this.storage.createEntryId(),
162
+ parentId: await this.storage.getLeafId(),
163
+ timestamp: new Date().toISOString(),
164
+ targetId,
165
+ label,
166
+ });
167
+ }
168
+ async appendSessionName(name) {
169
+ return this.appendTypedEntry({
170
+ type: "session_info",
171
+ id: await this.storage.createEntryId(),
172
+ parentId: await this.storage.getLeafId(),
173
+ timestamp: new Date().toISOString(),
174
+ name: name.trim(),
175
+ });
176
+ }
177
+ async moveTo(entryId, summary) {
178
+ if (entryId !== null && !(await this.storage.getEntry(entryId))) {
179
+ throw new Error(`Entry ${entryId} not found`);
180
+ }
181
+ await this.storage.setLeafId(entryId);
182
+ if (!summary)
183
+ return undefined;
184
+ return this.appendTypedEntry({
185
+ type: "branch_summary",
186
+ id: await this.storage.createEntryId(),
187
+ parentId: entryId,
188
+ timestamp: new Date().toISOString(),
189
+ fromId: entryId ?? "root",
190
+ summary: summary.summary,
191
+ details: summary.details,
192
+ fromHook: summary.fromHook,
193
+ });
194
+ }
195
+ }
196
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1,170 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { createReadStream } from "node:fs";
3
+ import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
4
+ import { dirname, resolve } from "node:path";
5
+ import { createInterface } from "node:readline";
6
+ function updateLabelCache(labelsById, entry) {
7
+ if (entry.type !== "label")
8
+ return;
9
+ const label = entry.label?.trim();
10
+ if (label) {
11
+ labelsById.set(entry.targetId, label);
12
+ }
13
+ else {
14
+ labelsById.delete(entry.targetId);
15
+ }
16
+ }
17
+ function buildLabelsById(entries) {
18
+ const labelsById = new Map();
19
+ for (const entry of entries) {
20
+ updateLabelCache(labelsById, entry);
21
+ }
22
+ return labelsById;
23
+ }
24
+ function generateEntryId(byId) {
25
+ for (let i = 0; i < 100; i++) {
26
+ const id = randomUUID().slice(0, 8);
27
+ if (!byId.has(id))
28
+ return id;
29
+ }
30
+ return randomUUID();
31
+ }
32
+ function headerToSessionMetadata(header, path) {
33
+ return {
34
+ id: header.id,
35
+ createdAt: header.timestamp,
36
+ cwd: header.cwd,
37
+ path,
38
+ parentSessionPath: header.parentSession,
39
+ };
40
+ }
41
+ export async function loadJsonlSessionMetadata(filePath) {
42
+ const stream = createReadStream(filePath, { encoding: "utf8" });
43
+ const lines = createInterface({ input: stream, crlfDelay: Infinity });
44
+ try {
45
+ for await (const line of lines) {
46
+ if (!line.trim())
47
+ break;
48
+ try {
49
+ const header = JSON.parse(line);
50
+ return headerToSessionMetadata(header, resolve(filePath));
51
+ }
52
+ catch {
53
+ throw new Error(`Invalid JSONL session file ${filePath}: first line is not a valid session header`);
54
+ }
55
+ }
56
+ throw new Error(`Invalid JSONL session file ${filePath}: missing session header`);
57
+ }
58
+ finally {
59
+ lines.close();
60
+ stream.destroy();
61
+ }
62
+ }
63
+ async function loadJsonlStorage(filePath) {
64
+ const content = await readFile(filePath, "utf8");
65
+ const lines = content.split("\n").filter((line) => line.trim());
66
+ if (lines.length === 0) {
67
+ throw new Error(`Invalid JSONL session file ${filePath}: missing session header`);
68
+ }
69
+ let header;
70
+ try {
71
+ header = JSON.parse(lines[0]);
72
+ }
73
+ catch {
74
+ throw new Error(`Invalid JSONL session file ${filePath}: first line is not a valid session header`);
75
+ }
76
+ const entries = [];
77
+ let leafId = null;
78
+ for (const line of lines.slice(1)) {
79
+ try {
80
+ const entry = JSON.parse(line);
81
+ entries.push(entry);
82
+ leafId = entry.id;
83
+ }
84
+ catch {
85
+ // ignore malformed entry lines
86
+ }
87
+ }
88
+ return { header, entries, leafId };
89
+ }
90
+ export class JsonlSessionStorage {
91
+ filePath;
92
+ metadata;
93
+ entries;
94
+ byId;
95
+ labelsById;
96
+ currentLeafId;
97
+ constructor(filePath, header, entries, leafId) {
98
+ this.filePath = resolve(filePath);
99
+ this.metadata = headerToSessionMetadata(header, this.filePath);
100
+ this.entries = entries;
101
+ this.byId = new Map(entries.map((entry) => [entry.id, entry]));
102
+ this.labelsById = buildLabelsById(entries);
103
+ this.currentLeafId = leafId;
104
+ }
105
+ static async open(filePath) {
106
+ const resolvedPath = resolve(filePath);
107
+ const loaded = await loadJsonlStorage(resolvedPath);
108
+ return new JsonlSessionStorage(resolvedPath, loaded.header, loaded.entries, loaded.leafId);
109
+ }
110
+ static async create(filePath, options) {
111
+ const resolvedPath = resolve(filePath);
112
+ const header = {
113
+ type: "session",
114
+ version: 3,
115
+ id: options.sessionId,
116
+ timestamp: new Date().toISOString(),
117
+ cwd: options.cwd,
118
+ parentSession: options.parentSessionPath,
119
+ };
120
+ await mkdir(dirname(resolvedPath), { recursive: true });
121
+ await writeFile(resolvedPath, `${JSON.stringify(header)}\n`);
122
+ return new JsonlSessionStorage(resolvedPath, header, [], null);
123
+ }
124
+ async getMetadata() {
125
+ return this.metadata;
126
+ }
127
+ async getLeafId() {
128
+ return this.currentLeafId;
129
+ }
130
+ async setLeafId(leafId) {
131
+ if (leafId !== null && !this.byId.has(leafId)) {
132
+ throw new Error(`Entry ${leafId} not found`);
133
+ }
134
+ this.currentLeafId = leafId;
135
+ }
136
+ async createEntryId() {
137
+ return generateEntryId(this.byId);
138
+ }
139
+ async appendEntry(entry) {
140
+ await appendFile(this.filePath, `${JSON.stringify(entry)}\n`);
141
+ this.entries.push(entry);
142
+ this.byId.set(entry.id, entry);
143
+ updateLabelCache(this.labelsById, entry);
144
+ this.currentLeafId = entry.id;
145
+ }
146
+ async getEntry(id) {
147
+ return this.byId.get(id);
148
+ }
149
+ async findEntries(type) {
150
+ return this.entries.filter((entry) => entry.type === type);
151
+ }
152
+ async getLabel(id) {
153
+ return this.labelsById.get(id);
154
+ }
155
+ async getPathToRoot(leafId) {
156
+ if (leafId === null)
157
+ return [];
158
+ const path = [];
159
+ let current = this.byId.get(leafId);
160
+ while (current) {
161
+ path.unshift(current);
162
+ current = current.parentId ? this.byId.get(current.parentId) : undefined;
163
+ }
164
+ return path;
165
+ }
166
+ async getEntries() {
167
+ return [...this.entries];
168
+ }
169
+ }
170
+ //# sourceMappingURL=jsonl.js.map
@@ -0,0 +1,90 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { v7 as uuidv7 } from "uuid";
3
+ function updateLabelCache(labelsById, entry) {
4
+ if (entry.type !== "label")
5
+ return;
6
+ const label = entry.label?.trim();
7
+ if (label) {
8
+ labelsById.set(entry.targetId, label);
9
+ }
10
+ else {
11
+ labelsById.delete(entry.targetId);
12
+ }
13
+ }
14
+ function buildLabelsById(entries) {
15
+ const labelsById = new Map();
16
+ for (const entry of entries) {
17
+ updateLabelCache(labelsById, entry);
18
+ }
19
+ return labelsById;
20
+ }
21
+ function generateEntryId(byId) {
22
+ for (let i = 0; i < 100; i++) {
23
+ const id = randomUUID().slice(0, 8);
24
+ if (!byId.has(id))
25
+ return id;
26
+ }
27
+ return randomUUID();
28
+ }
29
+ export class InMemorySessionStorage {
30
+ metadata;
31
+ entries;
32
+ byId;
33
+ labelsById;
34
+ leafId;
35
+ constructor(options) {
36
+ this.entries = options?.entries ? [...options.entries] : [];
37
+ this.byId = new Map(this.entries.map((entry) => [entry.id, entry]));
38
+ this.labelsById = buildLabelsById(this.entries);
39
+ this.leafId = options?.leafId ?? this.entries[this.entries.length - 1]?.id ?? null;
40
+ if (this.leafId !== null && !this.byId.has(this.leafId)) {
41
+ throw new Error(`Entry ${this.leafId} not found`);
42
+ }
43
+ this.metadata = options?.metadata ?? { id: uuidv7(), createdAt: new Date().toISOString() };
44
+ }
45
+ async getMetadata() {
46
+ return this.metadata;
47
+ }
48
+ async getLeafId() {
49
+ return this.leafId;
50
+ }
51
+ async setLeafId(leafId) {
52
+ if (leafId !== null && !this.byId.has(leafId)) {
53
+ throw new Error(`Entry ${leafId} not found`);
54
+ }
55
+ this.leafId = leafId;
56
+ }
57
+ async createEntryId() {
58
+ return generateEntryId(this.byId);
59
+ }
60
+ async appendEntry(entry) {
61
+ this.entries.push(entry);
62
+ this.byId.set(entry.id, entry);
63
+ updateLabelCache(this.labelsById, entry);
64
+ this.leafId = entry.id;
65
+ }
66
+ async getEntry(id) {
67
+ return this.byId.get(id);
68
+ }
69
+ async findEntries(type) {
70
+ return this.entries.filter((entry) => entry.type === type);
71
+ }
72
+ async getLabel(id) {
73
+ return this.labelsById.get(id);
74
+ }
75
+ async getPathToRoot(leafId) {
76
+ if (leafId === null)
77
+ return [];
78
+ const path = [];
79
+ let current = this.byId.get(leafId);
80
+ while (current) {
81
+ path.unshift(current);
82
+ current = current.parentId ? this.byId.get(current.parentId) : undefined;
83
+ }
84
+ return path;
85
+ }
86
+ async getEntries() {
87
+ return [...this.entries];
88
+ }
89
+ }
90
+ //# sourceMappingURL=memory.js.map