@caupulican/pi-adaptative 0.81.42 → 0.84.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 (1414) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/bun/cli.d.ts.map +1 -1
  3. package/dist/bun/cli.js.map +1 -1
  4. package/dist/bun/register-bedrock.d.ts.map +1 -1
  5. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  6. package/dist/bun/restore-sandbox-env.js.map +1 -1
  7. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
  8. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
  9. package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
  10. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +52 -49
  11. package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
  12. package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +62 -57
  13. package/dist/bundled-resources/prompts/skillify.md +1 -1
  14. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/fs.py +16 -19
  15. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/search.py +12 -26
  16. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/strings.py +15 -121
  17. package/dist/bundled-resources/runtimes/pi-shell-engine/commands/text.py +52 -79
  18. package/dist/bundled-resources/runtimes/pi-shell-engine/escapes.py +70 -0
  19. package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +110 -61
  20. package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +106 -23
  21. package/dist/bundled-resources/runtimes/pi-shell-engine/paths.py +10 -0
  22. package/dist/bundled-resources/runtimes/pi-shell-engine/proc.py +12 -4
  23. package/dist/bundled-resources/runtimes/pi-shell-engine/shell_args.py +22 -0
  24. package/dist/bundled-resources/runtimes/pi-shell-engine/state.py +9 -2
  25. package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +129 -259
  26. package/dist/bundled-resources/skills/authorized-web-security-audit/SKILL.md +187 -0
  27. package/dist/bundled-resources/skills/authorized-web-security-audit/references/assessment-contract.md +92 -0
  28. package/dist/bundled-resources/skills/deduplicate-by-evidence/SKILL.md +134 -0
  29. package/dist/bundled-resources/skills/evidence-gated-tdd/SKILL.md +93 -0
  30. package/dist/bundled-resources/skills/evidence-gated-tdd/references/evidence-model.md +27 -0
  31. package/dist/bundled-resources/skills/evidence-gated-tdd/references/security-scanners.md +24 -0
  32. package/dist/bundled-resources/skills/harness-self-adaptation/SKILL.md +4 -2
  33. package/dist/bundled-resources/skills/secure-agent-tool-surfaces/SKILL.md +217 -0
  34. package/dist/bundled-resources/skills/secure-agent-tool-surfaces/references/defensive-exploit-catalogue.md +175 -0
  35. package/dist/bundled-resources/skills/secure-agent-tool-surfaces/references/tool-boundary-checklist.md +87 -0
  36. package/dist/bundled-resources/skills/skill-architect/SKILL.md +2 -2
  37. package/dist/bundled-resources/skills/skill-creator/SKILL.md +188 -0
  38. package/dist/bundled-resources/skills/skill-creator/references/pi-skill-contract.md +73 -0
  39. package/dist/bundled-resources/skills/skill-creator/scripts/init-skill.mjs +142 -0
  40. package/dist/bundled-resources/skills/skill-creator/scripts/validate-skill.mjs +122 -0
  41. package/dist/cli/args.d.ts.map +1 -1
  42. package/dist/cli/args.js.map +1 -1
  43. package/dist/cli/config-selector.d.ts.map +1 -1
  44. package/dist/cli/config-selector.js.map +1 -1
  45. package/dist/cli/file-processor.d.ts.map +1 -1
  46. package/dist/cli/file-processor.js +8 -8
  47. package/dist/cli/file-processor.js.map +1 -1
  48. package/dist/cli/initial-message.d.ts +1 -1
  49. package/dist/cli/initial-message.d.ts.map +1 -1
  50. package/dist/cli/initial-message.js.map +1 -1
  51. package/dist/cli/list-models.d.ts.map +1 -1
  52. package/dist/cli/list-models.js.map +1 -1
  53. package/dist/cli/piped-stdin.d.ts +4 -0
  54. package/dist/cli/piped-stdin.d.ts.map +1 -0
  55. package/dist/cli/piped-stdin.js +13 -0
  56. package/dist/cli/piped-stdin.js.map +1 -0
  57. package/dist/cli/session-picker.d.ts.map +1 -1
  58. package/dist/cli/session-picker.js.map +1 -1
  59. package/dist/cli.d.ts.map +1 -1
  60. package/dist/cli.js.map +1 -1
  61. package/dist/config.d.ts +1 -1
  62. package/dist/config.d.ts.map +1 -1
  63. package/dist/config.js +10 -15
  64. package/dist/config.js.map +1 -1
  65. package/dist/core/agent-directory-layout.d.ts.map +1 -1
  66. package/dist/core/agent-directory-layout.js.map +1 -1
  67. package/dist/core/agent-paths.d.ts +1 -1
  68. package/dist/core/agent-paths.d.ts.map +1 -1
  69. package/dist/core/agent-paths.js +1 -1
  70. package/dist/core/agent-paths.js.map +1 -1
  71. package/dist/core/agent-session-contracts.d.ts +5 -9
  72. package/dist/core/agent-session-contracts.d.ts.map +1 -1
  73. package/dist/core/agent-session-contracts.js +1 -12
  74. package/dist/core/agent-session-contracts.js.map +1 -1
  75. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  76. package/dist/core/agent-session-runtime.js +10 -25
  77. package/dist/core/agent-session-runtime.js.map +1 -1
  78. package/dist/core/agent-session-services.d.ts.map +1 -1
  79. package/dist/core/agent-session-services.js.map +1 -1
  80. package/dist/core/agent-session.d.ts +24 -1
  81. package/dist/core/agent-session.d.ts.map +1 -1
  82. package/dist/core/agent-session.js +210 -237
  83. package/dist/core/agent-session.js.map +1 -1
  84. package/dist/core/auth-guidance.d.ts.map +1 -1
  85. package/dist/core/auth-guidance.js.map +1 -1
  86. package/dist/core/auth-storage.d.ts +4 -1
  87. package/dist/core/auth-storage.d.ts.map +1 -1
  88. package/dist/core/auth-storage.js +13 -39
  89. package/dist/core/auth-storage.js.map +1 -1
  90. package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
  91. package/dist/core/autonomy/approval-gate.js.map +1 -1
  92. package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
  93. package/dist/core/autonomy/bounded-completion.js.map +1 -1
  94. package/dist/core/autonomy/contracts.d.ts.map +1 -1
  95. package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
  96. package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
  97. package/dist/core/autonomy/evidence-finding-projection.d.ts +11 -0
  98. package/dist/core/autonomy/evidence-finding-projection.d.ts.map +1 -0
  99. package/dist/core/autonomy/evidence-finding-projection.js +37 -0
  100. package/dist/core/autonomy/evidence-finding-projection.js.map +1 -0
  101. package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -1
  102. package/dist/core/autonomy/foreground-envelope.js.map +1 -1
  103. package/dist/core/autonomy/gates.d.ts.map +1 -1
  104. package/dist/core/autonomy/gates.js.map +1 -1
  105. package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -1
  106. package/dist/core/autonomy/lane-private-paths.js.map +1 -1
  107. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  108. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  109. package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
  110. package/dist/core/autonomy/lane-tracker.js +2 -3
  111. package/dist/core/autonomy/lane-tracker.js.map +1 -1
  112. package/dist/core/autonomy/path-scope.d.ts.map +1 -1
  113. package/dist/core/autonomy/path-scope.js.map +1 -1
  114. package/dist/core/autonomy/risk-assessment.d.ts.map +1 -1
  115. package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
  116. package/dist/core/autonomy/session-lane-record.js.map +1 -1
  117. package/dist/core/autonomy/status.d.ts.map +1 -1
  118. package/dist/core/autonomy/status.js.map +1 -1
  119. package/dist/core/autonomy/subagent-prompt.d.ts.map +1 -1
  120. package/dist/core/autonomy/subagent-prompt.js.map +1 -1
  121. package/dist/core/autonomy/telemetry-events.d.ts.map +1 -1
  122. package/dist/core/autonomy/telemetry-events.js.map +1 -1
  123. package/dist/core/autonomy-telemetry.d.ts.map +1 -1
  124. package/dist/core/autonomy-telemetry.js +2 -4
  125. package/dist/core/autonomy-telemetry.js.map +1 -1
  126. package/dist/core/background-lane-controller.d.ts.map +1 -1
  127. package/dist/core/background-lane-controller.js +2 -15
  128. package/dist/core/background-lane-controller.js.map +1 -1
  129. package/dist/core/background-tool-task-controller.d.ts +88 -0
  130. package/dist/core/background-tool-task-controller.d.ts.map +1 -0
  131. package/dist/core/background-tool-task-controller.js +470 -0
  132. package/dist/core/background-tool-task-controller.js.map +1 -0
  133. package/dist/core/bash-execution-controller.d.ts +1 -0
  134. package/dist/core/bash-execution-controller.d.ts.map +1 -1
  135. package/dist/core/bash-execution-controller.js +5 -4
  136. package/dist/core/bash-execution-controller.js.map +1 -1
  137. package/dist/core/bash-executor.d.ts.map +1 -1
  138. package/dist/core/bash-executor.js.map +1 -1
  139. package/dist/core/bedrock-sso-login.d.ts.map +1 -1
  140. package/dist/core/bedrock-sso-login.js.map +1 -1
  141. package/dist/core/billing-failover-controller.d.ts.map +1 -1
  142. package/dist/core/billing-failover-controller.js +3 -3
  143. package/dist/core/billing-failover-controller.js.map +1 -1
  144. package/dist/core/billing-failover.d.ts.map +1 -1
  145. package/dist/core/billing-failover.js.map +1 -1
  146. package/dist/core/capability-contract.d.ts.map +1 -1
  147. package/dist/core/catalog-manager.d.ts.map +1 -1
  148. package/dist/core/catalog-manager.js +0 -0
  149. package/dist/core/catalog-manager.js.map +1 -1
  150. package/dist/core/compaction-controller.d.ts +2 -0
  151. package/dist/core/compaction-controller.d.ts.map +1 -1
  152. package/dist/core/compaction-controller.js +21 -8
  153. package/dist/core/compaction-controller.js.map +1 -1
  154. package/dist/core/compaction-support.d.ts +8 -0
  155. package/dist/core/compaction-support.d.ts.map +1 -1
  156. package/dist/core/compaction-support.js +0 -2
  157. package/dist/core/compaction-support.js.map +1 -1
  158. package/dist/core/context/artifact-retrieval.d.ts.map +1 -1
  159. package/dist/core/context/artifact-retrieval.js.map +1 -1
  160. package/dist/core/context/brain-curator.d.ts.map +1 -1
  161. package/dist/core/context/brain-curator.js +14 -33
  162. package/dist/core/context/brain-curator.js.map +1 -1
  163. package/dist/core/context/context-artifacts.d.ts.map +1 -1
  164. package/dist/core/context/context-artifacts.js +16 -24
  165. package/dist/core/context/context-artifacts.js.map +1 -1
  166. package/dist/core/context/context-audit.d.ts.map +1 -1
  167. package/dist/core/context/context-audit.js +3 -17
  168. package/dist/core/context/context-audit.js.map +1 -1
  169. package/dist/core/context/context-composition.d.ts.map +1 -1
  170. package/dist/core/context/context-composition.js.map +1 -1
  171. package/dist/core/context/context-item.d.ts.map +1 -1
  172. package/dist/core/context/context-item.js.map +1 -1
  173. package/dist/core/context/context-prompt-enforcement.d.ts.map +1 -1
  174. package/dist/core/context/context-prompt-enforcement.js +3 -16
  175. package/dist/core/context/context-prompt-enforcement.js.map +1 -1
  176. package/dist/core/context/context-prompt-policy.d.ts.map +1 -1
  177. package/dist/core/context/context-prompt-policy.js.map +1 -1
  178. package/dist/core/context/context-retention.d.ts.map +1 -1
  179. package/dist/core/context/context-retention.js.map +1 -1
  180. package/dist/core/context/context-store-retention.d.ts.map +1 -1
  181. package/dist/core/context/context-store-retention.js.map +1 -1
  182. package/dist/core/context/context-store.d.ts.map +1 -1
  183. package/dist/core/context/context-store.js.map +1 -1
  184. package/dist/core/context/context-tool-result.d.ts +4 -0
  185. package/dist/core/context/context-tool-result.d.ts.map +1 -0
  186. package/dist/core/context/context-tool-result.js +15 -0
  187. package/dist/core/context/context-tool-result.js.map +1 -0
  188. package/dist/core/context/current-work-memory.d.ts.map +1 -1
  189. package/dist/core/context/current-work-memory.js.map +1 -1
  190. package/dist/core/context/file-store-memory-provider.d.ts.map +1 -1
  191. package/dist/core/context/file-store-memory-provider.js +7 -28
  192. package/dist/core/context/file-store-memory-provider.js.map +1 -1
  193. package/dist/core/context/local-memory-search.d.ts +11 -0
  194. package/dist/core/context/local-memory-search.d.ts.map +1 -0
  195. package/dist/core/context/local-memory-search.js +37 -0
  196. package/dist/core/context/local-memory-search.js.map +1 -0
  197. package/dist/core/context/long-term-memory-trigger.d.ts.map +1 -1
  198. package/dist/core/context/long-term-memory-trigger.js.map +1 -1
  199. package/dist/core/context/memory-diagnostics.d.ts.map +1 -1
  200. package/dist/core/context/memory-diagnostics.js.map +1 -1
  201. package/dist/core/context/memory-index-store.d.ts.map +1 -1
  202. package/dist/core/context/memory-index-store.js.map +1 -1
  203. package/dist/core/context/memory-prompt-block.d.ts.map +1 -1
  204. package/dist/core/context/memory-prompt-block.js.map +1 -1
  205. package/dist/core/context/memory-prompt-budget.d.ts.map +1 -1
  206. package/dist/core/context/memory-prompt-budget.js.map +1 -1
  207. package/dist/core/context/memory-provider-contract.d.ts.map +1 -1
  208. package/dist/core/context/memory-provider-contract.js.map +1 -1
  209. package/dist/core/context/memory-retrieval.d.ts.map +1 -1
  210. package/dist/core/context/memory-retrieval.js.map +1 -1
  211. package/dist/core/context/memory-tier-composer.d.ts.map +1 -1
  212. package/dist/core/context/memory-tier-composer.js.map +1 -1
  213. package/dist/core/context/message-text.d.ts +7 -0
  214. package/dist/core/context/message-text.d.ts.map +1 -0
  215. package/dist/core/context/message-text.js +68 -0
  216. package/dist/core/context/message-text.js.map +1 -0
  217. package/dist/core/context/okf-memory-provider.d.ts.map +1 -1
  218. package/dist/core/context/okf-memory-provider.js +4 -30
  219. package/dist/core/context/okf-memory-provider.js.map +1 -1
  220. package/dist/core/context/okf-memory.d.ts.map +1 -1
  221. package/dist/core/context/okf-memory.js.map +1 -1
  222. package/dist/core/context/policy-engine.d.ts.map +1 -1
  223. package/dist/core/context/policy-engine.js.map +1 -1
  224. package/dist/core/context/policy-types.d.ts.map +1 -1
  225. package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
  226. package/dist/core/context/sqlite-runtime-index.js.map +1 -1
  227. package/dist/core/context/storage-authority.d.ts.map +1 -1
  228. package/dist/core/context/tool-output-packer.d.ts.map +1 -1
  229. package/dist/core/context/tool-output-packer.js.map +1 -1
  230. package/dist/core/context-gc.d.ts.map +1 -1
  231. package/dist/core/context-gc.js +14 -21
  232. package/dist/core/context-gc.js.map +1 -1
  233. package/dist/core/context-pipeline.d.ts +1 -3
  234. package/dist/core/context-pipeline.d.ts.map +1 -1
  235. package/dist/core/context-pipeline.js +64 -145
  236. package/dist/core/context-pipeline.js.map +1 -1
  237. package/dist/core/cost/cost-summary.d.ts.map +1 -1
  238. package/dist/core/cost/cost-summary.js.map +1 -1
  239. package/dist/core/cost/daily-usage.d.ts.map +1 -1
  240. package/dist/core/cost/daily-usage.js.map +1 -1
  241. package/dist/core/cost/session-usage.d.ts.map +1 -1
  242. package/dist/core/cost/session-usage.js.map +1 -1
  243. package/dist/core/cost-guard.d.ts.map +1 -1
  244. package/dist/core/cost-guard.js.map +1 -1
  245. package/dist/core/default-tool-surface.d.ts.map +1 -1
  246. package/dist/core/default-tool-surface.js +1 -0
  247. package/dist/core/default-tool-surface.js.map +1 -1
  248. package/dist/core/defaults.d.ts.map +1 -1
  249. package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -1
  250. package/dist/core/delegation/managed-lane-controller.js +2 -6
  251. package/dist/core/delegation/managed-lane-controller.js.map +1 -1
  252. package/dist/core/delegation/session-worker-claim.d.ts.map +1 -1
  253. package/dist/core/delegation/session-worker-claim.js.map +1 -1
  254. package/dist/core/delegation/worker-action-journal.d.ts.map +1 -1
  255. package/dist/core/delegation/worker-action-journal.js +0 -4
  256. package/dist/core/delegation/worker-action-journal.js.map +1 -1
  257. package/dist/core/delegation/worker-actions.d.ts.map +1 -1
  258. package/dist/core/delegation/worker-actions.js.map +1 -1
  259. package/dist/core/delegation/worker-agent-control-coordinator.d.ts +1 -0
  260. package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
  261. package/dist/core/delegation/worker-agent-control-coordinator.js +13 -15
  262. package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
  263. package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
  264. package/dist/core/delegation/worker-agent-control.js +1 -4
  265. package/dist/core/delegation/worker-agent-control.js.map +1 -1
  266. package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
  267. package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
  268. package/dist/core/delegation/worker-claim.d.ts.map +1 -1
  269. package/dist/core/delegation/worker-claim.js.map +1 -1
  270. package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -1
  271. package/dist/core/delegation/worker-conversation-store.js +0 -2
  272. package/dist/core/delegation/worker-conversation-store.js.map +1 -1
  273. package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
  274. package/dist/core/delegation/worker-delegation-controller.js +5 -14
  275. package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
  276. package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
  277. package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -1
  278. package/dist/core/delegation/worker-dispatch-scheduler.js +5 -6
  279. package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -1
  280. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  281. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  282. package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -1
  283. package/dist/core/delegation/worker-lane-projection.js.map +1 -1
  284. package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
  285. package/dist/core/delegation/worker-lifecycle.js +0 -3
  286. package/dist/core/delegation/worker-lifecycle.js.map +1 -1
  287. package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -1
  288. package/dist/core/delegation/worker-notification-coordinator.js +4 -5
  289. package/dist/core/delegation/worker-notification-coordinator.js.map +1 -1
  290. package/dist/core/delegation/worker-process-owner.d.ts.map +1 -1
  291. package/dist/core/delegation/worker-process-owner.js.map +1 -1
  292. package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -1
  293. package/dist/core/delegation/worker-profile-resolver.js +1 -2
  294. package/dist/core/delegation/worker-profile-resolver.js.map +1 -1
  295. package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
  296. package/dist/core/delegation/worker-recovery-coordinator.js +3 -4
  297. package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
  298. package/dist/core/delegation/worker-resource-catalog.d.ts.map +1 -1
  299. package/dist/core/delegation/worker-resource-catalog.js.map +1 -1
  300. package/dist/core/delegation/worker-resource-materializer.d.ts.map +1 -1
  301. package/dist/core/delegation/worker-resource-materializer.js +1 -4
  302. package/dist/core/delegation/worker-resource-materializer.js.map +1 -1
  303. package/dist/core/delegation/worker-runner.d.ts +2 -4
  304. package/dist/core/delegation/worker-runner.d.ts.map +1 -1
  305. package/dist/core/delegation/worker-runner.js +6 -18
  306. package/dist/core/delegation/worker-runner.js.map +1 -1
  307. package/dist/core/delegation/worker-task-label.d.ts.map +1 -1
  308. package/dist/core/delegation/worker-task-label.js.map +1 -1
  309. package/dist/core/delegation/worker-terminal-finalizer.d.ts.map +1 -1
  310. package/dist/core/delegation/worker-terminal-finalizer.js.map +1 -1
  311. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
  312. package/dist/core/delegation/worker-write-reservation-coordinator.js +1 -4
  313. package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
  314. package/dist/core/delegation/worker-write-reservation.d.ts.map +1 -1
  315. package/dist/core/delegation/worker-write-reservation.js +0 -2
  316. package/dist/core/delegation/worker-write-reservation.js.map +1 -1
  317. package/dist/core/diagnostics.d.ts.map +1 -1
  318. package/dist/core/doctor.d.ts +5 -5
  319. package/dist/core/doctor.d.ts.map +1 -1
  320. package/dist/core/doctor.js +16 -20
  321. package/dist/core/doctor.js.map +1 -1
  322. package/dist/core/event-bus.d.ts.map +1 -1
  323. package/dist/core/event-bus.js.map +1 -1
  324. package/dist/core/exec.d.ts.map +1 -1
  325. package/dist/core/exec.js +26 -7
  326. package/dist/core/exec.js.map +1 -1
  327. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  328. package/dist/core/export-html/ansi-to-html.js +21 -74
  329. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  330. package/dist/core/export-html/index.d.ts.map +1 -1
  331. package/dist/core/export-html/index.js +4 -0
  332. package/dist/core/export-html/index.js.map +1 -1
  333. package/dist/core/export-html/session-tree-foundations.d.mts +67 -0
  334. package/dist/core/export-html/session-tree-foundations.mjs +313 -0
  335. package/dist/core/export-html/template.css +14 -41
  336. package/dist/core/export-html/template.html +3 -1
  337. package/dist/core/export-html/template.js +26 -435
  338. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  339. package/dist/core/export-html/tool-renderer.js.map +1 -1
  340. package/dist/core/extension-import-authority.d.ts.map +1 -1
  341. package/dist/core/extension-import-authority.js.map +1 -1
  342. package/dist/core/extension-metadata.d.ts.map +1 -1
  343. package/dist/core/extension-metadata.js.map +1 -1
  344. package/dist/core/extensions/builtin.d.ts +17 -0
  345. package/dist/core/extensions/builtin.d.ts.map +1 -1
  346. package/dist/core/extensions/builtin.js +18 -54
  347. package/dist/core/extensions/builtin.js.map +1 -1
  348. package/dist/core/extensions/entry-resolution.d.ts +3 -0
  349. package/dist/core/extensions/entry-resolution.d.ts.map +1 -0
  350. package/dist/core/extensions/entry-resolution.js +17 -0
  351. package/dist/core/extensions/entry-resolution.js.map +1 -0
  352. package/dist/core/extensions/index.d.ts.map +1 -1
  353. package/dist/core/extensions/loader.d.ts.map +1 -1
  354. package/dist/core/extensions/loader.js +76 -21
  355. package/dist/core/extensions/loader.js.map +1 -1
  356. package/dist/core/extensions/runner.d.ts +2 -0
  357. package/dist/core/extensions/runner.d.ts.map +1 -1
  358. package/dist/core/extensions/runner.js +41 -112
  359. package/dist/core/extensions/runner.js.map +1 -1
  360. package/dist/core/extensions/stale-context.d.ts.map +1 -1
  361. package/dist/core/extensions/storage.d.ts.map +1 -1
  362. package/dist/core/extensions/storage.js.map +1 -1
  363. package/dist/core/extensions/types.d.ts.map +1 -1
  364. package/dist/core/extensions/types.js.map +1 -1
  365. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  366. package/dist/core/extensions/wrapper.js.map +1 -1
  367. package/dist/core/failure-corpus.d.ts.map +1 -1
  368. package/dist/core/failure-corpus.js +2 -5
  369. package/dist/core/failure-corpus.js.map +1 -1
  370. package/dist/core/footer-data-provider.d.ts.map +1 -1
  371. package/dist/core/footer-data-provider.js +27 -33
  372. package/dist/core/footer-data-provider.js.map +1 -1
  373. package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
  374. package/dist/core/foreground-recovery-controller.js +0 -4
  375. package/dist/core/foreground-recovery-controller.js.map +1 -1
  376. package/dist/core/gateways/channel-provider.d.ts.map +1 -1
  377. package/dist/core/gateways/channel-provider.js +7 -5
  378. package/dist/core/gateways/channel-provider.js.map +1 -1
  379. package/dist/core/goal-loop-controller.d.ts.map +1 -1
  380. package/dist/core/goal-loop-controller.js +0 -1
  381. package/dist/core/goal-loop-controller.js.map +1 -1
  382. package/dist/core/goals/compact-goal-context.d.ts.map +1 -1
  383. package/dist/core/goals/compact-goal-context.js +2 -4
  384. package/dist/core/goals/compact-goal-context.js.map +1 -1
  385. package/dist/core/goals/goal-acceptance.d.ts.map +1 -1
  386. package/dist/core/goals/goal-acceptance.js.map +1 -1
  387. package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
  388. package/dist/core/goals/goal-auto-continue-controller.js +1 -3
  389. package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
  390. package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
  391. package/dist/core/goals/goal-continuation-controller.js.map +1 -1
  392. package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
  393. package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
  394. package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
  395. package/dist/core/goals/goal-lifecycle.d.ts.map +1 -1
  396. package/dist/core/goals/goal-lifecycle.js.map +1 -1
  397. package/dist/core/goals/goal-record.d.ts.map +1 -1
  398. package/dist/core/goals/goal-record.js.map +1 -1
  399. package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
  400. package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
  401. package/dist/core/goals/goal-session-controller.d.ts +15 -0
  402. package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
  403. package/dist/core/goals/goal-session-controller.js +27 -3
  404. package/dist/core/goals/goal-session-controller.js.map +1 -1
  405. package/dist/core/goals/goal-state.d.ts.map +1 -1
  406. package/dist/core/goals/goal-state.js +35 -51
  407. package/dist/core/goals/goal-state.js.map +1 -1
  408. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  409. package/dist/core/goals/goal-tool-core.js.map +1 -1
  410. package/dist/core/goals/natural-language-goal.d.ts +9 -0
  411. package/dist/core/goals/natural-language-goal.d.ts.map +1 -0
  412. package/dist/core/goals/natural-language-goal.js +23 -0
  413. package/dist/core/goals/natural-language-goal.js.map +1 -0
  414. package/dist/core/goals/session-goal-state.d.ts.map +1 -1
  415. package/dist/core/goals/session-goal-state.js.map +1 -1
  416. package/dist/core/http-dispatcher.d.ts.map +1 -1
  417. package/dist/core/http-dispatcher.js.map +1 -1
  418. package/dist/core/human-input-controller.d.ts.map +1 -1
  419. package/dist/core/human-input-controller.js +2 -3
  420. package/dist/core/human-input-controller.js.map +1 -1
  421. package/dist/core/human-input.d.ts.map +1 -1
  422. package/dist/core/human-input.js.map +1 -1
  423. package/dist/core/improvement-loop.d.ts.map +1 -1
  424. package/dist/core/improvement-loop.js +11 -11
  425. package/dist/core/improvement-loop.js.map +1 -1
  426. package/dist/core/index.d.ts.map +1 -1
  427. package/dist/core/install-telemetry.d.ts.map +1 -1
  428. package/dist/core/install-telemetry.js.map +1 -1
  429. package/dist/core/isolated-text-completion.d.ts +17 -0
  430. package/dist/core/isolated-text-completion.d.ts.map +1 -0
  431. package/dist/core/isolated-text-completion.js +15 -0
  432. package/dist/core/isolated-text-completion.js.map +1 -0
  433. package/dist/core/keybindings.d.ts +47 -2
  434. package/dist/core/keybindings.d.ts.map +1 -1
  435. package/dist/core/keybindings.js +12 -1
  436. package/dist/core/keybindings.js.map +1 -1
  437. package/dist/core/learning/learning-audit.d.ts.map +1 -1
  438. package/dist/core/learning/learning-audit.js.map +1 -1
  439. package/dist/core/learning/learning-gate.d.ts.map +1 -1
  440. package/dist/core/learning/learning-gate.js.map +1 -1
  441. package/dist/core/learning/observation-store.d.ts.map +1 -1
  442. package/dist/core/learning/observation-store.js +0 -2
  443. package/dist/core/learning/observation-store.js.map +1 -1
  444. package/dist/core/learning/reflection-engine.d.ts +1 -1
  445. package/dist/core/learning/reflection-engine.d.ts.map +1 -1
  446. package/dist/core/learning/reflection-engine.js +3 -0
  447. package/dist/core/learning/reflection-engine.js.map +1 -1
  448. package/dist/core/learning/reflection-turn-analysis.d.ts +20 -0
  449. package/dist/core/learning/reflection-turn-analysis.d.ts.map +1 -0
  450. package/dist/core/learning/reflection-turn-analysis.js +136 -0
  451. package/dist/core/learning/reflection-turn-analysis.js.map +1 -0
  452. package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
  453. package/dist/core/learning/session-learning-decision.js.map +1 -1
  454. package/dist/core/learning/skill-curator.d.ts.map +1 -1
  455. package/dist/core/learning/skill-curator.js +0 -3
  456. package/dist/core/learning/skill-curator.js.map +1 -1
  457. package/dist/core/local-runtime-controller.d.ts +39 -0
  458. package/dist/core/local-runtime-controller.d.ts.map +1 -1
  459. package/dist/core/local-runtime-controller.js +41 -62
  460. package/dist/core/local-runtime-controller.js.map +1 -1
  461. package/dist/core/memory/effectiveness-tracker.d.ts.map +1 -1
  462. package/dist/core/memory/effectiveness-tracker.js +4 -2
  463. package/dist/core/memory/effectiveness-tracker.js.map +1 -1
  464. package/dist/core/memory/memory-manager.d.ts.map +1 -1
  465. package/dist/core/memory/memory-manager.js +7 -7
  466. package/dist/core/memory/memory-manager.js.map +1 -1
  467. package/dist/core/memory/memory-provider.d.ts.map +1 -1
  468. package/dist/core/memory/providers/file-store.d.ts +7 -0
  469. package/dist/core/memory/providers/file-store.d.ts.map +1 -1
  470. package/dist/core/memory/providers/file-store.js +48 -13
  471. package/dist/core/memory/providers/file-store.js.map +1 -1
  472. package/dist/core/memory/providers/transcript-recall-worker-protocol.d.ts +47 -0
  473. package/dist/core/memory/providers/transcript-recall-worker-protocol.d.ts.map +1 -0
  474. package/dist/core/memory/providers/transcript-recall-worker-protocol.js +50 -0
  475. package/dist/core/memory/providers/transcript-recall-worker-protocol.js.map +1 -0
  476. package/dist/core/memory/providers/transcript-recall-worker.d.ts +2 -0
  477. package/dist/core/memory/providers/transcript-recall-worker.d.ts.map +1 -0
  478. package/dist/core/memory/providers/transcript-recall-worker.js +143 -0
  479. package/dist/core/memory/providers/transcript-recall-worker.js.map +1 -0
  480. package/dist/core/memory/providers/transcript-recall.d.ts +24 -13
  481. package/dist/core/memory/providers/transcript-recall.d.ts.map +1 -1
  482. package/dist/core/memory/providers/transcript-recall.js +143 -141
  483. package/dist/core/memory/providers/transcript-recall.js.map +1 -1
  484. package/dist/core/memory/providers/user-memory-archive.d.ts +39 -0
  485. package/dist/core/memory/providers/user-memory-archive.d.ts.map +1 -0
  486. package/dist/core/memory/providers/user-memory-archive.js +258 -0
  487. package/dist/core/memory/providers/user-memory-archive.js.map +1 -0
  488. package/dist/core/memory/transcript-index.d.ts.map +1 -1
  489. package/dist/core/memory/transcript-index.js +1 -1
  490. package/dist/core/memory/transcript-index.js.map +1 -1
  491. package/dist/core/memory-controller.d.ts +9 -0
  492. package/dist/core/memory-controller.d.ts.map +1 -1
  493. package/dist/core/memory-controller.js +57 -16
  494. package/dist/core/memory-controller.js.map +1 -1
  495. package/dist/core/model-capability.d.ts.map +1 -1
  496. package/dist/core/model-capability.js.map +1 -1
  497. package/dist/core/model-output-json.d.ts +10 -0
  498. package/dist/core/model-output-json.d.ts.map +1 -0
  499. package/dist/core/model-output-json.js +43 -0
  500. package/dist/core/model-output-json.js.map +1 -0
  501. package/dist/core/model-registry.d.ts +8 -8
  502. package/dist/core/model-registry.d.ts.map +1 -1
  503. package/dist/core/model-registry.js +29 -52
  504. package/dist/core/model-registry.js.map +1 -1
  505. package/dist/core/model-resolver.d.ts.map +1 -1
  506. package/dist/core/model-resolver.js +1 -1
  507. package/dist/core/model-resolver.js.map +1 -1
  508. package/dist/core/model-router/config-diagnostics.d.ts.map +1 -1
  509. package/dist/core/model-router/config-diagnostics.js.map +1 -1
  510. package/dist/core/model-router/executor-route.d.ts.map +1 -1
  511. package/dist/core/model-router/executor-route.js.map +1 -1
  512. package/dist/core/model-router/fitness-gate.d.ts.map +1 -1
  513. package/dist/core/model-router/fitness-gate.js.map +1 -1
  514. package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
  515. package/dist/core/model-router/route-judge.d.ts.map +1 -1
  516. package/dist/core/model-router/route-judge.js +18 -36
  517. package/dist/core/model-router/route-judge.js.map +1 -1
  518. package/dist/core/model-router/session-buffer.d.ts.map +1 -1
  519. package/dist/core/model-router/session-buffer.js.map +1 -1
  520. package/dist/core/model-router/status.d.ts.map +1 -1
  521. package/dist/core/model-router/status.js.map +1 -1
  522. package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
  523. package/dist/core/model-router/tool-escalation.js.map +1 -1
  524. package/dist/core/model-router-controller.d.ts +1 -0
  525. package/dist/core/model-router-controller.d.ts.map +1 -1
  526. package/dist/core/model-router-controller.js +25 -56
  527. package/dist/core/model-router-controller.js.map +1 -1
  528. package/dist/core/model-selection-controller.d.ts +10 -0
  529. package/dist/core/model-selection-controller.d.ts.map +1 -1
  530. package/dist/core/model-selection-controller.js +0 -1
  531. package/dist/core/model-selection-controller.js.map +1 -1
  532. package/dist/core/model-tool-protocol.d.ts.map +1 -1
  533. package/dist/core/model-tool-protocol.js.map +1 -1
  534. package/dist/core/models/adaptation-store.d.ts.map +1 -1
  535. package/dist/core/models/adaptation-store.js +0 -1
  536. package/dist/core/models/adaptation-store.js.map +1 -1
  537. package/dist/core/models/context-sizing.d.ts.map +1 -1
  538. package/dist/core/models/context-sizing.js.map +1 -1
  539. package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
  540. package/dist/core/models/default-model-suggestions.js.map +1 -1
  541. package/dist/core/models/fitness-store.d.ts.map +1 -1
  542. package/dist/core/models/fitness-store.js +0 -1
  543. package/dist/core/models/fitness-store.js.map +1 -1
  544. package/dist/core/models/host-state-store.d.ts.map +1 -1
  545. package/dist/core/models/host-state-store.js +1 -6
  546. package/dist/core/models/host-state-store.js.map +1 -1
  547. package/dist/core/models/llamacpp-runtime.d.ts +4 -19
  548. package/dist/core/models/llamacpp-runtime.d.ts.map +1 -1
  549. package/dist/core/models/llamacpp-runtime.js +32 -136
  550. package/dist/core/models/llamacpp-runtime.js.map +1 -1
  551. package/dist/core/models/local-registration.d.ts.map +1 -1
  552. package/dist/core/models/local-registration.js +82 -115
  553. package/dist/core/models/local-registration.js.map +1 -1
  554. package/dist/core/models/local-runtime.d.ts +12 -18
  555. package/dist/core/models/local-runtime.d.ts.map +1 -1
  556. package/dist/core/models/local-runtime.js +60 -204
  557. package/dist/core/models/local-runtime.js.map +1 -1
  558. package/dist/core/models/model-endpoint.d.ts.map +1 -1
  559. package/dist/core/models/model-endpoint.js.map +1 -1
  560. package/dist/core/models/model-ref.d.ts.map +1 -1
  561. package/dist/core/models/model-ref.js.map +1 -1
  562. package/dist/core/models/needle-runtime.d.ts +7 -3
  563. package/dist/core/models/needle-runtime.d.ts.map +1 -1
  564. package/dist/core/models/needle-runtime.js +16 -92
  565. package/dist/core/models/needle-runtime.js.map +1 -1
  566. package/dist/core/models/perf-profile.d.ts +1 -1
  567. package/dist/core/models/perf-profile.d.ts.map +1 -1
  568. package/dist/core/models/perf-profile.js +6 -13
  569. package/dist/core/models/perf-profile.js.map +1 -1
  570. package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -1
  571. package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -1
  572. package/dist/core/models/runtime-arbiter.d.ts.map +1 -1
  573. package/dist/core/models/runtime-arbiter.js +3 -15
  574. package/dist/core/models/runtime-arbiter.js.map +1 -1
  575. package/dist/core/models/runtime-process.d.ts +100 -0
  576. package/dist/core/models/runtime-process.d.ts.map +1 -0
  577. package/dist/core/models/runtime-process.js +183 -0
  578. package/dist/core/models/runtime-process.js.map +1 -0
  579. package/dist/core/orchestration/agent-resume.d.ts.map +1 -1
  580. package/dist/core/orchestration/agent-resume.js.map +1 -1
  581. package/dist/core/orchestration/attempt-usage.d.ts.map +1 -1
  582. package/dist/core/orchestration/attempt-usage.js.map +1 -1
  583. package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
  584. package/dist/core/orchestration/capability-gateway.js +0 -14
  585. package/dist/core/orchestration/capability-gateway.js.map +1 -1
  586. package/dist/core/orchestration/contracts.d.ts.map +1 -1
  587. package/dist/core/orchestration/contracts.js.map +1 -1
  588. package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
  589. package/dist/core/orchestration/delegation-ledger.js +0 -2
  590. package/dist/core/orchestration/delegation-ledger.js.map +1 -1
  591. package/dist/core/orchestration/event-store.d.ts.map +1 -1
  592. package/dist/core/orchestration/event-store.js +1 -14
  593. package/dist/core/orchestration/event-store.js.map +1 -1
  594. package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
  595. package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
  596. package/dist/core/orchestration/model-binding.d.ts.map +1 -1
  597. package/dist/core/orchestration/model-binding.js.map +1 -1
  598. package/dist/core/orchestration/policy-compiler.d.ts.map +1 -1
  599. package/dist/core/orchestration/policy-compiler.js +0 -3
  600. package/dist/core/orchestration/policy-compiler.js.map +1 -1
  601. package/dist/core/orchestration/policy-gate.d.ts.map +1 -1
  602. package/dist/core/orchestration/policy-gate.js +0 -2
  603. package/dist/core/orchestration/policy-gate.js.map +1 -1
  604. package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
  605. package/dist/core/orchestration/profile-registry.js +1 -1
  606. package/dist/core/orchestration/profile-registry.js.map +1 -1
  607. package/dist/core/orchestration/profile-store.d.ts.map +1 -1
  608. package/dist/core/orchestration/profile-store.js +0 -3
  609. package/dist/core/orchestration/profile-store.js.map +1 -1
  610. package/dist/core/orchestration/risk-budget.d.ts.map +1 -1
  611. package/dist/core/orchestration/risk-budget.js.map +1 -1
  612. package/dist/core/orchestration/task-runtime.d.ts +1 -0
  613. package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
  614. package/dist/core/orchestration/task-runtime.js +27 -42
  615. package/dist/core/orchestration/task-runtime.js.map +1 -1
  616. package/dist/core/orchestration/work-state-projection.d.ts.map +1 -1
  617. package/dist/core/orchestration/work-state-projection.js.map +1 -1
  618. package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
  619. package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
  620. package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -1
  621. package/dist/core/orchestration/worker-result-adapter.js.map +1 -1
  622. package/dist/core/output-guard.d.ts.map +1 -1
  623. package/dist/core/output-guard.js.map +1 -1
  624. package/dist/core/package-manager.d.ts +3 -0
  625. package/dist/core/package-manager.d.ts.map +1 -1
  626. package/dist/core/package-manager.js +88 -353
  627. package/dist/core/package-manager.js.map +1 -1
  628. package/dist/core/process-identity.d.ts.map +1 -1
  629. package/dist/core/process-identity.js.map +1 -1
  630. package/dist/core/process-liveness.d.ts +3 -0
  631. package/dist/core/process-liveness.d.ts.map +1 -0
  632. package/dist/core/process-liveness.js +17 -0
  633. package/dist/core/process-liveness.js.map +1 -0
  634. package/dist/core/process-matrix/codes.d.ts.map +1 -1
  635. package/dist/core/process-matrix/resume-launcher.d.ts.map +1 -1
  636. package/dist/core/process-matrix/resume-launcher.js.map +1 -1
  637. package/dist/core/process-matrix/runtime.d.ts.map +1 -1
  638. package/dist/core/process-matrix/runtime.js.map +1 -1
  639. package/dist/core/process-matrix/store.d.ts.map +1 -1
  640. package/dist/core/process-matrix/store.js.map +1 -1
  641. package/dist/core/process-matrix/supervisor.d.ts.map +1 -1
  642. package/dist/core/process-matrix/supervisor.js.map +1 -1
  643. package/dist/core/profile-filter-controller.d.ts.map +1 -1
  644. package/dist/core/profile-filter-controller.js +7 -8
  645. package/dist/core/profile-filter-controller.js.map +1 -1
  646. package/dist/core/profile-registry.d.ts.map +1 -1
  647. package/dist/core/profile-registry.js +1 -2
  648. package/dist/core/profile-registry.js.map +1 -1
  649. package/dist/core/profile-resource-selection.d.ts.map +1 -1
  650. package/dist/core/profile-resource-selection.js +18 -59
  651. package/dist/core/profile-resource-selection.js.map +1 -1
  652. package/dist/core/prompt-markup.d.ts +3 -0
  653. package/dist/core/prompt-markup.d.ts.map +1 -0
  654. package/dist/core/prompt-markup.js +7 -0
  655. package/dist/core/prompt-markup.js.map +1 -0
  656. package/dist/core/prompt-templates.d.ts.map +1 -1
  657. package/dist/core/prompt-templates.js +13 -39
  658. package/dist/core/prompt-templates.js.map +1 -1
  659. package/dist/core/provider-display-names.d.ts.map +1 -1
  660. package/dist/core/python-runtime.d.ts.map +1 -1
  661. package/dist/core/python-runtime.js.map +1 -1
  662. package/dist/core/reflection-controller.d.ts +22 -1
  663. package/dist/core/reflection-controller.d.ts.map +1 -1
  664. package/dist/core/reflection-controller.js +143 -25
  665. package/dist/core/reflection-controller.js.map +1 -1
  666. package/dist/core/reload-blockers.d.ts +2 -1
  667. package/dist/core/reload-blockers.d.ts.map +1 -1
  668. package/dist/core/reload-blockers.js +4 -14
  669. package/dist/core/reload-blockers.js.map +1 -1
  670. package/dist/core/request-auth.d.ts.map +1 -1
  671. package/dist/core/request-auth.js.map +1 -1
  672. package/dist/core/research/automata-provider.d.ts.map +1 -1
  673. package/dist/core/research/automata-provider.js.map +1 -1
  674. package/dist/core/research/evidence-bundle.d.ts.map +1 -1
  675. package/dist/core/research/evidence-bundle.js.map +1 -1
  676. package/dist/core/research/lane-model-resolver.d.ts.map +1 -1
  677. package/dist/core/research/lane-model-resolver.js +0 -1
  678. package/dist/core/research/lane-model-resolver.js.map +1 -1
  679. package/dist/core/research/model-fitness-controller.d.ts.map +1 -1
  680. package/dist/core/research/model-fitness-controller.js +17 -33
  681. package/dist/core/research/model-fitness-controller.js.map +1 -1
  682. package/dist/core/research/model-fitness.d.ts.map +1 -1
  683. package/dist/core/research/model-fitness.js +4 -25
  684. package/dist/core/research/model-fitness.js.map +1 -1
  685. package/dist/core/research/research-gate.d.ts.map +1 -1
  686. package/dist/core/research/research-gate.js.map +1 -1
  687. package/dist/core/research/research-lane-controller.d.ts.map +1 -1
  688. package/dist/core/research/research-lane-controller.js +5 -10
  689. package/dist/core/research/research-lane-controller.js.map +1 -1
  690. package/dist/core/research/research-runner.d.ts +2 -4
  691. package/dist/core/research/research-runner.d.ts.map +1 -1
  692. package/dist/core/research/research-runner.js +17 -48
  693. package/dist/core/research/research-runner.js.map +1 -1
  694. package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
  695. package/dist/core/research/session-evidence-bundle.js.map +1 -1
  696. package/dist/core/research/workspace-collector.d.ts.map +1 -1
  697. package/dist/core/research/workspace-collector.js.map +1 -1
  698. package/dist/core/resolve-config-value.d.ts.map +1 -1
  699. package/dist/core/resolve-config-value.js.map +1 -1
  700. package/dist/core/resource-ignore.d.ts +6 -0
  701. package/dist/core/resource-ignore.d.ts.map +1 -0
  702. package/dist/core/resource-ignore.js +44 -0
  703. package/dist/core/resource-ignore.js.map +1 -0
  704. package/dist/core/resource-loader.d.ts +0 -1
  705. package/dist/core/resource-loader.d.ts.map +1 -1
  706. package/dist/core/resource-loader.js +52 -187
  707. package/dist/core/resource-loader.js.map +1 -1
  708. package/dist/core/resource-profile-blocks.d.ts +3 -1
  709. package/dist/core/resource-profile-blocks.d.ts.map +1 -1
  710. package/dist/core/resource-profile-blocks.js +8 -5
  711. package/dist/core/resource-profile-blocks.js.map +1 -1
  712. package/dist/core/resource-profile-equality.d.ts.map +1 -1
  713. package/dist/core/resource-profile-equality.js.map +1 -1
  714. package/dist/core/resource-traversal.d.ts +43 -0
  715. package/dist/core/resource-traversal.d.ts.map +1 -0
  716. package/dist/core/resource-traversal.js +84 -0
  717. package/dist/core/resource-traversal.js.map +1 -0
  718. package/dist/core/risk-classifier.d.ts.map +1 -1
  719. package/dist/core/risk-classifier.js.map +1 -1
  720. package/dist/core/runtime-builder.d.ts +4 -1
  721. package/dist/core/runtime-builder.d.ts.map +1 -1
  722. package/dist/core/runtime-builder.js +25 -50
  723. package/dist/core/runtime-builder.js.map +1 -1
  724. package/dist/core/scout-controller.d.ts.map +1 -1
  725. package/dist/core/scout-controller.js +0 -1
  726. package/dist/core/scout-controller.js.map +1 -1
  727. package/dist/core/sdk.d.ts.map +1 -1
  728. package/dist/core/sdk.js.map +1 -1
  729. package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
  730. package/dist/core/secrets/credential-exposure-guard.js +101 -43
  731. package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
  732. package/dist/core/secrets/secret-dotenv.d.ts.map +1 -1
  733. package/dist/core/secrets/secret-dotenv.js +0 -1
  734. package/dist/core/secrets/secret-dotenv.js.map +1 -1
  735. package/dist/core/secrets/secret-vault-format.d.ts.map +1 -1
  736. package/dist/core/secrets/secret-vault-format.js +0 -1
  737. package/dist/core/secrets/secret-vault-format.js.map +1 -1
  738. package/dist/core/secrets/secret-vault.d.ts.map +1 -1
  739. package/dist/core/secrets/secret-vault.js +2 -10
  740. package/dist/core/secrets/secret-vault.js.map +1 -1
  741. package/dist/core/security/secret-text.d.ts.map +1 -1
  742. package/dist/core/security/secret-text.js.map +1 -1
  743. package/dist/core/security/untrusted-boundary.d.ts.map +1 -1
  744. package/dist/core/security/untrusted-boundary.js.map +1 -1
  745. package/dist/core/session-analytics.d.ts.map +1 -1
  746. package/dist/core/session-analytics.js +18 -50
  747. package/dist/core/session-analytics.js.map +1 -1
  748. package/dist/core/session-artifact-bundle.d.ts.map +1 -1
  749. package/dist/core/session-artifact-bundle.js.map +1 -1
  750. package/dist/core/session-cwd.d.ts.map +1 -1
  751. package/dist/core/session-cwd.js +0 -1
  752. package/dist/core/session-cwd.js.map +1 -1
  753. package/dist/core/session-entry-index.d.ts +8 -0
  754. package/dist/core/session-entry-index.d.ts.map +1 -0
  755. package/dist/core/session-entry-index.js +16 -0
  756. package/dist/core/session-entry-index.js.map +1 -0
  757. package/dist/core/session-image-store.d.ts.map +1 -1
  758. package/dist/core/session-image-store.js +0 -3
  759. package/dist/core/session-image-store.js.map +1 -1
  760. package/dist/core/session-jsonl-writer.d.ts +3 -0
  761. package/dist/core/session-jsonl-writer.d.ts.map +1 -0
  762. package/dist/core/session-jsonl-writer.js +38 -0
  763. package/dist/core/session-jsonl-writer.js.map +1 -0
  764. package/dist/core/session-manager-factory.d.ts.map +1 -1
  765. package/dist/core/session-manager-factory.js.map +1 -1
  766. package/dist/core/session-role.d.ts.map +1 -1
  767. package/dist/core/session-role.js.map +1 -1
  768. package/dist/core/session-snapshot.d.ts.map +1 -1
  769. package/dist/core/session-snapshot.js.map +1 -1
  770. package/dist/core/session-supervision-runtime.d.ts.map +1 -1
  771. package/dist/core/session-supervision-runtime.js +1 -4
  772. package/dist/core/session-supervision-runtime.js.map +1 -1
  773. package/dist/core/session-tree-navigator.d.ts.map +1 -1
  774. package/dist/core/session-tree-navigator.js +0 -1
  775. package/dist/core/session-tree-navigator.js.map +1 -1
  776. package/dist/core/settings-manager.d.ts +2 -1
  777. package/dist/core/settings-manager.d.ts.map +1 -1
  778. package/dist/core/settings-manager.js +64 -162
  779. package/dist/core/settings-manager.js.map +1 -1
  780. package/dist/core/skill-block.d.mts +8 -0
  781. package/dist/core/skill-block.mjs +52 -0
  782. package/dist/core/skill-discovery.d.ts +5 -0
  783. package/dist/core/skill-discovery.d.ts.map +1 -0
  784. package/dist/core/skill-discovery.js +34 -0
  785. package/dist/core/skill-discovery.js.map +1 -0
  786. package/dist/core/skills.d.ts.map +1 -1
  787. package/dist/core/skills.js +23 -159
  788. package/dist/core/skills.js.map +1 -1
  789. package/dist/core/slash-commands.d.ts.map +1 -1
  790. package/dist/core/source-info.d.ts.map +1 -1
  791. package/dist/core/source-info.js.map +1 -1
  792. package/dist/core/spawned-usage.d.ts +21 -0
  793. package/dist/core/spawned-usage.d.ts.map +1 -0
  794. package/dist/core/spawned-usage.js +29 -0
  795. package/dist/core/spawned-usage.js.map +1 -0
  796. package/dist/core/system-prompt-builder.d.ts +4 -0
  797. package/dist/core/system-prompt-builder.d.ts.map +1 -1
  798. package/dist/core/system-prompt-builder.js +15 -8
  799. package/dist/core/system-prompt-builder.js.map +1 -1
  800. package/dist/core/system-prompt.d.ts.map +1 -1
  801. package/dist/core/system-prompt.js +53 -35
  802. package/dist/core/system-prompt.js.map +1 -1
  803. package/dist/core/tasks/session-task-state.d.ts.map +1 -1
  804. package/dist/core/tasks/session-task-state.js.map +1 -1
  805. package/dist/core/tasks/task-command.d.ts.map +1 -1
  806. package/dist/core/tasks/task-command.js.map +1 -1
  807. package/dist/core/tasks/task-contract-monitor.d.ts.map +1 -1
  808. package/dist/core/tasks/task-contract-monitor.js.map +1 -1
  809. package/dist/core/tasks/task-projection.d.ts.map +1 -1
  810. package/dist/core/tasks/task-projection.js.map +1 -1
  811. package/dist/core/tasks/task-state.d.ts.map +1 -1
  812. package/dist/core/tasks/task-state.js.map +1 -1
  813. package/dist/core/text-preview.d.ts +4 -0
  814. package/dist/core/text-preview.d.ts.map +1 -0
  815. package/dist/core/text-preview.js +33 -0
  816. package/dist/core/text-preview.js.map +1 -0
  817. package/dist/core/timings.d.ts.map +1 -1
  818. package/dist/core/timings.js.map +1 -1
  819. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  820. package/dist/core/tool-capability-policy.js.map +1 -1
  821. package/dist/core/tool-gate-controller.d.ts.map +1 -1
  822. package/dist/core/tool-gate-controller.js +86 -87
  823. package/dist/core/tool-gate-controller.js.map +1 -1
  824. package/dist/core/tool-protocol-controller.d.ts +4 -1
  825. package/dist/core/tool-protocol-controller.d.ts.map +1 -1
  826. package/dist/core/tool-protocol-controller.js +19 -23
  827. package/dist/core/tool-protocol-controller.js.map +1 -1
  828. package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
  829. package/dist/core/tool-recovery-log-records.js.map +1 -1
  830. package/dist/core/tool-recovery-log-worker.d.ts.map +1 -1
  831. package/dist/core/tool-recovery-log-worker.js.map +1 -1
  832. package/dist/core/tool-recovery-logger.d.ts.map +1 -1
  833. package/dist/core/tool-recovery-logger.js +12 -24
  834. package/dist/core/tool-recovery-logger.js.map +1 -1
  835. package/dist/core/tool-recovery-stats.d.ts.map +1 -1
  836. package/dist/core/tool-recovery-stats.js +16 -22
  837. package/dist/core/tool-recovery-stats.js.map +1 -1
  838. package/dist/core/tool-repair-health.d.ts.map +1 -1
  839. package/dist/core/tool-repair-health.js.map +1 -1
  840. package/dist/core/tool-repair-settings.d.ts.map +1 -1
  841. package/dist/core/tool-repair-settings.js.map +1 -1
  842. package/dist/core/tool-selection/expected-utility.d.ts.map +1 -1
  843. package/dist/core/tool-selection/expected-utility.js.map +1 -1
  844. package/dist/core/tool-selection/promotion.d.ts.map +1 -1
  845. package/dist/core/tool-selection/promotion.js.map +1 -1
  846. package/dist/core/tool-selection/tool-performance-store.d.ts +2 -0
  847. package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
  848. package/dist/core/tool-selection/tool-performance-store.js +49 -7
  849. package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
  850. package/dist/core/tool-selection/tool-phase-timing.d.ts +19 -0
  851. package/dist/core/tool-selection/tool-phase-timing.d.ts.map +1 -0
  852. package/dist/core/tool-selection/tool-phase-timing.js +63 -0
  853. package/dist/core/tool-selection/tool-phase-timing.js.map +1 -0
  854. package/dist/core/tool-selection/tool-selection-controller.d.ts +2 -5
  855. package/dist/core/tool-selection/tool-selection-controller.d.ts.map +1 -1
  856. package/dist/core/tool-selection/tool-selection-controller.js +50 -30
  857. package/dist/core/tool-selection/tool-selection-controller.js.map +1 -1
  858. package/dist/core/toolkit/reflex-interpreter.d.ts +16 -0
  859. package/dist/core/toolkit/reflex-interpreter.d.ts.map +1 -1
  860. package/dist/core/toolkit/reflex-interpreter.js +21 -0
  861. package/dist/core/toolkit/reflex-interpreter.js.map +1 -1
  862. package/dist/core/toolkit/script-registry.d.ts.map +1 -1
  863. package/dist/core/toolkit/script-registry.js.map +1 -1
  864. package/dist/core/toolkit/script-runner.d.ts.map +1 -1
  865. package/dist/core/toolkit/script-runner.js.map +1 -1
  866. package/dist/core/tools/artifact-retrieve.d.ts.map +1 -1
  867. package/dist/core/tools/artifact-retrieve.js.map +1 -1
  868. package/dist/core/tools/ask-question.d.ts +2 -3
  869. package/dist/core/tools/ask-question.d.ts.map +1 -1
  870. package/dist/core/tools/ask-question.js +14 -40
  871. package/dist/core/tools/ask-question.js.map +1 -1
  872. package/dist/core/tools/bash.d.ts +2 -0
  873. package/dist/core/tools/bash.d.ts.map +1 -1
  874. package/dist/core/tools/bash.js +83 -30
  875. package/dist/core/tools/bash.js.map +1 -1
  876. package/dist/core/tools/context-scout.d.ts.map +1 -1
  877. package/dist/core/tools/context-scout.js.map +1 -1
  878. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  879. package/dist/core/tools/delegate-status.js +9 -7
  880. package/dist/core/tools/delegate-status.js.map +1 -1
  881. package/dist/core/tools/delegate.d.ts.map +1 -1
  882. package/dist/core/tools/delegate.js +6 -6
  883. package/dist/core/tools/delegate.js.map +1 -1
  884. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  885. package/dist/core/tools/edit-diff.js.map +1 -1
  886. package/dist/core/tools/edit.d.ts.map +1 -1
  887. package/dist/core/tools/edit.js.map +1 -1
  888. package/dist/core/tools/extensionify.d.ts.map +1 -1
  889. package/dist/core/tools/extensionify.js.map +1 -1
  890. package/dist/core/tools/fff-search-backend.d.ts +19 -0
  891. package/dist/core/tools/fff-search-backend.d.ts.map +1 -1
  892. package/dist/core/tools/fff-search-backend.js +28 -2
  893. package/dist/core/tools/fff-search-backend.js.map +1 -1
  894. package/dist/core/tools/file-encoding-policy.d.ts.map +1 -1
  895. package/dist/core/tools/file-encoding-policy.js.map +1 -1
  896. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  897. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  898. package/dist/core/tools/find.d.ts +1 -1
  899. package/dist/core/tools/find.d.ts.map +1 -1
  900. package/dist/core/tools/find.js +44 -108
  901. package/dist/core/tools/find.js.map +1 -1
  902. package/dist/core/tools/git-filter.d.ts.map +1 -1
  903. package/dist/core/tools/git-filter.js.map +1 -1
  904. package/dist/core/tools/goal.d.ts.map +1 -1
  905. package/dist/core/tools/goal.js +7 -7
  906. package/dist/core/tools/goal.js.map +1 -1
  907. package/dist/core/tools/grep.d.ts +1 -1
  908. package/dist/core/tools/grep.d.ts.map +1 -1
  909. package/dist/core/tools/grep.js +42 -102
  910. package/dist/core/tools/grep.js.map +1 -1
  911. package/dist/core/tools/index.d.ts.map +1 -1
  912. package/dist/core/tools/index.js.map +1 -1
  913. package/dist/core/tools/ls.d.ts.map +1 -1
  914. package/dist/core/tools/ls.js +20 -36
  915. package/dist/core/tools/ls.js.map +1 -1
  916. package/dist/core/tools/model-fitness.d.ts.map +1 -1
  917. package/dist/core/tools/model-fitness.js.map +1 -1
  918. package/dist/core/tools/orchestration-panel.d.ts +5 -0
  919. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  920. package/dist/core/tools/orchestration-panel.js +5 -5
  921. package/dist/core/tools/orchestration-panel.js.map +1 -1
  922. package/dist/core/tools/output-accumulator.d.ts +2 -0
  923. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  924. package/dist/core/tools/output-accumulator.js +24 -36
  925. package/dist/core/tools/output-accumulator.js.map +1 -1
  926. package/dist/core/tools/path-utils.d.ts.map +1 -1
  927. package/dist/core/tools/path-utils.js.map +1 -1
  928. package/dist/core/tools/persistent-process-coordinator.d.ts +31 -0
  929. package/dist/core/tools/persistent-process-coordinator.d.ts.map +1 -0
  930. package/dist/core/tools/persistent-process-coordinator.js +123 -0
  931. package/dist/core/tools/persistent-process-coordinator.js.map +1 -0
  932. package/dist/core/tools/python.d.ts.map +1 -1
  933. package/dist/core/tools/python.js.map +1 -1
  934. package/dist/core/tools/read.d.ts.map +1 -1
  935. package/dist/core/tools/read.js +14 -13
  936. package/dist/core/tools/read.js.map +1 -1
  937. package/dist/core/tools/render-utils.d.ts +29 -0
  938. package/dist/core/tools/render-utils.d.ts.map +1 -1
  939. package/dist/core/tools/render-utils.js +31 -1
  940. package/dist/core/tools/render-utils.js.map +1 -1
  941. package/dist/core/tools/run-process.d.ts.map +1 -1
  942. package/dist/core/tools/run-process.js.map +1 -1
  943. package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
  944. package/dist/core/tools/run-toolkit-script.js.map +1 -1
  945. package/dist/core/tools/search-command-guard.d.ts +10 -0
  946. package/dist/core/tools/search-command-guard.d.ts.map +1 -1
  947. package/dist/core/tools/search-command-guard.js +118 -31
  948. package/dist/core/tools/search-command-guard.js.map +1 -1
  949. package/dist/core/tools/search-router.d.ts.map +1 -1
  950. package/dist/core/tools/search-router.js.map +1 -1
  951. package/dist/core/tools/search-tool-runtime.d.ts +19 -0
  952. package/dist/core/tools/search-tool-runtime.d.ts.map +1 -0
  953. package/dist/core/tools/search-tool-runtime.js +12 -0
  954. package/dist/core/tools/search-tool-runtime.js.map +1 -0
  955. package/dist/core/tools/secret-store.d.ts.map +1 -1
  956. package/dist/core/tools/secret-store.js.map +1 -1
  957. package/dist/core/tools/shell-command-parser.d.ts.map +1 -1
  958. package/dist/core/tools/shell-command-parser.js.map +1 -1
  959. package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
  960. package/dist/core/tools/shell-contract-router.js +4 -1
  961. package/dist/core/tools/shell-contract-router.js.map +1 -1
  962. package/dist/core/tools/shell-execution-session.d.ts +4 -0
  963. package/dist/core/tools/shell-execution-session.d.ts.map +1 -0
  964. package/dist/core/tools/shell-execution-session.js +11 -0
  965. package/dist/core/tools/shell-execution-session.js.map +1 -0
  966. package/dist/core/tools/shell-output-projection.d.ts +49 -0
  967. package/dist/core/tools/shell-output-projection.d.ts.map +1 -0
  968. package/dist/core/tools/shell-output-projection.js +381 -0
  969. package/dist/core/tools/shell-output-projection.js.map +1 -0
  970. package/dist/core/tools/shell-session.d.ts +2 -13
  971. package/dist/core/tools/shell-session.d.ts.map +1 -1
  972. package/dist/core/tools/shell-session.js +36 -136
  973. package/dist/core/tools/shell-session.js.map +1 -1
  974. package/dist/core/tools/skill-audit.d.ts.map +1 -1
  975. package/dist/core/tools/skill-audit.js.map +1 -1
  976. package/dist/core/tools/skillify.d.ts.map +1 -1
  977. package/dist/core/tools/skillify.js.map +1 -1
  978. package/dist/core/tools/task-steps.d.ts +8 -8
  979. package/dist/core/tools/task-steps.d.ts.map +1 -1
  980. package/dist/core/tools/task-steps.js +17 -18
  981. package/dist/core/tools/task-steps.js.map +1 -1
  982. package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
  983. package/dist/core/tools/tmux-dispatch.js.map +1 -1
  984. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  985. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  986. package/dist/core/tools/tool-task.d.ts +23 -0
  987. package/dist/core/tools/tool-task.d.ts.map +1 -0
  988. package/dist/core/tools/tool-task.js +93 -0
  989. package/dist/core/tools/tool-task.js.map +1 -0
  990. package/dist/core/tools/windows-shell-engine.d.ts +17 -11
  991. package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
  992. package/dist/core/tools/windows-shell-engine.js +339 -117
  993. package/dist/core/tools/windows-shell-engine.js.map +1 -1
  994. package/dist/core/tools/windows-shell-state.d.ts.map +1 -1
  995. package/dist/core/tools/windows-shell-state.js.map +1 -1
  996. package/dist/core/tools/worktree-sync.d.ts.map +1 -1
  997. package/dist/core/tools/worktree-sync.js +8 -12
  998. package/dist/core/tools/worktree-sync.js.map +1 -1
  999. package/dist/core/tools/write.d.ts.map +1 -1
  1000. package/dist/core/tools/write.js +0 -1
  1001. package/dist/core/tools/write.js.map +1 -1
  1002. package/dist/core/trust-manager.d.ts.map +1 -1
  1003. package/dist/core/trust-manager.js +7 -40
  1004. package/dist/core/trust-manager.js.map +1 -1
  1005. package/dist/core/util/atomic-file.d.ts +19 -0
  1006. package/dist/core/util/atomic-file.d.ts.map +1 -1
  1007. package/dist/core/util/atomic-file.js +50 -15
  1008. package/dist/core/util/atomic-file.js.map +1 -1
  1009. package/dist/core/util/bounded-file.d.ts.map +1 -1
  1010. package/dist/core/util/bounded-file.js.map +1 -1
  1011. package/dist/core/util/bounded-jsonl.d.ts.map +1 -1
  1012. package/dist/core/util/bounded-jsonl.js +2 -9
  1013. package/dist/core/util/bounded-jsonl.js.map +1 -1
  1014. package/dist/core/util/bounded-value.d.ts.map +1 -1
  1015. package/dist/core/util/bounded-value.js.map +1 -1
  1016. package/dist/core/util/json-size.d.ts +3 -0
  1017. package/dist/core/util/json-size.d.ts.map +1 -0
  1018. package/dist/core/util/json-size.js +95 -0
  1019. package/dist/core/util/json-size.js.map +1 -0
  1020. package/dist/core/util/minimatch-cache.d.ts.map +1 -1
  1021. package/dist/core/util/minimatch-cache.js.map +1 -1
  1022. package/dist/core/util/value-guards.d.ts.map +1 -1
  1023. package/dist/core/util/value-guards.js.map +1 -1
  1024. package/dist/core/worktree-sync/codes.d.ts.map +1 -1
  1025. package/dist/core/worktree-sync/git-engine.d.ts.map +1 -1
  1026. package/dist/core/worktree-sync/git-engine.js +20 -36
  1027. package/dist/core/worktree-sync/git-engine.js.map +1 -1
  1028. package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -1
  1029. package/dist/core/worktree-sync/lane-gate.js +1 -4
  1030. package/dist/core/worktree-sync/lane-gate.js.map +1 -1
  1031. package/dist/core/worktree-sync/runtime.d.ts.map +1 -1
  1032. package/dist/core/worktree-sync/runtime.js.map +1 -1
  1033. package/dist/core/worktree-sync/store.d.ts.map +1 -1
  1034. package/dist/core/worktree-sync/store.js.map +1 -1
  1035. package/dist/core/worktree-sync/watcher.d.ts.map +1 -1
  1036. package/dist/core/worktree-sync/watcher.js.map +1 -1
  1037. package/dist/index.d.ts.map +1 -1
  1038. package/dist/index.js.map +1 -1
  1039. package/dist/main.d.ts.map +1 -1
  1040. package/dist/main.js +10 -32
  1041. package/dist/main.js.map +1 -1
  1042. package/dist/migrations.d.ts.map +1 -1
  1043. package/dist/migrations.js +6 -19
  1044. package/dist/migrations.js.map +1 -1
  1045. package/dist/modes/index.d.ts.map +1 -1
  1046. package/dist/modes/interactive/auth-dialogs-controller.d.ts +3 -0
  1047. package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
  1048. package/dist/modes/interactive/auth-dialogs-controller.js +96 -132
  1049. package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
  1050. package/dist/modes/interactive/auto-learn-controller.d.ts +1 -31
  1051. package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
  1052. package/dist/modes/interactive/auto-learn-controller.js +86 -307
  1053. package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
  1054. package/dist/modes/interactive/autocomplete-provider.d.ts.map +1 -1
  1055. package/dist/modes/interactive/autocomplete-provider.js.map +1 -1
  1056. package/dist/modes/interactive/autonomy-commands.d.ts.map +1 -1
  1057. package/dist/modes/interactive/autonomy-commands.js +2 -8
  1058. package/dist/modes/interactive/autonomy-commands.js.map +1 -1
  1059. package/dist/modes/interactive/clipboard-input.d.ts +5 -1
  1060. package/dist/modes/interactive/clipboard-input.d.ts.map +1 -1
  1061. package/dist/modes/interactive/clipboard-input.js +17 -0
  1062. package/dist/modes/interactive/clipboard-input.js.map +1 -1
  1063. package/dist/modes/interactive/compaction-queue.d.ts.map +1 -1
  1064. package/dist/modes/interactive/compaction-queue.js +13 -18
  1065. package/dist/modes/interactive/compaction-queue.js.map +1 -1
  1066. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
  1067. package/dist/modes/interactive/components/activity-lane.js +6 -10
  1068. package/dist/modes/interactive/components/activity-lane.js.map +1 -1
  1069. package/dist/modes/interactive/components/armin.d.ts +1 -0
  1070. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  1071. package/dist/modes/interactive/components/armin.js +10 -21
  1072. package/dist/modes/interactive/components/armin.js.map +1 -1
  1073. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  1074. package/dist/modes/interactive/components/assistant-message.js +1 -6
  1075. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  1076. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  1077. package/dist/modes/interactive/components/bash-execution.js +4 -9
  1078. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  1079. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  1080. package/dist/modes/interactive/components/bordered-loader.js +0 -3
  1081. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  1082. package/dist/modes/interactive/components/branch-summary-message.d.ts +3 -8
  1083. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  1084. package/dist/modes/interactive/components/branch-summary-message.js +13 -35
  1085. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  1086. package/dist/modes/interactive/components/compaction-summary-message.d.ts +3 -8
  1087. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  1088. package/dist/modes/interactive/components/compaction-summary-message.js +14 -36
  1089. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  1090. package/dist/modes/interactive/components/config-selector.d.ts +1 -0
  1091. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  1092. package/dist/modes/interactive/components/config-selector.js +20 -43
  1093. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  1094. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  1095. package/dist/modes/interactive/components/countdown-timer.js +0 -5
  1096. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  1097. package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
  1098. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  1099. package/dist/modes/interactive/components/custom-editor.js +4 -8
  1100. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  1101. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  1102. package/dist/modes/interactive/components/custom-message.js +1 -6
  1103. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  1104. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  1105. package/dist/modes/interactive/components/daxnuts.js +6 -8
  1106. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  1107. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  1108. package/dist/modes/interactive/components/diff.js.map +1 -1
  1109. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  1110. package/dist/modes/interactive/components/dynamic-border.js +0 -1
  1111. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  1112. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  1113. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  1114. package/dist/modes/interactive/components/expandable-markdown-message.d.ts +21 -0
  1115. package/dist/modes/interactive/components/expandable-markdown-message.d.ts.map +1 -0
  1116. package/dist/modes/interactive/components/expandable-markdown-message.js +48 -0
  1117. package/dist/modes/interactive/components/expandable-markdown-message.js.map +1 -0
  1118. package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -1
  1119. package/dist/modes/interactive/components/expandable-text.js +0 -2
  1120. package/dist/modes/interactive/components/expandable-text.js.map +1 -1
  1121. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  1122. package/dist/modes/interactive/components/extension-editor.js +1 -9
  1123. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  1124. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  1125. package/dist/modes/interactive/components/extension-input.js +2 -8
  1126. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  1127. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  1128. package/dist/modes/interactive/components/extension-selector.js +5 -20
  1129. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  1130. package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
  1131. package/dist/modes/interactive/components/fitness-role-selector.js +0 -1
  1132. package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
  1133. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  1134. package/dist/modes/interactive/components/footer.js +1 -5
  1135. package/dist/modes/interactive/components/footer.js.map +1 -1
  1136. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  1137. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  1138. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  1139. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  1140. package/dist/modes/interactive/components/login-dialog.js +4 -10
  1141. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  1142. package/dist/modes/interactive/components/model-selector.d.ts +2 -2
  1143. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  1144. package/dist/modes/interactive/components/model-selector.js +21 -44
  1145. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  1146. package/dist/modes/interactive/components/model-suggestion-selector.d.ts.map +1 -1
  1147. package/dist/modes/interactive/components/model-suggestion-selector.js +0 -1
  1148. package/dist/modes/interactive/components/model-suggestion-selector.js.map +1 -1
  1149. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  1150. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  1151. package/dist/modes/interactive/components/oauth-selector.js +16 -32
  1152. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  1153. package/dist/modes/interactive/components/profile-resource-editor.d.ts +3 -4
  1154. package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
  1155. package/dist/modes/interactive/components/profile-resource-editor.js +34 -93
  1156. package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
  1157. package/dist/modes/interactive/components/profile-selector.d.ts.map +1 -1
  1158. package/dist/modes/interactive/components/profile-selector.js +0 -1
  1159. package/dist/modes/interactive/components/profile-selector.js.map +1 -1
  1160. package/dist/modes/interactive/components/scoped-models-selector.d.ts +3 -4
  1161. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  1162. package/dist/modes/interactive/components/scoped-models-selector.js +34 -79
  1163. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  1164. package/dist/modes/interactive/components/selector-list.d.ts +63 -0
  1165. package/dist/modes/interactive/components/selector-list.d.ts.map +1 -0
  1166. package/dist/modes/interactive/components/selector-list.js +186 -0
  1167. package/dist/modes/interactive/components/selector-list.js.map +1 -0
  1168. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  1169. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  1170. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  1171. package/dist/modes/interactive/components/session-selector.js +34 -59
  1172. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  1173. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  1174. package/dist/modes/interactive/components/settings-selector.js +40 -138
  1175. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  1176. package/dist/modes/interactive/components/show-images-selector.d.ts +2 -4
  1177. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  1178. package/dist/modes/interactive/components/show-images-selector.js +9 -28
  1179. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  1180. package/dist/modes/interactive/components/skill-invocation-message.d.ts +3 -8
  1181. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  1182. package/dist/modes/interactive/components/skill-invocation-message.js +12 -40
  1183. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  1184. package/dist/modes/interactive/components/theme-selector.d.ts +2 -5
  1185. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  1186. package/dist/modes/interactive/components/theme-selector.js +11 -37
  1187. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  1188. package/dist/modes/interactive/components/thinking-selector.d.ts +2 -4
  1189. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  1190. package/dist/modes/interactive/components/thinking-selector.js +9 -31
  1191. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  1192. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  1193. package/dist/modes/interactive/components/tool-execution.js +9 -28
  1194. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  1195. package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
  1196. package/dist/modes/interactive/components/tool-group.js +2 -3
  1197. package/dist/modes/interactive/components/tool-group.js.map +1 -1
  1198. package/dist/modes/interactive/components/tool-panel-registry.d.ts.map +1 -1
  1199. package/dist/modes/interactive/components/tool-panel-registry.js +5 -3
  1200. package/dist/modes/interactive/components/tool-panel-registry.js.map +1 -1
  1201. package/dist/modes/interactive/components/tool-title.d.ts.map +1 -1
  1202. package/dist/modes/interactive/components/tool-title.js +0 -4
  1203. package/dist/modes/interactive/components/tool-title.js.map +1 -1
  1204. package/dist/modes/interactive/components/transcript-pager.d.ts +26 -0
  1205. package/dist/modes/interactive/components/transcript-pager.d.ts.map +1 -0
  1206. package/dist/modes/interactive/components/transcript-pager.js +81 -0
  1207. package/dist/modes/interactive/components/transcript-pager.js.map +1 -0
  1208. package/dist/modes/interactive/components/tree-selector.d.ts +1 -12
  1209. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  1210. package/dist/modes/interactive/components/tree-selector.js +42 -402
  1211. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  1212. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
  1213. package/dist/modes/interactive/components/trust-selector.js +4 -16
  1214. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  1215. package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -1
  1216. package/dist/modes/interactive/components/usage-action-selector.js +2 -10
  1217. package/dist/modes/interactive/components/usage-action-selector.js.map +1 -1
  1218. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  1219. package/dist/modes/interactive/components/user-message-selector.js +3 -6
  1220. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  1221. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  1222. package/dist/modes/interactive/components/user-message.js +0 -1
  1223. package/dist/modes/interactive/components/user-message.js.map +1 -1
  1224. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  1225. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  1226. package/dist/modes/interactive/config-backup.d.ts.map +1 -1
  1227. package/dist/modes/interactive/config-backup.js.map +1 -1
  1228. package/dist/modes/interactive/editor-overlay-host.d.ts.map +1 -1
  1229. package/dist/modes/interactive/editor-overlay-host.js +0 -3
  1230. package/dist/modes/interactive/editor-overlay-host.js.map +1 -1
  1231. package/dist/modes/interactive/extension-ui-host.d.ts +2 -0
  1232. package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
  1233. package/dist/modes/interactive/extension-ui-host.js +51 -72
  1234. package/dist/modes/interactive/extension-ui-host.js.map +1 -1
  1235. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  1236. package/dist/modes/interactive/external-editor.js +2 -15
  1237. package/dist/modes/interactive/external-editor.js.map +1 -1
  1238. package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
  1239. package/dist/modes/interactive/history-reload-math.js.map +1 -1
  1240. package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -1
  1241. package/dist/modes/interactive/interactive-event-controller.js +23 -16
  1242. package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
  1243. package/dist/modes/interactive/interactive-mode.d.ts +13 -4
  1244. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  1245. package/dist/modes/interactive/interactive-mode.js +126 -207
  1246. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  1247. package/dist/modes/interactive/interactive-selection-prompts.d.ts +20 -0
  1248. package/dist/modes/interactive/interactive-selection-prompts.d.ts.map +1 -0
  1249. package/dist/modes/interactive/interactive-selection-prompts.js +43 -0
  1250. package/dist/modes/interactive/interactive-selection-prompts.js.map +1 -0
  1251. package/dist/modes/interactive/key-handlers.d.ts +2 -1
  1252. package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
  1253. package/dist/modes/interactive/key-handlers.js +4 -2
  1254. package/dist/modes/interactive/key-handlers.js.map +1 -1
  1255. package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -1
  1256. package/dist/modes/interactive/loaded-resources-view.js.map +1 -1
  1257. package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
  1258. package/dist/modes/interactive/local-model-commands.js +4 -9
  1259. package/dist/modes/interactive/local-model-commands.js.map +1 -1
  1260. package/dist/modes/interactive/model-fitness-presentation.d.ts +21 -0
  1261. package/dist/modes/interactive/model-fitness-presentation.d.ts.map +1 -0
  1262. package/dist/modes/interactive/model-fitness-presentation.js +13 -0
  1263. package/dist/modes/interactive/model-fitness-presentation.js.map +1 -0
  1264. package/dist/modes/interactive/profile-menu-controller.d.ts +2 -0
  1265. package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -1
  1266. package/dist/modes/interactive/profile-menu-controller.js +79 -171
  1267. package/dist/modes/interactive/profile-menu-controller.js.map +1 -1
  1268. package/dist/modes/interactive/report-commands.d.ts +2 -0
  1269. package/dist/modes/interactive/report-commands.d.ts.map +1 -1
  1270. package/dist/modes/interactive/report-commands.js +12 -6
  1271. package/dist/modes/interactive/report-commands.js.map +1 -1
  1272. package/dist/modes/interactive/resource-display.d.ts.map +1 -1
  1273. package/dist/modes/interactive/resource-display.js.map +1 -1
  1274. package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
  1275. package/dist/modes/interactive/resource-shell-commands.js +6 -23
  1276. package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
  1277. package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
  1278. package/dist/modes/interactive/session-flow-commands.js +21 -25
  1279. package/dist/modes/interactive/session-flow-commands.js.map +1 -1
  1280. package/dist/modes/interactive/session-io-commands.d.ts.map +1 -1
  1281. package/dist/modes/interactive/session-io-commands.js.map +1 -1
  1282. package/dist/modes/interactive/session-replacement-errors.d.ts.map +1 -1
  1283. package/dist/modes/interactive/session-replacement-errors.js.map +1 -1
  1284. package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
  1285. package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
  1286. package/dist/modes/interactive/signal-lifecycle.d.ts.map +1 -1
  1287. package/dist/modes/interactive/signal-lifecycle.js.map +1 -1
  1288. package/dist/modes/interactive/startup-checks.d.ts.map +1 -1
  1289. package/dist/modes/interactive/startup-checks.js +12 -8
  1290. package/dist/modes/interactive/startup-checks.js.map +1 -1
  1291. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  1292. package/dist/modes/interactive/theme/theme.js +10 -76
  1293. package/dist/modes/interactive/theme/theme.js.map +1 -1
  1294. package/dist/modes/interactive/usage-commands.d.ts.map +1 -1
  1295. package/dist/modes/interactive/usage-commands.js.map +1 -1
  1296. package/dist/modes/print-mode.d.ts.map +1 -1
  1297. package/dist/modes/print-mode.js +5 -22
  1298. package/dist/modes/print-mode.js.map +1 -1
  1299. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  1300. package/dist/modes/rpc/jsonl.js +1 -1
  1301. package/dist/modes/rpc/jsonl.js.map +1 -1
  1302. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  1303. package/dist/modes/rpc/rpc-client.js +7 -8
  1304. package/dist/modes/rpc/rpc-client.js.map +1 -1
  1305. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  1306. package/dist/modes/rpc/rpc-mode.js +5 -20
  1307. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  1308. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  1309. package/dist/modes/rpc/rpc-types.js.map +1 -1
  1310. package/dist/modes/termination-signals.d.ts +4 -0
  1311. package/dist/modes/termination-signals.d.ts.map +1 -0
  1312. package/dist/modes/termination-signals.js +21 -0
  1313. package/dist/modes/termination-signals.js.map +1 -0
  1314. package/dist/package-manager-cli.d.ts.map +1 -1
  1315. package/dist/package-manager-cli.js.map +1 -1
  1316. package/dist/utils/ansi-colors.d.ts +5 -0
  1317. package/dist/utils/ansi-colors.d.ts.map +1 -0
  1318. package/dist/utils/ansi-colors.js +38 -0
  1319. package/dist/utils/ansi-colors.js.map +1 -0
  1320. package/dist/utils/ansi.d.ts.map +1 -1
  1321. package/dist/utils/ansi.js.map +1 -1
  1322. package/dist/utils/changelog.d.ts.map +1 -1
  1323. package/dist/utils/changelog.js.map +1 -1
  1324. package/dist/utils/child-process.d.ts.map +1 -1
  1325. package/dist/utils/child-process.js.map +1 -1
  1326. package/dist/utils/clipboard-image.d.ts.map +1 -1
  1327. package/dist/utils/clipboard-image.js.map +1 -1
  1328. package/dist/utils/clipboard-native.d.ts.map +1 -1
  1329. package/dist/utils/clipboard-native.js.map +1 -1
  1330. package/dist/utils/clipboard.d.ts.map +1 -1
  1331. package/dist/utils/clipboard.js.map +1 -1
  1332. package/dist/utils/deprecation.d.ts.map +1 -1
  1333. package/dist/utils/deprecation.js.map +1 -1
  1334. package/dist/utils/exif-orientation.d.ts.map +1 -1
  1335. package/dist/utils/exif-orientation.js.map +1 -1
  1336. package/dist/utils/external-editor-command.d.ts.map +1 -1
  1337. package/dist/utils/external-editor-command.js.map +1 -1
  1338. package/dist/utils/frontmatter.d.ts.map +1 -1
  1339. package/dist/utils/frontmatter.js.map +1 -1
  1340. package/dist/utils/fs-watch.d.ts.map +1 -1
  1341. package/dist/utils/fs-watch.js.map +1 -1
  1342. package/dist/utils/git.d.ts.map +1 -1
  1343. package/dist/utils/git.js +20 -28
  1344. package/dist/utils/git.js.map +1 -1
  1345. package/dist/utils/highlight-js-languages.d.ts.map +1 -1
  1346. package/dist/utils/html.d.ts.map +1 -1
  1347. package/dist/utils/html.js.map +1 -1
  1348. package/dist/utils/image-convert.d.ts.map +1 -1
  1349. package/dist/utils/image-convert.js.map +1 -1
  1350. package/dist/utils/image-resize-core.d.ts.map +1 -1
  1351. package/dist/utils/image-resize-core.js.map +1 -1
  1352. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  1353. package/dist/utils/image-resize-worker.js.map +1 -1
  1354. package/dist/utils/image-resize.d.ts.map +1 -1
  1355. package/dist/utils/image-resize.js.map +1 -1
  1356. package/dist/utils/json.d.ts.map +1 -1
  1357. package/dist/utils/json.js.map +1 -1
  1358. package/dist/utils/mime.d.ts.map +1 -1
  1359. package/dist/utils/mime.js.map +1 -1
  1360. package/dist/utils/open-browser.d.ts.map +1 -1
  1361. package/dist/utils/open-browser.js.map +1 -1
  1362. package/dist/utils/paths.d.ts.map +1 -1
  1363. package/dist/utils/paths.js.map +1 -1
  1364. package/dist/utils/photon.d.ts.map +1 -1
  1365. package/dist/utils/photon.js.map +1 -1
  1366. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  1367. package/dist/utils/pi-user-agent.js.map +1 -1
  1368. package/dist/utils/platform.d.ts.map +1 -1
  1369. package/dist/utils/platform.js.map +1 -1
  1370. package/dist/utils/process-memory.d.ts.map +1 -1
  1371. package/dist/utils/process-memory.js.map +1 -1
  1372. package/dist/utils/safe-write-stream.d.ts.map +1 -1
  1373. package/dist/utils/safe-write-stream.js.map +1 -1
  1374. package/dist/utils/shell.d.ts.map +1 -1
  1375. package/dist/utils/shell.js.map +1 -1
  1376. package/dist/utils/sleep.d.ts.map +1 -1
  1377. package/dist/utils/sleep.js +2 -15
  1378. package/dist/utils/sleep.js.map +1 -1
  1379. package/dist/utils/stdin-events.d.ts +8 -0
  1380. package/dist/utils/stdin-events.d.ts.map +1 -0
  1381. package/dist/utils/stdin-events.js +19 -0
  1382. package/dist/utils/stdin-events.js.map +1 -0
  1383. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  1384. package/dist/utils/syntax-highlight.js +20 -13
  1385. package/dist/utils/syntax-highlight.js.map +1 -1
  1386. package/dist/utils/tools-manager.d.ts +6 -1
  1387. package/dist/utils/tools-manager.d.ts.map +1 -1
  1388. package/dist/utils/tools-manager.js +59 -2
  1389. package/dist/utils/tools-manager.js.map +1 -1
  1390. package/dist/utils/version-check.d.ts.map +1 -1
  1391. package/dist/utils/version-check.js.map +1 -1
  1392. package/dist/utils/windows-self-update.d.ts.map +1 -1
  1393. package/dist/utils/windows-self-update.js.map +1 -1
  1394. package/dist/utils/work-directory.d.ts.map +1 -1
  1395. package/dist/utils/work-directory.js.map +1 -1
  1396. package/docs/compaction.md +11 -3
  1397. package/docs/development.md +1 -1
  1398. package/docs/sessions.md +6 -0
  1399. package/docs/settings.md +1 -1
  1400. package/docs/windows.md +28 -3
  1401. package/docs/work-directory.md +10 -2
  1402. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  1403. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  1404. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  1405. package/examples/extensions/sandbox/package-lock.json +2 -2
  1406. package/examples/extensions/sandbox/package.json +1 -1
  1407. package/examples/extensions/with-deps/package-lock.json +2 -2
  1408. package/examples/extensions/with-deps/package.json +1 -1
  1409. package/npm-shrinkwrap.json +27 -27
  1410. package/package.json +11 -11
  1411. package/dist/utils/streaming-lines.d.ts +0 -20
  1412. package/dist/utils/streaming-lines.d.ts.map +0 -1
  1413. package/dist/utils/streaming-lines.js +0 -79
  1414. package/dist/utils/streaming-lines.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAQjD,SAAS,kBAAkB,CAAC,OAAmC,EAAQ;IACtE,IA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,CAAC;IAChG,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;IAC3B,CAAC;IACD,IAAI,gBAAgB,EAAE,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC;QAC5G,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,gBAAgB,EAAE,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QACrE,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;IAC7B,CAAC;IACD,OAAO,CACN,IAAI,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;QAC1E,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CACzC,CAAC;AAAA,CACF","sourcesContent":["import { execFileSync, execSync } from \"child_process\";\nimport { platform } from \"os\";\nimport { spawnProcess, waitForChildProcessWithTermination } from \"./child-process.ts\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\nimport { isWslEnvironment } from \"./platform.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\nconst MAX_CLIPBOARD_TEXT_BYTES = 10 * 1024 * 1024;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession();\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst proc = spawnProcess(\"wl-copy\", [], {\n\t\t\t\t\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\t\t\t\t\tstdio: [\"pipe\", \"ignore\", \"ignore\"],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst terminalPromise = waitForChildProcessWithTermination(proc, {\n\t\t\t\t\t\t\t\ttimeoutMs: options.timeout,\n\t\t\t\t\t\t\t\tkillGraceMs: 1_000,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tproc.stdin?.on(\"error\", () => {\n\t\t\t\t\t\t\t\t// The terminal result below decides whether the copy succeeded.\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tproc.stdin?.end(text);\n\t\t\t\t\t\t\tconst terminal = await terminalPromise;\n\t\t\t\t\t\t\tif (terminal.reason !== \"exited\" || terminal.code !== 0) {\n\t\t\t\t\t\t\t\tthrow new Error(`wl-copy failed with code ${terminal.code ?? \"unknown\"}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tif (remote || !copied) {\n\t\tconst osc52Copied = emitOsc52(text);\n\t\tcopied = copied || osc52Copied;\n\t}\n\n\tif (!copied) {\n\t\tthrow new Error(\"Failed to copy to clipboard\");\n\t}\n}\n\nexport async function readClipboardText(): Promise<string | null> {\n\tconst p = platform();\n\tif (isRemoteSession()) return null;\n\n\tif (clipboard && p !== \"linux\") {\n\t\ttry {\n\t\t\tconst text = await clipboard.getText();\n\t\t\tif (text) return text;\n\t\t} catch {}\n\t}\n\n\tconst read = (command: string, args: string[]): string | null => {\n\t\ttry {\n\t\t\tconst output = execFileSync(command, args, {\n\t\t\t\tencoding: \"utf8\",\n\t\t\t\tmaxBuffer: MAX_CLIPBOARD_TEXT_BYTES,\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\t\ttimeout: 3000,\n\t\t\t});\n\t\t\treturn output.length > 0 ? output : null;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t};\n\n\tif (p === \"darwin\") return read(\"pbpaste\", []);\n\tif (p === \"win32\") {\n\t\treturn read(\"powershell\", [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Get-Clipboard -Raw\"]);\n\t}\n\tif (process.env.TERMUX_VERSION) {\n\t\tconst termux = read(\"termux-clipboard-get\", []);\n\t\tif (termux) return termux;\n\t}\n\tif (isWslEnvironment()) {\n\t\tconst windows = read(\"powershell.exe\", [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Get-Clipboard -Raw\"]);\n\t\tif (windows) return windows.replace(/\\r\\n/g, \"\\n\");\n\t}\n\tif (isWaylandSession()) {\n\t\tconst wayland = read(\"wl-paste\", [\"--no-newline\", \"--type\", \"text\"]);\n\t\tif (wayland) return wayland;\n\t}\n\treturn (\n\t\tread(\"xclip\", [\"-selection\", \"clipboard\", \"-target\", \"UTF8_STRING\", \"-o\"]) ??\n\t\tread(\"xsel\", [\"--clipboard\", \"--output\"])\n\t);\n}\n"]}
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAQjD,SAAS,kBAAkB,CAAC,OAAmC;IAC9D,IAAI,CAAC;QACJ,QAAQ,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACR,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;AACF,CAAC;AAED,MAAM,wBAAwB,GAAG,OAAO,CAAC;AACzC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,SAAS,eAAe,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAC5D,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,OAAO,CAAC,MAA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AC;IAC7B,CAAC;IACD,OAAO,CACN,IAAI,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;QAC1E,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CACzC,CAAC;AACH,CAAC","sourcesContent":["import { execFileSync, execSync } from \"child_process\";\nimport { platform } from \"os\";\nimport { spawnProcess, waitForChildProcessWithTermination } from \"./child-process.ts\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\nimport { isWslEnvironment } from \"./platform.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\nconst MAX_CLIPBOARD_TEXT_BYTES = 10 * 1024 * 1024;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession();\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst proc = spawnProcess(\"wl-copy\", [], {\n\t\t\t\t\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\t\t\t\t\tstdio: [\"pipe\", \"ignore\", \"ignore\"],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst terminalPromise = waitForChildProcessWithTermination(proc, {\n\t\t\t\t\t\t\t\ttimeoutMs: options.timeout,\n\t\t\t\t\t\t\t\tkillGraceMs: 1_000,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tproc.stdin?.on(\"error\", () => {\n\t\t\t\t\t\t\t\t// The terminal result below decides whether the copy succeeded.\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tproc.stdin?.end(text);\n\t\t\t\t\t\t\tconst terminal = await terminalPromise;\n\t\t\t\t\t\t\tif (terminal.reason !== \"exited\" || terminal.code !== 0) {\n\t\t\t\t\t\t\t\tthrow new Error(`wl-copy failed with code ${terminal.code ?? \"unknown\"}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tif (remote || !copied) {\n\t\tconst osc52Copied = emitOsc52(text);\n\t\tcopied = copied || osc52Copied;\n\t}\n\n\tif (!copied) {\n\t\tthrow new Error(\"Failed to copy to clipboard\");\n\t}\n}\n\nexport async function readClipboardText(): Promise<string | null> {\n\tconst p = platform();\n\tif (isRemoteSession()) return null;\n\n\tif (clipboard && p !== \"linux\") {\n\t\ttry {\n\t\t\tconst text = await clipboard.getText();\n\t\t\tif (text) return text;\n\t\t} catch {}\n\t}\n\n\tconst read = (command: string, args: string[]): string | null => {\n\t\ttry {\n\t\t\tconst output = execFileSync(command, args, {\n\t\t\t\tencoding: \"utf8\",\n\t\t\t\tmaxBuffer: MAX_CLIPBOARD_TEXT_BYTES,\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\t\ttimeout: 3000,\n\t\t\t});\n\t\t\treturn output.length > 0 ? output : null;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t};\n\n\tif (p === \"darwin\") return read(\"pbpaste\", []);\n\tif (p === \"win32\") {\n\t\treturn read(\"powershell\", [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Get-Clipboard -Raw\"]);\n\t}\n\tif (process.env.TERMUX_VERSION) {\n\t\tconst termux = read(\"termux-clipboard-get\", []);\n\t\tif (termux) return termux;\n\t}\n\tif (isWslEnvironment()) {\n\t\tconst windows = read(\"powershell.exe\", [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Get-Clipboard -Raw\"]);\n\t\tif (windows) return windows.replace(/\\r\\n/g, \"\\n\");\n\t}\n\tif (isWaylandSession()) {\n\t\tconst wayland = read(\"wl-paste\", [\"--no-newline\", \"--type\", \"text\"]);\n\t\tif (wayland) return wayland;\n\t}\n\treturn (\n\t\tread(\"xclip\", [\"-selection\", \"clipboard\", \"-target\", \"UTF8_STRING\", \"-o\"]) ??\n\t\tread(\"xsel\", [\"--clipboard\", \"--output\"])\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,2DAA2D;AAC3D,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD","sourcesContent":["import chalk from \"chalk\";\n\nconst emittedDeprecationWarnings = new Set<string>();\n\nexport function warnDeprecation(message: string): void {\n\tif (emittedDeprecationWarnings.has(message)) return;\n\temittedDeprecationWarnings.add(message);\n\tconsole.warn(chalk.yellow(`Deprecation warning: ${message}`));\n}\n\n/** Clear deprecation warning state. Exported for tests. */\nexport function clearDeprecationWarningsForTests(): void {\n\temittedDeprecationWarnings.clear();\n}\n"]}
1
+ {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,2DAA2D;AAC3D,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecation.js","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAAU,CAAC;AAErD,MAAM,UAAU,eAAe,CAAC,OAAe,EAAQ;IACtD,IAAI,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO;IACpD,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC,CAAC;AAAA,CAC9D;AAED,2DAA2D;AAC3D,MAAM,UAAU,gCAAgC,GAAS;IACxD,0BAA0B,CAAC,KAAK,EAAE,CAAC;AAAA,CACnC","sourcesContent":["import chalk from \"chalk\";\n\nconst emittedDeprecationWarnings = new Set<string>();\n\nexport function warnDeprecation(message: string): void {\n\tif (emittedDeprecationWarnings.has(message)) return;\n\temittedDeprecationWarnings.add(message);\n\tconsole.warn(chalk.yellow(`Deprecation warning: ${message}`));\n}\n\n/** Clear deprecation warning state. Exported for tests. */\nexport function clearDeprecationWarningsForTests(): void {\n\temittedDeprecationWarnings.clear();\n}\n"]}
1
+ {"version":3,"file":"deprecation.js","sourceRoot":"","sources":["../../src/utils/deprecation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAAU,CAAC;AAErD,MAAM,UAAU,eAAe,CAAC,OAAe;IAC9C,IAAI,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO;IACpD,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,gCAAgC;IAC/C,0BAA0B,CAAC,KAAK,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import chalk from \"chalk\";\n\nconst emittedDeprecationWarnings = new Set<string>();\n\nexport function warnDeprecation(message: string): void {\n\tif (emittedDeprecationWarnings.has(message)) return;\n\temittedDeprecationWarnings.add(message);\n\tconsole.warn(chalk.yellow(`Deprecation warning: ${message}`));\n}\n\n/** Clear deprecation warning state. Exported for tests. */\nexport function clearDeprecationWarningsForTests(): void {\n\temittedDeprecationWarnings.clear();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"exif-orientation.d.ts","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,MAAM,GAAG,cAAc,4BAA4B,CAAC,CAAC;AAgJ1D,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,UAAU,GACvB,eAAe,CAgCjB","sourcesContent":["import type { PhotonImageType } from \"./photon.ts\";\n\ntype Photon = typeof import(\"@silvia-odwyer/photon-node\");\n\nfunction readOrientationFromTiff(bytes: Uint8Array, tiffStart: number): number {\n\tif (tiffStart + 8 > bytes.length) return 1;\n\n\tconst byteOrder = (bytes[tiffStart] << 8) | bytes[tiffStart + 1];\n\tconst le = byteOrder === 0x4949;\n\n\tconst read16 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8);\n\t\treturn (bytes[pos] << 8) | bytes[pos + 1];\n\t};\n\n\tconst read32 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8) | (bytes[pos + 2] << 16) | (bytes[pos + 3] << 24);\n\t\treturn ((bytes[pos] << 24) | (bytes[pos + 1] << 16) | (bytes[pos + 2] << 8) | bytes[pos + 3]) >>> 0;\n\t};\n\n\tconst ifdOffset = read32(tiffStart + 4);\n\tconst ifdStart = tiffStart + ifdOffset;\n\tif (ifdStart + 2 > bytes.length) return 1;\n\n\tconst entryCount = read16(ifdStart);\n\tfor (let i = 0; i < entryCount; i++) {\n\t\tconst entryPos = ifdStart + 2 + i * 12;\n\t\tif (entryPos + 12 > bytes.length) return 1;\n\n\t\tif (read16(entryPos) === 0x0112) {\n\t\t\tconst value = read16(entryPos + 8);\n\t\t\treturn value >= 1 && value <= 8 ? value : 1;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nfunction findJpegTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 2;\n\twhile (offset < bytes.length - 1) {\n\t\tif (bytes[offset] !== 0xff) return -1;\n\t\tconst marker = bytes[offset + 1];\n\t\tif (marker === 0xff) {\n\t\t\toffset++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (marker === 0xe1) {\n\t\t\tif (offset + 4 >= bytes.length) return -1;\n\t\t\tconst segmentStart = offset + 4;\n\t\t\tif (segmentStart + 6 > bytes.length) return -1;\n\t\t\tif (!hasExifHeader(bytes, segmentStart)) return -1;\n\t\t\treturn segmentStart + 6;\n\t\t}\n\n\t\tif (offset + 4 > bytes.length) return -1;\n\t\tconst length = (bytes[offset + 2] << 8) | bytes[offset + 3];\n\t\toffset += 2 + length;\n\t}\n\n\treturn -1;\n}\n\nfunction findWebpTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 12;\n\twhile (offset + 8 <= bytes.length) {\n\t\tconst chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);\n\t\tconst chunkSize =\n\t\t\tbytes[offset + 4] | (bytes[offset + 5] << 8) | (bytes[offset + 6] << 16) | (bytes[offset + 7] << 24);\n\t\tconst dataStart = offset + 8;\n\n\t\tif (chunkId === \"EXIF\") {\n\t\t\tif (dataStart + chunkSize > bytes.length) return -1;\n\t\t\t// Some WebP files have \"Exif\\0\\0\" prefix before the TIFF header\n\t\t\tconst tiffStart = chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;\n\t\t\treturn tiffStart;\n\t\t}\n\n\t\t// RIFF chunks are padded to even size\n\t\toffset = dataStart + chunkSize + (chunkSize % 2);\n\t}\n\n\treturn -1;\n}\n\nfunction hasExifHeader(bytes: Uint8Array, offset: number): boolean {\n\treturn (\n\t\tbytes[offset] === 0x45 &&\n\t\tbytes[offset + 1] === 0x78 &&\n\t\tbytes[offset + 2] === 0x69 &&\n\t\tbytes[offset + 3] === 0x66 &&\n\t\tbytes[offset + 4] === 0x00 &&\n\t\tbytes[offset + 5] === 0x00\n\t);\n}\n\nfunction getExifOrientation(bytes: Uint8Array): number {\n\tlet tiffOffset = -1;\n\n\t// JPEG: starts with FF D8\n\tif (bytes.length >= 2 && bytes[0] === 0xff && bytes[1] === 0xd8) {\n\t\ttiffOffset = findJpegTiffOffset(bytes);\n\t}\n\t// WebP: starts with RIFF....WEBP\n\telse if (\n\t\tbytes.length >= 12 &&\n\t\tbytes[0] === 0x52 &&\n\t\tbytes[1] === 0x49 &&\n\t\tbytes[2] === 0x46 &&\n\t\tbytes[3] === 0x46 &&\n\t\tbytes[8] === 0x57 &&\n\t\tbytes[9] === 0x45 &&\n\t\tbytes[10] === 0x42 &&\n\t\tbytes[11] === 0x50\n\t) {\n\t\ttiffOffset = findWebpTiffOffset(bytes);\n\t}\n\n\tif (tiffOffset === -1) return 1;\n\treturn readOrientationFromTiff(bytes, tiffOffset);\n}\n\ntype DstIndexFn = (x: number, y: number, w: number, h: number) => number;\n\nfunction rotate90(photon: Photon, image: PhotonImageType, dstIndex: DstIndexFn): PhotonImageType {\n\tconst w = image.get_width();\n\tconst h = image.get_height();\n\tconst src = image.get_raw_pixels();\n\tconst dst = new Uint8Array(src.length);\n\n\tfor (let y = 0; y < h; y++) {\n\t\tfor (let x = 0; x < w; x++) {\n\t\t\tconst srcIdx = (y * w + x) * 4;\n\t\t\tconst dstIdx = dstIndex(x, y, w, h) * 4;\n\t\t\tdst[dstIdx] = src[srcIdx];\n\t\t\tdst[dstIdx + 1] = src[srcIdx + 1];\n\t\t\tdst[dstIdx + 2] = src[srcIdx + 2];\n\t\t\tdst[dstIdx + 3] = src[srcIdx + 3];\n\t\t}\n\t}\n\n\treturn new photon.PhotonImage(dst, h, w);\n}\n\n// Flip orientations mutate in-place. Rotations return a new image (caller must free the old one if different).\nexport function applyExifOrientation(\n\tphoton: Photon,\n\timage: PhotonImageType,\n\toriginalBytes: Uint8Array,\n): PhotonImageType {\n\tconst orientation = getExifOrientation(originalBytes);\n\tif (orientation === 1) return image;\n\n\tswitch (orientation) {\n\t\tcase 2:\n\t\t\tphoton.fliph(image);\n\t\t\treturn image;\n\t\tcase 3:\n\t\t\tphoton.fliph(image);\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 4:\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 5: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 6:\n\t\t\treturn rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\tcase 7: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 8:\n\t\t\treturn rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\tdefault:\n\t\t\treturn image;\n\t}\n}\n"]}
1
+ {"version":3,"file":"exif-orientation.d.ts","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,MAAM,GAAG,cAAc,4BAA4B,CAAC,CAAC;AAgJ1D,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,UAAU,GACvB,eAAe,CAgCjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"exif-orientation.js","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAIA,SAAS,uBAAuB,CAAC,KAAiB,EAAE,SAAiB,EAAU;IAC9E,IAAI,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC;IAE3C,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,GAAG,SAAS,KAAK,MAAM,CAAC;IAEhC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC;QACvC,IAAI,EAAE;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAAA,CAC1C,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC;QACvC,IAAI,EAAE;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAA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K,CAAC;IACf,CAAC;AAAA,CACD","sourcesContent":["import type { PhotonImageType } from \"./photon.ts\";\n\ntype Photon = typeof import(\"@silvia-odwyer/photon-node\");\n\nfunction readOrientationFromTiff(bytes: Uint8Array, tiffStart: number): number {\n\tif (tiffStart + 8 > bytes.length) return 1;\n\n\tconst byteOrder = (bytes[tiffStart] << 8) | bytes[tiffStart + 1];\n\tconst le = byteOrder === 0x4949;\n\n\tconst read16 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8);\n\t\treturn (bytes[pos] << 8) | bytes[pos + 1];\n\t};\n\n\tconst read32 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8) | (bytes[pos + 2] << 16) | (bytes[pos + 3] << 24);\n\t\treturn ((bytes[pos] << 24) | (bytes[pos + 1] << 16) | (bytes[pos + 2] << 8) | bytes[pos + 3]) >>> 0;\n\t};\n\n\tconst ifdOffset = read32(tiffStart + 4);\n\tconst ifdStart = tiffStart + ifdOffset;\n\tif (ifdStart + 2 > bytes.length) return 1;\n\n\tconst entryCount = read16(ifdStart);\n\tfor (let i = 0; i < entryCount; i++) {\n\t\tconst entryPos = ifdStart + 2 + i * 12;\n\t\tif (entryPos + 12 > bytes.length) return 1;\n\n\t\tif (read16(entryPos) === 0x0112) {\n\t\t\tconst value = read16(entryPos + 8);\n\t\t\treturn value >= 1 && value <= 8 ? value : 1;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nfunction findJpegTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 2;\n\twhile (offset < bytes.length - 1) {\n\t\tif (bytes[offset] !== 0xff) return -1;\n\t\tconst marker = bytes[offset + 1];\n\t\tif (marker === 0xff) {\n\t\t\toffset++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (marker === 0xe1) {\n\t\t\tif (offset + 4 >= bytes.length) return -1;\n\t\t\tconst segmentStart = offset + 4;\n\t\t\tif (segmentStart + 6 > bytes.length) return -1;\n\t\t\tif (!hasExifHeader(bytes, segmentStart)) return -1;\n\t\t\treturn segmentStart + 6;\n\t\t}\n\n\t\tif (offset + 4 > bytes.length) return -1;\n\t\tconst length = (bytes[offset + 2] << 8) | bytes[offset + 3];\n\t\toffset += 2 + length;\n\t}\n\n\treturn -1;\n}\n\nfunction findWebpTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 12;\n\twhile (offset + 8 <= bytes.length) {\n\t\tconst chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);\n\t\tconst chunkSize =\n\t\t\tbytes[offset + 4] | (bytes[offset + 5] << 8) | (bytes[offset + 6] << 16) | (bytes[offset + 7] << 24);\n\t\tconst dataStart = offset + 8;\n\n\t\tif (chunkId === \"EXIF\") {\n\t\t\tif (dataStart + chunkSize > bytes.length) return -1;\n\t\t\t// Some WebP files have \"Exif\\0\\0\" prefix before the TIFF header\n\t\t\tconst tiffStart = chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;\n\t\t\treturn tiffStart;\n\t\t}\n\n\t\t// RIFF chunks are padded to even size\n\t\toffset = dataStart + chunkSize + (chunkSize % 2);\n\t}\n\n\treturn -1;\n}\n\nfunction hasExifHeader(bytes: Uint8Array, offset: number): boolean {\n\treturn (\n\t\tbytes[offset] === 0x45 &&\n\t\tbytes[offset + 1] === 0x78 &&\n\t\tbytes[offset + 2] === 0x69 &&\n\t\tbytes[offset + 3] === 0x66 &&\n\t\tbytes[offset + 4] === 0x00 &&\n\t\tbytes[offset + 5] === 0x00\n\t);\n}\n\nfunction getExifOrientation(bytes: Uint8Array): number {\n\tlet tiffOffset = -1;\n\n\t// JPEG: starts with FF D8\n\tif (bytes.length >= 2 && bytes[0] === 0xff && bytes[1] === 0xd8) {\n\t\ttiffOffset = findJpegTiffOffset(bytes);\n\t}\n\t// WebP: starts with RIFF....WEBP\n\telse if (\n\t\tbytes.length >= 12 &&\n\t\tbytes[0] === 0x52 &&\n\t\tbytes[1] === 0x49 &&\n\t\tbytes[2] === 0x46 &&\n\t\tbytes[3] === 0x46 &&\n\t\tbytes[8] === 0x57 &&\n\t\tbytes[9] === 0x45 &&\n\t\tbytes[10] === 0x42 &&\n\t\tbytes[11] === 0x50\n\t) {\n\t\ttiffOffset = findWebpTiffOffset(bytes);\n\t}\n\n\tif (tiffOffset === -1) return 1;\n\treturn readOrientationFromTiff(bytes, tiffOffset);\n}\n\ntype DstIndexFn = (x: number, y: number, w: number, h: number) => number;\n\nfunction rotate90(photon: Photon, image: PhotonImageType, dstIndex: DstIndexFn): PhotonImageType {\n\tconst w = image.get_width();\n\tconst h = image.get_height();\n\tconst src = image.get_raw_pixels();\n\tconst dst = new Uint8Array(src.length);\n\n\tfor (let y = 0; y < h; y++) {\n\t\tfor (let x = 0; x < w; x++) {\n\t\t\tconst srcIdx = (y * w + x) * 4;\n\t\t\tconst dstIdx = dstIndex(x, y, w, h) * 4;\n\t\t\tdst[dstIdx] = src[srcIdx];\n\t\t\tdst[dstIdx + 1] = src[srcIdx + 1];\n\t\t\tdst[dstIdx + 2] = src[srcIdx + 2];\n\t\t\tdst[dstIdx + 3] = src[srcIdx + 3];\n\t\t}\n\t}\n\n\treturn new photon.PhotonImage(dst, h, w);\n}\n\n// Flip orientations mutate in-place. Rotations return a new image (caller must free the old one if different).\nexport function applyExifOrientation(\n\tphoton: Photon,\n\timage: PhotonImageType,\n\toriginalBytes: Uint8Array,\n): PhotonImageType {\n\tconst orientation = getExifOrientation(originalBytes);\n\tif (orientation === 1) return image;\n\n\tswitch (orientation) {\n\t\tcase 2:\n\t\t\tphoton.fliph(image);\n\t\t\treturn image;\n\t\tcase 3:\n\t\t\tphoton.fliph(image);\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 4:\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 5: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 6:\n\t\t\treturn rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\tcase 7: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 8:\n\t\t\treturn rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\tdefault:\n\t\t\treturn image;\n\t}\n}\n"]}
1
+ {"version":3,"file":"exif-orientation.js","sourceRoot":"","sources":["../../src/utils/exif-orientation.ts"],"names":[],"mappings":"AAIA,SAAS,uBAAuB,CAAC,KAAiB,EAAE,SAAiB;IACpE,IAAI,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC;IAE3C,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,GAAG,SAAS,KAAK,MAAM,CAAC;IAEhC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE;QACtC,IAAI,EAAE;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE;QACtC,IAAI,EAAE;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GA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F,CAAC","sourcesContent":["import type { PhotonImageType } from \"./photon.ts\";\n\ntype Photon = typeof import(\"@silvia-odwyer/photon-node\");\n\nfunction readOrientationFromTiff(bytes: Uint8Array, tiffStart: number): number {\n\tif (tiffStart + 8 > bytes.length) return 1;\n\n\tconst byteOrder = (bytes[tiffStart] << 8) | bytes[tiffStart + 1];\n\tconst le = byteOrder === 0x4949;\n\n\tconst read16 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8);\n\t\treturn (bytes[pos] << 8) | bytes[pos + 1];\n\t};\n\n\tconst read32 = (pos: number): number => {\n\t\tif (le) return bytes[pos] | (bytes[pos + 1] << 8) | (bytes[pos + 2] << 16) | (bytes[pos + 3] << 24);\n\t\treturn ((bytes[pos] << 24) | (bytes[pos + 1] << 16) | (bytes[pos + 2] << 8) | bytes[pos + 3]) >>> 0;\n\t};\n\n\tconst ifdOffset = read32(tiffStart + 4);\n\tconst ifdStart = tiffStart + ifdOffset;\n\tif (ifdStart + 2 > bytes.length) return 1;\n\n\tconst entryCount = read16(ifdStart);\n\tfor (let i = 0; i < entryCount; i++) {\n\t\tconst entryPos = ifdStart + 2 + i * 12;\n\t\tif (entryPos + 12 > bytes.length) return 1;\n\n\t\tif (read16(entryPos) === 0x0112) {\n\t\t\tconst value = read16(entryPos + 8);\n\t\t\treturn value >= 1 && value <= 8 ? value : 1;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nfunction findJpegTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 2;\n\twhile (offset < bytes.length - 1) {\n\t\tif (bytes[offset] !== 0xff) return -1;\n\t\tconst marker = bytes[offset + 1];\n\t\tif (marker === 0xff) {\n\t\t\toffset++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (marker === 0xe1) {\n\t\t\tif (offset + 4 >= bytes.length) return -1;\n\t\t\tconst segmentStart = offset + 4;\n\t\t\tif (segmentStart + 6 > bytes.length) return -1;\n\t\t\tif (!hasExifHeader(bytes, segmentStart)) return -1;\n\t\t\treturn segmentStart + 6;\n\t\t}\n\n\t\tif (offset + 4 > bytes.length) return -1;\n\t\tconst length = (bytes[offset + 2] << 8) | bytes[offset + 3];\n\t\toffset += 2 + length;\n\t}\n\n\treturn -1;\n}\n\nfunction findWebpTiffOffset(bytes: Uint8Array): number {\n\tlet offset = 12;\n\twhile (offset + 8 <= bytes.length) {\n\t\tconst chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);\n\t\tconst chunkSize =\n\t\t\tbytes[offset + 4] | (bytes[offset + 5] << 8) | (bytes[offset + 6] << 16) | (bytes[offset + 7] << 24);\n\t\tconst dataStart = offset + 8;\n\n\t\tif (chunkId === \"EXIF\") {\n\t\t\tif (dataStart + chunkSize > bytes.length) return -1;\n\t\t\t// Some WebP files have \"Exif\\0\\0\" prefix before the TIFF header\n\t\t\tconst tiffStart = chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;\n\t\t\treturn tiffStart;\n\t\t}\n\n\t\t// RIFF chunks are padded to even size\n\t\toffset = dataStart + chunkSize + (chunkSize % 2);\n\t}\n\n\treturn -1;\n}\n\nfunction hasExifHeader(bytes: Uint8Array, offset: number): boolean {\n\treturn (\n\t\tbytes[offset] === 0x45 &&\n\t\tbytes[offset + 1] === 0x78 &&\n\t\tbytes[offset + 2] === 0x69 &&\n\t\tbytes[offset + 3] === 0x66 &&\n\t\tbytes[offset + 4] === 0x00 &&\n\t\tbytes[offset + 5] === 0x00\n\t);\n}\n\nfunction getExifOrientation(bytes: Uint8Array): number {\n\tlet tiffOffset = -1;\n\n\t// JPEG: starts with FF D8\n\tif (bytes.length >= 2 && bytes[0] === 0xff && bytes[1] === 0xd8) {\n\t\ttiffOffset = findJpegTiffOffset(bytes);\n\t}\n\t// WebP: starts with RIFF....WEBP\n\telse if (\n\t\tbytes.length >= 12 &&\n\t\tbytes[0] === 0x52 &&\n\t\tbytes[1] === 0x49 &&\n\t\tbytes[2] === 0x46 &&\n\t\tbytes[3] === 0x46 &&\n\t\tbytes[8] === 0x57 &&\n\t\tbytes[9] === 0x45 &&\n\t\tbytes[10] === 0x42 &&\n\t\tbytes[11] === 0x50\n\t) {\n\t\ttiffOffset = findWebpTiffOffset(bytes);\n\t}\n\n\tif (tiffOffset === -1) return 1;\n\treturn readOrientationFromTiff(bytes, tiffOffset);\n}\n\ntype DstIndexFn = (x: number, y: number, w: number, h: number) => number;\n\nfunction rotate90(photon: Photon, image: PhotonImageType, dstIndex: DstIndexFn): PhotonImageType {\n\tconst w = image.get_width();\n\tconst h = image.get_height();\n\tconst src = image.get_raw_pixels();\n\tconst dst = new Uint8Array(src.length);\n\n\tfor (let y = 0; y < h; y++) {\n\t\tfor (let x = 0; x < w; x++) {\n\t\t\tconst srcIdx = (y * w + x) * 4;\n\t\t\tconst dstIdx = dstIndex(x, y, w, h) * 4;\n\t\t\tdst[dstIdx] = src[srcIdx];\n\t\t\tdst[dstIdx + 1] = src[srcIdx + 1];\n\t\t\tdst[dstIdx + 2] = src[srcIdx + 2];\n\t\t\tdst[dstIdx + 3] = src[srcIdx + 3];\n\t\t}\n\t}\n\n\treturn new photon.PhotonImage(dst, h, w);\n}\n\n// Flip orientations mutate in-place. Rotations return a new image (caller must free the old one if different).\nexport function applyExifOrientation(\n\tphoton: Photon,\n\timage: PhotonImageType,\n\toriginalBytes: Uint8Array,\n): PhotonImageType {\n\tconst orientation = getExifOrientation(originalBytes);\n\tif (orientation === 1) return image;\n\n\tswitch (orientation) {\n\t\tcase 2:\n\t\t\tphoton.fliph(image);\n\t\t\treturn image;\n\t\tcase 3:\n\t\t\tphoton.fliph(image);\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 4:\n\t\t\tphoton.flipv(image);\n\t\t\treturn image;\n\t\tcase 5: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 6:\n\t\t\treturn rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));\n\t\tcase 7: {\n\t\t\tconst rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\t\tphoton.fliph(rotated);\n\t\t\treturn rotated;\n\t\t}\n\t\tcase 8:\n\t\t\treturn rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);\n\t\tdefault:\n\t\t\treturn image;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"external-editor-command.d.ts","sourceRoot":"","sources":["../../src/utils/external-editor-command.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CACf;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAyC3F;AAED,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYrG","sourcesContent":["import { spawnProcess, waitForChildProcess } from \"./child-process.ts\";\n\nexport interface ExternalEditorCommand {\n\tcommand: string;\n\targs: string[];\n}\n\n/** Parse the small command-line form conventionally stored in VISUAL/EDITOR. */\nexport function parseExternalEditorCommand(value: string): ExternalEditorCommand | undefined {\n\tconst args: string[] = [];\n\tlet current = \"\";\n\tlet quote: '\"' | \"'\" | undefined;\n\tlet tokenStarted = false;\n\n\tfor (let index = 0; index < value.length; index++) {\n\t\tconst character = value[index];\n\t\tif (quote) {\n\t\t\tif (character === quote) {\n\t\t\t\tquote = undefined;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (character === \"\\\\\" && value[index + 1] === quote) {\n\t\t\t\tcurrent += quote;\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += character;\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === '\"' || character === \"'\") {\n\t\t\tquote = character;\n\t\t\ttokenStarted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (/\\s/.test(character)) {\n\t\t\tif (tokenStarted) {\n\t\t\t\targs.push(current);\n\t\t\t\tcurrent = \"\";\n\t\t\t\ttokenStarted = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += character;\n\t\ttokenStarted = true;\n\t}\n\tif (quote || !tokenStarted) return undefined;\n\targs.push(current);\n\tconst [command, ...commandArgs] = args;\n\treturn command ? { command, args: commandArgs } : undefined;\n}\n\nexport async function runExternalEditor(commandLine: string, filePath: string): Promise<number | null> {\n\tconst parsed = parseExternalEditorCommand(commandLine);\n\tif (!parsed) return null;\n\ttry {\n\t\tconst child = spawnProcess(parsed.command, [...parsed.args, filePath], {\n\t\t\tstdio: \"inherit\",\n\t\t\twindowsHide: false,\n\t\t});\n\t\treturn await waitForChildProcess(child);\n\t} catch {\n\t\treturn null;\n\t}\n}\n"]}
1
+ {"version":3,"file":"external-editor-command.d.ts","sourceRoot":"","sources":["../../src/utils/external-editor-command.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CACf;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAyC3F;AAED,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYrG"}
@@ -1 +1 @@
1
- {"version":3,"file":"external-editor-command.js","sourceRoot":"","sources":["../../src/utils/external-editor-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAOvE,gFAAgF;AAChF,MAAM,UAAU,0BAA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;IACnB,MAAM,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,GAAG,IAAI,CAAC;IACvC,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CAC5D;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,WAAmB,EAAE,QAAgB,EAA0B;IACtG,MAAM,MAAM,GAAG,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;YACtE,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,KAAK;SAClB,CAAC,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AAAA,CACD","sourcesContent":["import { spawnProcess, waitForChildProcess } from \"./child-process.ts\";\n\nexport interface ExternalEditorCommand {\n\tcommand: string;\n\targs: string[];\n}\n\n/** Parse the small command-line form conventionally stored in VISUAL/EDITOR. */\nexport function parseExternalEditorCommand(value: string): ExternalEditorCommand | undefined {\n\tconst args: string[] = [];\n\tlet current = \"\";\n\tlet quote: '\"' | \"'\" | undefined;\n\tlet tokenStarted = false;\n\n\tfor (let index = 0; index < value.length; index++) {\n\t\tconst character = value[index];\n\t\tif (quote) {\n\t\t\tif (character === quote) {\n\t\t\t\tquote = undefined;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (character === \"\\\\\" && value[index + 1] === quote) {\n\t\t\t\tcurrent += quote;\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += character;\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === '\"' || character === \"'\") {\n\t\t\tquote = character;\n\t\t\ttokenStarted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (/\\s/.test(character)) {\n\t\t\tif (tokenStarted) {\n\t\t\t\targs.push(current);\n\t\t\t\tcurrent = \"\";\n\t\t\t\ttokenStarted = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += character;\n\t\ttokenStarted = true;\n\t}\n\tif (quote || !tokenStarted) return undefined;\n\targs.push(current);\n\tconst [command, ...commandArgs] = args;\n\treturn command ? { command, args: commandArgs } : undefined;\n}\n\nexport async function runExternalEditor(commandLine: string, filePath: string): Promise<number | null> {\n\tconst parsed = parseExternalEditorCommand(commandLine);\n\tif (!parsed) return null;\n\ttry {\n\t\tconst child = spawnProcess(parsed.command, [...parsed.args, filePath], {\n\t\t\tstdio: \"inherit\",\n\t\t\twindowsHide: false,\n\t\t});\n\t\treturn await waitForChildProcess(child);\n\t} catch {\n\t\treturn null;\n\t}\n}\n"]}
1
+ {"version":3,"file":"external-editor-command.js","sourceRoot":"","sources":["../../src/utils/external-editor-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAOvE,gFAAgF;AAChF,MAAM,UAAU,0BAA0B,CAAC,KAAa;IACvD,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,KAA4B,CAAC;IACjC,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACnD,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,KAAK,EAAE,CAAC;YACX,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;gBACzB,KAAK,GAAG,SAAS,CAAC;gBAClB,SAAS;YAC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,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;YACtE,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,KAAK;SAClB,CAAC,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import { spawnProcess, waitForChildProcess } from \"./child-process.ts\";\n\nexport interface ExternalEditorCommand {\n\tcommand: string;\n\targs: string[];\n}\n\n/** Parse the small command-line form conventionally stored in VISUAL/EDITOR. */\nexport function parseExternalEditorCommand(value: string): ExternalEditorCommand | undefined {\n\tconst args: string[] = [];\n\tlet current = \"\";\n\tlet quote: '\"' | \"'\" | undefined;\n\tlet tokenStarted = false;\n\n\tfor (let index = 0; index < value.length; index++) {\n\t\tconst character = value[index];\n\t\tif (quote) {\n\t\t\tif (character === quote) {\n\t\t\t\tquote = undefined;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (character === \"\\\\\" && value[index + 1] === quote) {\n\t\t\t\tcurrent += quote;\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += character;\n\t\t\tcontinue;\n\t\t}\n\t\tif (character === '\"' || character === \"'\") {\n\t\t\tquote = character;\n\t\t\ttokenStarted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (/\\s/.test(character)) {\n\t\t\tif (tokenStarted) {\n\t\t\t\targs.push(current);\n\t\t\t\tcurrent = \"\";\n\t\t\t\ttokenStarted = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += character;\n\t\ttokenStarted = true;\n\t}\n\tif (quote || !tokenStarted) return undefined;\n\targs.push(current);\n\tconst [command, ...commandArgs] = args;\n\treturn command ? { command, args: commandArgs } : undefined;\n}\n\nexport async function runExternalEditor(commandLine: string, filePath: string): Promise<number | null> {\n\tconst parsed = parseExternalEditorCommand(commandLine);\n\tif (!parsed) return null;\n\ttry {\n\t\tconst child = spawnProcess(parsed.command, [...parsed.args, filePath], {\n\t\t\tstdio: \"inherit\",\n\t\t\twindowsHide: false,\n\t\t});\n\t\treturn await waitForChildProcess(child);\n\t} catch {\n\t\treturn null;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAEA,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC3D,WAAW,EAAE,CAAC,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAsBF,eAAO,MAAM,gBAAgB,GAAI,CAAC,oGASjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,6BAA8D,CAAC","sourcesContent":["import { parse } from \"yaml\";\n\ntype ParsedFrontmatter<T extends Record<string, unknown>> = {\n\tfrontmatter: T;\n\tbody: string;\n};\n\nconst normalizeNewlines = (value: string): string => value.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\nconst extractFrontmatter = (content: string): { yamlString: string | null; body: string } => {\n\tconst normalized = normalizeNewlines(content);\n\n\tif (!normalized.startsWith(\"---\")) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\tif (endIndex === -1) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\treturn {\n\t\tyamlString: normalized.slice(4, endIndex),\n\t\tbody: normalized.slice(endIndex + 4).trim(),\n\t};\n};\n\nexport const parseFrontmatter = <T extends Record<string, unknown> = Record<string, unknown>>(\n\tcontent: string,\n): ParsedFrontmatter<T> => {\n\tconst { yamlString, body } = extractFrontmatter(content);\n\tif (!yamlString) {\n\t\treturn { frontmatter: {} as T, body };\n\t}\n\tconst parsed = parse(yamlString);\n\treturn { frontmatter: (parsed ?? {}) as T, body };\n};\n\nexport const stripFrontmatter = (content: string): string => parseFrontmatter(content).body;\n"]}
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAEA,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC3D,WAAW,EAAE,CAAC,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAsBF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAClF,MAAM,KACb,iBAAiB,CAAC,CAAC,CAOrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAa,MAAM,KAAG,MAAwC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAO7B,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAEvG,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAA+C,EAAE,CAAC;IAC5F,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAChD,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO;QACN,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC;QACzC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE;KAC3C,CAAC;AAAA,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,OAAe,EACQ,EAAE,CAAC;IAC1B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,OAAO,EAAE,WAAW,EAAE,EAAO,EAAE,IAAI,EAAE,CAAC;IACvC,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IACjC,OAAO,EAAE,WAAW,EAAE,CAAC,MAAM,IAAI,EAAE,CAAM,EAAE,IAAI,EAAE,CAAC;AAAA,CAClD,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC","sourcesContent":["import { parse } from \"yaml\";\n\ntype ParsedFrontmatter<T extends Record<string, unknown>> = {\n\tfrontmatter: T;\n\tbody: string;\n};\n\nconst normalizeNewlines = (value: string): string => value.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\nconst extractFrontmatter = (content: string): { yamlString: string | null; body: string } => {\n\tconst normalized = normalizeNewlines(content);\n\n\tif (!normalized.startsWith(\"---\")) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\tif (endIndex === -1) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\treturn {\n\t\tyamlString: normalized.slice(4, endIndex),\n\t\tbody: normalized.slice(endIndex + 4).trim(),\n\t};\n};\n\nexport const parseFrontmatter = <T extends Record<string, unknown> = Record<string, unknown>>(\n\tcontent: string,\n): ParsedFrontmatter<T> => {\n\tconst { yamlString, body } = extractFrontmatter(content);\n\tif (!yamlString) {\n\t\treturn { frontmatter: {} as T, body };\n\t}\n\tconst parsed = parse(yamlString);\n\treturn { frontmatter: (parsed ?? {}) as T, body };\n};\n\nexport const stripFrontmatter = (content: string): string => parseFrontmatter(content).body;\n"]}
1
+ {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAO7B,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAEvG,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAA+C,EAAE;IAC3F,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAChD,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO;QACN,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC;QACzC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE;KAC3C,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,OAAe,EACQ,EAAE;IACzB,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,OAAO,EAAE,WAAW,EAAE,EAAO,EAAE,IAAI,EAAE,CAAC;IACvC,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IACjC,OAAO,EAAE,WAAW,EAAE,CAAC,MAAM,IAAI,EAAE,CAAM,EAAE,IAAI,EAAE,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC","sourcesContent":["import { parse } from \"yaml\";\n\ntype ParsedFrontmatter<T extends Record<string, unknown>> = {\n\tfrontmatter: T;\n\tbody: string;\n};\n\nconst normalizeNewlines = (value: string): string => value.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\nconst extractFrontmatter = (content: string): { yamlString: string | null; body: string } => {\n\tconst normalized = normalizeNewlines(content);\n\n\tif (!normalized.startsWith(\"---\")) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\tif (endIndex === -1) {\n\t\treturn { yamlString: null, body: normalized };\n\t}\n\n\treturn {\n\t\tyamlString: normalized.slice(4, endIndex),\n\t\tbody: normalized.slice(endIndex + 4).trim(),\n\t};\n};\n\nexport const parseFrontmatter = <T extends Record<string, unknown> = Record<string, unknown>>(\n\tcontent: string,\n): ParsedFrontmatter<T> => {\n\tconst { yamlString, body } = extractFrontmatter(content);\n\tif (!yamlString) {\n\t\treturn { frontmatter: {} as T, body };\n\t}\n\tconst parsed = parse(yamlString);\n\treturn { frontmatter: (parsed ?? {}) as T, body };\n};\n\nexport const stripFrontmatter = (content: string): string => parseFrontmatter(content).body;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fs-watch.d.ts","sourceRoot":"","sources":["../../src/utils/fs-watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAgB,KAAK,aAAa,EAAS,MAAM,SAAS,CAAC;AAElF,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAUxE;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,EAC/B,OAAO,EAAE,MAAM,IAAI,GACjB,SAAS,GAAG,IAAI,CASlB","sourcesContent":["import { type FSWatcher, realpathSync, type WatchListener, watch } from \"node:fs\";\n\nexport const FS_WATCH_RETRY_DELAY_MS = 5000;\n\nexport function closeWatcher(watcher: FSWatcher | null | undefined): void {\n\tif (!watcher) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\twatcher.close();\n\t} catch {\n\t\t// Ignore watcher close errors\n\t}\n}\n\n/**\n * Resolve a watch target to its canonical (long-form, symlink-free) path before handing it to\n * fs.watch. On Windows, libuv's fs-event backend hard-aborts the process\n * (`Assertion failed: !_wcsnicmp(filename, dir, dirlen), file src\\win\\fs-event.c, line 72`) when\n * the watched directory is referenced via a non-canonical alias -- most commonly an 8.3 short\n * path (e.g. `C:\\Users\\RUNNER~1\\...`) -- because ReadDirectoryChangesW resolves events against the\n * long-form name and libuv's internal prefix comparison then mismatches. `realpathSync.native`\n * fails closed to the original path (directory not created yet, permissions, etc.) rather than\n * throwing, since a best-effort watch on the given path is strictly better than none.\n */\nexport function canonicalizeWatchDir(path: string): string {\n\ttry {\n\t\treturn realpathSync.native(path);\n\t} catch {\n\t\treturn path;\n\t}\n}\n\nexport function watchWithErrorHandler(\n\tpath: string,\n\tlistener: WatchListener<string>,\n\tonError: () => void,\n): FSWatcher | null {\n\ttry {\n\t\tconst watcher = watch(canonicalizeWatchDir(path), listener);\n\t\twatcher.on(\"error\", onError);\n\t\treturn watcher;\n\t} catch {\n\t\tonError();\n\t\treturn null;\n\t}\n}\n"]}
1
+ {"version":3,"file":"fs-watch.d.ts","sourceRoot":"","sources":["../../src/utils/fs-watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAgB,KAAK,aAAa,EAAS,MAAM,SAAS,CAAC;AAElF,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAUxE;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,EAC/B,OAAO,EAAE,MAAM,IAAI,GACjB,SAAS,GAAG,IAAI,CASlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"fs-watch.js","sourceRoot":"","sources":["../../src/utils/fs-watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAsB,KAAK,EAAE,MAAM,SAAS,CAAC;AAElF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,MAAM,UAAU,YAAY,CAAC,OAAqC,EAAQ;IACzE,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO;IACR,CAAC;IAED,IAAI,CAAC;QACJ,OAAO,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACR,8BAA8B;IAC/B,CAAC;AAAA,CACD;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAU;IAC1D,IAAI,CAAC;QACJ,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AAAA,CACD;AAED,MAAM,UAAU,qBAAqB,CACpC,IAAY,EACZ,QAA+B,EAC/B,OAAmB,EACA;IACnB,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC5D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACb,CAAC;AAAA,CACD","sourcesContent":["import { type FSWatcher, realpathSync, type WatchListener, watch } from \"node:fs\";\n\nexport const FS_WATCH_RETRY_DELAY_MS = 5000;\n\nexport function closeWatcher(watcher: FSWatcher | null | undefined): void {\n\tif (!watcher) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\twatcher.close();\n\t} catch {\n\t\t// Ignore watcher close errors\n\t}\n}\n\n/**\n * Resolve a watch target to its canonical (long-form, symlink-free) path before handing it to\n * fs.watch. On Windows, libuv's fs-event backend hard-aborts the process\n * (`Assertion failed: !_wcsnicmp(filename, dir, dirlen), file src\\win\\fs-event.c, line 72`) when\n * the watched directory is referenced via a non-canonical alias -- most commonly an 8.3 short\n * path (e.g. `C:\\Users\\RUNNER~1\\...`) -- because ReadDirectoryChangesW resolves events against the\n * long-form name and libuv's internal prefix comparison then mismatches. `realpathSync.native`\n * fails closed to the original path (directory not created yet, permissions, etc.) rather than\n * throwing, since a best-effort watch on the given path is strictly better than none.\n */\nexport function canonicalizeWatchDir(path: string): string {\n\ttry {\n\t\treturn realpathSync.native(path);\n\t} catch {\n\t\treturn path;\n\t}\n}\n\nexport function watchWithErrorHandler(\n\tpath: string,\n\tlistener: WatchListener<string>,\n\tonError: () => void,\n): FSWatcher | null {\n\ttry {\n\t\tconst watcher = watch(canonicalizeWatchDir(path), listener);\n\t\twatcher.on(\"error\", onError);\n\t\treturn watcher;\n\t} catch {\n\t\tonError();\n\t\treturn null;\n\t}\n}\n"]}
1
+ {"version":3,"file":"fs-watch.js","sourceRoot":"","sources":["../../src/utils/fs-watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAsB,KAAK,EAAE,MAAM,SAAS,CAAC;AAElF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,MAAM,UAAU,YAAY,CAAC,OAAqC;IACjE,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO;IACR,CAAC;IAED,IAAI,CAAC;QACJ,OAAO,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACR,8BAA8B;IAC/B,CAAC;AACF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAChD,IAAI,CAAC;QACJ,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,IAAY,EACZ,QAA+B,EAC/B,OAAmB;IAEnB,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC5D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import { type FSWatcher, realpathSync, type WatchListener, watch } from \"node:fs\";\n\nexport const FS_WATCH_RETRY_DELAY_MS = 5000;\n\nexport function closeWatcher(watcher: FSWatcher | null | undefined): void {\n\tif (!watcher) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\twatcher.close();\n\t} catch {\n\t\t// Ignore watcher close errors\n\t}\n}\n\n/**\n * Resolve a watch target to its canonical (long-form, symlink-free) path before handing it to\n * fs.watch. On Windows, libuv's fs-event backend hard-aborts the process\n * (`Assertion failed: !_wcsnicmp(filename, dir, dirlen), file src\\win\\fs-event.c, line 72`) when\n * the watched directory is referenced via a non-canonical alias -- most commonly an 8.3 short\n * path (e.g. `C:\\Users\\RUNNER~1\\...`) -- because ReadDirectoryChangesW resolves events against the\n * long-form name and libuv's internal prefix comparison then mismatches. `realpathSync.native`\n * fails closed to the original path (directory not created yet, permissions, etc.) rather than\n * throwing, since a best-effort watch on the given path is strictly better than none.\n */\nexport function canonicalizeWatchDir(path: string): string {\n\ttry {\n\t\treturn realpathSync.native(path);\n\t} catch {\n\t\treturn path;\n\t}\n}\n\nexport function watchWithErrorHandler(\n\tpath: string,\n\tlistener: WatchListener<string>,\n\tonError: () => void,\n): FSWatcher | null {\n\ttry {\n\t\tconst watcher = watch(canonicalizeWatchDir(path), listener);\n\t\twatcher.on(\"error\", onError);\n\t\treturn watcher;\n\t} catch {\n\t\tonError();\n\t\treturn null;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,mCAAmC;IACnC,IAAI,EAAE,KAAK,CAAC;IACZ,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC;AAkJF;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAsD5D","sourcesContent":["import hostedGitInfo from \"hosted-git-info\";\n\n/**\n * Parsed git URL information.\n */\nexport type GitSource = {\n\t/** Always \"git\" for git sources */\n\ttype: \"git\";\n\t/** Clone URL (always valid for git clone, without ref suffix) */\n\trepo: string;\n\t/** Git host domain (e.g., \"github.com\") */\n\thost: string;\n\t/** Repository path (e.g., \"user/repo\") */\n\tpath: string;\n\t/** Git ref (branch, tag, commit) if specified */\n\tref?: string;\n\t/** True if ref was specified (package won't be auto-updated) */\n\tpinned: boolean;\n};\n\nfunction splitRef(url: string): { repo: string; ref?: string } {\n\tconst scpLikeMatch = url.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\tconst pathWithMaybeRef = scpLikeMatch[2] ?? \"\";\n\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\tif (refSeparator < 0) return { repo: url };\n\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\tif (!repoPath || !ref) return { repo: url };\n\t\treturn {\n\t\t\trepo: `git@${scpLikeMatch[1] ?? \"\"}:${repoPath}`,\n\t\t\tref,\n\t\t};\n\t}\n\n\tif (url.includes(\"://\")) {\n\t\ttry {\n\t\t\tconst parsed = new URL(url);\n\t\t\tconst pathWithMaybeRef = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\t\tif (refSeparator < 0) return { repo: url };\n\t\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\t\tif (!repoPath || !ref) return { repo: url };\n\t\t\tparsed.pathname = `/${repoPath}`;\n\t\t\treturn {\n\t\t\t\trepo: parsed.toString().replace(/\\/$/, \"\"),\n\t\t\t\tref,\n\t\t\t};\n\t\t} catch {\n\t\t\treturn { repo: url };\n\t\t}\n\t}\n\n\tconst slashIndex = url.indexOf(\"/\");\n\tif (slashIndex < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst host = url.slice(0, slashIndex);\n\tconst pathWithMaybeRef = url.slice(slashIndex + 1);\n\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\tif (refSeparator < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\tif (!repoPath || !ref) {\n\t\treturn { repo: url };\n\t}\n\treturn {\n\t\trepo: `${host}/${repoPath}`,\n\t\tref,\n\t};\n}\n\nfunction decodeForValidation(value: string): string | null {\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction hasUnsafeGitInstallPart(value: string, allowSlash: boolean): boolean {\n\tconst decoded = decodeForValidation(value);\n\tif (decoded === null) {\n\t\treturn true;\n\t}\n\tconst candidates = [value, decoded];\n\tfor (const candidate of candidates) {\n\t\tif (candidate.includes(\"\\0\") || candidate.includes(\"\\\\\") || candidate.startsWith(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!allowSlash && candidate.includes(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (candidate.split(\"/\").includes(\"..\")) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction buildGitSource(args: { repo: string; host: string; path: string; ref?: string }): GitSource | null {\n\tif (args.path.startsWith(\"/\")) {\n\t\treturn null;\n\t}\n\tconst normalizedPath = args.path.replace(/\\.git$/, \"\").replace(/^\\/+/, \"\");\n\tif (!args.host || !normalizedPath || normalizedPath.split(\"/\").length < 2) {\n\t\treturn null;\n\t}\n\tif (hasUnsafeGitInstallPart(args.host, false) || hasUnsafeGitInstallPart(normalizedPath, true)) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\ttype: \"git\",\n\t\trepo: args.repo,\n\t\thost: args.host,\n\t\tpath: normalizedPath,\n\t\tref: args.ref,\n\t\tpinned: Boolean(args.ref),\n\t};\n}\n\nfunction parseGenericGitUrl(url: string): GitSource | null {\n\tconst { repo: repoWithoutRef, ref } = splitRef(url);\n\tlet repo = repoWithoutRef;\n\tlet host = \"\";\n\tlet path = \"\";\n\n\tconst scpLikeMatch = repoWithoutRef.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\thost = scpLikeMatch[1] ?? \"\";\n\t\tpath = scpLikeMatch[2] ?? \"\";\n\t} else if (\n\t\trepoWithoutRef.startsWith(\"https://\") ||\n\t\trepoWithoutRef.startsWith(\"http://\") ||\n\t\trepoWithoutRef.startsWith(\"ssh://\") ||\n\t\trepoWithoutRef.startsWith(\"git://\")\n\t) {\n\t\ttry {\n\t\t\tconst parsed = new URL(repoWithoutRef);\n\t\t\thost = parsed.hostname;\n\t\t\tpath = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t} else {\n\t\tconst slashIndex = repoWithoutRef.indexOf(\"/\");\n\t\tif (slashIndex < 0) {\n\t\t\treturn null;\n\t\t}\n\t\thost = repoWithoutRef.slice(0, slashIndex);\n\t\tpath = repoWithoutRef.slice(slashIndex + 1);\n\t\tif (!host.includes(\".\") && host !== \"localhost\") {\n\t\t\treturn null;\n\t\t}\n\t\trepo = `https://${repoWithoutRef}`;\n\t}\n\n\treturn buildGitSource({ repo, host, path, ref });\n}\n\n/**\n * Parse git source into a GitSource.\n *\n * Rules:\n * - With git: prefix, accept all historical shorthand forms.\n * - Without git: prefix, only accept explicit protocol URLs.\n */\nexport function parseGitUrl(source: string): GitSource | null {\n\tconst trimmed = source.trim();\n\tconst hasGitPrefix = trimmed.startsWith(\"git:\");\n\tconst url = hasGitPrefix ? trimmed.slice(4).trim() : trimmed;\n\n\tif (!hasGitPrefix && !/^(https?|ssh|git):\\/\\//i.test(url)) {\n\t\treturn null;\n\t}\n\n\tconst split = splitRef(url);\n\n\tconst hostedCandidates = [split.ref ? `${split.repo}#${split.ref}` : undefined, url].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of hostedCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst useHttpsPrefix =\n\t\t\t\t!split.repo.startsWith(\"http://\") &&\n\t\t\t\t!split.repo.startsWith(\"https://\") &&\n\t\t\t\t!split.repo.startsWith(\"ssh://\") &&\n\t\t\t\t!split.repo.startsWith(\"git://\") &&\n\t\t\t\t!split.repo.startsWith(\"git@\");\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: useHttpsPrefix ? `https://${split.repo}` : split.repo,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\tconst httpsCandidates = [split.ref ? `https://${split.repo}#${split.ref}` : undefined, `https://${url}`].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of httpsCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: `https://${split.repo}`,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn parseGenericGitUrl(url);\n}\n"]}
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,mCAAmC;IACnC,IAAI,EAAE,KAAK,CAAC;IACZ,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC;AA2IF;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAsD5D"}
package/dist/utils/git.js CHANGED
@@ -1,35 +1,33 @@
1
1
  import hostedGitInfo from "hosted-git-info";
2
+ function splitPathRef(pathWithMaybeRef) {
3
+ const refSeparator = pathWithMaybeRef.indexOf("@");
4
+ if (refSeparator < 0)
5
+ return undefined;
6
+ const path = pathWithMaybeRef.slice(0, refSeparator);
7
+ const ref = pathWithMaybeRef.slice(refSeparator + 1);
8
+ return path && ref ? { path, ref } : undefined;
9
+ }
2
10
  function splitRef(url) {
3
11
  const scpLikeMatch = url.match(/^git@([^:]+):(.+)$/);
4
12
  if (scpLikeMatch) {
5
- const pathWithMaybeRef = scpLikeMatch[2] ?? "";
6
- const refSeparator = pathWithMaybeRef.indexOf("@");
7
- if (refSeparator < 0)
8
- return { repo: url };
9
- const repoPath = pathWithMaybeRef.slice(0, refSeparator);
10
- const ref = pathWithMaybeRef.slice(refSeparator + 1);
11
- if (!repoPath || !ref)
13
+ const split = splitPathRef(scpLikeMatch[2] ?? "");
14
+ if (!split)
12
15
  return { repo: url };
13
16
  return {
14
- repo: `git@${scpLikeMatch[1] ?? ""}:${repoPath}`,
15
- ref,
17
+ repo: `git@${scpLikeMatch[1] ?? ""}:${split.path}`,
18
+ ref: split.ref,
16
19
  };
17
20
  }
18
21
  if (url.includes("://")) {
19
22
  try {
20
23
  const parsed = new URL(url);
21
- const pathWithMaybeRef = parsed.pathname.replace(/^\/+/, "");
22
- const refSeparator = pathWithMaybeRef.indexOf("@");
23
- if (refSeparator < 0)
24
- return { repo: url };
25
- const repoPath = pathWithMaybeRef.slice(0, refSeparator);
26
- const ref = pathWithMaybeRef.slice(refSeparator + 1);
27
- if (!repoPath || !ref)
24
+ const split = splitPathRef(parsed.pathname.replace(/^\/+/, ""));
25
+ if (!split)
28
26
  return { repo: url };
29
- parsed.pathname = `/${repoPath}`;
27
+ parsed.pathname = `/${split.path}`;
30
28
  return {
31
29
  repo: parsed.toString().replace(/\/$/, ""),
32
- ref,
30
+ ref: split.ref,
33
31
  };
34
32
  }
35
33
  catch {
@@ -42,18 +40,12 @@ function splitRef(url) {
42
40
  }
43
41
  const host = url.slice(0, slashIndex);
44
42
  const pathWithMaybeRef = url.slice(slashIndex + 1);
45
- const refSeparator = pathWithMaybeRef.indexOf("@");
46
- if (refSeparator < 0) {
43
+ const split = splitPathRef(pathWithMaybeRef);
44
+ if (!split)
47
45
  return { repo: url };
48
- }
49
- const repoPath = pathWithMaybeRef.slice(0, refSeparator);
50
- const ref = pathWithMaybeRef.slice(refSeparator + 1);
51
- if (!repoPath || !ref) {
52
- return { repo: url };
53
- }
54
46
  return {
55
- repo: `${host}/${repoPath}`,
56
- ref,
47
+ repo: `${host}/${split.path}`,
48
+ ref: split.ref,
57
49
  };
58
50
  }
59
51
  function decodeForValidation(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAoB5C,SAAS,QAAQ,CAAC,GAAW,EAAkC;IAC9D,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACrD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,gBAAgB,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/C,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,YAAY,GAAG,CAAC;YAAE,OAAO,EAAE,IAAI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,CAC9G,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAC1C,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,IAAI,EAAE,CAAC;YACV,IAAI,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC9C,SAAS;YACV,CAAC;YACD,OAAO,cAAc,CAAC;gBACrB,IAAI,EAAE,WAAW,KAAK,CAAC,IAAI,EAAE;gBAC7B,IAAI,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;gBACvB,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;gBACpC,GAAG,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,IAAI,SAAS;aAC9C,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAAA,CAC/B","sourcesContent":["import hostedGitInfo from \"hosted-git-info\";\n\n/**\n * Parsed git URL information.\n */\nexport type GitSource = {\n\t/** Always \"git\" for git sources */\n\ttype: \"git\";\n\t/** Clone URL (always valid for git clone, without ref suffix) */\n\trepo: string;\n\t/** Git host domain (e.g., \"github.com\") */\n\thost: string;\n\t/** Repository path (e.g., \"user/repo\") */\n\tpath: string;\n\t/** Git ref (branch, tag, commit) if specified */\n\tref?: string;\n\t/** True if ref was specified (package won't be auto-updated) */\n\tpinned: boolean;\n};\n\nfunction splitRef(url: string): { repo: string; ref?: string } {\n\tconst scpLikeMatch = url.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\tconst pathWithMaybeRef = scpLikeMatch[2] ?? \"\";\n\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\tif (refSeparator < 0) return { repo: url };\n\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\tif (!repoPath || !ref) return { repo: url };\n\t\treturn {\n\t\t\trepo: `git@${scpLikeMatch[1] ?? \"\"}:${repoPath}`,\n\t\t\tref,\n\t\t};\n\t}\n\n\tif (url.includes(\"://\")) {\n\t\ttry {\n\t\t\tconst parsed = new URL(url);\n\t\t\tconst pathWithMaybeRef = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\t\tif (refSeparator < 0) return { repo: url };\n\t\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\t\tif (!repoPath || !ref) return { repo: url };\n\t\t\tparsed.pathname = `/${repoPath}`;\n\t\t\treturn {\n\t\t\t\trepo: parsed.toString().replace(/\\/$/, \"\"),\n\t\t\t\tref,\n\t\t\t};\n\t\t} catch {\n\t\t\treturn { repo: url };\n\t\t}\n\t}\n\n\tconst slashIndex = url.indexOf(\"/\");\n\tif (slashIndex < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst host = url.slice(0, slashIndex);\n\tconst pathWithMaybeRef = url.slice(slashIndex + 1);\n\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\tif (refSeparator < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\tif (!repoPath || !ref) {\n\t\treturn { repo: url };\n\t}\n\treturn {\n\t\trepo: `${host}/${repoPath}`,\n\t\tref,\n\t};\n}\n\nfunction decodeForValidation(value: string): string | null {\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction hasUnsafeGitInstallPart(value: string, allowSlash: boolean): boolean {\n\tconst decoded = decodeForValidation(value);\n\tif (decoded === null) {\n\t\treturn true;\n\t}\n\tconst candidates = [value, decoded];\n\tfor (const candidate of candidates) {\n\t\tif (candidate.includes(\"\\0\") || candidate.includes(\"\\\\\") || candidate.startsWith(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!allowSlash && candidate.includes(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (candidate.split(\"/\").includes(\"..\")) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction buildGitSource(args: { repo: string; host: string; path: string; ref?: string }): GitSource | null {\n\tif (args.path.startsWith(\"/\")) {\n\t\treturn null;\n\t}\n\tconst normalizedPath = args.path.replace(/\\.git$/, \"\").replace(/^\\/+/, \"\");\n\tif (!args.host || !normalizedPath || normalizedPath.split(\"/\").length < 2) {\n\t\treturn null;\n\t}\n\tif (hasUnsafeGitInstallPart(args.host, false) || hasUnsafeGitInstallPart(normalizedPath, true)) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\ttype: \"git\",\n\t\trepo: args.repo,\n\t\thost: args.host,\n\t\tpath: normalizedPath,\n\t\tref: args.ref,\n\t\tpinned: Boolean(args.ref),\n\t};\n}\n\nfunction parseGenericGitUrl(url: string): GitSource | null {\n\tconst { repo: repoWithoutRef, ref } = splitRef(url);\n\tlet repo = repoWithoutRef;\n\tlet host = \"\";\n\tlet path = \"\";\n\n\tconst scpLikeMatch = repoWithoutRef.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\thost = scpLikeMatch[1] ?? \"\";\n\t\tpath = scpLikeMatch[2] ?? \"\";\n\t} else if (\n\t\trepoWithoutRef.startsWith(\"https://\") ||\n\t\trepoWithoutRef.startsWith(\"http://\") ||\n\t\trepoWithoutRef.startsWith(\"ssh://\") ||\n\t\trepoWithoutRef.startsWith(\"git://\")\n\t) {\n\t\ttry {\n\t\t\tconst parsed = new URL(repoWithoutRef);\n\t\t\thost = parsed.hostname;\n\t\t\tpath = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t} else {\n\t\tconst slashIndex = repoWithoutRef.indexOf(\"/\");\n\t\tif (slashIndex < 0) {\n\t\t\treturn null;\n\t\t}\n\t\thost = repoWithoutRef.slice(0, slashIndex);\n\t\tpath = repoWithoutRef.slice(slashIndex + 1);\n\t\tif (!host.includes(\".\") && host !== \"localhost\") {\n\t\t\treturn null;\n\t\t}\n\t\trepo = `https://${repoWithoutRef}`;\n\t}\n\n\treturn buildGitSource({ repo, host, path, ref });\n}\n\n/**\n * Parse git source into a GitSource.\n *\n * Rules:\n * - With git: prefix, accept all historical shorthand forms.\n * - Without git: prefix, only accept explicit protocol URLs.\n */\nexport function parseGitUrl(source: string): GitSource | null {\n\tconst trimmed = source.trim();\n\tconst hasGitPrefix = trimmed.startsWith(\"git:\");\n\tconst url = hasGitPrefix ? trimmed.slice(4).trim() : trimmed;\n\n\tif (!hasGitPrefix && !/^(https?|ssh|git):\\/\\//i.test(url)) {\n\t\treturn null;\n\t}\n\n\tconst split = splitRef(url);\n\n\tconst hostedCandidates = [split.ref ? `${split.repo}#${split.ref}` : undefined, url].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of hostedCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst useHttpsPrefix =\n\t\t\t\t!split.repo.startsWith(\"http://\") &&\n\t\t\t\t!split.repo.startsWith(\"https://\") &&\n\t\t\t\t!split.repo.startsWith(\"ssh://\") &&\n\t\t\t\t!split.repo.startsWith(\"git://\") &&\n\t\t\t\t!split.repo.startsWith(\"git@\");\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: useHttpsPrefix ? `https://${split.repo}` : split.repo,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\tconst httpsCandidates = [split.ref ? `https://${split.repo}#${split.ref}` : undefined, `https://${url}`].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of httpsCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: `https://${split.repo}`,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn parseGenericGitUrl(url);\n}\n"]}
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAoB5C,SAAS,YAAY,CAAC,gBAAwB;IAC7C,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,YAAY,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;IACrD,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC5B,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACrD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC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Source = {\n\t/** Always \"git\" for git sources */\n\ttype: \"git\";\n\t/** Clone URL (always valid for git clone, without ref suffix) */\n\trepo: string;\n\t/** Git host domain (e.g., \"github.com\") */\n\thost: string;\n\t/** Repository path (e.g., \"user/repo\") */\n\tpath: string;\n\t/** Git ref (branch, tag, commit) if specified */\n\tref?: string;\n\t/** True if ref was specified (package won't be auto-updated) */\n\tpinned: boolean;\n};\n\nfunction splitPathRef(pathWithMaybeRef: string): { path: string; ref: string } | undefined {\n\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\tif (refSeparator < 0) return undefined;\n\tconst path = pathWithMaybeRef.slice(0, refSeparator);\n\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\treturn path && ref ? { path, ref } : undefined;\n}\n\nfunction splitRef(url: string): { repo: string; ref?: string } {\n\tconst scpLikeMatch = url.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\tconst split = splitPathRef(scpLikeMatch[2] ?? \"\");\n\t\tif (!split) return { repo: url };\n\t\treturn {\n\t\t\trepo: `git@${scpLikeMatch[1] ?? \"\"}:${split.path}`,\n\t\t\tref: split.ref,\n\t\t};\n\t}\n\n\tif (url.includes(\"://\")) {\n\t\ttry {\n\t\t\tconst parsed = new URL(url);\n\t\t\tconst split = splitPathRef(parsed.pathname.replace(/^\\/+/, \"\"));\n\t\t\tif (!split) return { repo: url };\n\t\t\tparsed.pathname = `/${split.path}`;\n\t\t\treturn {\n\t\t\t\trepo: parsed.toString().replace(/\\/$/, \"\"),\n\t\t\t\tref: split.ref,\n\t\t\t};\n\t\t} catch {\n\t\t\treturn { repo: url };\n\t\t}\n\t}\n\n\tconst slashIndex = url.indexOf(\"/\");\n\tif (slashIndex < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst host = url.slice(0, slashIndex);\n\tconst pathWithMaybeRef = url.slice(slashIndex + 1);\n\tconst split = splitPathRef(pathWithMaybeRef);\n\tif (!split) return { repo: url };\n\treturn {\n\t\trepo: `${host}/${split.path}`,\n\t\tref: split.ref,\n\t};\n}\n\nfunction decodeForValidation(value: string): string | null {\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction hasUnsafeGitInstallPart(value: string, allowSlash: boolean): boolean {\n\tconst decoded = decodeForValidation(value);\n\tif (decoded === null) {\n\t\treturn true;\n\t}\n\tconst candidates = [value, decoded];\n\tfor (const candidate of candidates) {\n\t\tif (candidate.includes(\"\\0\") || candidate.includes(\"\\\\\") || candidate.startsWith(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!allowSlash && candidate.includes(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (candidate.split(\"/\").includes(\"..\")) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction buildGitSource(args: { repo: string; host: string; path: string; ref?: string }): GitSource | null {\n\tif (args.path.startsWith(\"/\")) {\n\t\treturn null;\n\t}\n\tconst normalizedPath = args.path.replace(/\\.git$/, \"\").replace(/^\\/+/, \"\");\n\tif (!args.host || !normalizedPath || normalizedPath.split(\"/\").length < 2) {\n\t\treturn null;\n\t}\n\tif (hasUnsafeGitInstallPart(args.host, false) || hasUnsafeGitInstallPart(normalizedPath, true)) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\ttype: \"git\",\n\t\trepo: args.repo,\n\t\thost: args.host,\n\t\tpath: normalizedPath,\n\t\tref: args.ref,\n\t\tpinned: Boolean(args.ref),\n\t};\n}\n\nfunction parseGenericGitUrl(url: string): GitSource | null {\n\tconst { repo: repoWithoutRef, ref } = splitRef(url);\n\tlet repo = repoWithoutRef;\n\tlet host = \"\";\n\tlet path = \"\";\n\n\tconst scpLikeMatch = repoWithoutRef.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\thost = scpLikeMatch[1] ?? \"\";\n\t\tpath = scpLikeMatch[2] ?? \"\";\n\t} else if (\n\t\trepoWithoutRef.startsWith(\"https://\") ||\n\t\trepoWithoutRef.startsWith(\"http://\") ||\n\t\trepoWithoutRef.startsWith(\"ssh://\") ||\n\t\trepoWithoutRef.startsWith(\"git://\")\n\t) {\n\t\ttry {\n\t\t\tconst parsed = new URL(repoWithoutRef);\n\t\t\thost = parsed.hostname;\n\t\t\tpath = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t} else {\n\t\tconst slashIndex = repoWithoutRef.indexOf(\"/\");\n\t\tif (slashIndex < 0) {\n\t\t\treturn null;\n\t\t}\n\t\thost = repoWithoutRef.slice(0, slashIndex);\n\t\tpath = repoWithoutRef.slice(slashIndex + 1);\n\t\tif (!host.includes(\".\") && host !== \"localhost\") {\n\t\t\treturn null;\n\t\t}\n\t\trepo = `https://${repoWithoutRef}`;\n\t}\n\n\treturn buildGitSource({ repo, host, path, ref });\n}\n\n/**\n * Parse git source into a GitSource.\n *\n * Rules:\n * - With git: prefix, accept all historical shorthand forms.\n * - Without git: prefix, only accept explicit protocol URLs.\n */\nexport function parseGitUrl(source: string): GitSource | null {\n\tconst trimmed = source.trim();\n\tconst hasGitPrefix = trimmed.startsWith(\"git:\");\n\tconst url = hasGitPrefix ? trimmed.slice(4).trim() : trimmed;\n\n\tif (!hasGitPrefix && !/^(https?|ssh|git):\\/\\//i.test(url)) {\n\t\treturn null;\n\t}\n\n\tconst split = splitRef(url);\n\n\tconst hostedCandidates = [split.ref ? `${split.repo}#${split.ref}` : undefined, url].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of hostedCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst useHttpsPrefix =\n\t\t\t\t!split.repo.startsWith(\"http://\") &&\n\t\t\t\t!split.repo.startsWith(\"https://\") &&\n\t\t\t\t!split.repo.startsWith(\"ssh://\") &&\n\t\t\t\t!split.repo.startsWith(\"git://\") &&\n\t\t\t\t!split.repo.startsWith(\"git@\");\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: useHttpsPrefix ? `https://${split.repo}` : split.repo,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\tconst httpsCandidates = [split.ref ? `https://${split.repo}#${split.ref}` : undefined, `https://${url}`].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of httpsCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: `https://${split.repo}`,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn parseGenericGitUrl(url);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"highlight-js-languages.d.ts","sourceRoot":"","sources":["../../src/utils/highlight-js-languages.ts"],"names":[],"mappings":"AAwMA,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;AAG7D,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAgM1E,CAAC;AAKF,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgL7D,CAAC","sourcesContent":["// GENERATED. Do not hand-edit.\n// Static per-language highlight.js module map, enabling register-on-first-use\n// instead of eagerly registering all languages via highlight.js/lib/index.js.\n// It also carries the alias table below, derived from highlight.js/lib/index.js's\n// registration data (including its alias-collision registration order).\n// Regenerate: re-derive from the installed highlight.js/lib/languages/*.js modules\n// and highlight.js/lib/index.js's registration order.\n\nimport _1cLang from \"highlight.js/lib/languages/1c.js\";\nimport abnfLang from \"highlight.js/lib/languages/abnf.js\";\nimport accesslogLang from \"highlight.js/lib/languages/accesslog.js\";\nimport actionscriptLang from \"highlight.js/lib/languages/actionscript.js\";\nimport adaLang from \"highlight.js/lib/languages/ada.js\";\nimport angelscriptLang from \"highlight.js/lib/languages/angelscript.js\";\nimport apacheLang from \"highlight.js/lib/languages/apache.js\";\nimport applescriptLang from \"highlight.js/lib/languages/applescript.js\";\nimport arcadeLang from \"highlight.js/lib/languages/arcade.js\";\nimport arduinoLang from \"highlight.js/lib/languages/arduino.js\";\nimport armasmLang from \"highlight.js/lib/languages/armasm.js\";\nimport asciidocLang from \"highlight.js/lib/languages/asciidoc.js\";\nimport aspectjLang from \"highlight.js/lib/languages/aspectj.js\";\nimport autohotkeyLang from \"highlight.js/lib/languages/autohotkey.js\";\nimport autoitLang from \"highlight.js/lib/languages/autoit.js\";\nimport avrasmLang from \"highlight.js/lib/languages/avrasm.js\";\nimport awkLang from \"highlight.js/lib/languages/awk.js\";\nimport axaptaLang from \"highlight.js/lib/languages/axapta.js\";\nimport bashLang from \"highlight.js/lib/languages/bash.js\";\nimport basicLang from \"highlight.js/lib/languages/basic.js\";\nimport bnfLang from \"highlight.js/lib/languages/bnf.js\";\nimport brainfuckLang from \"highlight.js/lib/languages/brainfuck.js\";\nimport cLang from \"highlight.js/lib/languages/c.js\";\nimport c_likeLang from \"highlight.js/lib/languages/c-like.js\";\nimport calLang from \"highlight.js/lib/languages/cal.js\";\nimport capnprotoLang from \"highlight.js/lib/languages/capnproto.js\";\nimport ceylonLang from \"highlight.js/lib/languages/ceylon.js\";\nimport cleanLang from \"highlight.js/lib/languages/clean.js\";\nimport clojureLang from \"highlight.js/lib/languages/clojure.js\";\nimport clojure_replLang from \"highlight.js/lib/languages/clojure-repl.js\";\nimport cmakeLang from \"highlight.js/lib/languages/cmake.js\";\nimport coffeescriptLang from \"highlight.js/lib/languages/coffeescript.js\";\nimport coqLang from \"highlight.js/lib/languages/coq.js\";\nimport cosLang from \"highlight.js/lib/languages/cos.js\";\nimport cppLang from \"highlight.js/lib/languages/cpp.js\";\nimport crmshLang from \"highlight.js/lib/languages/crmsh.js\";\nimport crystalLang from \"highlight.js/lib/languages/crystal.js\";\nimport csharpLang from \"highlight.js/lib/languages/csharp.js\";\nimport cspLang from \"highlight.js/lib/languages/csp.js\";\nimport cssLang from \"highlight.js/lib/languages/css.js\";\nimport dLang from \"highlight.js/lib/languages/d.js\";\nimport dartLang from \"highlight.js/lib/languages/dart.js\";\nimport delphiLang from \"highlight.js/lib/languages/delphi.js\";\nimport diffLang from \"highlight.js/lib/languages/diff.js\";\nimport djangoLang from \"highlight.js/lib/languages/django.js\";\nimport dnsLang from \"highlight.js/lib/languages/dns.js\";\nimport dockerfileLang from \"highlight.js/lib/languages/dockerfile.js\";\nimport dosLang from \"highlight.js/lib/languages/dos.js\";\nimport dsconfigLang from \"highlight.js/lib/languages/dsconfig.js\";\nimport dtsLang from \"highlight.js/lib/languages/dts.js\";\nimport dustLang from \"highlight.js/lib/languages/dust.js\";\nimport ebnfLang from \"highlight.js/lib/languages/ebnf.js\";\nimport elixirLang from \"highlight.js/lib/languages/elixir.js\";\nimport elmLang from \"highlight.js/lib/languages/elm.js\";\nimport erbLang from \"highlight.js/lib/languages/erb.js\";\nimport erlangLang from \"highlight.js/lib/languages/erlang.js\";\nimport erlang_replLang from \"highlight.js/lib/languages/erlang-repl.js\";\nimport excelLang from \"highlight.js/lib/languages/excel.js\";\nimport fixLang from \"highlight.js/lib/languages/fix.js\";\nimport flixLang from \"highlight.js/lib/languages/flix.js\";\nimport fortranLang from \"highlight.js/lib/languages/fortran.js\";\nimport fsharpLang from \"highlight.js/lib/languages/fsharp.js\";\nimport gamsLang from \"highlight.js/lib/languages/gams.js\";\nimport gaussLang from \"highlight.js/lib/languages/gauss.js\";\nimport gcodeLang from \"highlight.js/lib/languages/gcode.js\";\nimport gherkinLang from \"highlight.js/lib/languages/gherkin.js\";\nimport glslLang from \"highlight.js/lib/languages/glsl.js\";\nimport gmlLang from \"highlight.js/lib/languages/gml.js\";\nimport goLang from \"highlight.js/lib/languages/go.js\";\nimport goloLang from \"highlight.js/lib/languages/golo.js\";\nimport gradleLang from \"highlight.js/lib/languages/gradle.js\";\nimport groovyLang from \"highlight.js/lib/languages/groovy.js\";\nimport hamlLang from \"highlight.js/lib/languages/haml.js\";\nimport handlebarsLang from \"highlight.js/lib/languages/handlebars.js\";\nimport haskellLang from \"highlight.js/lib/languages/haskell.js\";\nimport haxeLang from \"highlight.js/lib/languages/haxe.js\";\nimport hspLang from \"highlight.js/lib/languages/hsp.js\";\nimport htmlbarsLang from \"highlight.js/lib/languages/htmlbars.js\";\nimport httpLang from \"highlight.js/lib/languages/http.js\";\nimport hyLang from \"highlight.js/lib/languages/hy.js\";\nimport inform7Lang from \"highlight.js/lib/languages/inform7.js\";\nimport iniLang from \"highlight.js/lib/languages/ini.js\";\nimport irpf90Lang from \"highlight.js/lib/languages/irpf90.js\";\nimport isblLang from \"highlight.js/lib/languages/isbl.js\";\nimport javaLang from \"highlight.js/lib/languages/java.js\";\nimport javascriptLang from \"highlight.js/lib/languages/javascript.js\";\nimport jboss_cliLang from \"highlight.js/lib/languages/jboss-cli.js\";\nimport jsonLang from \"highlight.js/lib/languages/json.js\";\nimport juliaLang from \"highlight.js/lib/languages/julia.js\";\nimport julia_replLang from \"highlight.js/lib/languages/julia-repl.js\";\nimport kotlinLang from \"highlight.js/lib/languages/kotlin.js\";\nimport lassoLang from \"highlight.js/lib/languages/lasso.js\";\nimport latexLang from \"highlight.js/lib/languages/latex.js\";\nimport ldifLang from \"highlight.js/lib/languages/ldif.js\";\nimport leafLang from \"highlight.js/lib/languages/leaf.js\";\nimport lessLang from \"highlight.js/lib/languages/less.js\";\nimport lispLang from \"highlight.js/lib/languages/lisp.js\";\nimport livecodeserverLang from \"highlight.js/lib/languages/livecodeserver.js\";\nimport livescriptLang from \"highlight.js/lib/languages/livescript.js\";\nimport llvmLang from \"highlight.js/lib/languages/llvm.js\";\nimport lslLang from \"highlight.js/lib/languages/lsl.js\";\nimport luaLang from \"highlight.js/lib/languages/lua.js\";\nimport makefileLang from \"highlight.js/lib/languages/makefile.js\";\nimport markdownLang from \"highlight.js/lib/languages/markdown.js\";\nimport mathematicaLang from \"highlight.js/lib/languages/mathematica.js\";\nimport matlabLang from \"highlight.js/lib/languages/matlab.js\";\nimport maximaLang from \"highlight.js/lib/languages/maxima.js\";\nimport melLang from \"highlight.js/lib/languages/mel.js\";\nimport mercuryLang from \"highlight.js/lib/languages/mercury.js\";\nimport mipsasmLang from \"highlight.js/lib/languages/mipsasm.js\";\nimport mizarLang from \"highlight.js/lib/languages/mizar.js\";\nimport mojoliciousLang from \"highlight.js/lib/languages/mojolicious.js\";\nimport monkeyLang from \"highlight.js/lib/languages/monkey.js\";\nimport moonscriptLang from \"highlight.js/lib/languages/moonscript.js\";\nimport n1qlLang from \"highlight.js/lib/languages/n1ql.js\";\nimport nginxLang from \"highlight.js/lib/languages/nginx.js\";\nimport nimLang from \"highlight.js/lib/languages/nim.js\";\nimport nixLang from \"highlight.js/lib/languages/nix.js\";\nimport node_replLang from \"highlight.js/lib/languages/node-repl.js\";\nimport nsisLang from \"highlight.js/lib/languages/nsis.js\";\nimport objectivecLang from \"highlight.js/lib/languages/objectivec.js\";\nimport ocamlLang from \"highlight.js/lib/languages/ocaml.js\";\nimport openscadLang from \"highlight.js/lib/languages/openscad.js\";\nimport oxygeneLang from \"highlight.js/lib/languages/oxygene.js\";\nimport parser3Lang from \"highlight.js/lib/languages/parser3.js\";\nimport perlLang from \"highlight.js/lib/languages/perl.js\";\nimport pfLang from \"highlight.js/lib/languages/pf.js\";\nimport pgsqlLang from \"highlight.js/lib/languages/pgsql.js\";\nimport phpLang from \"highlight.js/lib/languages/php.js\";\nimport php_templateLang from \"highlight.js/lib/languages/php-template.js\";\nimport plaintextLang from \"highlight.js/lib/languages/plaintext.js\";\nimport ponyLang from \"highlight.js/lib/languages/pony.js\";\nimport powershellLang from \"highlight.js/lib/languages/powershell.js\";\nimport processingLang from \"highlight.js/lib/languages/processing.js\";\nimport profileLang from \"highlight.js/lib/languages/profile.js\";\nimport prologLang from \"highlight.js/lib/languages/prolog.js\";\nimport propertiesLang from \"highlight.js/lib/languages/properties.js\";\nimport protobufLang from \"highlight.js/lib/languages/protobuf.js\";\nimport puppetLang from \"highlight.js/lib/languages/puppet.js\";\nimport purebasicLang from \"highlight.js/lib/languages/purebasic.js\";\nimport pythonLang from \"highlight.js/lib/languages/python.js\";\nimport python_replLang from \"highlight.js/lib/languages/python-repl.js\";\nimport qLang from \"highlight.js/lib/languages/q.js\";\nimport qmlLang from \"highlight.js/lib/languages/qml.js\";\nimport rLang from \"highlight.js/lib/languages/r.js\";\nimport reasonmlLang from \"highlight.js/lib/languages/reasonml.js\";\nimport ribLang from \"highlight.js/lib/languages/rib.js\";\nimport roboconfLang from \"highlight.js/lib/languages/roboconf.js\";\nimport routerosLang from \"highlight.js/lib/languages/routeros.js\";\nimport rslLang from \"highlight.js/lib/languages/rsl.js\";\nimport rubyLang from \"highlight.js/lib/languages/ruby.js\";\nimport ruleslanguageLang from \"highlight.js/lib/languages/ruleslanguage.js\";\nimport rustLang from \"highlight.js/lib/languages/rust.js\";\nimport sasLang from \"highlight.js/lib/languages/sas.js\";\nimport scalaLang from \"highlight.js/lib/languages/scala.js\";\nimport schemeLang from \"highlight.js/lib/languages/scheme.js\";\nimport scilabLang from \"highlight.js/lib/languages/scilab.js\";\nimport scssLang from \"highlight.js/lib/languages/scss.js\";\nimport shellLang from \"highlight.js/lib/languages/shell.js\";\nimport smaliLang from \"highlight.js/lib/languages/smali.js\";\nimport smalltalkLang from \"highlight.js/lib/languages/smalltalk.js\";\nimport smlLang from \"highlight.js/lib/languages/sml.js\";\nimport sqfLang from \"highlight.js/lib/languages/sqf.js\";\nimport sqlLang from \"highlight.js/lib/languages/sql.js\";\nimport sql_moreLang from \"highlight.js/lib/languages/sql_more.js\";\nimport stanLang from \"highlight.js/lib/languages/stan.js\";\nimport stataLang from \"highlight.js/lib/languages/stata.js\";\nimport step21Lang from \"highlight.js/lib/languages/step21.js\";\nimport stylusLang from \"highlight.js/lib/languages/stylus.js\";\nimport subunitLang from \"highlight.js/lib/languages/subunit.js\";\nimport swiftLang from \"highlight.js/lib/languages/swift.js\";\nimport taggerscriptLang from \"highlight.js/lib/languages/taggerscript.js\";\nimport tapLang from \"highlight.js/lib/languages/tap.js\";\nimport tclLang from \"highlight.js/lib/languages/tcl.js\";\nimport thriftLang from \"highlight.js/lib/languages/thrift.js\";\nimport tpLang from \"highlight.js/lib/languages/tp.js\";\nimport twigLang from \"highlight.js/lib/languages/twig.js\";\nimport typescriptLang from \"highlight.js/lib/languages/typescript.js\";\nimport valaLang from \"highlight.js/lib/languages/vala.js\";\nimport vbnetLang from \"highlight.js/lib/languages/vbnet.js\";\nimport vbscriptLang from \"highlight.js/lib/languages/vbscript.js\";\nimport vbscript_htmlLang from \"highlight.js/lib/languages/vbscript-html.js\";\nimport verilogLang from \"highlight.js/lib/languages/verilog.js\";\nimport vhdlLang from \"highlight.js/lib/languages/vhdl.js\";\nimport vimLang from \"highlight.js/lib/languages/vim.js\";\nimport x86asmLang from \"highlight.js/lib/languages/x86asm.js\";\nimport xlLang from \"highlight.js/lib/languages/xl.js\";\nimport xmlLang from \"highlight.js/lib/languages/xml.js\";\nimport xqueryLang from \"highlight.js/lib/languages/xquery.js\";\nimport yamlLang from \"highlight.js/lib/languages/yaml.js\";\nimport zephirLang from \"highlight.js/lib/languages/zephir.js\";\n\nexport type HighlightLanguageFn = (hljs: unknown) => unknown;\n\n// Canonical highlight.js language name -> language definition factory.\nexport const HIGHLIGHT_LANGUAGE_MODULES: Record<string, HighlightLanguageFn> = {\n\t\"1c\": _1cLang,\n\tabnf: abnfLang,\n\taccesslog: accesslogLang,\n\tactionscript: actionscriptLang,\n\tada: adaLang,\n\tangelscript: angelscriptLang,\n\tapache: apacheLang,\n\tapplescript: applescriptLang,\n\tarcade: arcadeLang,\n\tarduino: arduinoLang,\n\tarmasm: armasmLang,\n\txml: xmlLang,\n\tasciidoc: asciidocLang,\n\taspectj: aspectjLang,\n\tautohotkey: autohotkeyLang,\n\tautoit: autoitLang,\n\tavrasm: avrasmLang,\n\tawk: awkLang,\n\taxapta: axaptaLang,\n\tbash: bashLang,\n\tbasic: basicLang,\n\tbnf: bnfLang,\n\tbrainfuck: brainfuckLang,\n\t\"c-like\": c_likeLang,\n\tc: cLang,\n\tcal: calLang,\n\tcapnproto: capnprotoLang,\n\tceylon: ceylonLang,\n\tclean: cleanLang,\n\tclojure: clojureLang,\n\t\"clojure-repl\": clojure_replLang,\n\tcmake: cmakeLang,\n\tcoffeescript: coffeescriptLang,\n\tcoq: coqLang,\n\tcos: cosLang,\n\tcpp: cppLang,\n\tcrmsh: crmshLang,\n\tcrystal: crystalLang,\n\tcsharp: csharpLang,\n\tcsp: cspLang,\n\tcss: cssLang,\n\td: dLang,\n\tmarkdown: markdownLang,\n\tdart: dartLang,\n\tdelphi: delphiLang,\n\tdiff: diffLang,\n\tdjango: djangoLang,\n\tdns: dnsLang,\n\tdockerfile: dockerfileLang,\n\tdos: dosLang,\n\tdsconfig: dsconfigLang,\n\tdts: dtsLang,\n\tdust: dustLang,\n\tebnf: ebnfLang,\n\telixir: elixirLang,\n\telm: elmLang,\n\truby: rubyLang,\n\terb: erbLang,\n\t\"erlang-repl\": erlang_replLang,\n\terlang: erlangLang,\n\texcel: excelLang,\n\tfix: fixLang,\n\tflix: flixLang,\n\tfortran: fortranLang,\n\tfsharp: fsharpLang,\n\tgams: gamsLang,\n\tgauss: gaussLang,\n\tgcode: gcodeLang,\n\tgherkin: gherkinLang,\n\tglsl: glslLang,\n\tgml: gmlLang,\n\tgo: goLang,\n\tgolo: goloLang,\n\tgradle: gradleLang,\n\tgroovy: groovyLang,\n\thaml: hamlLang,\n\thandlebars: handlebarsLang,\n\thaskell: haskellLang,\n\thaxe: haxeLang,\n\thsp: hspLang,\n\thtmlbars: htmlbarsLang,\n\thttp: httpLang,\n\thy: hyLang,\n\tinform7: inform7Lang,\n\tini: iniLang,\n\tirpf90: irpf90Lang,\n\tisbl: isblLang,\n\tjava: javaLang,\n\tjavascript: javascriptLang,\n\t\"jboss-cli\": jboss_cliLang,\n\tjson: jsonLang,\n\tjulia: juliaLang,\n\t\"julia-repl\": julia_replLang,\n\tkotlin: kotlinLang,\n\tlasso: lassoLang,\n\tlatex: latexLang,\n\tldif: ldifLang,\n\tleaf: leafLang,\n\tless: lessLang,\n\tlisp: lispLang,\n\tlivecodeserver: livecodeserverLang,\n\tlivescript: livescriptLang,\n\tllvm: llvmLang,\n\tlsl: lslLang,\n\tlua: luaLang,\n\tmakefile: makefileLang,\n\tmathematica: mathematicaLang,\n\tmatlab: matlabLang,\n\tmaxima: maximaLang,\n\tmel: melLang,\n\tmercury: mercuryLang,\n\tmipsasm: mipsasmLang,\n\tmizar: mizarLang,\n\tperl: perlLang,\n\tmojolicious: mojoliciousLang,\n\tmonkey: monkeyLang,\n\tmoonscript: moonscriptLang,\n\tn1ql: n1qlLang,\n\tnginx: nginxLang,\n\tnim: nimLang,\n\tnix: nixLang,\n\t\"node-repl\": node_replLang,\n\tnsis: nsisLang,\n\tobjectivec: objectivecLang,\n\tocaml: ocamlLang,\n\topenscad: openscadLang,\n\toxygene: oxygeneLang,\n\tparser3: parser3Lang,\n\tpf: pfLang,\n\tpgsql: pgsqlLang,\n\tphp: phpLang,\n\t\"php-template\": php_templateLang,\n\tplaintext: plaintextLang,\n\tpony: ponyLang,\n\tpowershell: powershellLang,\n\tprocessing: processingLang,\n\tprofile: profileLang,\n\tprolog: prologLang,\n\tproperties: propertiesLang,\n\tprotobuf: protobufLang,\n\tpuppet: puppetLang,\n\tpurebasic: purebasicLang,\n\tpython: pythonLang,\n\t\"python-repl\": python_replLang,\n\tq: qLang,\n\tqml: qmlLang,\n\tr: rLang,\n\treasonml: reasonmlLang,\n\trib: ribLang,\n\troboconf: roboconfLang,\n\trouteros: routerosLang,\n\trsl: rslLang,\n\truleslanguage: ruleslanguageLang,\n\trust: rustLang,\n\tsas: sasLang,\n\tscala: scalaLang,\n\tscheme: schemeLang,\n\tscilab: scilabLang,\n\tscss: scssLang,\n\tshell: shellLang,\n\tsmali: smaliLang,\n\tsmalltalk: smalltalkLang,\n\tsml: smlLang,\n\tsqf: sqfLang,\n\tsql_more: sql_moreLang,\n\tsql: sqlLang,\n\tstan: stanLang,\n\tstata: stataLang,\n\tstep21: step21Lang,\n\tstylus: stylusLang,\n\tsubunit: subunitLang,\n\tswift: swiftLang,\n\ttaggerscript: taggerscriptLang,\n\tyaml: yamlLang,\n\ttap: tapLang,\n\ttcl: tclLang,\n\tthrift: thriftLang,\n\ttp: tpLang,\n\ttwig: twigLang,\n\ttypescript: typescriptLang,\n\tvala: valaLang,\n\tvbnet: vbnetLang,\n\tvbscript: vbscriptLang,\n\t\"vbscript-html\": vbscript_htmlLang,\n\tverilog: verilogLang,\n\tvhdl: vhdlLang,\n\tvim: vimLang,\n\tx86asm: x86asmLang,\n\txl: xlLang,\n\txquery: xqueryLang,\n\tzephir: zephirLang,\n};\n\n// Alias name -> canonical highlight.js language name (mirrors the aliases each\n// language module registers internally; last registration wins, matching the\n// original highlight.js/lib/index.js registration order).\nexport const HIGHLIGHT_LANGUAGE_ALIASES: Record<string, string> = {\n\tas: \"actionscript\",\n\tasc: \"angelscript\",\n\tapacheconf: \"apache\",\n\tosascript: \"applescript\",\n\tino: \"arduino\",\n\tarm: \"armasm\",\n\thtml: \"xml\",\n\txhtml: \"xml\",\n\trss: \"xml\",\n\tatom: \"xml\",\n\txjb: \"xml\",\n\txsd: \"xml\",\n\txsl: \"xml\",\n\tplist: \"xml\",\n\twsf: \"xml\",\n\tsvg: \"xml\",\n\tadoc: \"asciidoc\",\n\tahk: \"autohotkey\",\n\t\"x++\": \"axapta\",\n\tsh: \"bash\",\n\tzsh: \"bash\",\n\tbf: \"brainfuck\",\n\tc: \"c-like\",\n\th: \"c\",\n\tcc: \"cpp\",\n\t\"c++\": \"cpp\",\n\t\"h++\": \"cpp\",\n\thpp: \"cpp\",\n\thh: \"cpp\",\n\thxx: \"cpp\",\n\tcxx: \"cpp\",\n\tcapnp: \"capnproto\",\n\ticl: \"clean\",\n\tdcl: \"clean\",\n\tclj: \"clojure\",\n\t\"cmake.in\": \"cmake\",\n\tcoffee: \"coffeescript\",\n\tcson: \"coffeescript\",\n\ticed: \"coffeescript\",\n\tcls: \"cos\",\n\tcrm: \"crmsh\",\n\tpcmk: \"crmsh\",\n\tcr: \"crystal\",\n\tcs: \"csharp\",\n\t\"c#\": \"csharp\",\n\tmd: \"markdown\",\n\tmkdown: \"markdown\",\n\tmkd: \"markdown\",\n\tdpr: \"delphi\",\n\tdfm: \"delphi\",\n\tpas: \"delphi\",\n\tpascal: \"delphi\",\n\tfreepascal: \"delphi\",\n\tlazarus: \"delphi\",\n\tlpr: \"delphi\",\n\tlfm: \"delphi\",\n\tpatch: \"diff\",\n\tjinja: \"django\",\n\tbind: \"dns\",\n\tzone: \"dns\",\n\tdocker: \"dockerfile\",\n\tbat: \"dos\",\n\tcmd: \"dos\",\n\tdst: \"dust\",\n\trb: \"ruby\",\n\tgemspec: \"ruby\",\n\tpodspec: \"ruby\",\n\tthor: \"ruby\",\n\tirb: \"ruby\",\n\terl: \"erlang\",\n\txlsx: \"excel\",\n\txls: \"excel\",\n\tf90: \"fortran\",\n\tf95: \"fortran\",\n\tfs: \"fsharp\",\n\tgms: \"gams\",\n\tgss: \"gauss\",\n\tnc: \"gcode\",\n\tfeature: \"gherkin\",\n\tgolang: \"go\",\n\thbs: \"htmlbars\",\n\t\"html.hbs\": \"htmlbars\",\n\t\"html.handlebars\": \"htmlbars\",\n\thtmlbars: \"handlebars\",\n\ths: \"haskell\",\n\thx: \"haxe\",\n\thttps: \"http\",\n\thylang: \"hy\",\n\ti7: \"inform7\",\n\ttoml: \"ini\",\n\tjsp: \"java\",\n\tjs: \"javascript\",\n\tjsx: \"javascript\",\n\tmjs: \"javascript\",\n\tcjs: \"javascript\",\n\t\"wildfly-cli\": \"jboss-cli\",\n\tkt: \"kotlin\",\n\tkts: \"kotlin\",\n\tls: \"livescript\",\n\tlassoscript: \"lasso\",\n\ttex: \"latex\",\n\tmk: \"makefile\",\n\tmak: \"makefile\",\n\tmake: \"makefile\",\n\tmma: \"mathematica\",\n\twl: \"mathematica\",\n\tm: \"mercury\",\n\tmoo: \"mercury\",\n\tmips: \"mipsasm\",\n\tpl: \"perl\",\n\tpm: \"perl\",\n\tmoon: \"moonscript\",\n\tnginxconf: \"nginx\",\n\tnixos: \"nix\",\n\tmm: \"objectivec\",\n\tobjc: \"objectivec\",\n\t\"obj-c\": \"objectivec\",\n\t\"obj-c++\": \"objectivec\",\n\t\"objective-c++\": \"objectivec\",\n\tml: \"sml\",\n\tscad: \"openscad\",\n\t\"pf.conf\": \"pf\",\n\tpostgres: \"pgsql\",\n\tpostgresql: \"pgsql\",\n\tphp3: \"php\",\n\tphp4: \"php\",\n\tphp5: \"php\",\n\tphp6: \"php\",\n\tphp7: \"php\",\n\tphp8: \"php\",\n\ttext: \"plaintext\",\n\ttxt: \"plaintext\",\n\tps: \"powershell\",\n\tps1: \"powershell\",\n\tpp: \"puppet\",\n\tpb: \"purebasic\",\n\tpbi: \"purebasic\",\n\tpy: \"python\",\n\tgyp: \"python\",\n\tipython: \"python\",\n\tpycon: \"python-repl\",\n\tk: \"q\",\n\tkdb: \"q\",\n\tqt: \"qml\",\n\tre: \"reasonml\",\n\tgraph: \"roboconf\",\n\tinstances: \"roboconf\",\n\tmikrotik: \"routeros\",\n\trs: \"rust\",\n\tsci: \"scilab\",\n\tconsole: \"shell\",\n\tst: \"smalltalk\",\n\tmysql: \"sql_more\",\n\toracle: \"sql_more\",\n\tstanfuncs: \"stan\",\n\tdo: \"stata\",\n\tado: \"stata\",\n\tp21: \"step21\",\n\tstep: \"step21\",\n\tstp: \"step21\",\n\tstyl: \"stylus\",\n\tyml: \"yaml\",\n\ttk: \"tcl\",\n\tcraftcms: \"twig\",\n\tts: \"typescript\",\n\ttsx: \"typescript\",\n\tvb: \"vbnet\",\n\tvbs: \"vbscript\",\n\tv: \"verilog\",\n\tsv: \"verilog\",\n\tsvh: \"verilog\",\n\ttao: \"xl\",\n\txpath: \"xquery\",\n\txq: \"xquery\",\n\tzep: \"zephir\",\n};\n"]}
1
+ {"version":3,"file":"highlight-js-languages.d.ts","sourceRoot":"","sources":["../../src/utils/highlight-js-languages.ts"],"names":[],"mappings":"AAwMA,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;AAG7D,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAgM1E,CAAC;AAKF,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgL7D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf;AASD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAuBnE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAa7F","sourcesContent":["export interface DecodedHtmlEntity {\n\ttext: string;\n\tlength: number;\n}\n\nfunction decodeCodePoint(codePoint: number): string | undefined {\n\tif (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 0x10ffff) {\n\t\treturn undefined;\n\t}\n\treturn String.fromCodePoint(codePoint);\n}\n\nexport function decodeHtmlEntity(entity: string): string | undefined {\n\tswitch (entity) {\n\t\tcase \"amp\":\n\t\t\treturn \"&\";\n\t\tcase \"lt\":\n\t\t\treturn \"<\";\n\t\tcase \"gt\":\n\t\t\treturn \">\";\n\t\tcase \"quot\":\n\t\t\treturn '\"';\n\t\tcase \"apos\":\n\t\t\treturn \"'\";\n\t}\n\n\tif (entity.startsWith(\"#x\") || entity.startsWith(\"#X\")) {\n\t\treturn decodeCodePoint(Number.parseInt(entity.slice(2), 16));\n\t}\n\n\tif (entity.startsWith(\"#\")) {\n\t\treturn decodeCodePoint(Number.parseInt(entity.slice(1), 10));\n\t}\n\n\treturn undefined;\n}\n\nexport function decodeHtmlEntityAt(html: string, index: number): DecodedHtmlEntity | undefined {\n\tconst semicolonIndex = html.indexOf(\";\", index + 1);\n\tif (semicolonIndex === -1 || semicolonIndex - index > 16) {\n\t\treturn undefined;\n\t}\n\n\tconst entity = html.slice(index + 1, semicolonIndex);\n\tconst decoded = decodeHtmlEntity(entity);\n\tif (decoded === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { text: decoded, length: semicolonIndex - index + 1 };\n}\n"]}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf;AASD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAuBnE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAa7F"}
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAKA,SAAS,eAAe,CAAC,SAAiB,EAAsB;IAC/D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;QAC3E,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,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KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC;AAAA,CAC7D","sourcesContent":["export interface DecodedHtmlEntity {\n\ttext: string;\n\tlength: number;\n}\n\nfunction decodeCodePoint(codePoint: number): string | undefined {\n\tif (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 0x10ffff) {\n\t\treturn undefined;\n\t}\n\treturn String.fromCodePoint(codePoint);\n}\n\nexport function decodeHtmlEntity(entity: string): string | undefined {\n\tswitch (entity) {\n\t\tcase \"amp\":\n\t\t\treturn \"&\";\n\t\tcase \"lt\":\n\t\t\treturn \"<\";\n\t\tcase \"gt\":\n\t\t\treturn \">\";\n\t\tcase \"quot\":\n\t\t\treturn '\"';\n\t\tcase \"apos\":\n\t\t\treturn \"'\";\n\t}\n\n\tif (entity.startsWith(\"#x\") || entity.startsWith(\"#X\")) {\n\t\treturn decodeCodePoint(Number.parseInt(entity.slice(2), 16));\n\t}\n\n\tif (entity.startsWith(\"#\")) {\n\t\treturn decodeCodePoint(Number.parseInt(entity.slice(1), 10));\n\t}\n\n\treturn undefined;\n}\n\nexport function decodeHtmlEntityAt(html: string, index: number): DecodedHtmlEntity | undefined {\n\tconst semicolonIndex = html.indexOf(\";\", index + 1);\n\tif (semicolonIndex === -1 || semicolonIndex - index > 16) {\n\t\treturn undefined;\n\t}\n\n\tconst entity = html.slice(index + 1, semicolonIndex);\n\tconst decoded = decodeHtmlEntity(entity);\n\tif (decoded === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { text: decoded, length: semicolonIndex - index + 1 };\n}\n"]}
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAKA,SAAS,eAAe,CAAC,SAAiB;IACzC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAA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cAAc,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["export interface DecodedHtmlEntity {\n\ttext: string;\n\tlength: number;\n}\n\nfunction decodeCodePoint(codePoint: number): string | undefined {\n\tif (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 0x10ffff) {\n\t\treturn undefined;\n\t}\n\treturn String.fromCodePoint(codePoint);\n}\n\nexport function decodeHtmlEntity(entity: string): string | undefined {\n\tswitch (entity) {\n\t\tcase \"amp\":\n\t\t\treturn \"&\";\n\t\tcase \"lt\":\n\t\t\treturn \"<\";\n\t\tcase \"gt\":\n\t\t\treturn \">\";\n\t\tcase \"quot\":\n\t\t\treturn '\"';\n\t\tcase \"apos\":\n\t\t\treturn \"'\";\n\t}\n\n\tif (entity.startsWith(\"#x\") || entity.startsWith(\"#X\")) {\n\t\treturn decodeCodePoint(Number.parseInt(entity.slice(2), 16));\n\t}\n\n\tif (entity.startsWith(\"#\")) {\n\t\treturn decodeCodePoint(Number.parseInt(entity.slice(1), 10));\n\t}\n\n\treturn undefined;\n}\n\nexport function decodeHtmlEntityAt(html: string, index: number): DecodedHtmlEntity | undefined {\n\tconst semicolonIndex = html.indexOf(\";\", index + 1);\n\tif (semicolonIndex === -1 || semicolonIndex - index > 16) {\n\t\treturn undefined;\n\t}\n\n\tconst entity = html.slice(index + 1, semicolonIndex);\n\tconst decoded = decodeHtmlEntity(entity);\n\tif (decoded === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { text: decoded, length: semicolonIndex - index + 1 };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"image-convert.d.ts","sourceRoot":"","sources":["../../src/utils/image-convert.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAsB,YAAY,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA8BpD","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\n/**\n * Convert image to PNG format for terminal display.\n * Kitty graphics protocol requires PNG format (f=100).\n */\nexport async function convertToPng(\n\tbase64Data: string,\n\tmimeType: string,\n): Promise<{ data: string; mimeType: string } | null> {\n\t// Already PNG, no conversion needed\n\tif (mimeType === \"image/png\") {\n\t\treturn { data: base64Data, mimeType };\n\t}\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\t// Photon not available, can't convert\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst bytes = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(bytes);\n\t\tconst image = applyExifOrientation(photon, rawImage, bytes);\n\t\tif (image !== rawImage) rawImage.free();\n\t\ttry {\n\t\t\tconst pngBuffer = image.get_bytes();\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(pngBuffer).toString(\"base64\"),\n\t\t\t\tmimeType: \"image/png\",\n\t\t\t};\n\t\t} finally {\n\t\t\timage.free();\n\t\t}\n\t} catch {\n\t\t// Conversion failed\n\t\treturn null;\n\t}\n}\n"]}
1
+ {"version":3,"file":"image-convert.d.ts","sourceRoot":"","sources":["../../src/utils/image-convert.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAsB,YAAY,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA8BpD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I,CAAC;IACb,CAAC;AAAA,CACD","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\n/**\n * Convert image to PNG format for terminal display.\n * Kitty graphics protocol requires PNG format (f=100).\n */\nexport async function convertToPng(\n\tbase64Data: string,\n\tmimeType: string,\n): Promise<{ data: string; mimeType: string } | null> {\n\t// Already PNG, no conversion needed\n\tif (mimeType === \"image/png\") {\n\t\treturn { data: base64Data, mimeType };\n\t}\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\t// Photon not available, can't convert\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst bytes = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(bytes);\n\t\tconst image = applyExifOrientation(photon, rawImage, bytes);\n\t\tif (image !== rawImage) rawImage.free();\n\t\ttry {\n\t\t\tconst pngBuffer = image.get_bytes();\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(pngBuffer).toString(\"base64\"),\n\t\t\t\tmimeType: \"image/png\",\n\t\t\t};\n\t\t} finally {\n\t\t\timage.free();\n\t\t}\n\t} catch {\n\t\t// Conversion failed\n\t\treturn null;\n\t}\n}\n"]}
1
+ {"version":3,"file":"image-convert.js","sourceRoot":"","sources":["../../src/utils/image-convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,UAAkB,EAClB,QAAgB;IAEhB,oCAAoC;IACpC,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvC,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,sCAAsC;QACtC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAI,KAAK,KAAK,QAAQ;YAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC;YACJ,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;YACpC,OAAO;gBACN,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAC/C,QAAQ,EAAE,WAAW;aACrB,CAAC;QACH,CAAC;gBAAS,CAAC;YACV,KAAK,CAAC,IAAI,EAAE,CAAC;QACd,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,oBAAoB;QACpB,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\n/**\n * Convert image to PNG format for terminal display.\n * Kitty graphics protocol requires PNG format (f=100).\n */\nexport async function convertToPng(\n\tbase64Data: string,\n\tmimeType: string,\n): Promise<{ data: string; mimeType: string } | null> {\n\t// Already PNG, no conversion needed\n\tif (mimeType === \"image/png\") {\n\t\treturn { data: base64Data, mimeType };\n\t}\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\t// Photon not available, can't convert\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst bytes = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(bytes);\n\t\tconst image = applyExifOrientation(photon, rawImage, bytes);\n\t\tif (image !== rawImage) rawImage.free();\n\t\ttry {\n\t\t\tconst pngBuffer = image.get_bytes();\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(pngBuffer).toString(\"base64\"),\n\t\t\t\tmimeType: \"image/png\",\n\t\t\t};\n\t\t} finally {\n\t\t\timage.free();\n\t\t}\n\t} catch {\n\t\t// Conversion failed\n\t\treturn null;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"image-resize-core.d.ts","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACpB;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAqG9B","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport interface ImageResizeOptions {\n\tmaxWidth?: number; // Default: 2000\n\tmaxHeight?: number; // Default: 2000\n\tmaxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit)\n\tjpegQuality?: number; // Default: 80\n}\n\nexport interface ResizedImage {\n\tdata: string; // base64\n\tmimeType: string;\n\toriginalWidth: number;\n\toriginalHeight: number;\n\twidth: number;\n\theight: number;\n\twasResized: boolean;\n}\n\n// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.\nconst DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;\n\nconst DEFAULT_OPTIONS: Required<ImageResizeOptions> = {\n\tmaxWidth: 2000,\n\tmaxHeight: 2000,\n\tmaxBytes: DEFAULT_MAX_BYTES,\n\tjpegQuality: 80,\n};\n\ninterface EncodedCandidate {\n\tdata: string;\n\tencodedSize: number;\n\tmimeType: string;\n}\n\nfunction encodeCandidate(buffer: Uint8Array, mimeType: string): EncodedCandidate {\n\tconst data = Buffer.from(buffer).toString(\"base64\");\n\treturn {\n\t\tdata,\n\t\tencodedSize: Buffer.byteLength(data, \"utf-8\"),\n\t\tmimeType,\n\t};\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Returns null if the image cannot be resized below maxBytes.\n *\n * Uses Photon (Rust/WASM) for image processing. If Photon is not available,\n * returns null.\n *\n * Strategy for staying under maxBytes:\n * 1. First resize to maxWidth/maxHeight\n * 2. Try both PNG and JPEG formats, pick the smaller one\n * 3. If still too large, try JPEG with decreasing quality\n * 4. If still too large, progressively reduce dimensions until 1x1\n */\nexport async function resizeImageInProcess(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst opts = { ...DEFAULT_OPTIONS, ...options };\n\tconst inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\tlet image: ReturnType<typeof photon.PhotonImage.new_from_byteslice> | undefined;\n\ttry {\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);\n\t\timage = applyExifOrientation(photon, rawImage, inputBytes);\n\t\tif (image !== rawImage) rawImage.free();\n\n\t\tconst originalWidth = image.get_width();\n\t\tconst originalHeight = image.get_height();\n\t\tconst format = mimeType.split(\"/\")[1] ?? \"png\";\n\n\t\t// Check if already within all limits (dimensions AND encoded size)\n\t\tif (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: mimeType || `image/${format}`,\n\t\t\t\toriginalWidth,\n\t\t\t\toriginalHeight,\n\t\t\t\twidth: originalWidth,\n\t\t\t\theight: originalHeight,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\n\t\t// Calculate initial dimensions respecting max limits\n\t\tlet targetWidth = originalWidth;\n\t\tlet targetHeight = originalHeight;\n\n\t\tif (targetWidth > opts.maxWidth) {\n\t\t\ttargetHeight = Math.round((targetHeight * opts.maxWidth) / targetWidth);\n\t\t\ttargetWidth = opts.maxWidth;\n\t\t}\n\t\tif (targetHeight > opts.maxHeight) {\n\t\t\ttargetWidth = Math.round((targetWidth * opts.maxHeight) / targetHeight);\n\t\t\ttargetHeight = opts.maxHeight;\n\t\t}\n\n\t\tfunction tryEncodings(width: number, height: number, jpegQualities: number[]): EncodedCandidate[] {\n\t\t\tconst resized = photon!.resize(image!, width, height, photon!.SamplingFilter.Lanczos3);\n\n\t\t\ttry {\n\t\t\t\tconst candidates: EncodedCandidate[] = [encodeCandidate(resized.get_bytes(), \"image/png\")];\n\t\t\t\tfor (const quality of jpegQualities) {\n\t\t\t\t\tcandidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), \"image/jpeg\"));\n\t\t\t\t}\n\t\t\t\treturn candidates;\n\t\t\t} finally {\n\t\t\t\tresized.free();\n\t\t\t}\n\t\t}\n\n\t\tconst qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));\n\t\tlet currentWidth = targetWidth;\n\t\tlet currentHeight = targetHeight;\n\n\t\twhile (true) {\n\t\t\tconst candidates = tryEncodings(currentWidth, currentHeight, qualitySteps);\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (candidate.encodedSize < opts.maxBytes) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: candidate.data,\n\t\t\t\t\t\tmimeType: candidate.mimeType,\n\t\t\t\t\t\toriginalWidth,\n\t\t\t\t\t\toriginalHeight,\n\t\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\t\theight: currentHeight,\n\t\t\t\t\t\twasResized: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentWidth === 1 && currentHeight === 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));\n\t\t\tconst nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));\n\t\t\tif (nextWidth === currentWidth && nextHeight === currentHeight) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentWidth = nextWidth;\n\t\t\tcurrentHeight = nextHeight;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\tif (image) {\n\t\t\timage.free();\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"image-resize-core.d.ts","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACpB;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAqG9B"}