@tonyclaw/agent-inspector 3.0.45 → 3.0.47

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 (343) hide show
  1. package/.output/{nitro.json → backend/nitro.json} +3 -3
  2. package/.output/backend-public/assets/index-D4LX-sw-.js +11 -0
  3. package/.output/cli.js +8018 -5451
  4. package/.output/server/_libs/extend.mjs +4 -8
  5. package/.output/server/_libs/jszip.mjs +9 -35
  6. package/.output/server/_libs/react-dom.mjs +2 -3
  7. package/.output/server/_libs/react.mjs +1 -27
  8. package/.output/server/_libs/tanstack__react-router.mjs +1 -329
  9. package/.output/server/_libs/tanstack__router-core.mjs +42 -100
  10. package/.output/server/_libs/use-sync-external-store.mjs +1 -64
  11. package/.output/server/_libs/ws.mjs +1 -1
  12. package/.output/server/_ssr/index.mjs +4 -4
  13. package/.output/server/_ssr/{publicBasePathContext-5264L3rX.mjs → publicBasePathContext-IH2ilOfu.mjs} +52 -24
  14. package/.output/server/_ssr/{router-BJ_ltLim.mjs → router-BwZEsYfS.mjs} +19794 -19444
  15. package/.output/server/_ssr/{start-C6MjPjxp.mjs → start-COQu_AgD.mjs} +1 -1
  16. package/.output/server/_tanstack-start-manifest_v-DnbdNeun.mjs +4 -0
  17. package/.output/server/index.mjs +5 -145
  18. package/.output/{public/assets/CompareDrawer-B3_TLTJh.js → ui/assets/CompareDrawer-V-8lPASC.js} +1 -1
  19. package/.output/{public/assets/InspectorPet-Cpn6hv4P.js → ui/assets/InspectorPet-D4CVnfdf.js} +1 -1
  20. package/.output/ui/assets/ProxyViewerContainer-CO3ZVHLX.js +59 -0
  21. package/.output/{public/assets/ReplayDialog-B3EKVdJk.js → ui/assets/ReplayDialog-CpGyTLtt.js} +1 -1
  22. package/.output/{public/assets/RequestAnatomy-COOQjyUC.js → ui/assets/RequestAnatomy-BLuJL9dZ.js} +1 -1
  23. package/.output/ui/assets/ResponseView-BuSC-CH7.js +2 -0
  24. package/.output/ui/assets/StreamingChunkSequence-DeA-JJKa.js +1 -0
  25. package/.output/{public/assets/_sessionId-zbgYl7ZJ.js → ui/assets/_sessionId-8HuHFhjo.js} +1 -1
  26. package/.output/{public/assets/_sessionId-BJlM3nmt.js → ui/assets/_sessionId-Chp67th6.js} +1 -1
  27. package/.output/ui/assets/favicon-DYEkHSNl.svg +21 -0
  28. package/.output/ui/assets/index-BvXp42al.css +1 -0
  29. package/.output/{public/assets/index-xF_NY8Yb.js → ui/assets/index-DPmKK_5d.js} +5 -5
  30. package/.output/{public/assets/index-BIK4bPTv.js → ui/assets/index-atoQrlb8.js} +1 -1
  31. package/.output/ui/assets/index-nY3E1vxV.js +73 -0
  32. package/.output/{public/assets/index-D2Qw6Ri2.js → ui/assets/index-nl9-dpZn.js} +1 -1
  33. package/.output/ui/assets/json-viewer-B9kIzqeX.js +1 -0
  34. package/.output/{public/assets/jszip.min-B_rfAUCe.js → ui/assets/jszip.min-B7tfyE-I.js} +1 -1
  35. package/.output/ui/index.html +229 -0
  36. package/.output/ui/runtime-config.js +2 -0
  37. package/.output/workers/logFinalizer.worker.js +979 -414
  38. package/.output/workers/sessionWorkerEntry.js +979 -414
  39. package/README.md +182 -43
  40. package/docs/instance-control.openapi.yaml +59 -4
  41. package/package.json +40 -6
  42. package/scripts/generate-theme-scales.mjs +3 -3
  43. package/src/{router.tsx → backend/router.tsx} +3 -15
  44. package/src/backend/routes/$.ts +26 -0
  45. package/src/backend/routes/__root.ts +4 -0
  46. package/src/backend/routes/api/-instances.ts +7 -0
  47. package/src/{routes → backend/routes}/api/alerts.summary.ts +3 -3
  48. package/src/{routes → backend/routes}/api/alerts.ts +4 -4
  49. package/src/{routes → backend/routes}/api/config.paths.ts +1 -1
  50. package/src/{routes → backend/routes}/api/config.ts +11 -2
  51. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.help.ts +1 -1
  52. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.install.ts +1 -1
  53. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.runner-presets.ts +1 -1
  54. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.upgrade.ts +1 -1
  55. package/src/{routes → backend/routes}/api/ecosystem.packages.ts +5 -1
  56. package/src/{routes → backend/routes}/api/ecosystem.recipes.$recipeId.run.ts +1 -1
  57. package/src/{routes → backend/routes}/api/ecosystem.tasks.$taskId.ts +1 -1
  58. package/src/{routes → backend/routes}/api/ecosystem.tasks.ts +1 -1
  59. package/src/{routes → backend/routes}/api/groups.$groupId.evidence.ts +2 -2
  60. package/src/{routes → backend/routes}/api/groups.$groupId.sessions.ts +2 -2
  61. package/src/{routes → backend/routes}/api/groups.$groupId.ts +2 -2
  62. package/src/{routes → backend/routes}/api/groups.ts +2 -2
  63. package/src/{routes → backend/routes}/api/health.ts +3 -3
  64. package/src/{routes → backend/routes}/api/instances.$name.connection.ts +1 -1
  65. package/src/{routes → backend/routes}/api/instances.$name.restart.ts +2 -2
  66. package/src/{routes → backend/routes}/api/instances.$name.start.ts +2 -2
  67. package/src/{routes → backend/routes}/api/instances.$name.stop.ts +2 -2
  68. package/src/{routes → backend/routes}/api/instances.$name.ts +1 -1
  69. package/src/{routes → backend/routes}/api/instances.ts +1 -1
  70. package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.promote.ts +2 -2
  71. package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.ts +2 -2
  72. package/src/{routes → backend/routes}/api/knowledge.candidates.ts +1 -1
  73. package/src/{routes → backend/routes}/api/knowledge.project-context.ts +2 -2
  74. package/src/{routes → backend/routes}/api/knowledge.search.ts +2 -2
  75. package/src/{routes → backend/routes}/api/knowledge.sessions.$sessionId.candidates.ts +3 -3
  76. package/src/{routes → backend/routes}/api/logs.$id.body.ts +6 -6
  77. package/src/{routes → backend/routes}/api/logs.$id.chunks.ts +5 -4
  78. package/src/{routes → backend/routes}/api/logs.$id.replay.ts +12 -11
  79. package/src/{routes → backend/routes}/api/logs.$id.ts +4 -3
  80. package/src/{routes → backend/routes}/api/logs.import.ts +3 -3
  81. package/src/{routes → backend/routes}/api/logs.stream.ts +11 -7
  82. package/src/{routes → backend/routes}/api/logs.ts +17 -9
  83. package/src/{routes → backend/routes}/api/mcp.ts +1 -1
  84. package/src/{routes → backend/routes}/api/models.ts +1 -1
  85. package/src/{routes → backend/routes}/api/pi-agent.ts +2 -2
  86. package/src/{routes → backend/routes}/api/providers.$providerId.model-metadata.ts +5 -5
  87. package/src/{routes → backend/routes}/api/providers.$providerId.test.log.ts +7 -7
  88. package/src/{routes → backend/routes}/api/providers.$providerId.ts +4 -4
  89. package/src/{routes → backend/routes}/api/providers.export.ts +1 -1
  90. package/src/{routes → backend/routes}/api/providers.import.ts +3 -3
  91. package/src/{routes → backend/routes}/api/providers.scan.ts +2 -2
  92. package/src/{routes → backend/routes}/api/providers.ts +9 -4
  93. package/src/{routes → backend/routes}/api/runs.$runId.evidence.ts +2 -2
  94. package/src/{routes → backend/routes}/api/runs.$runId.ts +2 -2
  95. package/src/{routes → backend/routes}/api/runs.ts +4 -4
  96. package/src/backend/routes/api/runtime.ts +46 -0
  97. package/src/{routes → backend/routes}/api/sessions.ts +3 -3
  98. package/src/{routes → backend/routes}/proxy/$.ts +1 -1
  99. package/src/{routes → backend/routes}/readyz.ts +1 -1
  100. package/src/{start.ts → backend/start.ts} +1 -1
  101. package/src/cli/alias.ts +2 -11
  102. package/src/cli/doctor.ts +32 -9
  103. package/src/cli/instance.ts +36 -13
  104. package/src/cli/instanceApi.ts +213 -0
  105. package/src/cli/instanceArgs.ts +46 -11
  106. package/src/cli/instanceControl.ts +10 -2
  107. package/src/cli/instanceModel.ts +18 -17
  108. package/src/cli/instanceRegistry.ts +0 -9
  109. package/src/cli/networkHints.ts +27 -14
  110. package/src/cli/onboard.ts +69 -2
  111. package/src/cli/onboardTarget.ts +89 -40
  112. package/src/cli/rustBackendPackage.ts +450 -0
  113. package/src/cli/templates/codex-skill-onboard.ts +44 -14
  114. package/src/cli/templates/skill-onboard.ts +64 -28
  115. package/src/cli.ts +341 -75
  116. package/src/components/ProxyViewer.tsx +11 -9
  117. package/src/components/ProxyViewerContainer.tsx +12 -11
  118. package/src/components/pi-agent/PiAgentPanel.tsx +2 -2
  119. package/src/components/providers/ProviderCard.tsx +1 -1
  120. package/src/components/providers/ProviderTestResultsView.tsx +1 -1
  121. package/src/components/providers/SettingsDialog.tsx +159 -144
  122. package/src/components/proxy-viewer/ApplicationBar.tsx +2 -1
  123. package/src/components/proxy-viewer/LogEntry.tsx +1 -1
  124. package/src/components/proxy-viewer/log-formats/index.ts +1 -1
  125. package/src/contracts/index.ts +5 -0
  126. package/src/contracts/log.ts +33 -3
  127. package/src/knowledge/types.ts +3 -2
  128. package/src/lib/alertContract.ts +2 -2
  129. package/src/lib/apiClient.ts +30 -7
  130. package/src/lib/apiFormat.ts +29 -0
  131. package/src/lib/backendImplementation.ts +16 -0
  132. package/src/lib/basePath.ts +29 -11
  133. package/src/lib/browserRuntimeContract.ts +124 -0
  134. package/src/lib/browserRuntimeResolver.ts +244 -0
  135. package/src/{proxy → lib}/claudeCodeStrip.ts +6 -7
  136. package/src/lib/codingAgentEndpoints.ts +38 -0
  137. package/src/lib/instanceContract.ts +30 -11
  138. package/src/lib/managedInstance.ts +9 -1
  139. package/src/lib/piAgentContract.ts +3 -2
  140. package/src/lib/publicBasePathContext.ts +40 -10
  141. package/src/lib/resourceLimits.ts +2 -0
  142. package/src/lib/runContract.ts +3 -3
  143. package/src/lib/sessionInfoContract.ts +3 -2
  144. package/src/mcp/instanceHandlers.ts +2 -0
  145. package/src/mcp/server.ts +19 -24
  146. package/src/proxy/config.ts +25 -30
  147. package/src/proxy/dataDir.ts +43 -7
  148. package/src/proxy/ecosystemTasks.ts +161 -70
  149. package/src/proxy/formats/registry.ts +6 -21
  150. package/src/proxy/handler.ts +129 -29
  151. package/src/proxy/identityProxy.ts +567 -39
  152. package/src/proxy/jsonlRecovery.ts +554 -0
  153. package/src/proxy/logFinalizer.ts +25 -10
  154. package/src/proxy/logImporter.ts +2 -1
  155. package/src/proxy/logIndex.ts +191 -95
  156. package/src/proxy/logger.ts +77 -14
  157. package/src/proxy/platformCommands.ts +41 -0
  158. package/src/proxy/privateDataPath.ts +310 -88
  159. package/src/proxy/rawStreamCapture.ts +194 -13
  160. package/src/proxy/runtimeAdmission.ts +5 -2
  161. package/src/proxy/runtimeHealth.ts +14 -1
  162. package/src/proxy/runtimeShutdown.ts +11 -1
  163. package/src/proxy/schemas.ts +7 -1
  164. package/src/proxy/sessionArchive.ts +70 -14
  165. package/src/proxy/sqliteLogIndex.ts +65 -42
  166. package/src/proxy/store.ts +141 -34
  167. package/src/proxy/uiAssetServer.ts +106 -0
  168. package/src/proxy/upstream.ts +29 -2
  169. package/src/ui/bootstrap.ts +167 -0
  170. package/src/ui/index.html +38 -0
  171. package/src/ui/logsStreamClient.ts +20 -0
  172. package/src/ui/main.tsx +13 -0
  173. package/src/ui/public/runtime-config.js +2 -0
  174. package/src/ui/router.tsx +13 -0
  175. package/src/ui/routes/__root.tsx +69 -0
  176. package/src/{routes → ui/routes}/index.tsx +2 -3
  177. package/src/{routes → ui/routes}/session/$sessionId.tsx +5 -11
  178. package/src/ui/runtimeDiscovery.ts +50 -0
  179. package/styles/globals.css +1 -0
  180. package/.output/public/assets/ProxyViewerContainer-BEAhuGOJ.js +0 -126
  181. package/.output/public/assets/ResponseView-DBCjkwye.js +0 -2
  182. package/.output/public/assets/StreamingChunkSequence-CuXhDgMo.js +0 -1
  183. package/.output/public/assets/index-BZo_8koU.js +0 -70
  184. package/.output/public/assets/index-ZWschkCh.css +0 -1
  185. package/.output/public/assets/json-viewer-B-Ao6pwW.js +0 -1
  186. package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +0 -1
  187. package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +0 -344
  188. package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +0 -2
  189. package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +0 -2
  190. package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +0 -2
  191. package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +0 -11
  192. package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +0 -69
  193. package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +0 -1
  194. package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +0 -28
  195. package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +0 -6
  196. package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +0 -34
  197. package/.output/server/_libs/aria-hidden.mjs +0 -122
  198. package/.output/server/_libs/bail.mjs +0 -8
  199. package/.output/server/_libs/character-entities.mjs +0 -2130
  200. package/.output/server/_libs/class-variance-authority.mjs +0 -44
  201. package/.output/server/_libs/clsx.mjs +0 -16
  202. package/.output/server/_libs/comma-separated-tokens.mjs +0 -10
  203. package/.output/server/_libs/decode-named-character-reference+[...].mjs +0 -8
  204. package/.output/server/_libs/dequal.mjs +0 -27
  205. package/.output/server/_libs/detect-node-es.mjs +0 -1
  206. package/.output/server/_libs/devlop.mjs +0 -8
  207. package/.output/server/_libs/diff.mjs +0 -320
  208. package/.output/server/_libs/estree-util-is-identifier-name.mjs +0 -11
  209. package/.output/server/_libs/floating-ui__core.mjs +0 -725
  210. package/.output/server/_libs/floating-ui__dom.mjs +0 -622
  211. package/.output/server/_libs/floating-ui__react-dom.mjs +0 -292
  212. package/.output/server/_libs/floating-ui__utils.mjs +0 -320
  213. package/.output/server/_libs/get-nonce.mjs +0 -9
  214. package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +0 -388
  215. package/.output/server/_libs/hast-util-whitespace.mjs +0 -10
  216. package/.output/server/_libs/html-url-attributes.mjs +0 -26
  217. package/.output/server/_libs/inline-style-parser.mjs +0 -142
  218. package/.output/server/_libs/is-plain-obj.mjs +0 -10
  219. package/.output/server/_libs/lucide-react.mjs +0 -1027
  220. package/.output/server/_libs/mdast-util-from-markdown.mjs +0 -717
  221. package/.output/server/_libs/mdast-util-to-hast.mjs +0 -710
  222. package/.output/server/_libs/mdast-util-to-string.mjs +0 -38
  223. package/.output/server/_libs/micromark-core-commonmark.mjs +0 -2259
  224. package/.output/server/_libs/micromark-factory-destination.mjs +0 -94
  225. package/.output/server/_libs/micromark-factory-label.mjs +0 -63
  226. package/.output/server/_libs/micromark-factory-space.mjs +0 -24
  227. package/.output/server/_libs/micromark-factory-title.mjs +0 -65
  228. package/.output/server/_libs/micromark-factory-whitespace.mjs +0 -22
  229. package/.output/server/_libs/micromark-util-character.mjs +0 -44
  230. package/.output/server/_libs/micromark-util-chunked.mjs +0 -36
  231. package/.output/server/_libs/micromark-util-classify-character+[...].mjs +0 -12
  232. package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +0 -41
  233. package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +0 -19
  234. package/.output/server/_libs/micromark-util-decode-string.mjs +0 -21
  235. package/.output/server/_libs/micromark-util-encode.mjs +0 -1
  236. package/.output/server/_libs/micromark-util-html-tag-name.mjs +0 -69
  237. package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +0 -6
  238. package/.output/server/_libs/micromark-util-resolve-all.mjs +0 -15
  239. package/.output/server/_libs/micromark-util-sanitize-uri.mjs +0 -41
  240. package/.output/server/_libs/micromark-util-subtokenize.mjs +0 -346
  241. package/.output/server/_libs/micromark.mjs +0 -906
  242. package/.output/server/_libs/property-information.mjs +0 -1209
  243. package/.output/server/_libs/radix-ui.mjs +0 -1
  244. package/.output/server/_libs/radix-ui__number.mjs +0 -6
  245. package/.output/server/_libs/radix-ui__primitive.mjs +0 -11
  246. package/.output/server/_libs/radix-ui__react-accordion.mjs +0 -1
  247. package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +0 -1
  248. package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
  249. package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +0 -1
  250. package/.output/server/_libs/radix-ui__react-avatar.mjs +0 -1
  251. package/.output/server/_libs/radix-ui__react-checkbox.mjs +0 -1
  252. package/.output/server/_libs/radix-ui__react-collapsible.mjs +0 -144
  253. package/.output/server/_libs/radix-ui__react-collection.mjs +0 -69
  254. package/.output/server/_libs/radix-ui__react-compose-refs.mjs +0 -38
  255. package/.output/server/_libs/radix-ui__react-context-menu.mjs +0 -1
  256. package/.output/server/_libs/radix-ui__react-context.mjs +0 -64
  257. package/.output/server/_libs/radix-ui__react-dialog.mjs +0 -280
  258. package/.output/server/_libs/radix-ui__react-direction.mjs +0 -9
  259. package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +0 -1
  260. package/.output/server/_libs/radix-ui__react-focus-guards.mjs +0 -39
  261. package/.output/server/_libs/radix-ui__react-focus-scope.mjs +0 -210
  262. package/.output/server/_libs/radix-ui__react-form.mjs +0 -1
  263. package/.output/server/_libs/radix-ui__react-hover-card.mjs +0 -1
  264. package/.output/server/_libs/radix-ui__react-id.mjs +0 -14
  265. package/.output/server/_libs/radix-ui__react-label.mjs +0 -1
  266. package/.output/server/_libs/radix-ui__react-menu.mjs +0 -1
  267. package/.output/server/_libs/radix-ui__react-menubar.mjs +0 -1
  268. package/.output/server/_libs/radix-ui__react-popover.mjs +0 -1
  269. package/.output/server/_libs/radix-ui__react-popper.mjs +0 -340
  270. package/.output/server/_libs/radix-ui__react-portal.mjs +0 -16
  271. package/.output/server/_libs/radix-ui__react-presence.mjs +0 -173
  272. package/.output/server/_libs/radix-ui__react-primitive.mjs +0 -42
  273. package/.output/server/_libs/radix-ui__react-progress.mjs +0 -1
  274. package/.output/server/_libs/radix-ui__react-radio-group.mjs +0 -1
  275. package/.output/server/_libs/radix-ui__react-roving-focus.mjs +0 -235
  276. package/.output/server/_libs/radix-ui__react-scroll-area.mjs +0 -731
  277. package/.output/server/_libs/radix-ui__react-select.mjs +0 -1207
  278. package/.output/server/_libs/radix-ui__react-separator.mjs +0 -28
  279. package/.output/server/_libs/radix-ui__react-slider.mjs +0 -1
  280. package/.output/server/_libs/radix-ui__react-slot.mjs +0 -132
  281. package/.output/server/_libs/radix-ui__react-switch.mjs +0 -1
  282. package/.output/server/_libs/radix-ui__react-tabs.mjs +0 -194
  283. package/.output/server/_libs/radix-ui__react-toast.mjs +0 -2
  284. package/.output/server/_libs/radix-ui__react-toggle-group.mjs +0 -1
  285. package/.output/server/_libs/radix-ui__react-toggle.mjs +0 -1
  286. package/.output/server/_libs/radix-ui__react-toolbar.mjs +0 -1
  287. package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -498
  288. package/.output/server/_libs/radix-ui__react-use-previous.mjs +0 -14
  289. package/.output/server/_libs/radix-ui__react-use-size.mjs +0 -39
  290. package/.output/server/_libs/react-markdown.mjs +0 -235
  291. package/.output/server/_libs/react-remove-scroll-bar.mjs +0 -82
  292. package/.output/server/_libs/react-remove-scroll.mjs +0 -328
  293. package/.output/server/_libs/react-style-singleton.mjs +0 -69
  294. package/.output/server/_libs/remark-parse.mjs +0 -19
  295. package/.output/server/_libs/remark-rehype.mjs +0 -21
  296. package/.output/server/_libs/space-separated-tokens.mjs +0 -6
  297. package/.output/server/_libs/style-to-js.mjs +0 -72
  298. package/.output/server/_libs/style-to-object.mjs +0 -38
  299. package/.output/server/_libs/swr.mjs +0 -947
  300. package/.output/server/_libs/tailwind-merge.mjs +0 -3255
  301. package/.output/server/_libs/tanstack__react-virtual.mjs +0 -130
  302. package/.output/server/_libs/tanstack__virtual-core.mjs +0 -1319
  303. package/.output/server/_libs/three.mjs +0 -26016
  304. package/.output/server/_libs/trim-lines.mjs +0 -41
  305. package/.output/server/_libs/trough.mjs +0 -85
  306. package/.output/server/_libs/tslib.mjs +0 -1
  307. package/.output/server/_libs/ungap__structured-clone.mjs +0 -212
  308. package/.output/server/_libs/unified.mjs +0 -661
  309. package/.output/server/_libs/unist-util-is.mjs +0 -100
  310. package/.output/server/_libs/unist-util-position.mjs +0 -27
  311. package/.output/server/_libs/unist-util-stringify-position.mjs +0 -27
  312. package/.output/server/_libs/unist-util-visit-parents.mjs +0 -82
  313. package/.output/server/_libs/unist-util-visit.mjs +0 -24
  314. package/.output/server/_libs/use-callback-ref.mjs +0 -66
  315. package/.output/server/_libs/use-sidecar.mjs +0 -106
  316. package/.output/server/_libs/vfile-message.mjs +0 -138
  317. package/.output/server/_libs/vfile.mjs +0 -467
  318. package/.output/server/_sessionId-CJ99gZFV.mjs +0 -84
  319. package/.output/server/_sessionId-DEjScBpK.mjs +0 -146
  320. package/.output/server/_ssr/CompareDrawer-DtOIMeQB.mjs +0 -1060
  321. package/.output/server/_ssr/InspectorPet-CXc4oCBQ.mjs +0 -938
  322. package/.output/server/_ssr/ProxyViewerContainer-DVPlwfkt.mjs +0 -17632
  323. package/.output/server/_ssr/ReplayDialog-BQEA95qC.mjs +0 -725
  324. package/.output/server/_ssr/RequestAnatomy-BMyd8B7Q.mjs +0 -837
  325. package/.output/server/_ssr/ResponseView-qrTaEIM8.mjs +0 -757
  326. package/.output/server/_ssr/StreamingChunkSequence-BFTL8mIy.mjs +0 -274
  327. package/.output/server/_ssr/index-Bcj1Hcy4.mjs +0 -135
  328. package/.output/server/_ssr/index-DW-M7XUG.mjs +0 -84
  329. package/.output/server/_ssr/json-viewer-DiI0Yjsn.mjs +0 -483
  330. package/.output/server/_tanstack-start-manifest_v-C6pXXX9R.mjs +0 -4
  331. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  332. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  333. package/.output/server/node_modules/tslib/package.json +0 -47
  334. package/.output/server/node_modules/tslib/tslib.js +0 -484
  335. package/.output/server/package.json +0 -9
  336. package/src/routes/__root.tsx +0 -170
  337. package/src/routes/api/-instances.ts +0 -109
  338. /package/.output/{public → ui}/assets/agent-inspector-58K1_MsC.ico +0 -0
  339. /package/.output/{public → ui}/assets/alibaba-TTwafVwX.svg +0 -0
  340. /package/.output/{public → ui}/assets/minimax-BPMzvuL-.jpeg +0 -0
  341. /package/.output/{public → ui}/assets/qwen-mMn3f5ul.webp +0 -0
  342. /package/.output/{public → ui}/assets/zhipuai-BPNAnxo-.svg +0 -0
  343. /package/src/{routes → backend/routes}/livez.ts +0 -0
@@ -1,906 +0,0 @@
1
- import { c as combineExtensions } from "./micromark-util-combine-extensions+[...].mjs";
2
- import { f as factorySpace } from "./micromark-factory-space.mjs";
3
- import { m as markdownLineEnding } from "./micromark-util-character.mjs";
4
- import { s as splice, p as push } from "./micromark-util-chunked.mjs";
5
- import { b as blankLine, c as content$1, d as definition, a as blockQuote, l as list, e as codeFenced, t as thematicBreak, s as setextUnderline, h as htmlFlow, f as headingAtx, g as codeIndented, i as attention, j as characterEscape, k as characterReference, m as codeText, n as labelEnd, o as hardBreakEscape, p as labelStartLink, q as autolink, r as htmlText, u as labelStartImage, v as lineEnding } from "./micromark-core-commonmark.mjs";
6
- import { r as resolveAll } from "./micromark-util-resolve-all.mjs";
7
- import { s as subtokenize } from "./micromark-util-subtokenize.mjs";
8
- const content = {
9
- tokenize: initializeContent
10
- };
11
- function initializeContent(effects) {
12
- const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);
13
- let previous;
14
- return contentStart;
15
- function afterContentStartConstruct(code) {
16
- if (code === null) {
17
- effects.consume(code);
18
- return;
19
- }
20
- effects.enter("lineEnding");
21
- effects.consume(code);
22
- effects.exit("lineEnding");
23
- return factorySpace(effects, contentStart, "linePrefix");
24
- }
25
- function paragraphInitial(code) {
26
- effects.enter("paragraph");
27
- return lineStart(code);
28
- }
29
- function lineStart(code) {
30
- const token = effects.enter("chunkText", {
31
- contentType: "text",
32
- previous
33
- });
34
- if (previous) {
35
- previous.next = token;
36
- }
37
- previous = token;
38
- return data(code);
39
- }
40
- function data(code) {
41
- if (code === null) {
42
- effects.exit("chunkText");
43
- effects.exit("paragraph");
44
- effects.consume(code);
45
- return;
46
- }
47
- if (markdownLineEnding(code)) {
48
- effects.consume(code);
49
- effects.exit("chunkText");
50
- return lineStart;
51
- }
52
- effects.consume(code);
53
- return data;
54
- }
55
- }
56
- const document$1 = {
57
- tokenize: initializeDocument
58
- };
59
- const containerConstruct = {
60
- tokenize: tokenizeContainer
61
- };
62
- function initializeDocument(effects) {
63
- const self = this;
64
- const stack = [];
65
- let continued = 0;
66
- let childFlow;
67
- let childToken;
68
- let lineStartOffset;
69
- return start;
70
- function start(code) {
71
- if (continued < stack.length) {
72
- const item = stack[continued];
73
- self.containerState = item[1];
74
- return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
75
- }
76
- return checkNewContainers(code);
77
- }
78
- function documentContinue(code) {
79
- continued++;
80
- if (self.containerState._closeFlow) {
81
- self.containerState._closeFlow = void 0;
82
- if (childFlow) {
83
- closeFlow();
84
- }
85
- const indexBeforeExits = self.events.length;
86
- let indexBeforeFlow = indexBeforeExits;
87
- let point;
88
- while (indexBeforeFlow--) {
89
- if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") {
90
- point = self.events[indexBeforeFlow][1].end;
91
- break;
92
- }
93
- }
94
- exitContainers(continued);
95
- let index = indexBeforeExits;
96
- while (index < self.events.length) {
97
- self.events[index][1].end = {
98
- ...point
99
- };
100
- index++;
101
- }
102
- splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
103
- self.events.length = index;
104
- return checkNewContainers(code);
105
- }
106
- return start(code);
107
- }
108
- function checkNewContainers(code) {
109
- if (continued === stack.length) {
110
- if (!childFlow) {
111
- return documentContinued(code);
112
- }
113
- if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
114
- return flowStart(code);
115
- }
116
- self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack);
117
- }
118
- self.containerState = {};
119
- return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);
120
- }
121
- function thereIsANewContainer(code) {
122
- if (childFlow) closeFlow();
123
- exitContainers(continued);
124
- return documentContinued(code);
125
- }
126
- function thereIsNoNewContainer(code) {
127
- self.parser.lazy[self.now().line] = continued !== stack.length;
128
- lineStartOffset = self.now().offset;
129
- return flowStart(code);
130
- }
131
- function documentContinued(code) {
132
- self.containerState = {};
133
- return effects.attempt(containerConstruct, containerContinue, flowStart)(code);
134
- }
135
- function containerContinue(code) {
136
- continued++;
137
- stack.push([self.currentConstruct, self.containerState]);
138
- return documentContinued(code);
139
- }
140
- function flowStart(code) {
141
- if (code === null) {
142
- if (childFlow) closeFlow();
143
- exitContainers(0);
144
- effects.consume(code);
145
- return;
146
- }
147
- childFlow = childFlow || self.parser.flow(self.now());
148
- effects.enter("chunkFlow", {
149
- _tokenizer: childFlow,
150
- contentType: "flow",
151
- previous: childToken
152
- });
153
- return flowContinue(code);
154
- }
155
- function flowContinue(code) {
156
- if (code === null) {
157
- writeToChild(effects.exit("chunkFlow"), true);
158
- exitContainers(0);
159
- effects.consume(code);
160
- return;
161
- }
162
- if (markdownLineEnding(code)) {
163
- effects.consume(code);
164
- writeToChild(effects.exit("chunkFlow"));
165
- continued = 0;
166
- self.interrupt = void 0;
167
- return start;
168
- }
169
- effects.consume(code);
170
- return flowContinue;
171
- }
172
- function writeToChild(token, endOfFile) {
173
- const stream = self.sliceStream(token);
174
- if (endOfFile) stream.push(null);
175
- token.previous = childToken;
176
- if (childToken) childToken.next = token;
177
- childToken = token;
178
- childFlow.defineSkip(token.start);
179
- childFlow.write(stream);
180
- if (self.parser.lazy[token.start.line]) {
181
- let index = childFlow.events.length;
182
- while (index--) {
183
- if (
184
- // The token starts before the line ending…
185
- childFlow.events[index][1].start.offset < lineStartOffset && // …and either is not ended yet…
186
- (!childFlow.events[index][1].end || // …or ends after it.
187
- childFlow.events[index][1].end.offset > lineStartOffset)
188
- ) {
189
- return;
190
- }
191
- }
192
- const indexBeforeExits = self.events.length;
193
- let indexBeforeFlow = indexBeforeExits;
194
- let seen;
195
- let point;
196
- while (indexBeforeFlow--) {
197
- if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") {
198
- if (seen) {
199
- point = self.events[indexBeforeFlow][1].end;
200
- break;
201
- }
202
- seen = true;
203
- }
204
- }
205
- exitContainers(continued);
206
- index = indexBeforeExits;
207
- while (index < self.events.length) {
208
- self.events[index][1].end = {
209
- ...point
210
- };
211
- index++;
212
- }
213
- splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
214
- self.events.length = index;
215
- }
216
- }
217
- function exitContainers(size) {
218
- let index = stack.length;
219
- while (index-- > size) {
220
- const entry = stack[index];
221
- self.containerState = entry[1];
222
- entry[0].exit.call(self, effects);
223
- }
224
- stack.length = size;
225
- }
226
- function closeFlow() {
227
- childFlow.write([null]);
228
- childToken = void 0;
229
- childFlow = void 0;
230
- self.containerState._closeFlow = void 0;
231
- }
232
- }
233
- function tokenizeContainer(effects, ok, nok) {
234
- return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
235
- }
236
- const flow$1 = {
237
- tokenize: initializeFlow
238
- };
239
- function initializeFlow(effects) {
240
- const self = this;
241
- const initial = effects.attempt(
242
- // Try to parse a blank line.
243
- blankLine,
244
- atBlankEnding,
245
- // Try to parse initial flow (essentially, only code).
246
- effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content$1, afterConstruct)), "linePrefix"))
247
- );
248
- return initial;
249
- function atBlankEnding(code) {
250
- if (code === null) {
251
- effects.consume(code);
252
- return;
253
- }
254
- effects.enter("lineEndingBlank");
255
- effects.consume(code);
256
- effects.exit("lineEndingBlank");
257
- self.currentConstruct = void 0;
258
- return initial;
259
- }
260
- function afterConstruct(code) {
261
- if (code === null) {
262
- effects.consume(code);
263
- return;
264
- }
265
- effects.enter("lineEnding");
266
- effects.consume(code);
267
- effects.exit("lineEnding");
268
- self.currentConstruct = void 0;
269
- return initial;
270
- }
271
- }
272
- const resolver = {
273
- resolveAll: createResolver()
274
- };
275
- const string$1 = initializeFactory("string");
276
- const text$1 = initializeFactory("text");
277
- function initializeFactory(field) {
278
- return {
279
- resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0),
280
- tokenize: initializeText
281
- };
282
- function initializeText(effects) {
283
- const self = this;
284
- const constructs = this.parser.constructs[field];
285
- const text2 = effects.attempt(constructs, start, notText);
286
- return start;
287
- function start(code) {
288
- return atBreak(code) ? text2(code) : notText(code);
289
- }
290
- function notText(code) {
291
- if (code === null) {
292
- effects.consume(code);
293
- return;
294
- }
295
- effects.enter("data");
296
- effects.consume(code);
297
- return data;
298
- }
299
- function data(code) {
300
- if (atBreak(code)) {
301
- effects.exit("data");
302
- return text2(code);
303
- }
304
- effects.consume(code);
305
- return data;
306
- }
307
- function atBreak(code) {
308
- if (code === null) {
309
- return true;
310
- }
311
- const list2 = constructs[code];
312
- let index = -1;
313
- if (list2) {
314
- while (++index < list2.length) {
315
- const item = list2[index];
316
- if (!item.previous || item.previous.call(self, self.previous)) {
317
- return true;
318
- }
319
- }
320
- }
321
- return false;
322
- }
323
- }
324
- }
325
- function createResolver(extraResolver) {
326
- return resolveAllText;
327
- function resolveAllText(events, context) {
328
- let index = -1;
329
- let enter;
330
- while (++index <= events.length) {
331
- if (enter === void 0) {
332
- if (events[index] && events[index][1].type === "data") {
333
- enter = index;
334
- index++;
335
- }
336
- } else if (!events[index] || events[index][1].type !== "data") {
337
- if (index !== enter + 2) {
338
- events[enter][1].end = events[index - 1][1].end;
339
- events.splice(enter + 2, index - enter - 2);
340
- index = enter + 2;
341
- }
342
- enter = void 0;
343
- }
344
- }
345
- return extraResolver ? extraResolver(events, context) : events;
346
- }
347
- }
348
- function resolveAllLineSuffixes(events, context) {
349
- let eventIndex = 0;
350
- while (++eventIndex <= events.length) {
351
- if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") {
352
- const data = events[eventIndex - 1][1];
353
- const chunks = context.sliceStream(data);
354
- let index = chunks.length;
355
- let bufferIndex = -1;
356
- let size = 0;
357
- let tabs;
358
- while (index--) {
359
- const chunk = chunks[index];
360
- if (typeof chunk === "string") {
361
- bufferIndex = chunk.length;
362
- while (chunk.charCodeAt(bufferIndex - 1) === 32) {
363
- size++;
364
- bufferIndex--;
365
- }
366
- if (bufferIndex) break;
367
- bufferIndex = -1;
368
- } else if (chunk === -2) {
369
- tabs = true;
370
- size++;
371
- } else if (chunk === -1) ;
372
- else {
373
- index++;
374
- break;
375
- }
376
- }
377
- if (context._contentTypeTextTrailing && eventIndex === events.length) {
378
- size = 0;
379
- }
380
- if (size) {
381
- const token = {
382
- type: eventIndex === events.length || tabs || size < 2 ? "lineSuffix" : "hardBreakTrailing",
383
- start: {
384
- _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,
385
- _index: data.start._index + index,
386
- line: data.end.line,
387
- column: data.end.column - size,
388
- offset: data.end.offset - size
389
- },
390
- end: {
391
- ...data.end
392
- }
393
- };
394
- data.end = {
395
- ...token.start
396
- };
397
- if (data.start.offset === data.end.offset) {
398
- Object.assign(data, token);
399
- } else {
400
- events.splice(eventIndex, 0, ["enter", token, context], ["exit", token, context]);
401
- eventIndex += 2;
402
- }
403
- }
404
- eventIndex++;
405
- }
406
- }
407
- return events;
408
- }
409
- const document = {
410
- [42]: list,
411
- [43]: list,
412
- [45]: list,
413
- [48]: list,
414
- [49]: list,
415
- [50]: list,
416
- [51]: list,
417
- [52]: list,
418
- [53]: list,
419
- [54]: list,
420
- [55]: list,
421
- [56]: list,
422
- [57]: list,
423
- [62]: blockQuote
424
- };
425
- const contentInitial = {
426
- [91]: definition
427
- };
428
- const flowInitial = {
429
- [-2]: codeIndented,
430
- [-1]: codeIndented,
431
- [32]: codeIndented
432
- };
433
- const flow = {
434
- [35]: headingAtx,
435
- [42]: thematicBreak,
436
- [45]: [setextUnderline, thematicBreak],
437
- [60]: htmlFlow,
438
- [61]: setextUnderline,
439
- [95]: thematicBreak,
440
- [96]: codeFenced,
441
- [126]: codeFenced
442
- };
443
- const string = {
444
- [38]: characterReference,
445
- [92]: characterEscape
446
- };
447
- const text = {
448
- [-5]: lineEnding,
449
- [-4]: lineEnding,
450
- [-3]: lineEnding,
451
- [33]: labelStartImage,
452
- [38]: characterReference,
453
- [42]: attention,
454
- [60]: [autolink, htmlText],
455
- [91]: labelStartLink,
456
- [92]: [hardBreakEscape, characterEscape],
457
- [93]: labelEnd,
458
- [95]: attention,
459
- [96]: codeText
460
- };
461
- const insideSpan = {
462
- null: [attention, resolver]
463
- };
464
- const attentionMarkers = {
465
- null: [42, 95]
466
- };
467
- const disable = {
468
- null: []
469
- };
470
- const defaultConstructs = /* @__PURE__ */ Object.freeze({
471
- __proto__: null,
472
- attentionMarkers,
473
- contentInitial,
474
- disable,
475
- document,
476
- flow,
477
- flowInitial,
478
- insideSpan,
479
- string,
480
- text
481
- });
482
- function createTokenizer(parser, initialize, from) {
483
- let point = {
484
- _bufferIndex: -1,
485
- _index: 0,
486
- line: from && from.line || 1,
487
- column: from && from.column || 1,
488
- offset: from && from.offset || 0
489
- };
490
- const columnStart = {};
491
- const resolveAllConstructs = [];
492
- let chunks = [];
493
- let stack = [];
494
- const effects = {
495
- attempt: constructFactory(onsuccessfulconstruct),
496
- check: constructFactory(onsuccessfulcheck),
497
- consume,
498
- enter,
499
- exit,
500
- interrupt: constructFactory(onsuccessfulcheck, {
501
- interrupt: true
502
- })
503
- };
504
- const context = {
505
- code: null,
506
- containerState: {},
507
- defineSkip,
508
- events: [],
509
- now,
510
- parser,
511
- previous: null,
512
- sliceSerialize,
513
- sliceStream,
514
- write
515
- };
516
- let state = initialize.tokenize.call(context, effects);
517
- if (initialize.resolveAll) {
518
- resolveAllConstructs.push(initialize);
519
- }
520
- return context;
521
- function write(slice) {
522
- chunks = push(chunks, slice);
523
- main();
524
- if (chunks[chunks.length - 1] !== null) {
525
- return [];
526
- }
527
- addResult(initialize, 0);
528
- context.events = resolveAll(resolveAllConstructs, context.events, context);
529
- return context.events;
530
- }
531
- function sliceSerialize(token, expandTabs) {
532
- return serializeChunks(sliceStream(token), expandTabs);
533
- }
534
- function sliceStream(token) {
535
- return sliceChunks(chunks, token);
536
- }
537
- function now() {
538
- const {
539
- _bufferIndex,
540
- _index,
541
- line,
542
- column,
543
- offset
544
- } = point;
545
- return {
546
- _bufferIndex,
547
- _index,
548
- line,
549
- column,
550
- offset
551
- };
552
- }
553
- function defineSkip(value) {
554
- columnStart[value.line] = value.column;
555
- accountForPotentialSkip();
556
- }
557
- function main() {
558
- let chunkIndex;
559
- while (point._index < chunks.length) {
560
- const chunk = chunks[point._index];
561
- if (typeof chunk === "string") {
562
- chunkIndex = point._index;
563
- if (point._bufferIndex < 0) {
564
- point._bufferIndex = 0;
565
- }
566
- while (point._index === chunkIndex && point._bufferIndex < chunk.length) {
567
- go(chunk.charCodeAt(point._bufferIndex));
568
- }
569
- } else {
570
- go(chunk);
571
- }
572
- }
573
- }
574
- function go(code) {
575
- state = state(code);
576
- }
577
- function consume(code) {
578
- if (markdownLineEnding(code)) {
579
- point.line++;
580
- point.column = 1;
581
- point.offset += code === -3 ? 2 : 1;
582
- accountForPotentialSkip();
583
- } else if (code !== -1) {
584
- point.column++;
585
- point.offset++;
586
- }
587
- if (point._bufferIndex < 0) {
588
- point._index++;
589
- } else {
590
- point._bufferIndex++;
591
- if (point._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
592
- // strings.
593
- /** @type {string} */
594
- chunks[point._index].length) {
595
- point._bufferIndex = -1;
596
- point._index++;
597
- }
598
- }
599
- context.previous = code;
600
- }
601
- function enter(type, fields) {
602
- const token = fields || {};
603
- token.type = type;
604
- token.start = now();
605
- context.events.push(["enter", token, context]);
606
- stack.push(token);
607
- return token;
608
- }
609
- function exit(type) {
610
- const token = stack.pop();
611
- token.end = now();
612
- context.events.push(["exit", token, context]);
613
- return token;
614
- }
615
- function onsuccessfulconstruct(construct, info) {
616
- addResult(construct, info.from);
617
- }
618
- function onsuccessfulcheck(_, info) {
619
- info.restore();
620
- }
621
- function constructFactory(onreturn, fields) {
622
- return hook;
623
- function hook(constructs, returnState, bogusState) {
624
- let listOfConstructs;
625
- let constructIndex;
626
- let currentConstruct;
627
- let info;
628
- return Array.isArray(constructs) ? (
629
- /* c8 ignore next 1 */
630
- handleListOfConstructs(constructs)
631
- ) : "tokenize" in constructs ? (
632
- // Looks like a construct.
633
- handleListOfConstructs([
634
- /** @type {Construct} */
635
- constructs
636
- ])
637
- ) : handleMapOfConstructs(constructs);
638
- function handleMapOfConstructs(map) {
639
- return start;
640
- function start(code) {
641
- const left = code !== null && map[code];
642
- const all = code !== null && map.null;
643
- const list2 = [
644
- // To do: add more extension tests.
645
- /* c8 ignore next 2 */
646
- ...Array.isArray(left) ? left : left ? [left] : [],
647
- ...Array.isArray(all) ? all : all ? [all] : []
648
- ];
649
- return handleListOfConstructs(list2)(code);
650
- }
651
- }
652
- function handleListOfConstructs(list2) {
653
- listOfConstructs = list2;
654
- constructIndex = 0;
655
- if (list2.length === 0) {
656
- return bogusState;
657
- }
658
- return handleConstruct(list2[constructIndex]);
659
- }
660
- function handleConstruct(construct) {
661
- return start;
662
- function start(code) {
663
- info = store();
664
- currentConstruct = construct;
665
- if (!construct.partial) {
666
- context.currentConstruct = construct;
667
- }
668
- if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
669
- return nok();
670
- }
671
- return construct.tokenize.call(
672
- // If we do have fields, create an object w/ `context` as its
673
- // prototype.
674
- // This allows a “live binding”, which is needed for `interrupt`.
675
- fields ? Object.assign(Object.create(context), fields) : context,
676
- effects,
677
- ok,
678
- nok
679
- )(code);
680
- }
681
- }
682
- function ok(code) {
683
- onreturn(currentConstruct, info);
684
- return returnState;
685
- }
686
- function nok(code) {
687
- info.restore();
688
- if (++constructIndex < listOfConstructs.length) {
689
- return handleConstruct(listOfConstructs[constructIndex]);
690
- }
691
- return bogusState;
692
- }
693
- }
694
- }
695
- function addResult(construct, from2) {
696
- if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
697
- resolveAllConstructs.push(construct);
698
- }
699
- if (construct.resolve) {
700
- splice(context.events, from2, context.events.length - from2, construct.resolve(context.events.slice(from2), context));
701
- }
702
- if (construct.resolveTo) {
703
- context.events = construct.resolveTo(context.events, context);
704
- }
705
- }
706
- function store() {
707
- const startPoint = now();
708
- const startPrevious = context.previous;
709
- const startCurrentConstruct = context.currentConstruct;
710
- const startEventsIndex = context.events.length;
711
- const startStack = Array.from(stack);
712
- return {
713
- from: startEventsIndex,
714
- restore
715
- };
716
- function restore() {
717
- point = startPoint;
718
- context.previous = startPrevious;
719
- context.currentConstruct = startCurrentConstruct;
720
- context.events.length = startEventsIndex;
721
- stack = startStack;
722
- accountForPotentialSkip();
723
- }
724
- }
725
- function accountForPotentialSkip() {
726
- if (point.line in columnStart && point.column < 2) {
727
- point.column = columnStart[point.line];
728
- point.offset += columnStart[point.line] - 1;
729
- }
730
- }
731
- }
732
- function sliceChunks(chunks, token) {
733
- const startIndex = token.start._index;
734
- const startBufferIndex = token.start._bufferIndex;
735
- const endIndex = token.end._index;
736
- const endBufferIndex = token.end._bufferIndex;
737
- let view;
738
- if (startIndex === endIndex) {
739
- view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
740
- } else {
741
- view = chunks.slice(startIndex, endIndex);
742
- if (startBufferIndex > -1) {
743
- const head = view[0];
744
- if (typeof head === "string") {
745
- view[0] = head.slice(startBufferIndex);
746
- } else {
747
- view.shift();
748
- }
749
- }
750
- if (endBufferIndex > 0) {
751
- view.push(chunks[endIndex].slice(0, endBufferIndex));
752
- }
753
- }
754
- return view;
755
- }
756
- function serializeChunks(chunks, expandTabs) {
757
- let index = -1;
758
- const result = [];
759
- let atTab;
760
- while (++index < chunks.length) {
761
- const chunk = chunks[index];
762
- let value;
763
- if (typeof chunk === "string") {
764
- value = chunk;
765
- } else switch (chunk) {
766
- case -5: {
767
- value = "\r";
768
- break;
769
- }
770
- case -4: {
771
- value = "\n";
772
- break;
773
- }
774
- case -3: {
775
- value = "\r\n";
776
- break;
777
- }
778
- case -2: {
779
- value = expandTabs ? " " : " ";
780
- break;
781
- }
782
- case -1: {
783
- if (!expandTabs && atTab) continue;
784
- value = " ";
785
- break;
786
- }
787
- default: {
788
- value = String.fromCharCode(chunk);
789
- }
790
- }
791
- atTab = chunk === -2;
792
- result.push(value);
793
- }
794
- return result.join("");
795
- }
796
- function parse(options) {
797
- const settings = options || {};
798
- const constructs = (
799
- /** @type {FullNormalizedExtension} */
800
- combineExtensions([defaultConstructs, ...settings.extensions || []])
801
- );
802
- const parser = {
803
- constructs,
804
- content: create(content),
805
- defined: [],
806
- document: create(document$1),
807
- flow: create(flow$1),
808
- lazy: {},
809
- string: create(string$1),
810
- text: create(text$1)
811
- };
812
- return parser;
813
- function create(initial) {
814
- return creator;
815
- function creator(from) {
816
- return createTokenizer(parser, initial, from);
817
- }
818
- }
819
- }
820
- function postprocess(events) {
821
- while (!subtokenize(events)) {
822
- }
823
- return events;
824
- }
825
- const search = /[\0\t\n\r]/g;
826
- function preprocess() {
827
- let column = 1;
828
- let buffer = "";
829
- let start = true;
830
- let atCarriageReturn;
831
- return preprocessor;
832
- function preprocessor(value, encoding, end) {
833
- const chunks = [];
834
- let match;
835
- let next;
836
- let startPosition;
837
- let endPosition;
838
- let code;
839
- value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value));
840
- startPosition = 0;
841
- buffer = "";
842
- if (start) {
843
- if (value.charCodeAt(0) === 65279) {
844
- startPosition++;
845
- }
846
- start = void 0;
847
- }
848
- while (startPosition < value.length) {
849
- search.lastIndex = startPosition;
850
- match = search.exec(value);
851
- endPosition = match && match.index !== void 0 ? match.index : value.length;
852
- code = value.charCodeAt(endPosition);
853
- if (!match) {
854
- buffer = value.slice(startPosition);
855
- break;
856
- }
857
- if (code === 10 && startPosition === endPosition && atCarriageReturn) {
858
- chunks.push(-3);
859
- atCarriageReturn = void 0;
860
- } else {
861
- if (atCarriageReturn) {
862
- chunks.push(-5);
863
- atCarriageReturn = void 0;
864
- }
865
- if (startPosition < endPosition) {
866
- chunks.push(value.slice(startPosition, endPosition));
867
- column += endPosition - startPosition;
868
- }
869
- switch (code) {
870
- case 0: {
871
- chunks.push(65533);
872
- column++;
873
- break;
874
- }
875
- case 9: {
876
- next = Math.ceil(column / 4) * 4;
877
- chunks.push(-2);
878
- while (column++ < next) chunks.push(-1);
879
- break;
880
- }
881
- case 10: {
882
- chunks.push(-4);
883
- column = 1;
884
- break;
885
- }
886
- default: {
887
- atCarriageReturn = true;
888
- column = 1;
889
- }
890
- }
891
- }
892
- startPosition = endPosition + 1;
893
- }
894
- if (end) {
895
- if (atCarriageReturn) chunks.push(-5);
896
- if (buffer) chunks.push(buffer);
897
- chunks.push(null);
898
- }
899
- return chunks;
900
- }
901
- }
902
- export {
903
- parse as a,
904
- preprocess as b,
905
- postprocess as p
906
- };