pi-cursor-sdk 0.5.0 → 0.5.2

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 (723) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +110 -30
  3. package/dist/context.js +53 -34
  4. package/dist/cursor-api-key.js +34 -19
  5. package/dist/cursor-cloud-options.js +1 -0
  6. package/dist/cursor-config.js +59 -0
  7. package/dist/cursor-custom-store-path.js +177 -0
  8. package/dist/cursor-custom-subagent-definitions.js +14 -0
  9. package/dist/cursor-fallback-models.generated.js +1 -1
  10. package/dist/cursor-fallback-warning.js +8 -2
  11. package/dist/cursor-live-run-coordinator.js +22 -2
  12. package/dist/cursor-mcp-timeout-override.js +3 -1
  13. package/dist/cursor-pi-tool-bridge-run.js +21 -0
  14. package/dist/cursor-pi-tool-bridge-server.js +1 -1
  15. package/dist/cursor-provider-binding.js +70 -10
  16. package/dist/cursor-provider-errors.js +33 -26
  17. package/dist/cursor-provider-live-run-drain.js +10 -4
  18. package/dist/cursor-provider-run-finalizer.js +2 -1
  19. package/dist/cursor-provider-turn-prepare.js +25 -9
  20. package/dist/cursor-provider-turn-summary.js +1 -1
  21. package/dist/cursor-provider-turn-tool-ledger.js +13 -7
  22. package/dist/cursor-provider.js +2 -1
  23. package/dist/cursor-question-tool.js +5 -5
  24. package/dist/cursor-request-provenance.js +13 -2
  25. package/dist/cursor-sdk-output-filter.js +1 -1
  26. package/dist/cursor-sdk-process-error-guard.js +1 -3
  27. package/dist/cursor-sdk-runtime.js +13 -14
  28. package/dist/cursor-sdk-vendor-env.js +20 -0
  29. package/dist/cursor-session-agent-cleanup.js +29 -26
  30. package/dist/cursor-session-agent.js +38 -16
  31. package/dist/cursor-session-send-policy.js +2 -2
  32. package/dist/cursor-session-store.js +235 -45
  33. package/dist/cursor-state.js +6 -3
  34. package/dist/cursor-tool-manifest.js +1 -1
  35. package/dist/index.js +21 -19
  36. package/dist/model-discovery.js +51 -18
  37. package/dist/model-list-cache.js +12 -1
  38. package/docs/cursor-live-smoke-checklist.md +2 -2
  39. package/docs/cursor-model-ux-spec.md +70 -26
  40. package/docs/cursor-native-tool-replay.md +13 -5
  41. package/docs/cursor-native-tool-visual-audit.md +1 -1
  42. package/docs/cursor-testing-lessons.md +43 -5
  43. package/docs/cursor-tool-surfaces.md +3 -3
  44. package/node_modules/@hono/node-server/README.md +21 -10
  45. package/node_modules/@hono/node-server/dist/early-hints.cjs +1 -1
  46. package/node_modules/@hono/node-server/dist/early-hints.mjs +1 -1
  47. package/node_modules/@hono/node-server/dist/index.cjs +41 -19
  48. package/node_modules/@hono/node-server/dist/index.mjs +42 -20
  49. package/node_modules/@hono/node-server/dist/serve-static.cjs +1 -0
  50. package/node_modules/@hono/node-server/dist/serve-static.d.cts +2 -1
  51. package/node_modules/@hono/node-server/dist/serve-static.d.mts +2 -1
  52. package/node_modules/@hono/node-server/dist/serve-static.mjs +1 -0
  53. package/node_modules/@hono/node-server/package.json +3 -2
  54. package/node_modules/@modelcontextprotocol/core/dist/{auth--n_Yzytt.d.cts → auth-Anm-lwWi.d.mts} +9 -8
  55. package/node_modules/@modelcontextprotocol/core/dist/{auth-YUQV3RRv.d.mts.map → auth-Anm-lwWi.d.mts.map} +1 -1
  56. package/node_modules/@modelcontextprotocol/core/dist/{auth-CGP0BDVq.mjs → auth-BNDyLTqp.mjs} +5 -3
  57. package/node_modules/@modelcontextprotocol/core/dist/{auth-CGP0BDVq.mjs.map → auth-BNDyLTqp.mjs.map} +1 -1
  58. package/node_modules/@modelcontextprotocol/core/dist/{auth-4-zilcqg.cjs → auth-D1CeV_Jr.cjs} +5 -3
  59. package/node_modules/@modelcontextprotocol/core/dist/{auth-4-zilcqg.cjs.map → auth-D1CeV_Jr.cjs.map} +1 -1
  60. package/node_modules/@modelcontextprotocol/core/dist/{auth-YUQV3RRv.d.mts → auth-V9XJSCfa.d.cts} +9 -8
  61. package/node_modules/@modelcontextprotocol/core/dist/{auth--n_Yzytt.d.cts.map → auth-V9XJSCfa.d.cts.map} +1 -1
  62. package/node_modules/@modelcontextprotocol/core/dist/index.cjs +1 -1
  63. package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +1 -1
  64. package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +1 -1
  65. package/node_modules/@modelcontextprotocol/core/dist/index.mjs +1 -1
  66. package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +1 -1
  67. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +1 -1
  68. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +1 -1
  69. package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +1 -1
  70. package/node_modules/@modelcontextprotocol/core/package.json +2 -2
  71. package/node_modules/@modelcontextprotocol/hono/README.md +7 -5
  72. package/node_modules/@modelcontextprotocol/hono/dist/index.cjs.map +1 -1
  73. package/node_modules/@modelcontextprotocol/hono/dist/index.d.cts +5 -0
  74. package/node_modules/@modelcontextprotocol/hono/dist/index.d.cts.map +1 -1
  75. package/node_modules/@modelcontextprotocol/hono/dist/index.d.mts +5 -0
  76. package/node_modules/@modelcontextprotocol/hono/dist/index.d.mts.map +1 -1
  77. package/node_modules/@modelcontextprotocol/hono/dist/index.mjs.map +1 -1
  78. package/node_modules/@modelcontextprotocol/hono/package.json +4 -4
  79. package/node_modules/@modelcontextprotocol/server/README.md +1 -7
  80. package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-Bt6U_Fqb.d.mts → createMcpHandler-D4NN8WsG.d.mts} +35 -13
  81. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts.map +1 -0
  82. package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-BLVe3qmU.d.cts → createMcpHandler-DZmmlN8e.d.cts} +35 -13
  83. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-DZmmlN8e.d.cts.map +1 -0
  84. package/node_modules/@modelcontextprotocol/server/dist/index.cjs +32 -5
  85. package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -1
  86. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +41 -5
  87. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -1
  88. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +41 -5
  89. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -1
  90. package/node_modules/@modelcontextprotocol/server/dist/index.mjs +32 -5
  91. package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -1
  92. package/node_modules/@modelcontextprotocol/server/dist/{mcp-DUcCQSTW.cjs → mcp-BumlNux0.cjs} +73 -23
  93. package/node_modules/@modelcontextprotocol/server/dist/mcp-BumlNux0.cjs.map +1 -0
  94. package/node_modules/@modelcontextprotocol/server/dist/{mcp-Dw2OlZ1f.mjs → mcp-DIH4cS6P.mjs} +73 -23
  95. package/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs.map +1 -0
  96. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +1 -1
  97. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +1 -1
  98. package/node_modules/@modelcontextprotocol/server/dist/{src-CgFsfg3E.cjs → src-BhnGYybN.cjs} +29 -11
  99. package/node_modules/@modelcontextprotocol/server/dist/src-BhnGYybN.cjs.map +1 -0
  100. package/node_modules/@modelcontextprotocol/server/dist/{src-D-y6h4N7.mjs → src-Cqbh3MYc.mjs} +29 -11
  101. package/node_modules/@modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs.map +1 -0
  102. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +2 -2
  103. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +1 -1
  104. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +1 -1
  105. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +2 -2
  106. package/node_modules/@modelcontextprotocol/server/package.json +4 -4
  107. package/node_modules/hono/dist/_virtual/_rolldown/runtime.js +13 -0
  108. package/node_modules/hono/dist/adapter/aws-lambda/conninfo.js +42 -23
  109. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +318 -344
  110. package/node_modules/hono/dist/adapter/aws-lambda/index.js +2 -8
  111. package/node_modules/hono/dist/adapter/aws-lambda/types.js +1 -0
  112. package/node_modules/hono/dist/adapter/bun/conninfo.js +20 -25
  113. package/node_modules/hono/dist/adapter/bun/index.js +3 -13
  114. package/node_modules/hono/dist/adapter/bun/serve-static.js +27 -27
  115. package/node_modules/hono/dist/adapter/bun/server.js +11 -5
  116. package/node_modules/hono/dist/adapter/bun/ssg.js +25 -15
  117. package/node_modules/hono/dist/adapter/bun/websocket.js +61 -68
  118. package/node_modules/hono/dist/adapter/cloudflare-pages/conninfo.js +24 -9
  119. package/node_modules/hono/dist/adapter/cloudflare-pages/handler.js +59 -62
  120. package/node_modules/hono/dist/adapter/cloudflare-pages/index.js +2 -8
  121. package/node_modules/hono/dist/adapter/cloudflare-workers/conninfo.js +7 -9
  122. package/node_modules/hono/dist/adapter/cloudflare-workers/index.js +3 -8
  123. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js +5 -6
  124. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js +26 -20
  125. package/node_modules/hono/dist/adapter/cloudflare-workers/utils.js +21 -34
  126. package/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js +31 -39
  127. package/node_modules/hono/dist/adapter/deno/conninfo.js +16 -13
  128. package/node_modules/hono/dist/adapter/deno/deno.d.js +1 -0
  129. package/node_modules/hono/dist/adapter/deno/index.js +3 -10
  130. package/node_modules/hono/dist/adapter/deno/serve-static.js +33 -38
  131. package/node_modules/hono/dist/adapter/deno/ssg.js +27 -16
  132. package/node_modules/hono/dist/adapter/deno/websocket.js +30 -30
  133. package/node_modules/hono/dist/adapter/lambda-edge/conninfo.js +7 -9
  134. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +102 -101
  135. package/node_modules/hono/dist/adapter/lambda-edge/index.js +2 -6
  136. package/node_modules/hono/dist/adapter/netlify/conninfo.js +24 -9
  137. package/node_modules/hono/dist/adapter/netlify/handler.js +10 -8
  138. package/node_modules/hono/dist/adapter/netlify/index.js +3 -2
  139. package/node_modules/hono/dist/adapter/netlify/mod.js +2 -6
  140. package/node_modules/hono/dist/adapter/service-worker/handler.js +15 -19
  141. package/node_modules/hono/dist/adapter/service-worker/index.js +23 -7
  142. package/node_modules/hono/dist/adapter/service-worker/types.js +1 -0
  143. package/node_modules/hono/dist/adapter/vercel/conninfo.js +7 -10
  144. package/node_modules/hono/dist/adapter/vercel/handler.js +8 -6
  145. package/node_modules/hono/dist/adapter/vercel/index.js +2 -6
  146. package/node_modules/hono/dist/cjs/_virtual/_rolldown/runtime.js +33 -0
  147. package/node_modules/hono/dist/cjs/adapter/aws-lambda/conninfo.js +42 -44
  148. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +326 -373
  149. package/node_modules/hono/dist/cjs/adapter/aws-lambda/index.js +7 -34
  150. package/node_modules/hono/dist/cjs/adapter/aws-lambda/types.js +0 -15
  151. package/node_modules/hono/dist/cjs/adapter/bun/conninfo.js +21 -47
  152. package/node_modules/hono/dist/cjs/adapter/bun/index.js +14 -45
  153. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +29 -50
  154. package/node_modules/hono/dist/cjs/adapter/bun/server.js +11 -26
  155. package/node_modules/hono/dist/cjs/adapter/bun/ssg.js +24 -35
  156. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +63 -91
  157. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/conninfo.js +25 -31
  158. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/handler.js +61 -85
  159. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/index.js +7 -34
  160. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/conninfo.js +8 -31
  161. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/index.js +7 -33
  162. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static-module.js +7 -29
  163. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static.js +27 -42
  164. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/utils.js +21 -55
  165. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/websocket.js +33 -62
  166. package/node_modules/hono/dist/cjs/adapter/deno/conninfo.js +16 -34
  167. package/node_modules/hono/dist/cjs/adapter/deno/index.js +10 -38
  168. package/node_modules/hono/dist/cjs/adapter/deno/serve-static.js +33 -59
  169. package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +27 -37
  170. package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +32 -53
  171. package/node_modules/hono/dist/cjs/adapter/lambda-edge/conninfo.js +8 -31
  172. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +102 -130
  173. package/node_modules/hono/dist/cjs/adapter/lambda-edge/index.js +5 -30
  174. package/node_modules/hono/dist/cjs/adapter/netlify/conninfo.js +25 -31
  175. package/node_modules/hono/dist/cjs/adapter/netlify/handler.js +10 -29
  176. package/node_modules/hono/dist/cjs/adapter/netlify/index.js +5 -21
  177. package/node_modules/hono/dist/cjs/adapter/netlify/mod.js +5 -30
  178. package/node_modules/hono/dist/cjs/adapter/service-worker/handler.js +16 -41
  179. package/node_modules/hono/dist/cjs/adapter/service-worker/index.js +25 -30
  180. package/node_modules/hono/dist/cjs/adapter/service-worker/types.js +0 -15
  181. package/node_modules/hono/dist/cjs/adapter/vercel/conninfo.js +8 -32
  182. package/node_modules/hono/dist/cjs/adapter/vercel/handler.js +8 -27
  183. package/node_modules/hono/dist/cjs/adapter/vercel/index.js +5 -30
  184. package/node_modules/hono/dist/cjs/client/client.js +139 -212
  185. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +62 -80
  186. package/node_modules/hono/dist/cjs/client/index.js +7 -32
  187. package/node_modules/hono/dist/cjs/client/types.js +0 -15
  188. package/node_modules/hono/dist/cjs/client/utils.js +54 -92
  189. package/node_modules/hono/dist/cjs/compose.js +49 -66
  190. package/node_modules/hono/dist/cjs/context.js +379 -450
  191. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +47 -72
  192. package/node_modules/hono/dist/cjs/helper/accepts/index.js +3 -27
  193. package/node_modules/hono/dist/cjs/helper/adapter/index.js +33 -73
  194. package/node_modules/hono/dist/cjs/helper/conninfo/index.js +0 -15
  195. package/node_modules/hono/dist/cjs/helper/conninfo/types.js +0 -15
  196. package/node_modules/hono/dist/cjs/helper/cookie/index.js +75 -116
  197. package/node_modules/hono/dist/cjs/helper/css/common.js +165 -244
  198. package/node_modules/hono/dist/cjs/helper/css/index.js +136 -151
  199. package/node_modules/hono/dist/cjs/helper/dev/index.js +45 -71
  200. package/node_modules/hono/dist/cjs/helper/factory/index.js +30 -51
  201. package/node_modules/hono/dist/cjs/helper/html/index.js +32 -62
  202. package/node_modules/hono/dist/cjs/helper/proxy/index.js +113 -106
  203. package/node_modules/hono/dist/cjs/helper/route/index.js +123 -66
  204. package/node_modules/hono/dist/cjs/helper/ssg/index.js +19 -43
  205. package/node_modules/hono/dist/cjs/helper/ssg/middleware.js +56 -64
  206. package/node_modules/hono/dist/cjs/helper/ssg/plugins.js +55 -57
  207. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +196 -296
  208. package/node_modules/hono/dist/cjs/helper/ssg/utils.js +47 -90
  209. package/node_modules/hono/dist/cjs/helper/streaming/index.js +8 -35
  210. package/node_modules/hono/dist/cjs/helper/streaming/sse.js +53 -85
  211. package/node_modules/hono/dist/cjs/helper/streaming/stream.js +23 -53
  212. package/node_modules/hono/dist/cjs/helper/streaming/text.js +10 -32
  213. package/node_modules/hono/dist/cjs/helper/streaming/utils.js +13 -32
  214. package/node_modules/hono/dist/cjs/helper/testing/index.js +16 -31
  215. package/node_modules/hono/dist/cjs/helper/websocket/index.js +51 -76
  216. package/node_modules/hono/dist/cjs/hono-base.js +347 -403
  217. package/node_modules/hono/dist/cjs/hono.js +28 -42
  218. package/node_modules/hono/dist/cjs/http-exception.js +55 -56
  219. package/node_modules/hono/dist/cjs/index.js +22 -30
  220. package/node_modules/hono/dist/cjs/jsx/base.js +237 -366
  221. package/node_modules/hono/dist/cjs/jsx/children.js +16 -41
  222. package/node_modules/hono/dist/cjs/jsx/components.js +119 -192
  223. package/node_modules/hono/dist/cjs/jsx/constants.js +15 -42
  224. package/node_modules/hono/dist/cjs/jsx/context.js +144 -162
  225. package/node_modules/hono/dist/cjs/jsx/dom/client.js +49 -69
  226. package/node_modules/hono/dist/cjs/jsx/dom/components.js +23 -52
  227. package/node_modules/hono/dist/cjs/jsx/dom/context.js +39 -67
  228. package/node_modules/hono/dist/cjs/jsx/dom/css.js +143 -158
  229. package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +55 -64
  230. package/node_modules/hono/dist/cjs/jsx/dom/index.js +114 -173
  231. package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +282 -375
  232. package/node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js +14 -49
  233. package/node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js +5 -32
  234. package/node_modules/hono/dist/cjs/jsx/dom/render.js +469 -623
  235. package/node_modules/hono/dist/cjs/jsx/dom/server.js +37 -64
  236. package/node_modules/hono/dist/cjs/jsx/dom/utils.js +7 -30
  237. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +225 -318
  238. package/node_modules/hono/dist/cjs/jsx/index.js +86 -135
  239. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/common.js +20 -43
  240. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +117 -168
  241. package/node_modules/hono/dist/cjs/jsx/intrinsic-elements.js +0 -15
  242. package/node_modules/hono/dist/cjs/jsx/jsx-dev-runtime.js +14 -39
  243. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +34 -68
  244. package/node_modules/hono/dist/cjs/jsx/streaming.js +123 -166
  245. package/node_modules/hono/dist/cjs/jsx/types.js +0 -15
  246. package/node_modules/hono/dist/cjs/jsx/utils.js +91 -175
  247. package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +98 -86
  248. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +92 -109
  249. package/node_modules/hono/dist/cjs/middleware/body-limit/index.js +66 -72
  250. package/node_modules/hono/dist/cjs/middleware/cache/index.js +153 -199
  251. package/node_modules/hono/dist/cjs/middleware/combine/index.js +135 -95
  252. package/node_modules/hono/dist/cjs/middleware/compress/index.js +73 -88
  253. package/node_modules/hono/dist/cjs/middleware/context-storage/index.js +49 -41
  254. package/node_modules/hono/dist/cjs/middleware/cors/index.js +107 -107
  255. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +101 -72
  256. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +58 -97
  257. package/node_modules/hono/dist/cjs/middleware/etag/index.js +71 -91
  258. package/node_modules/hono/dist/cjs/middleware/ip-restriction/index.js +161 -169
  259. package/node_modules/hono/dist/cjs/middleware/jsx-renderer/index.js +99 -77
  260. package/node_modules/hono/dist/cjs/middleware/jwk/index.js +3 -27
  261. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +118 -135
  262. package/node_modules/hono/dist/cjs/middleware/jwt/index.js +9 -38
  263. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +120 -141
  264. package/node_modules/hono/dist/cjs/middleware/language/index.js +7 -35
  265. package/node_modules/hono/dist/cjs/middleware/language/language.js +184 -182
  266. package/node_modules/hono/dist/cjs/middleware/logger/index.js +41 -62
  267. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +82 -88
  268. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +101 -102
  269. package/node_modules/hono/dist/cjs/middleware/mount/index.js +71 -0
  270. package/node_modules/hono/dist/cjs/middleware/powered-by/index.js +23 -30
  271. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +38 -42
  272. package/node_modules/hono/dist/cjs/middleware/request-id/index.js +3 -27
  273. package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +34 -42
  274. package/node_modules/hono/dist/cjs/middleware/secure-headers/index.js +4 -29
  275. package/node_modules/hono/dist/cjs/middleware/secure-headers/permissions-policy.js +0 -15
  276. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +142 -174
  277. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +56 -93
  278. package/node_modules/hono/dist/cjs/middleware/serve-static/path.js +15 -38
  279. package/node_modules/hono/dist/cjs/middleware/timeout/index.js +40 -45
  280. package/node_modules/hono/dist/cjs/middleware/timing/index.js +7 -35
  281. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +177 -118
  282. package/node_modules/hono/dist/cjs/middleware/trailing-slash/index.js +85 -58
  283. package/node_modules/hono/dist/cjs/preset/quick.js +18 -37
  284. package/node_modules/hono/dist/cjs/preset/tiny.js +15 -33
  285. package/node_modules/hono/dist/cjs/request/constants.js +5 -27
  286. package/node_modules/hono/dist/cjs/request.js +334 -346
  287. package/node_modules/hono/dist/cjs/router/linear-router/index.js +3 -27
  288. package/node_modules/hono/dist/cjs/router/linear-router/router.js +95 -143
  289. package/node_modules/hono/dist/cjs/router/pattern-router/index.js +3 -27
  290. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +41 -63
  291. package/node_modules/hono/dist/cjs/router/reg-exp-router/index.js +7 -34
  292. package/node_modules/hono/dist/cjs/router/reg-exp-router/matcher.js +18 -45
  293. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +91 -135
  294. package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +92 -161
  295. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +98 -147
  296. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +73 -89
  297. package/node_modules/hono/dist/cjs/router/smart-router/index.js +3 -27
  298. package/node_modules/hono/dist/cjs/router/smart-router/router.js +49 -79
  299. package/node_modules/hono/dist/cjs/router/trie-router/index.js +3 -27
  300. package/node_modules/hono/dist/cjs/router/trie-router/node.js +134 -186
  301. package/node_modules/hono/dist/cjs/router/trie-router/router.js +15 -39
  302. package/node_modules/hono/dist/cjs/router/utils.js +5 -27
  303. package/node_modules/hono/dist/cjs/router.js +37 -37
  304. package/node_modules/hono/dist/cjs/types.js +5 -28
  305. package/node_modules/hono/dist/cjs/utils/accept.js +177 -225
  306. package/node_modules/hono/dist/cjs/utils/basic-auth.js +16 -40
  307. package/node_modules/hono/dist/cjs/utils/body.js +84 -110
  308. package/node_modules/hono/dist/cjs/utils/buffer.js +43 -91
  309. package/node_modules/hono/dist/cjs/utils/color.js +35 -44
  310. package/node_modules/hono/dist/cjs/utils/compress.js +11 -26
  311. package/node_modules/hono/dist/cjs/utils/concurrent.js +29 -59
  312. package/node_modules/hono/dist/cjs/utils/constants.js +7 -26
  313. package/node_modules/hono/dist/cjs/utils/cookie.js +107 -177
  314. package/node_modules/hono/dist/cjs/utils/crypto.js +30 -61
  315. package/node_modules/hono/dist/cjs/utils/encode.js +31 -48
  316. package/node_modules/hono/dist/cjs/utils/filepath.js +23 -54
  317. package/node_modules/hono/dist/cjs/utils/handler.js +11 -33
  318. package/node_modules/hono/dist/cjs/utils/headers.js +0 -15
  319. package/node_modules/hono/dist/cjs/utils/html.js +96 -137
  320. package/node_modules/hono/dist/cjs/utils/http-status.js +0 -15
  321. package/node_modules/hono/dist/cjs/utils/ipaddr.js +213 -286
  322. package/node_modules/hono/dist/cjs/utils/jwt/index.js +14 -27
  323. package/node_modules/hono/dist/cjs/utils/jwt/jwa.js +25 -42
  324. package/node_modules/hono/dist/cjs/utils/jwt/jws.js +119 -199
  325. package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +122 -206
  326. package/node_modules/hono/dist/cjs/utils/jwt/types.js +122 -159
  327. package/node_modules/hono/dist/cjs/utils/jwt/utf8.js +9 -28
  328. package/node_modules/hono/dist/cjs/utils/mime.js +75 -101
  329. package/node_modules/hono/dist/cjs/utils/stream.js +88 -111
  330. package/node_modules/hono/dist/cjs/utils/types.js +0 -15
  331. package/node_modules/hono/dist/cjs/utils/url.js +185 -234
  332. package/node_modules/hono/dist/cjs/validator/index.js +3 -27
  333. package/node_modules/hono/dist/cjs/validator/utils.js +0 -15
  334. package/node_modules/hono/dist/cjs/validator/validator.js +60 -103
  335. package/node_modules/hono/dist/client/client.js +138 -197
  336. package/node_modules/hono/dist/client/fetch-result-please.js +59 -56
  337. package/node_modules/hono/dist/client/index.js +3 -7
  338. package/node_modules/hono/dist/client/types.js +1 -0
  339. package/node_modules/hono/dist/client/utils.js +51 -68
  340. package/node_modules/hono/dist/compose.js +49 -45
  341. package/node_modules/hono/dist/context.js +376 -426
  342. package/node_modules/hono/dist/helper/accepts/accepts.js +47 -51
  343. package/node_modules/hono/dist/helper/accepts/index.js +1 -4
  344. package/node_modules/hono/dist/helper/adapter/index.js +33 -52
  345. package/node_modules/hono/dist/helper/conninfo/index.js +1 -0
  346. package/node_modules/hono/dist/helper/conninfo/types.js +1 -0
  347. package/node_modules/hono/dist/helper/cookie/index.js +74 -94
  348. package/node_modules/hono/dist/helper/css/common.js +167 -225
  349. package/node_modules/hono/dist/helper/css/index.js +132 -137
  350. package/node_modules/hono/dist/helper/dev/index.js +44 -49
  351. package/node_modules/hono/dist/helper/factory/index.js +27 -27
  352. package/node_modules/hono/dist/helper/html/index.js +30 -39
  353. package/node_modules/hono/dist/helper/proxy/index.js +116 -88
  354. package/node_modules/hono/dist/helper/route/index.js +121 -43
  355. package/node_modules/hono/dist/helper/ssg/index.js +3 -18
  356. package/node_modules/hono/dist/helper/ssg/middleware.js +53 -40
  357. package/node_modules/hono/dist/helper/ssg/plugins.js +55 -36
  358. package/node_modules/hono/dist/helper/ssg/ssg.js +198 -283
  359. package/node_modules/hono/dist/helper/ssg/utils.js +53 -75
  360. package/node_modules/hono/dist/helper/streaming/index.js +2 -8
  361. package/node_modules/hono/dist/helper/streaming/sse.js +50 -61
  362. package/node_modules/hono/dist/helper/streaming/stream.js +22 -31
  363. package/node_modules/hono/dist/helper/streaming/text.js +9 -10
  364. package/node_modules/hono/dist/helper/streaming/utils.js +9 -12
  365. package/node_modules/hono/dist/helper/testing/index.js +16 -10
  366. package/node_modules/hono/dist/helper/websocket/index.js +49 -53
  367. package/node_modules/hono/dist/hono-base.js +344 -379
  368. package/node_modules/hono/dist/hono.js +27 -20
  369. package/node_modules/hono/dist/http-exception.js +53 -33
  370. package/node_modules/hono/dist/index.js +19 -6
  371. package/node_modules/hono/dist/jsx/base.js +231 -340
  372. package/node_modules/hono/dist/jsx/children.js +16 -20
  373. package/node_modules/hono/dist/jsx/components.js +118 -170
  374. package/node_modules/hono/dist/jsx/constants.js +9 -15
  375. package/node_modules/hono/dist/jsx/context.js +153 -150
  376. package/node_modules/hono/dist/jsx/dom/client.js +45 -48
  377. package/node_modules/hono/dist/jsx/dom/components.js +21 -29
  378. package/node_modules/hono/dist/jsx/dom/context.js +37 -44
  379. package/node_modules/hono/dist/jsx/dom/css.js +142 -147
  380. package/node_modules/hono/dist/jsx/dom/hooks/index.js +52 -40
  381. package/node_modules/hono/dist/jsx/dom/index.js +71 -134
  382. package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +275 -359
  383. package/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js +14 -18
  384. package/node_modules/hono/dist/jsx/dom/jsx-runtime.js +2 -8
  385. package/node_modules/hono/dist/jsx/dom/render.js +492 -631
  386. package/node_modules/hono/dist/jsx/dom/server.js +32 -32
  387. package/node_modules/hono/dist/jsx/dom/utils.js +6 -8
  388. package/node_modules/hono/dist/jsx/hooks/index.js +236 -308
  389. package/node_modules/hono/dist/jsx/index.js +45 -98
  390. package/node_modules/hono/dist/jsx/intrinsic-element/common.js +20 -22
  391. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +113 -154
  392. package/node_modules/hono/dist/jsx/intrinsic-elements.js +1 -0
  393. package/node_modules/hono/dist/jsx/jsx-dev-runtime.js +12 -16
  394. package/node_modules/hono/dist/jsx/jsx-runtime.js +29 -42
  395. package/node_modules/hono/dist/jsx/streaming.js +120 -142
  396. package/node_modules/hono/dist/jsx/types.js +1 -0
  397. package/node_modules/hono/dist/jsx/utils.js +105 -168
  398. package/node_modules/hono/dist/middleware/basic-auth/index.js +96 -63
  399. package/node_modules/hono/dist/middleware/bearer-auth/index.js +93 -89
  400. package/node_modules/hono/dist/middleware/body-limit/index.js +66 -51
  401. package/node_modules/hono/dist/middleware/cache/index.js +165 -190
  402. package/node_modules/hono/dist/middleware/combine/index.js +134 -73
  403. package/node_modules/hono/dist/middleware/compress/index.js +75 -69
  404. package/node_modules/hono/dist/middleware/context-storage/index.js +49 -19
  405. package/node_modules/hono/dist/middleware/cors/index.js +107 -86
  406. package/node_modules/hono/dist/middleware/csrf/index.js +103 -53
  407. package/node_modules/hono/dist/middleware/etag/digest.js +59 -77
  408. package/node_modules/hono/dist/middleware/etag/index.js +71 -70
  409. package/node_modules/hono/dist/middleware/ip-restriction/index.js +163 -158
  410. package/node_modules/hono/dist/middleware/jsx-renderer/index.js +97 -54
  411. package/node_modules/hono/dist/middleware/jwk/index.js +1 -4
  412. package/node_modules/hono/dist/middleware/jwk/jwk.js +116 -112
  413. package/node_modules/hono/dist/middleware/jwt/index.js +2 -10
  414. package/node_modules/hono/dist/middleware/jwt/jwt.js +114 -114
  415. package/node_modules/hono/dist/middleware/language/index.js +2 -15
  416. package/node_modules/hono/dist/middleware/language/language.js +180 -157
  417. package/node_modules/hono/dist/middleware/logger/index.js +43 -37
  418. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +81 -66
  419. package/node_modules/hono/dist/middleware/method-override/index.js +101 -81
  420. package/node_modules/hono/dist/middleware/mount/index.js +70 -0
  421. package/node_modules/hono/dist/middleware/powered-by/index.js +23 -9
  422. package/node_modules/hono/dist/middleware/pretty-json/index.js +39 -22
  423. package/node_modules/hono/dist/middleware/request-id/index.js +1 -4
  424. package/node_modules/hono/dist/middleware/request-id/request-id.js +33 -20
  425. package/node_modules/hono/dist/middleware/secure-headers/index.js +1 -5
  426. package/node_modules/hono/dist/middleware/secure-headers/permissions-policy.js +1 -0
  427. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +144 -155
  428. package/node_modules/hono/dist/middleware/serve-static/index.js +56 -72
  429. package/node_modules/hono/dist/middleware/serve-static/path.js +15 -17
  430. package/node_modules/hono/dist/middleware/timeout/index.js +40 -23
  431. package/node_modules/hono/dist/middleware/timing/index.js +2 -9
  432. package/node_modules/hono/dist/middleware/timing/timing.js +177 -97
  433. package/node_modules/hono/dist/middleware/trailing-slash/index.js +85 -37
  434. package/node_modules/hono/dist/preset/quick.js +17 -15
  435. package/node_modules/hono/dist/preset/tiny.js +14 -11
  436. package/node_modules/hono/dist/request/constants.js +4 -5
  437. package/node_modules/hono/dist/request.js +328 -319
  438. package/node_modules/hono/dist/router/linear-router/index.js +1 -4
  439. package/node_modules/hono/dist/router/linear-router/router.js +93 -120
  440. package/node_modules/hono/dist/router/pattern-router/index.js +1 -4
  441. package/node_modules/hono/dist/router/pattern-router/router.js +39 -40
  442. package/node_modules/hono/dist/router/reg-exp-router/index.js +1 -7
  443. package/node_modules/hono/dist/router/reg-exp-router/matcher.js +17 -23
  444. package/node_modules/hono/dist/router/reg-exp-router/node.js +87 -110
  445. package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +89 -137
  446. package/node_modules/hono/dist/router/reg-exp-router/router.js +92 -129
  447. package/node_modules/hono/dist/router/reg-exp-router/trie.js +69 -64
  448. package/node_modules/hono/dist/router/smart-router/index.js +1 -4
  449. package/node_modules/hono/dist/router/smart-router/router.js +46 -55
  450. package/node_modules/hono/dist/router/trie-router/index.js +1 -4
  451. package/node_modules/hono/dist/router/trie-router/node.js +131 -162
  452. package/node_modules/hono/dist/router/trie-router/router.js +11 -14
  453. package/node_modules/hono/dist/router/utils.js +4 -5
  454. package/node_modules/hono/dist/router.js +35 -14
  455. package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +4 -1
  456. package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +150 -104
  457. package/node_modules/hono/dist/types/adapter/aws-lambda/index.d.ts +4 -8
  458. package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +152 -122
  459. package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +4 -1
  460. package/node_modules/hono/dist/types/adapter/bun/index.d.ts +6 -10
  461. package/node_modules/hono/dist/types/adapter/bun/serve-static.d.ts +7 -2
  462. package/node_modules/hono/dist/types/adapter/bun/server.d.ts +4 -5
  463. package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +5 -1
  464. package/node_modules/hono/dist/types/adapter/bun/websocket.d.ts +31 -16
  465. package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +4 -1
  466. package/node_modules/hono/dist/types/adapter/cloudflare-pages/handler.d.ts +29 -17
  467. package/node_modules/hono/dist/types/adapter/cloudflare-pages/index.d.ts +3 -7
  468. package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +6 -1
  469. package/node_modules/hono/dist/types/adapter/cloudflare-workers/index.d.ts +4 -7
  470. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +5 -2
  471. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static.d.ts +10 -5
  472. package/node_modules/hono/dist/types/adapter/cloudflare-workers/utils.d.ts +10 -2
  473. package/node_modules/hono/dist/types/adapter/cloudflare-workers/websocket.d.ts +6 -1
  474. package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +4 -1
  475. package/node_modules/hono/dist/types/adapter/deno/deno.d.ts +1 -0
  476. package/node_modules/hono/dist/types/adapter/deno/index.d.ts +5 -8
  477. package/node_modules/hono/dist/types/adapter/deno/serve-static.d.ts +7 -2
  478. package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +5 -1
  479. package/node_modules/hono/dist/types/adapter/deno/websocket.d.ts +6 -1
  480. package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +6 -1
  481. package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +83 -57
  482. package/node_modules/hono/dist/types/adapter/lambda-edge/index.d.ts +3 -7
  483. package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +4 -1
  484. package/node_modules/hono/dist/types/adapter/netlify/handler.d.ts +6 -1
  485. package/node_modules/hono/dist/types/adapter/netlify/index.d.ts +3 -5
  486. package/node_modules/hono/dist/types/adapter/netlify/mod.d.ts +3 -2
  487. package/node_modules/hono/dist/types/adapter/service-worker/handler.d.ts +9 -7
  488. package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +7 -9
  489. package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +12 -7
  490. package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +6 -1
  491. package/node_modules/hono/dist/types/adapter/vercel/handler.d.ts +6 -1
  492. package/node_modules/hono/dist/types/adapter/vercel/index.d.ts +3 -6
  493. package/node_modules/hono/dist/types/client/client.d.ts +5 -3
  494. package/node_modules/hono/dist/types/client/fetch-result-please.d.ts +21 -19
  495. package/node_modules/hono/dist/types/client/index.d.ts +5 -7
  496. package/node_modules/hono/dist/types/client/types.d.ts +134 -159
  497. package/node_modules/hono/dist/types/client/utils.d.ts +6 -4
  498. package/node_modules/hono/dist/types/compose.d.ts +4 -2
  499. package/node_modules/hono/dist/types/context.d.ts +335 -335
  500. package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +11 -9
  501. package/node_modules/hono/dist/types/helper/accepts/index.d.ts +2 -5
  502. package/node_modules/hono/dist/types/helper/adapter/index.d.ts +4 -6
  503. package/node_modules/hono/dist/types/helper/conninfo/index.d.ts +2 -5
  504. package/node_modules/hono/dist/types/helper/conninfo/types.d.ts +25 -23
  505. package/node_modules/hono/dist/types/helper/cookie/index.d.ts +10 -12
  506. package/node_modules/hono/dist/types/helper/css/common.d.ts +11 -9
  507. package/node_modules/hono/dist/types/helper/css/index.d.ts +26 -28
  508. package/node_modules/hono/dist/types/helper/dev/index.d.ts +10 -12
  509. package/node_modules/hono/dist/types/helper/factory/index.d.ts +26 -73
  510. package/node_modules/hono/dist/types/helper/html/index.d.ts +4 -7
  511. package/node_modules/hono/dist/types/helper/proxy/index.d.ts +19 -21
  512. package/node_modules/hono/dist/types/helper/route/index.d.ts +4 -2
  513. package/node_modules/hono/dist/types/helper/ssg/index.d.ts +4 -7
  514. package/node_modules/hono/dist/types/helper/ssg/middleware.d.ts +8 -6
  515. package/node_modules/hono/dist/types/helper/ssg/plugins.d.ts +3 -1
  516. package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +38 -36
  517. package/node_modules/hono/dist/types/helper/ssg/utils.d.ts +5 -3
  518. package/node_modules/hono/dist/types/helper/streaming/index.d.ts +4 -8
  519. package/node_modules/hono/dist/types/helper/streaming/sse.d.ts +10 -8
  520. package/node_modules/hono/dist/types/helper/streaming/stream.d.ts +4 -2
  521. package/node_modules/hono/dist/types/helper/streaming/text.d.ts +4 -2
  522. package/node_modules/hono/dist/types/helper/streaming/utils.d.ts +2 -0
  523. package/node_modules/hono/dist/types/helper/testing/index.d.ts +7 -9
  524. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +30 -33
  525. package/node_modules/hono/dist/types/hono-base.d.ts +210 -210
  526. package/node_modules/hono/dist/types/hono.d.ts +11 -10
  527. package/node_modules/hono/dist/types/http-exception.d.ts +20 -22
  528. package/node_modules/hono/dist/types/index.d.ts +6 -37
  529. package/node_modules/hono/dist/types/jsx/base.d.ts +37 -35
  530. package/node_modules/hono/dist/types/jsx/children.d.ts +8 -6
  531. package/node_modules/hono/dist/types/jsx/components.d.ts +8 -5
  532. package/node_modules/hono/dist/types/jsx/constants.d.ts +2 -0
  533. package/node_modules/hono/dist/types/jsx/context.d.ts +9 -6
  534. package/node_modules/hono/dist/types/jsx/dom/client.d.ts +9 -10
  535. package/node_modules/hono/dist/types/jsx/dom/components.d.ts +9 -6
  536. package/node_modules/hono/dist/types/jsx/dom/context.d.ts +3 -1
  537. package/node_modules/hono/dist/types/jsx/dom/css.d.ts +27 -30
  538. package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +11 -12
  539. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +79 -83
  540. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +9 -5
  541. package/node_modules/hono/dist/types/jsx/dom/jsx-dev-runtime.d.ts +4 -6
  542. package/node_modules/hono/dist/types/jsx/dom/jsx-runtime.d.ts +3 -7
  543. package/node_modules/hono/dist/types/jsx/dom/render.d.ts +32 -50
  544. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +87 -85
  545. package/node_modules/hono/dist/types/jsx/dom/utils.d.ts +2 -0
  546. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +16 -16
  547. package/node_modules/hono/dist/types/jsx/index.d.ts +71 -73
  548. package/node_modules/hono/dist/types/jsx/intrinsic-element/common.d.ts +3 -1
  549. package/node_modules/hono/dist/types/jsx/intrinsic-element/components.d.ts +7 -4
  550. package/node_modules/hono/dist/types/jsx/intrinsic-elements.d.ts +708 -708
  551. package/node_modules/hono/dist/types/jsx/jsx-dev-runtime.d.ts +4 -7
  552. package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +7 -10
  553. package/node_modules/hono/dist/types/jsx/streaming.d.ts +9 -10
  554. package/node_modules/hono/dist/types/jsx/types.d.ts +12 -13
  555. package/node_modules/hono/dist/types/jsx/utils.d.ts +2 -0
  556. package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +17 -19
  557. package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +46 -48
  558. package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +6 -8
  559. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +13 -15
  560. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +4 -6
  561. package/node_modules/hono/dist/types/middleware/compress/index.d.ts +9 -10
  562. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +4 -6
  563. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +10 -12
  564. package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +6 -8
  565. package/node_modules/hono/dist/types/middleware/etag/digest.d.ts +2 -0
  566. package/node_modules/hono/dist/types/middleware/etag/index.d.ts +6 -8
  567. package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +11 -12
  568. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +11 -11
  569. package/node_modules/hono/dist/types/middleware/jwk/index.d.ts +2 -1
  570. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +20 -23
  571. package/node_modules/hono/dist/types/middleware/jwt/index.d.ts +7 -6
  572. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +28 -30
  573. package/node_modules/hono/dist/types/middleware/language/index.d.ts +6 -5
  574. package/node_modules/hono/dist/types/middleware/language/language.d.ts +42 -44
  575. package/node_modules/hono/dist/types/middleware/logger/index.d.ts +3 -5
  576. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +7 -9
  577. package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +14 -16
  578. package/node_modules/hono/dist/types/middleware/mount/index.d.ts +46 -0
  579. package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +8 -10
  580. package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +18 -20
  581. package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +6 -5
  582. package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +9 -11
  583. package/node_modules/hono/dist/types/middleware/secure-headers/index.d.ts +6 -6
  584. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +2 -0
  585. package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +55 -57
  586. package/node_modules/hono/dist/types/middleware/serve-static/index.d.ts +24 -24
  587. package/node_modules/hono/dist/types/middleware/serve-static/path.d.ts +2 -0
  588. package/node_modules/hono/dist/types/middleware/timeout/index.d.ts +5 -7
  589. package/node_modules/hono/dist/types/middleware/timing/index.d.ts +6 -5
  590. package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +17 -20
  591. package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +35 -37
  592. package/node_modules/hono/dist/types/preset/quick.d.ts +6 -9
  593. package/node_modules/hono/dist/types/preset/tiny.d.ts +6 -9
  594. package/node_modules/hono/dist/types/request/constants.d.ts +2 -0
  595. package/node_modules/hono/dist/types/request.d.ts +288 -286
  596. package/node_modules/hono/dist/types/router/linear-router/index.d.ts +2 -5
  597. package/node_modules/hono/dist/types/router/linear-router/router.d.ts +7 -5
  598. package/node_modules/hono/dist/types/router/pattern-router/index.d.ts +2 -5
  599. package/node_modules/hono/dist/types/router/pattern-router/router.d.ts +7 -5
  600. package/node_modules/hono/dist/types/router/reg-exp-router/index.d.ts +3 -6
  601. package/node_modules/hono/dist/types/router/reg-exp-router/matcher.d.ts +3 -1
  602. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +6 -4
  603. package/node_modules/hono/dist/types/router/reg-exp-router/prepared-router.d.ts +11 -10
  604. package/node_modules/hono/dist/types/router/reg-exp-router/router.d.ts +10 -9
  605. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +7 -5
  606. package/node_modules/hono/dist/types/router/smart-router/index.d.ts +2 -5
  607. package/node_modules/hono/dist/types/router/smart-router/router.d.ts +11 -9
  608. package/node_modules/hono/dist/types/router/trie-router/index.d.ts +2 -5
  609. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +6 -4
  610. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +7 -5
  611. package/node_modules/hono/dist/types/router/utils.d.ts +2 -0
  612. package/node_modules/hono/dist/types/router.d.ts +23 -22
  613. package/node_modules/hono/dist/types/types.d.ts +146 -505
  614. package/node_modules/hono/dist/types/utils/accept.d.ts +5 -3
  615. package/node_modules/hono/dist/types/utils/basic-auth.d.ts +4 -2
  616. package/node_modules/hono/dist/types/utils/body.d.ts +46 -50
  617. package/node_modules/hono/dist/types/utils/buffer.d.ts +7 -5
  618. package/node_modules/hono/dist/types/utils/color.d.ts +2 -0
  619. package/node_modules/hono/dist/types/utils/compress.d.ts +2 -0
  620. package/node_modules/hono/dist/types/utils/concurrent.d.ts +6 -4
  621. package/node_modules/hono/dist/types/utils/constants.d.ts +2 -0
  622. package/node_modules/hono/dist/types/utils/cookie.d.ts +20 -18
  623. package/node_modules/hono/dist/types/utils/crypto.d.ts +5 -7
  624. package/node_modules/hono/dist/types/utils/encode.d.ts +2 -0
  625. package/node_modules/hono/dist/types/utils/filepath.d.ts +5 -3
  626. package/node_modules/hono/dist/types/utils/handler.d.ts +2 -0
  627. package/node_modules/hono/dist/types/utils/headers.d.ts +2 -0
  628. package/node_modules/hono/dist/types/utils/html.d.ts +11 -9
  629. package/node_modules/hono/dist/types/utils/http-status.d.ts +2 -0
  630. package/node_modules/hono/dist/types/utils/ipaddr.d.ts +4 -6
  631. package/node_modules/hono/dist/types/utils/jwt/index.d.ts +18 -12
  632. package/node_modules/hono/dist/types/utils/jwt/jwa.d.ts +15 -13
  633. package/node_modules/hono/dist/types/utils/jwt/jws.d.ts +4 -7
  634. package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +26 -29
  635. package/node_modules/hono/dist/types/utils/jwt/types.d.ts +48 -45
  636. package/node_modules/hono/dist/types/utils/jwt/utf8.d.ts +2 -0
  637. package/node_modules/hono/dist/types/utils/mime.d.ts +60 -57
  638. package/node_modules/hono/dist/types/utils/stream.d.ts +27 -25
  639. package/node_modules/hono/dist/types/utils/types.d.ts +14 -26
  640. package/node_modules/hono/dist/types/utils/url.d.ts +2 -0
  641. package/node_modules/hono/dist/types/validator/index.d.ts +3 -7
  642. package/node_modules/hono/dist/types/validator/utils.d.ts +6 -8
  643. package/node_modules/hono/dist/types/validator/validator.d.ts +11 -9
  644. package/node_modules/hono/dist/types.js +4 -6
  645. package/node_modules/hono/dist/utils/accept.js +185 -212
  646. package/node_modules/hono/dist/utils/basic-auth.js +18 -21
  647. package/node_modules/hono/dist/utils/body.js +87 -92
  648. package/node_modules/hono/dist/utils/buffer.js +44 -71
  649. package/node_modules/hono/dist/utils/color.js +33 -21
  650. package/node_modules/hono/dist/utils/compress.js +11 -5
  651. package/node_modules/hono/dist/utils/concurrent.js +29 -38
  652. package/node_modules/hono/dist/utils/constants.js +7 -5
  653. package/node_modules/hono/dist/utils/cookie.js +114 -163
  654. package/node_modules/hono/dist/utils/crypto.js +30 -40
  655. package/node_modules/hono/dist/utils/encode.js +30 -26
  656. package/node_modules/hono/dist/utils/filepath.js +23 -33
  657. package/node_modules/hono/dist/utils/handler.js +10 -11
  658. package/node_modules/hono/dist/utils/headers.js +1 -0
  659. package/node_modules/hono/dist/utils/html.js +97 -117
  660. package/node_modules/hono/dist/utils/http-status.js +1 -0
  661. package/node_modules/hono/dist/utils/ipaddr.js +227 -279
  662. package/node_modules/hono/dist/utils/jwt/index.js +12 -4
  663. package/node_modules/hono/dist/utils/jwt/jwa.js +24 -20
  664. package/node_modules/hono/dist/utils/jwt/jws.js +115 -174
  665. package/node_modules/hono/dist/utils/jwt/jwt.js +120 -198
  666. package/node_modules/hono/dist/utils/jwt/types.js +79 -95
  667. package/node_modules/hono/dist/utils/jwt/utf8.js +9 -7
  668. package/node_modules/hono/dist/utils/mime.js +74 -79
  669. package/node_modules/hono/dist/utils/stream.js +86 -88
  670. package/node_modules/hono/dist/utils/types.js +1 -0
  671. package/node_modules/hono/dist/utils/url.js +187 -215
  672. package/node_modules/hono/dist/validator/index.js +1 -4
  673. package/node_modules/hono/dist/validator/utils.js +1 -0
  674. package/node_modules/hono/dist/validator/validator.js +61 -83
  675. package/node_modules/hono/package.json +35 -27
  676. package/package.json +16 -14
  677. package/scripts/lib/cursor-sdk-output-filter.d.mts +1 -0
  678. package/scripts/lib/cursor-sdk-output-filter.mjs +1 -0
  679. package/scripts/platform-smoke/artifacts.mjs +7 -1
  680. package/shared/cursor-sdk-output-filter.d.mts +3 -0
  681. package/shared/cursor-sdk-output-filter.mjs +117 -44
  682. package/src/context.ts +57 -33
  683. package/src/cursor-api-key.ts +37 -17
  684. package/src/cursor-cloud-options.ts +2 -0
  685. package/src/cursor-config.ts +76 -0
  686. package/src/cursor-custom-store-path.ts +151 -0
  687. package/src/cursor-custom-subagent-definitions.ts +21 -0
  688. package/src/cursor-fallback-models.generated.ts +1 -1
  689. package/src/cursor-fallback-warning.ts +7 -3
  690. package/src/cursor-live-run-coordinator.ts +21 -2
  691. package/src/cursor-mcp-timeout-override.ts +3 -1
  692. package/src/cursor-pi-tool-bridge-run.ts +21 -0
  693. package/src/cursor-pi-tool-bridge-server.ts +1 -2
  694. package/src/cursor-pi-tool-bridge-types.ts +3 -0
  695. package/src/cursor-provider-binding.ts +70 -11
  696. package/src/cursor-provider-errors.ts +32 -28
  697. package/src/cursor-provider-live-run-drain.ts +9 -4
  698. package/src/cursor-provider-run-finalizer.ts +2 -1
  699. package/src/cursor-provider-turn-prepare.ts +28 -13
  700. package/src/cursor-provider-turn-summary.ts +1 -1
  701. package/src/cursor-provider-turn-tool-ledger.ts +12 -7
  702. package/src/cursor-provider.ts +3 -1
  703. package/src/cursor-question-tool.ts +5 -5
  704. package/src/cursor-request-provenance.ts +18 -3
  705. package/src/cursor-sdk-output-filter.ts +2 -0
  706. package/src/cursor-sdk-process-error-guard.ts +1 -2
  707. package/src/cursor-sdk-runtime.ts +14 -15
  708. package/src/cursor-sdk-vendor-env.ts +22 -0
  709. package/src/cursor-session-agent-cleanup.ts +28 -27
  710. package/src/cursor-session-agent.ts +44 -17
  711. package/src/cursor-session-send-policy.ts +2 -2
  712. package/src/cursor-session-store.ts +259 -53
  713. package/src/cursor-state.ts +7 -2
  714. package/src/cursor-tool-manifest.ts +1 -1
  715. package/src/index.ts +19 -19
  716. package/src/model-discovery.ts +62 -23
  717. package/src/model-list-cache.ts +11 -1
  718. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-BLVe3qmU.d.cts.map +0 -1
  719. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-Bt6U_Fqb.d.mts.map +0 -1
  720. package/node_modules/@modelcontextprotocol/server/dist/mcp-DUcCQSTW.cjs.map +0 -1
  721. package/node_modules/@modelcontextprotocol/server/dist/mcp-Dw2OlZ1f.mjs.map +0 -1
  722. package/node_modules/@modelcontextprotocol/server/dist/src-CgFsfg3E.cjs.map +0 -1
  723. package/node_modules/@modelcontextprotocol/server/dist/src-D-y6h4N7.mjs.map +0 -1
@@ -8,6 +8,8 @@ Implemented design target. This file describes the intended Cursor model UX and
8
8
 
9
9
  Current implementation notes:
10
10
 
11
+ - Cursor footer status is visible by default. `PI_CURSOR_FOOTER=0` clears the Cursor status on the next status refresh; provider runtime, mode, and transport validation remain active.
12
+
11
13
  - Provider contexts support official Pi 0.87.1/latest and current `fitchmultz/pi` main, including transcript-only hosts. `cursor-pi-context.ts` directly imports Pi 0.87.1's required public replay helpers. Current instructions and tools are replayed natively, system deltas are fingerprinted, and system messages are excluded from Cursor conversation formatting and trailing-result scans. Fresh cloud context preserves current instructions while excluding history. Native replay uses the request tool snapshot (including empty); the pi bridge retains its separate registry-owned surface. XML prompt sections are sanitized/deduplicated alongside the stock format.
12
14
 
13
15
  - Cursor context variants use `base@context` pi model IDs.
@@ -16,30 +18,36 @@ Current implementation notes:
16
18
  - Cursor SDK `mode` (`agent` or `plan`) is extension session state, not model identity, pi thinking, Cursor `fast`, or pi's separate plan-mode extension.
17
19
  - Cursor status uses one coordinated `ctx.ui.setStatus("cursor", ...)` value for fast, non-default plan mode, and the local-only `http1` transport marker; the default pi footer remains intact.
18
20
  - Installed `@cursor/sdk` user messages accept images, and Cursor models are treated as image-capable; registered input metadata is `text` plus `image`.
19
- - Image payload forwarding sends images only from the latest user message. If the latest user turn is plain text after an earlier image turn, the transcript keeps an `[image omitted from transcript]` placeholder but no image bytes are sent to Cursor. The prompt explicitly tells Cursor that prior image bytes are unavailable and to ask the user to reattach or describe a prior image when needed. Carrying images forward across turns remains a future product decision because it affects token cost, privacy, stale visual context, and expected multimodal follow-up behavior.
20
- - Shared SDK initialization resolves the native platform package relative to `@cursor/sdk` before import and sets `CURSOR_TREE_SITTER_VENDOR_DIR` only when unset and both vendored parser entrypoints exist. Explicit overrides remain SDK-owned. This repairs sibling-install native lookup, not compiled Bun or embedded-host dependency graphs.
21
+ - Native request receipts retain canonical source-role/order scalars from public `SessionManager.buildSessionProjection()` and `convertToLlm()`, not prompt text. Only exact equivalence with the actual provider request enables native input selection. Hidden `display:false` notices remain model-visible background context, never genuine user submissions. Pending native input travels together in bootstrap/incremental prompts and remains required under transcript budgeting. Custom-only continuation has no new user request or attachment; historical bootstrap requests are explicitly history. Cloud fresh prompts select the same pending input group without previous requests; bootstrap handoff preserves history with the same native-origin selection. Origin means the persisted native source, not a role-only rewrite yielding identical LLM content. If request-local transforms change payload/order (including blocked-image conversion), origin is unavailable: preserve conservative last-converted-user/reset behavior rather than guessing. This is not universal final-preconversion provenance.
22
+ - Image payload forwarding for request-equivalent native inputs sends images only from the latest pending native user message, even with trailing custom notices. Other/unmatched contexts retain last-converted-user selection. If the latest user turn is plain text after an earlier image turn, the transcript keeps an `[image omitted from transcript]` placeholder but no image bytes are sent to Cursor. The prompt explicitly tells Cursor that prior image bytes are unavailable and to ask the user to reattach or describe a prior image when needed. Carrying images forward across turns remains a future product decision because it affects token cost, privacy, stale visual context, and expected multimodal follow-up behavior.
23
+ - Shared SDK initialization resolves the native platform package relative to `@cursor/sdk` before import and sets `CURSOR_TREE_SITTER_VENDOR_DIR` only when unset and both vendored parser entrypoints exist. Explicit overrides remain SDK-owned. This repairs sibling-install native lookup. Static SDK and bridge imports additionally repair the compiled-Bun extension graph; the packed extension was qualified in official compiled Pi 1.0.3 on macOS arm64 with isolated empty credentials and a fake key. Embedded Windows missing-export behavior remains unqualified.
21
24
  - The selected vendor path is process-wide and inherited by shell commands and child Pi processes. A child using another install/worktree preserves the inherited value as an explicit override, even when stale. Unset it in the child's environment to rediscover that install's parser, or provide its absolute vendor path; see [native parser troubleshooting](../README.md#native-shell-parsing-or-module-loading-fails).
22
- - Provider and discovery errors retain bounded, scrubbed name/code/message/cause fields without serializing arbitrary error objects. Module-loading and ambiguous session-authentication failures do not imply a rejected API key. Explicit key rejection retains actionable setup guidance; idle expiry and recovery policy are unchanged.
23
- - Exact `@cursor/sdk@1.0.32` is an unbundled package dependency; users do not need a global SDK install. Package 0.5.0 requires Node 24+ and official Pi 0.87.1+, while optional published Pi and TypeBox peer dependencies use `"*"` ranges per Pi guidance. The exact development Pi cohort is 0.99.1, with host TypeBox 1.3.27.
25
+ - Provider and discovery errors retain bounded, scrubbed name/code/message/cause fields without serializing arbitrary error objects. Module-loading and ambiguous session-authentication failures do not imply a rejected API key. Explicit key rejection retains actionable setup guidance; no automatic reload or authentication recovery is performed.
26
+ - Exact `@cursor/sdk@1.0.36` is an unbundled package dependency; users do not need a global SDK install. Package 0.5.2 requires Node 24+ and official Pi 0.87.1+, while optional published Pi and TypeBox peer dependencies use `"*"` ranges per Pi guidance. Direct development Pi dependencies and their lockfile-resolved transitives are 1.0.4; nested host TypeBox remains 1.3.27; the extension's root TypeBox validation baseline is 1.3.36.
24
27
  - Native usage contains coherent current-context components only. The origin-owned ledger records every raw turn, original wait/handle snapshots, terminal success/error/abort/abandon, and bounded public whole-agent `getUsage()` observations separately. Cumulative bills never enter native usage. Request floors use actual native source chronology and projection equivalence, not text or clocks; see [Context and accounting boundaries](#context-and-accounting-boundaries).
25
- - Startup discovery does not duplicate Pi CLI parsing: it uses stored `~/.pi/agent/auth.json` API-key auth from `/login`, then `CURSOR_API_KEY`, otherwise it registers the bundled fallback catalog. Provider turns keep Pi's resolved `options.apiKey`. `/cursor-refresh-models` and `/cursor-cloud` mutations resolve provider `cursor` through the command context's Pi ModelRegistry, then normalize placeholders through `CURSOR_API_KEY`. The extension config file stores only non-secret Cursor-only state such as fast defaults and the user-level local HTTP transport preference.
28
+ - Cursor owns one public native Provider with native API-key login and a small resolver for stored/provider-env, runtime, composed config, and ambient credentials. Startup and auth mutations are cache-only, retaining known cached/fallback identities. `PI_CURSOR_HIDE_MODELS_WHEN_LOGGED_OUT=1` hides only unauthenticated picker/list availability, not CLI selection or login. Discovery receives explicit effective native auth and never guesses a default auth store. `/cursor-refresh-models` uses native registry refresh/publication. Provider turns keep Pi's resolved `options.apiKey`; non-secret Cursor-only settings remain separate.
26
29
  - Cursor Cloud repository overrides accept only HTTPS repository URLs without userinfo, query parameters, or fragments. Invalid values fail during preflight before `Agent.create()`, messages never echo the supplied URL, and shared provider/maintainer scrubbing removes URL/SCP-style userinfo defensively.
27
30
  - Cursor Cloud requires a persisted pi session. Immediately after remote `Agent.create()` returns, before debug work or abort checks, the provider appends a branch-local pi lifecycle entry, fsyncs the existing Pi session JSONL anchor through a read-write descriptor, and then fsyncs a newline-framed sidecar keyed by the stable pi session ID (POSIX mode `0600`; Windows inherits the user session directory ACL) in the session directory. Journal creation is exclusive, and existing append/read opens reject symlinks and require matching regular-file descriptor/path identity before using the descriptor. Existing session files use the exact lifecycle entry ID as anchor; fileless first turns use an orphan marker that a same-session-ID restart durably claims onto exactly one matching or replacement branch, surviving the timestamped path change and later JSONL creation without granting sibling access; returned run IDs are fsynced before abort/wait handling, readers skip malformed/truncated lines independently, and branch-only history events are reduced after deduplicated sidecar history, and tombstones are tracked before records exist. A durable sidecar result remains authoritative if its optional Pi mirror append fails; if the sidecar result itself fails, the prior durable intent remains pending and blocks retry rather than claiming success. `--no-session` and durable-ledger failures fail closed before send, while post-send ledger failure requests bounded cancellation. `/cursor-cloud` always validates the embedded session ID, accepts only null anchors while truly fileless, and reconciles each orphan to one branch before listing or mutation. Successive record events merge run/branch metadata monotonically even when mirrored sources arrive out of order. Archive/delete require resolved Cursor auth, fsync a durable intent before the SDK call, and fsync a durable success result afterward; unresolved intent blocks repeat mutation and requires dashboard inspection.
28
- - Local agents pass `settingSources: ["all"]` by default so Cursor MCP servers, plugin tools, project/user settings, and related Cursor-native capabilities are available. Users can narrow loading with a comma-separated list such as `PI_CURSOR_SETTING_SOURCES=project,user,plugins`, or disable ambient setting sources with `PI_CURSOR_SETTING_SOURCES=none`. `/cursor-refresh-config` calls the current pooled SDK agent's `agent.reload()` to refresh filesystem Cursor config without recreating the agent. The provider suppresses direct Cursor SDK bootstrap stdout/stderr/console noise (including late first-send workspace loading such as hook compatibility warnings) so it does not pollute pi's TUI.
31
+ - Local agents pass `settingSources: ["all"]` by default so Cursor MCP servers, plugin tools, project/user settings, and related Cursor-native capabilities are available. Users can narrow loading with a comma-separated list such as `PI_CURSOR_SETTING_SOURCES=project,user,plugins`, or disable ambient setting sources with `PI_CURSOR_SETTING_SOURCES=none`. `/cursor-refresh-config` calls the current pooled SDK agent's `agent.reload()` to refresh filesystem Cursor config without recreating the agent. The shared process sink filters complete, verified timestamp/INFO inventory and completion frames plus exact supported hook-compatibility notices, including pre-bound SDK console output during first send and unresolved live SDK completion across Pi bridge/replay turns. The same lease restores on completion/cancellation cleanup, not when a Pi tool-use stream ends. A new write invocation starts a frame after unrelated partial output has forwarded, so an unterminated native Pi footer/prompt does not admit the following SDK diagnostic. stdout/stderr framing is independent; outside the retained creation-only mute around `Agent.create()`, unrecognized output retains its original bytes, callbacks and delegated backpressure. Only possible diagnostic prefixes buffer (up to 16 KiB); undecided tails flush on final restoration and oversized candidates pass through. Outside-root local-plugin symlink rejection and the exact native-parser-unavailable warning escape the creation mute and route through the request's async owner to a bounded native notification (stderr in non-UI modes) and a `pi-cursor-sdk:capability-notice` non-model session entry, at most once per kind per request. Notices contain fixed recovery guidance, not raw paths or arbitrary SDK metadata. Unowned maintainer scripts retain these meaningful diagnostics. Outside the creation mute, real plugin/hook/config/parser/ripgrep failures stay visible; the plugin confinement guard, settings sources and native parser setup are unchanged. Text alone cannot distinguish an unrelated emitter printing an identical complete SDK frame; strict attribution requires a future public SDK logger/sink API.
29
32
  - On `cursor/*` models, pi-cursor-sdk removes only pi-generated `<project_instructions>` blocks that overlap the effective Cursor `settingSources`: `user` for `~/.pi/agent/AGENTS.md`; `project` for discovered repo/parent `AGENTS.md` and `CLAUDE.md` (verified Cursor behavior: local agents load project `AGENTS.md` and `CLAUDE.md`). `~/.pi/agent/CLAUDE.md` is not removed (Cursor user layer uses `~/.claude/CLAUDE.md`). Blocks are removed by exact pi serialization match from structured `contextFiles` via the `before_agent_start` hook, not in `buildCursorPrompt` sanitization. Suppression is skipped with `-nc`, `PI_CURSOR_SETTING_SOURCES=none`, narrowed sources such as `plugins` that omit the matching layer, or `PI_CURSOR_PRESERVE_PI_AGENTS_MD=1`. Switching away from a Cursor model restores pi's full context block on the next user message.
30
33
  - Cursor SDK models are treated as thinking-capable even when pi reports `thinking=no`; that pi column only means the SDK did not expose a pi-controllable thinking parameter for that model.
31
34
  - Cursor-side thinking remains visible through pi's native thinking rendering when the Cursor SDK emits thinking or summary deltas.
32
- - Local Cursor agents get two tool surfaces. First, Cursor keeps the Cursor SDK local-agent tool surface plus configured Cursor settings, plugins, and Cursor MCP servers. Second, pi-cursor-sdk exposes active pi tools through a default-on, tokenized loopback stable MCP v2 bridge when bridgeable tools exist. The bundled bridge runtime closure is `@modelcontextprotocol/server@2.1.0`, `@modelcontextprotocol/hono@2.0.1`, `hono@4.13.9`, and `@hono/node-server@2.1.1`; it binds loopback and validates Hono `Host` and `Origin` headers.
35
+ - Local Cursor agents get two tool surfaces. First, Cursor keeps the Cursor SDK local-agent tool surface plus configured Cursor settings, plugins, and Cursor MCP servers. Second, pi-cursor-sdk exposes active pi tools through a default-on, tokenized loopback stable MCP v2 bridge when bridgeable tools exist. The bundled bridge runtime closure is `@modelcontextprotocol/server@2.3.1`, `@modelcontextprotocol/hono@2.0.2`, `hono@4.13.13`, and `@hono/node-server@2.1.3`; it binds loopback and validates Hono `Host` and `Origin` headers.
33
36
  - `buildCursorPiToolBridgeSnapshot()` is the runtime capability source for pi bridge tools. It snapshots `pi.getActiveTools()` and `pi.getAllTools()`, carries pi 0.77+ per-tool `promptGuidelines` into bridge MCP descriptions, filters internal replay names, hides overlapping built-in pi tools (`read`, `bash`, `write`, `edit`, `grep`, `find`, `ls`) unless `PI_CURSOR_EXPOSE_BUILTIN_TOOLS=1`, and creates collision-safe MCP names such as `pi__sem_reindex`. Cursor discovers the current run's exposed bridge tools through MCP `listTools`. Bootstrap prompts include a compact callable-surface manifest from `buildCursorToolManifestText()` by default (`PI_CURSOR_TOOL_MANIFEST=1`); disable with `PI_CURSOR_TOOL_MANIFEST=0`. There is no per-turn visible tool list, status manifest, or footer manifest. User-facing summary: [Cursor tool surfaces in pi](./cursor-tool-surfaces.md).
34
- - Prompt text is the primary provider/bridge contract. Bootstrap prompts carry a short boundary block plus the callable-surface manifest by default (`PI_CURSOR_TOOL_MANIFEST=1`). MCP `listTools` descriptions use a one-line pointer to the bootstrap prompt instead of repeating the full contract (`buildCursorPiBridgeMcpToolDescription()`). Cursor must call the exposed `pi__*` MCP name, not the real pi tool name shown in pi history or transcripts. When exposed, `pi__mcp` takes preference over Cursor-configured MCP for MCP work and `pi__subagent` takes preference over Cursor-native subagents for delegation; the Cursor-native surfaces remain fallbacks when the matching pi bridge tool is absent or unavailable. Pi emits and executes the real pi tool name. Maintainer debug: `/cursor-tools` prints bridge/manifest enablement, effective `PI_CURSOR_SETTING_SOURCES`, and the current callable-surface snapshot.
35
- - The provider also registers `cursor_ask_question` for Cursor models when the bridge and default-on `PI_CURSOR_ASK_QUESTION` control are enabled. While the tool awaits pi UI input it emits package event `pi-cursor-sdk:ask-question:blocked` with `{ active: true }` and clears `{ active: false }` in `finally`; the tool runs with `executionMode: "sequential"` so parallel sibling calls cannot overlap dialogs. Cursor sees it as `pi__cursor_ask_question`, and pi executes it through the normal tool path so interactive users can choose options from pi UI. `PI_CURSOR_ASK_QUESTION=0` removes only this tool while preserving the rest of the bridge. In non-UI modes it reports that UI is unavailable so Cursor can state a default assumption instead. When pi has visible Agent Skills loaded, the provider rewrites the skill catalog for Cursor and registers `cursor_activate_skill` as `pi__cursor_activate_skill`; pi executes it through the normal tool path so Cursor can load the full `SKILL.md` and skill resource list for the current pi-loaded skill source of truth. `PI_CURSOR_PI_TOOL_BRIDGE=0` disables the local bridge, including question and skill activation bridging. Cloud Cursor agents remain out of scope for the bridge.
37
+ - Prompt text is the primary provider/bridge contract. Bootstrap prompts carry a short boundary block plus the callable-surface manifest by default (`PI_CURSOR_TOOL_MANIFEST=1`). MCP `listTools` descriptions use a one-line pointer to the bootstrap prompt instead of repeating the full contract (`buildCursorPiBridgeMcpToolDescription()`). Cursor must call the exposed `pi__*` MCP name, not the real pi tool name shown in pi history or transcripts. When exposed, `pi__mcp` takes preference over Cursor-configured MCP for MCP work and `pi__subagent` takes preference over Cursor-native subagents for delegation; the Cursor-native surfaces remain fallbacks when the matching pi bridge tool is absent or unavailable. Pi emits and executes the real pi tool name. Maintainer debug: `/cursor-tools` prints bridge/manifest enablement, effective `PI_CURSOR_SETTING_SOURCES`, and the current callable-surface snapshot. The shared prompt tail retains GitHub issue/PR comment guidance on both bootstrap and incremental sends; this is model guidance, not an execution permission guard.
38
+ - The provider also registers `cursor_ask_question` for Cursor models when the bridge is on and `PI_CURSOR_ASK_QUESTION=1`. While the tool awaits pi UI input it emits package event `pi-cursor-sdk:ask-question:blocked` with `{ active: true }` and clears `{ active: false }` in `finally`; the tool runs with `executionMode: "sequential"` so parallel sibling calls cannot overlap dialogs. Cursor sees it as `pi__cursor_ask_question`, and pi executes it through the normal tool path. The control is off by default so Cursor states an assumption instead of prompting. In non-UI modes it reports that UI is unavailable so Cursor can state a default assumption instead. When pi has visible Agent Skills loaded, the provider rewrites the skill catalog for Cursor and registers `cursor_activate_skill` as `pi__cursor_activate_skill`; pi executes it through the normal tool path so Cursor can load the full `SKILL.md` and skill resource list for the current pi-loaded skill source of truth. `PI_CURSOR_PI_TOOL_BRIDGE=0` disables the local bridge, including question and skill activation bridging. Cloud Cursor agents remain out of scope for the bridge.
36
39
  - The bridge queues MCP calls, emits provider `toolcall_*` events, waits for matching pi `toolResult` messages by `toolCallId`, resolves the result back into the same live Cursor SDK run without creating a new `Agent`, and never calls tool `execute()` handlers directly. The same-run resume invariant holds unless the run was disposed, aborted, or cancelled.
37
- - Cursor SDK MCP tool calls use a guarded timeout override because installed `@cursor/sdk` 1.0.32 has a 60-second MCP request default with no public per-server timeout option. The extension extends the verified Cursor SDK MCP `callTool` timeout path to 3600 seconds by default and shortens the verified first-send MCP initialize/listTools timeout paths to 10 seconds by default so unavailable configured MCP servers do not block the first reply for a full minute; unknown MCP protocol timeout stacks keep the SDK default. Users can override tool-call timeouts with `PI_CURSOR_MCP_TOOL_TIMEOUT_MS` or `PI_CURSOR_MCP_TOOL_TIMEOUT_SECONDS`, and initialize/listTools timeouts with `PI_CURSOR_MCP_CONNECT_TIMEOUT_MS` or `PI_CURSOR_MCP_CONNECT_TIMEOUT_SECONDS`. Bridged `CallTool` waits also have a local fail-closed deadline that defaults to and cannot exceed the effective MCP tool timeout; `PI_CURSOR_PI_BRIDGE_CALL_TIMEOUT_MS` can lower it, expiry or MCP cancellation aborts active pi execution when available, and expired bridge events are dropped before pi tool emission.
40
+ - Pending pi bridge calls keep their owning local Cursor live run active, including queued/emitted calls and pi execution awaiting human input. The last matching settlement restarts the full idle interval (five minutes by default) after the provider drain lease ends, including when cleanup was armed before the lease. Lease/queue/pending state is rechecked at expiry, and the per-run observer is detached on release/replacement. A pending call in another session does not delay cleanup. Explicit abort/shutdown/reset/compaction and the fail-closed MCP/bridge deadline (one hour by default) remain effective; display-only native replay abandonment is unchanged.
41
+
42
+ - Eligible local replay idle cleanup uses `PI_CURSOR_LIVE_RUN_IDLE_DISPOSE_MS`, default `300000` (five minutes). Accept only decimal digits representing `1`–`2147483647`; unset, blank, malformed (including surrounding whitespace), or out-of-range input uses the default. The existing explicit testing override takes precedence; reset returns to environment/default selection. Each timer arm selects the duration, and the full configured window starts after the last owned pending call settles and the provider drain lease ends. Bridge/MCP deadlines and explicit abort/shutdown release remain independent; this is not backend authentication, transport, or lost-executor recovery.
43
+
44
+ - Cursor SDK MCP tool calls use a guarded timeout override because installed `@cursor/sdk` 1.0.36 has a 60-second MCP request default with no public per-server timeout option. The extension extends the verified Cursor SDK MCP `callTool` timeout path to 3600 seconds by default and shortens the verified first-send MCP initialize/listTools timeout paths to 10 seconds by default so unavailable configured MCP servers do not block the first reply for a full minute; unknown MCP protocol timeout stacks keep the SDK default. Users can override tool-call timeouts with `PI_CURSOR_MCP_TOOL_TIMEOUT_MS` or `PI_CURSOR_MCP_TOOL_TIMEOUT_SECONDS`, and initialize/listTools timeouts with `PI_CURSOR_MCP_CONNECT_TIMEOUT_MS` or `PI_CURSOR_MCP_CONNECT_TIMEOUT_SECONDS`. Bridged `CallTool` waits also have a local fail-closed deadline that defaults to and cannot exceed the effective MCP tool timeout; `PI_CURSOR_PI_BRIDGE_CALL_TIMEOUT_MS` can lower it, expiry or MCP cancellation aborts active pi execution when available, and expired bridge events are dropped before pi tool emission.
38
45
  - Cursor SDK local safety controls are off by default. `--cursor-auto-review` / `PI_CURSOR_AUTO_REVIEW` and `--cursor-sandbox` / `PI_CURSOR_SANDBOX` pass only explicit enabled values into `Agent.create({ local })`; user or trusted project config can set `local.autoReview` and `local.sandboxOptions.enabled`; project config is active only when Pi's project-trust flow reached the extension and approved the project or the run used explicit `--approve`, and project saves require the same immutable trust provenance rather than creating Pi trust resources automatically. Pi loads `pi install -l` project-local extensions after the trust event, so those installs require `--approve` on every run that reads or writes `.pi/cursor-sdk.json`. Explicit runtime, fast-default, and HTTP transport saves preserve unrecognized config fields, reject malformed or non-object JSON without rewriting it, and use one lock-protected read-modify-write path; fast saves mutate only the selected model key. Because Pi can mutate its in-memory session branch before a journal append throws, a completed global save is authoritative and the command reports the partial journal failure instead of attempting an ambiguous rollback; the new global value stays authoritative over stale branch entries until a later successful save or session restart.
39
46
  - Local HTTP/1.1/SSE compatibility is strictly opt-in through `PI_CURSOR_HTTP_1_1`, `/cursor-http on|off|toggle`, or user `cursor-sdk.json` `local.useHttp1ForAgent`. Precedence is session, environment, user, then the built-in unset default; project config is excluded. Unset makes no `Cursor.configure()` call. Explicit values configure the installed SDK before local `Agent.create()`, extension-owned explicit state is cleared with the SDK's documented `null` reset when returning to unset and during session shutdown before module reload, and default/HTTP2/HTTP1 choices split pooled local agents. Pi's supported CLI/TUI/print/RPC lifecycle has one active session runtime per process; concurrent independent `AgentSession` embedding in one process is outside this transport toggle's contract because the installed SDK setting and executor cache are module-global. The footer adds `http1` only for enabled local runtime; cloud creation and status remain untouched.
40
47
  - Bridge diagnostics are opt-in only: `PI_CURSOR_PI_TOOL_BRIDGE_DEBUG=1` writes typed, allowlisted, scrubbed single-line JSONL records to `process.stderr` with prefix `[pi-cursor-sdk:bridge]`. Diagnostics are scrubbed operational logs, not anonymous telemetry. They intentionally include tool names, safe correlation IDs, run lifecycle, exposed pi↔MCP name pairs, queued requests, result resolution, rejection, cancellation, and pending counts. Correlation IDs are generated independently from the tokenized endpoint path, and Cursor MCP call IDs are hashed before serialization. Diagnostics must not include endpoint paths/URLs/path components/tokens, API keys, bearer tokens, cookies, session credentials, raw args/results, stdout/stderr payloads, file contents, Cursor settings output, or local private session paths in tracked docs, and they must not call pi UI status, notification, or footer APIs. If tool names themselves are unacceptable for a release target, bridge debug diagnostics are not safe for shared logs under the current contract. Provider-facing bridge tool-call IDs use the run UUID without separators in the `cursor-pi-bridge-<32 hex>-t<counter>` shape and are capped at 64 characters; bridge run IDs and tool-call IDs remain distinct.
41
48
  - This repo does not provide a generic desktop-automation, browser-driver, or CDP recipe. Provider docs should describe pi-cursor-sdk's Cursor provider/bridge contract only.
42
- - Cursor internal tool activity is recorded from SDK events and scrubbed. Maintainer reference for `@cursor/sdk@1.0.32` `ToolType` values, runtime alias normalization, and intentional mapping/fallback rules: [Cursor native tool replay — SDK ToolType replay matrix](./cursor-native-tool-replay.md#sdk-tooltype-replay-matrix) (official SDK docs: https://cursor.com/docs/sdk/typescript). In TUI sessions and structured JSON/RPC modes, supported completed `read`, `bash`, `grep`, `find`, `ls`, `edit`, `write`, diagnostics, delete, todo/plan, task, image generation, MCP, semantic search, and screen recording activity is replayed through pi's native tool-call rendering path with recorded Cursor results, so users and JSON/RPC consumers can see native-looking cards/events without rerunning Cursor's reads/shell commands/file edits. Cursor `glob` activity is replayed through native `find` cards. Cursor write activity is replayed through native-looking `write` cards, and Cursor StrReplace/edit activity uses native-looking `edit` only when recorded arguments truthfully satisfy pi's `edit` schema; path-only Cursor edit and notebook edit replay falls back to neutral Cursor activity before pi validation. Diagnostics, delete, todos/plans, task/subagent, image, and MCP activity use neutral Cursor activity cards with pi's default success/error shell. Cursor SDK `task` activity is labeled **Cursor subagent** by default because it represents Cursor-spawned child-agent work; the card summary includes description plus subagent kind/model/short ID when Cursor reports them, and `PI_CURSOR_TASK_PRESENTATION=task` restores the older **Cursor task** wording for comparison. This is visibility over Cursor SDK task events, not a native pi subagent session: pi shows start/final output plus any `conversationSteps` tool-call summaries Cursor returns, but cannot show a live nested read/shell/MCP trail when the SDK only returns final subagent text. Neutral Cursor activity calls include `activityTitle` and, when available, `activitySummary` so partial/collapsed cards preserve identity such as `Cursor plan`, `Cursor todos`, `Cursor subagent`, `Cursor MCP`, or `Cursor edit`. For long-running or externally meaningful Cursor tools (`task`, `shell`, `mcp`, `generateImage`, `recordScreen`, `semSearch`, web search/fetch, plan/todo), the provider may surface one low-noise deferred in-progress thinking line such as `Cursor MCP: external_search` from bounded, scrubbed SDK args; fast local tools (`read`, `grep`, `glob`, and similar) skip lifecycle lines when completion follows immediately, and pi bridge MCP calls are excluded because pi already shows real pi tool execution ([lifecycle visibility](./cursor-native-tool-replay.md#low-noise-tool-lifecycle-visibility)). Replay-only tools display recorded Cursor results, normalize workspace-local paths/diff headers for display, use pi diff colors for edit previews and path-inferred syntax highlighting for write previews, and fail closed if called without a recorded result. Native replay wrappers are registered only for tool names not already owned by another extension; conflicting tools use the bounded scrubbed transcript fallback. Cursor workflow tools such as mode/task/todo/plan activity are not pi workflow controls; reported todo/plan events are displayed as Cursor activity only. Plan/todo replay cards can be followed by Cursor's final plan text, selected from `run.wait().result` when Cursor provides one and trimmed against already-emitted text. Started Cursor SDK tool calls that never receive a completion event are surfaced with bounded user-visible labels/traces (neutral activity cards when native replay routing allows, otherwise the same inactive or transcript trace fallbacks used for completed replay) instead of being silently discarded when the run failed/aborted, produced no assistant text, or involved external/side-effectful tools; incomplete fast local discovery starts (`read`, `grep`, `glob`, `ls`) remain maintainer-debug-only after successful text-producing runs so stale SDK start events do not create red post-answer cards. Explicit failures remain visible when Cursor reports them through completed tool calls or step results. Pi bridge MCP starts remain excluded from duplicate incomplete Cursor cards because pi already shows real pi tool execution. `PI_CURSOR_NATIVE_TOOL_DISPLAY=0` disables native replay, and `PI_CURSOR_REGISTER_NATIVE_TOOLS=0` is a registration-only opt-out that keeps the transcript fallback without shadowing pi tool names. When bridge or native replay cards are emitted, the provider mirrors Codex's turn shape as Cursor SDK activity arrives: assistant `toolUse`, pi `toolResult`s, live post-tool Cursor thinking/text, any later tool batches as further `toolUse` turns, then Cursor's final assistant answer. For shell replay, completed `stdout` / `stderr` are primary; unambiguous `shell-output-delta` data is also shown as bounded live progress while one shell call is active and used as display-only fallback for empty successful shell completions, while overlapping shell calls drop ambiguous deltas instead of guessing. Print mode keeps bounded scrubbed transcript output instead, preserving `pi -p` assistant text output. Cursor text deltas stream live when no live-run turn split is active.
49
+ - Cursor internal tool activity is recorded from SDK events and scrubbed. Maintainer reference for `@cursor/sdk@1.0.36` `ToolType` values, runtime alias normalization, and intentional mapping/fallback rules: [Cursor native tool replay — SDK ToolType replay matrix](./cursor-native-tool-replay.md#sdk-tooltype-replay-matrix) (official SDK docs: https://cursor.com/docs/sdk/typescript). In TUI sessions and structured JSON/RPC modes, supported completed `read`, `bash`, `grep`, `find`, `ls`, `edit`, `write`, diagnostics, delete, todo/plan, task, image generation, MCP, semantic search, and screen recording activity is replayed through pi's native tool-call rendering path with recorded Cursor results, so users and JSON/RPC consumers can see native-looking cards/events without rerunning Cursor's reads/shell commands/file edits. Cursor `glob` activity is replayed through native `find` cards. Cursor write activity is replayed through native-looking `write` cards, and Cursor StrReplace/edit activity uses native-looking `edit` only when recorded arguments truthfully satisfy pi's `edit` schema; path-only Cursor edit and notebook edit replay falls back to neutral Cursor activity before pi validation. Diagnostics, delete, todos/plans, task/subagent, image, and MCP activity use neutral Cursor activity cards with pi's default success/error shell. Cursor SDK `task` activity is labeled **Cursor subagent** by default because it represents Cursor-spawned child-agent work; the card summary includes description plus subagent kind/model/short ID when Cursor reports them, and `PI_CURSOR_TASK_PRESENTATION=task` restores the older **Cursor task** wording for comparison. This is visibility over Cursor SDK task events, not a native pi subagent session: pi shows start/final output plus any `conversationSteps` tool-call summaries Cursor returns, but cannot show a live nested read/shell/MCP trail when the SDK only returns final subagent text. Neutral Cursor activity calls include `activityTitle` and, when available, `activitySummary` so partial/collapsed cards preserve identity such as `Cursor plan`, `Cursor todos`, `Cursor subagent`, `Cursor MCP`, or `Cursor edit`. For long-running or externally meaningful Cursor tools (`task`, `shell`, `mcp`, `generateImage`, `recordScreen`, `semSearch`, web search/fetch, plan/todo), the provider may surface one low-noise deferred in-progress thinking line such as `Cursor MCP: external_search` from bounded, scrubbed SDK args; fast local tools (`read`, `grep`, `glob`, and similar) skip lifecycle lines when completion follows immediately, and pi bridge MCP calls are excluded because pi already shows real pi tool execution ([lifecycle visibility](./cursor-native-tool-replay.md#low-noise-tool-lifecycle-visibility)). Replay-only tools display recorded Cursor results, normalize workspace-local paths/diff headers for display, use pi diff colors for edit previews and path-inferred syntax highlighting for write previews, and fail closed if called without a recorded result. Native replay wrappers are registered only for tool names not already owned by another extension; conflicting tools use the bounded scrubbed transcript fallback. Cursor workflow tools such as mode/task/todo/plan activity are not pi workflow controls; reported todo/plan events are displayed as Cursor activity only. Plan/todo replay cards can be followed by Cursor's final plan text, selected from `run.wait().result` when Cursor provides one and trimmed against already-emitted text. Started Cursor SDK tool calls that never receive a completion event are surfaced with bounded user-visible labels/traces (neutral activity cards when native replay routing allows, otherwise the same inactive or transcript trace fallbacks used for completed replay) instead of being silently discarded when the run failed/aborted, produced no assistant text, or involved external/side-effectful tools; incomplete fast local discovery starts (`read`, `grep`, `glob`, `ls`) remain maintainer-debug-only after successful text-producing runs so stale SDK start events do not create red post-answer cards. Explicit failures remain visible when Cursor reports them through completed tool calls or step results. Pi bridge MCP starts remain excluded from duplicate incomplete Cursor cards because pi already shows real pi tool execution. `PI_CURSOR_NATIVE_TOOL_DISPLAY=0` disables native replay, and `PI_CURSOR_REGISTER_NATIVE_TOOLS=0` is a registration-only opt-out that keeps the transcript fallback without shadowing pi tool names. When bridge or native replay cards are emitted, the provider mirrors Codex's turn shape as Cursor SDK activity arrives: assistant `toolUse`, pi `toolResult`s, live post-tool Cursor thinking/text, any later tool batches as further `toolUse` turns, then Cursor's final assistant answer. For shell replay, completed `stdout` / `stderr` are primary; unambiguous `shell-output-delta` data is also shown as bounded live progress while one shell call is active and used as display-only fallback for empty successful shell completions, while overlapping shell calls drop ambiguous deltas instead of guessing. Print mode keeps bounded scrubbed transcript output instead, preserving `pi -p` assistant text output. Cursor text deltas stream live when no live-run turn split is active.
50
+ - Shell correlation prefers exact IDs and otherwise requires a unique pending shell with identical arguments, accepting legacy aliases as compatibility inputs. SDK 1.0.36's public shell ToolCall uses `type: "shell"`; its installed accumulator preserves the completed ToolCall in an ID-less `onStep` before the completed delta. Offline contracts verify this producer shape and provider deduplication, not an observed alias-changing service pair or resolution of the reported stale-shell symptom. See [shell correlation evidence](./cursor-native-tool-replay.md#shell-correlation-and-evidence).
43
51
  - Cursor native replay uses one neutral replay tool name, `cursor`, plus native-compatible card names when renderer-compatible (`read`, `bash`, `grep`, `find`, `ls`, `edit`, `write`). Neutral replay identity lives in `activityTitle`, `activitySummary`, and typed replay details, not in extra registered tool names. Bridge MCP names such as `pi__sem_reindex` are MCP-only; pi session output uses real pi tool names.
44
52
  - In-time safe LOCAL raw `turn-ended.usage` maps full-prompt input into disjoint native components (`input = inputTokens - cacheReadTokens - cacheWriteTokens`), retaining caches and output; their sum equals `totalTokens = inputTokens + outputTokens`. Fresh usage supersedes historical floors. Fallback components describe the same estimated current context as total. Late SDK data never overwrites an emitted pi message, but raw events remain ledger facts independent of replay/display gating. `RunResult.usage`, Cloud raw data, and billed snapshots never become per-message occupancy. `src/cursor-usage-accounting.ts` owns native mapping; `src/cursor-usage-ledger.ts` owns durable telemetry.
45
53
  - Discovery registers zero cost rates. `models.json` configured per-million rates and tiers use native `calculateCost(model, partial.usage)` on each emitted message's coherent context components. Fallback has no inferred cache split, and split-message estimates are not internal request pricing. Public billed usage already has disjoint uncached input/cache/output categories; it is not normalized like raw LOCAL full-prompt input. Optional `cost.rawCostCents` and `cost.chargedCents` remain separate, revisable floating-point-cent observations, never substituted for configured native costs.
@@ -47,11 +55,11 @@ Current implementation notes:
47
55
  - Maintainer visual verification for replay-card changes should follow [Cursor Native Tool Visual Audit Workflow](./cursor-native-tool-visual-audit.md): offscreen PTY-driven pi run, xterm.js/Playwright screenshot rendering, and JSONL inspection before accepting commits or PRs.
48
56
  - Verification is offline/faux first, including cross-platform CI and native contracts. Reuse exact-input retained evidence. Only changed behavior that needs new real-service proof warrants the smallest meaningful live check on one representative environment; docs/metadata-only changes need no paid runs. No full paid campaign replay, matrix-only host coverage, or automatic paid retries. `npm run smoke:platform:all` is an optional comprehensive matrix, not an unconditional commit/release gate. No paid Cursor Cloud testing for generic PRs/releases; only explicitly Cursor Cloud-focused PRs/issues may select a necessary focused Cloud check, retaining run/evidence and cleanup contracts. Automated Cursor PR reviews, offline Cloud contracts, and Cloud product capabilities remain unchanged. See [Platform Smoke](./platform-smoke.md), [Cursor Live Smoke Checklist](./cursor-live-smoke-checklist.md), and [Cursor testing lessons](./cursor-testing-lessons.md).
49
57
  - For models without a catalog `context` parameter, context windows are not hardcoded. The extension ships a bundled SDK-derived default/non-Max cache generated from `createAgentPlatform().checkpointStore.loadLatest(agentId).tokenDetails.maxTokens`. Successful runs can update a local override cache, but model discovery does not probe models at startup.
50
- - Max Mode context windows are distinct from default/non-Max context windows. `@cursor/sdk` 1.0.32 documentation says the SDK may enable Max Mode automatically when a selected model requires it, but the public local-agent `ModelSelection` path still does not expose a manual Max Mode selector. Do not advertise Max Mode context windows unless the SDK catalog exposes an exact parameter/variant or the SDK public API adds a Max Mode selector that the extension actually sends.
58
+ - Max Mode context windows are distinct from default/non-Max context windows. [SDK documentation](https://cursor.com/docs/sdk/typescript) says that on legacy request-based plans Cursor enables Max Mode automatically when a selected model requires it, but the public local-agent `ModelSelection` path still does not expose a manual Max Mode selector. Do not advertise Max Mode context windows unless the SDK catalog exposes an exact parameter/variant or the SDK public API adds a Max Mode selector that the extension actually sends.
51
59
  - The installed `@cursor/sdk` exposes latest-style `ModelListItem.aliases`. The extension registers only unambiguous aliases as pi model IDs (with the same context suffixes when applicable) and sends the alias back in `ModelSelection.id`. Cursor-only fast preferences are keyed by the selected SDK model ID/alias, with read fallback for older preferences keyed by the underlying catalog `id`. Aliases shared by multiple base models, such as generic family aliases, are skipped because the pi row metadata would otherwise imply one base model while Cursor may resolve the alias to another.
52
60
  - Local restart resume treats user entries already present at `session_start` or selected by tree navigation as crash-ambiguous: an older SDK handle cannot span them because the prior process may already have submitted that prompt. A user entry appended after startup in the current process may span the last completed handle for the normal next send.
53
- - Persisted pi sessions use a session-scoped Cursor SDK SQLite store at `<getDefaultSdkStateRoot(cwd)>/pi-sessions/<session-hash>/`; create/resume, transcript reads, checkpoint lookup, and exact-ID cleanup all receive that same store. Fileless acquisitions use unique OS-temporary stores that are removed on graceful disposal; invalidation starts a fresh agent instead of reopening a disposed temporary store. Resume entries version the store identity. Legacy entries still resume against the SDK default workspace store, then move to the per-session store after fallback or agent replacement. Removing a persisted pi session does not automatically remove its store directory; only a verified session-derived `pi-sessions/<session-hash>` root may be removed after no pi process uses it. The shared SDK default workspace root recorded by legacy entries must never be removed as session cleanup. Cloud agents are unchanged.
54
- - Session-scoped Cursor SDK agent pooling reuses one live `@cursor/sdk` agent across compatible follow-up turns within the same pi session scope. Independently, each distinct local agent whose `Agent.send()` is initiated is best-effort recorded once per native pi session as a non-resumable `cursor-sdk-agent-lineage` custom entry (including failed/cancelled sends and when local resume is disabled). Cloned/forked sessions record lineage under their own pi session ID; donor entries do not suppress the new session. `planCursorSessionSend()` in `src/cursor-session-send-policy.ts` decides whether the next turn sends a full bootstrap prompt or an incremental follow-up, whether the SDK agent must be recreated, and why. `computeCursorContextFingerprint()` and `shouldBootstrapCursorContext()` remain the context-only bootstrap signal. The pool recreates the agent when context diverges, when newly appended model-visible input cannot fit the single-user incremental prompt (for example, a visible `!` shell result before the next question), when branch or compaction summaries appear after `/tree` navigation or compaction, after 20 completed incremental sends, when the API key identity changes, after send errors, on `session_shutdown`, and when `session_before_tree` / `session_tree` invalidate the active branch. Pi's `!!` shell output remains excluded from model context, so an ordinary follow-up after `!!` stays incremental. Incremental sends omit the full Cursor SDK tool boundary block because the session agent retains prior bootstrap context, but every send ends with a short tool tail guard placed after the latest user request (including an explicit shell `cd` hint). True incremental sends also omit invariant Pi system instructions; system-prompt changes are part of the context fingerprint and force a full context-divergence bootstrap that includes the updated system section.
61
+ - Persisted pi sessions use a session-scoped Cursor SDK SQLite store at `<getDefaultSdkStateRoot(cwd)>/pi-sessions/<session-hash>/` by default (see [custom roots](#local-store-migration-and-ownership)); create/resume, transcript reads, checkpoint lookup, and exact-ID cleanup all receive that same store. Fileless acquisitions use unique OS-temporary stores that are removed on graceful disposal; invalidation starts a fresh agent instead of reopening a disposed temporary store. Resume entries version the store identity. With default storage selected, legacy entries still resume against the SDK default workspace store, then move to the per-session store after fallback or agent replacement. Removing a persisted pi session does not automatically remove its store directory; only a verified session-derived `pi-sessions/<session-hash>` root may be removed after no pi process uses it. The shared SDK default workspace root recorded by legacy entries must never be removed as session cleanup. Cloud agents are unchanged.
62
+ - Session-scoped Cursor SDK agent pooling reuses one live `@cursor/sdk` agent across compatible follow-up turns within the same pi session scope. Independently, each distinct local agent whose `Agent.send()` is initiated is best-effort recorded once per native pi session as a non-resumable `cursor-sdk-agent-lineage` custom entry (including failed/cancelled sends and when local resume is disabled). Cloned/forked sessions record lineage under their own pi session ID; donor entries do not suppress the new session. `planCursorSessionSend()` in `src/cursor-session-send-policy.ts` decides whether the next turn sends a full bootstrap prompt or an incremental follow-up, whether the SDK agent must be recreated, and why. `computeCursorContextFingerprint()` and `shouldBootstrapCursorContext()` remain the context-only bootstrap signal. The pool recreates the agent when context diverges, when unmatched requests append model-visible input that cannot fit the conservative single-user incremental prompt, when branch or compaction summaries appear after `/tree` navigation or compaction, after 20 completed incremental sends, when the API key identity changes, after send errors, on `session_shutdown`, and when `session_before_tree` / `session_tree` invalidate the active branch. Pi's `!!` shell output remains excluded from model context, so an ordinary follow-up after `!!` stays incremental. Incremental sends omit the full Cursor SDK tool boundary block because the session agent retains prior bootstrap context, but every send ends with a short tool tail guard placed after the latest user request (including an explicit shell `cd` hint). True incremental sends also omit invariant Pi system instructions; system-prompt changes are part of the context fingerprint and force a full context-divergence bootstrap that includes the updated system section.
55
63
  - Pi steering/follow-up delivery can arrive while a split live Cursor SDK run is still active. The provider resolves only the captured session scope's indexed live run against trailing `toolResult` messages while skipping trailing `user` messages, ignores inherited foreign-run IDs without scanning sibling runs, and resumes its own in-flight run instead of calling `Agent.send()` again. When the context ends with steering user text after tool results, the provider releases the prior live run and chains an incremental `Agent.send()` for the latest user message in the same provider turn; if the prior run emits more text or tool requests after steering arrives, that stale activity is cancelled instead of surfacing another old-run tool turn and losing the new user input. A pre-send guard waits for or resumes any still-active scoped live run before starting a fresh send so `@cursor/sdk` `AgentBusyError` (`already has active run`) does not surface to pi users. Pooled session agents mark busy as soon as live/direct `run.wait()` tracking starts (`trackRunCompletion` on the session lease), and `acquireSessionCursorAgent()` awaits that busy state before returning a lease so send planning, transcript offsets, and later `Agent.send()` do not race the prior turn's SDK run completion (for example pi auto-compaction summarization). `session_before_compact` calls `prepareCursorSessionForCompaction()` to release scoped live-run drain state and reset the pooled agent before summarization streams. Tracked completions and send commits are scoped to the pooled agent `instanceId` so disposal/replacement drops stale tracking and ignores late commits from disposed agents.
56
64
 
57
65
  ## Goal
@@ -84,18 +92,17 @@ Not building now:
84
92
 
85
93
  Cursor SDK is the source of truth for Cursor model IDs and Cursor-supported parameters.
86
94
 
87
- At startup, the extension calls:
95
+ Startup registers a known cached/fallback baseline without catalog/network calls. The SDK remains in the static extension graph for compiled-Bun loading; cache-only does not promise zero SDK module evaluation. Native cache-only refresh follows real login/logout/rotation/runtime-key mutations; the genuine extension context supplies composed config auth once bound. There is no polling, replayed auth lifecycle event, or independent CLI parser.
88
96
 
89
- ```ts
90
- Cursor.models.list({ apiKey });
91
- ```
97
+ Known host limitation: official Pi 1.0.4 has a demonstrated startup refresh-admission race that can temporarily leave fallback models and an incorrect missing-key warning despite a matching authenticated cache. The shared-owner repair is merged in `fitchmultz/pi` via [#190](https://github.com/fitchmultz/pi/pull/190); this is not an official-host fix. See [#337](https://github.com/fitchmultz/pi-cursor-sdk/pull/337). It is separate from Cursor service authentication failures and the compiled-loader repair.
98
+
99
+ Effective auth follows native precedence: runtime override, stored API-key credential (key then provider-scoped `env.CURSOR_API_KEY` then ambient), composed `models.json` key when no stored credential exists, then ambient `CURSOR_API_KEY`. Placeholder normalization does not shadow composed config. An unsupported stored credential type remains unconfigured. Native logout removes both stored credentials and the runtime override; surviving env/config auth prevents false orphan-cache deletion. Same-process environment/config changes are picked up by native registry refresh, not a watcher.
92
100
 
93
- Startup discovery resolves `apiKey` in this order:
101
+ `PI_CURSOR_HIDE_MODELS_WHEN_LOGGED_OUT=1` is opt-in and affects `getAvailable` (picker/list) only. `getModels` retains known fallback/cached identities so native CLI selection can happen before `--api-key` is applied. The default no-auth fallback availability policy remains unchanged; it does not imply a usable Cursor key.
94
102
 
95
- 1. Stored pi auth for provider `cursor` from `readStoredCredential("cursor")`, accepting only an `api_key` credential.
96
- 2. `CURSOR_API_KEY`.
103
+ `/cursor-refresh-models` calls `ctx.modelRegistry.refresh({ providers: ["cursor"], allowNetwork: true, force: true, signal: ctx.signal })`. Cache-only phases never call the catalog or network, even when forced. Network-allowed discovery calls `Cursor.models.list({ apiKey })` with the explicit effective key. SDK 1.0.36's public `CursorRequestOptions` has no caller signal; cancellation protects publication, not underlying transport rollback. Pi 1.0.3's started OAuth refresh may outlive caller abort for up to 15 seconds to save rotated credentials; this API-key/catalog mechanism makes no OAuth rollback promise.
97
104
 
98
- Startup never parses `process.argv`; Pi remains the sole owner of CLI model/provider/key parsing. Provider turns keep Pi's resolved `options.apiKey`. Users can persist the stored key through `/login` -> `Use an API key` -> `Cursor`. If auth is added after startup, fallback models can run once Pi resolves the saved key for provider requests, and `/cursor-refresh-models` asks the command context's ModelRegistry for provider `cursor` and passes that normalized key explicitly to a forced live refresh.
105
+ Discovery stages models and selection metadata. Native `context.publish({ update })` accepts the owning generation before synchronously applying models, metadata, best-effort cache persistence/owned orphan cleanup, and one replaceable/clearable fallback-warning state. Cancelled/superseded responses and closed bindings cannot mutate those surfaces. Effective no-auth cleanup removes only a valid extension catalog regular file, never a user-managed link. Authenticated errors still prefer a fingerprint-matching cache or the bundled fallback.
99
106
 
100
107
  For each model, use:
101
108
 
@@ -106,7 +113,7 @@ For each model, use:
106
113
  - `model.variants`
107
114
  - default variant: `variant.isDefault === true`, else first variant
108
115
 
109
- This means new Cursor models and changed Cursor parameters are picked up after `/cursor-refresh-models`, reload, or restart.
116
+ New Cursor models and changed parameters are picked up by a network-allowed native refresh (explicitly `/cursor-refresh-models`); reload/restart restores cached or fallback identities without forcing live discovery.
110
117
 
111
118
  Pi model metadata is also a source of truth for pi-native behavior:
112
119
 
@@ -143,6 +150,8 @@ CURSOR_API_KEY="your-key" npm run refresh:cursor-snapshots -- --write \
143
150
 
144
151
  Both modes call `Cursor.models.list({ apiKey })` and use the same sanitizer and stable sort. `--check` byte-compares `src/cursor-fallback-models.generated.ts` without writing; `--write` refreshes it and updates `src/bundled-context-windows.ts` only when `--context-windows` is provided. Context-window inputs are limited to current selectable model IDs; redundant default `:fast`/`:slow` aliases collapse to one key, conflicting equivalent selections fail generation, and stale or ambiguous aliases are omitted. Generated provenance and command output record the installed `@cursor/sdk` version and model count. The script prints model IDs/counts only and scrubs known auth material from SDK errors; it must not print or store API keys. Review generated diffs before committing because Cursor can change aliases, defaults, and parameter meanings.
145
152
 
153
+ The authenticated SDK 1.0.36 catalog refresh on 2026-10-06 returned 45 models matching the reviewed metadata. The generated header records that observation; checkpoint limits were retained.
154
+
146
155
  Dated evidence for Cursor's assistant-visible, model-specific system text and reconstructed tool guidance lives in [Cursor System Prompts and Tool Guidance — 2026-08-02](https://github.com/fitchmultz/pi-cursor-sdk/blob/main/docs/evidence/cursor-system-prompts-2026-08-02/README.md). Keep that evidence separate from pi-cursor-sdk's own bootstrap prompt: Cursor persists its base system message in the local SDK checkpoint, while this extension sends Pi context and bridge instructions as user content.
147
156
 
148
157
  ## Design Direction
@@ -374,7 +383,7 @@ cursor/claude-opus-4-8@1m
374
383
  Each variant must:
375
384
 
376
385
  - have an entry in the extension metadata map that points back to the same Cursor base model ID,
377
- - include the selected Cursor `context` param when calling `Agent.create()`,
386
+ - include the selected Cursor `context` param when calling `Agent.create()`, except for the Grok 4.7 catalog-default compatibility rule below,
378
387
  - set pi `contextWindow` from that context value,
379
388
  - share the same `thinkingLevelMap` as the base model unless Cursor reports otherwise.
380
389
 
@@ -383,6 +392,33 @@ Reason:
383
392
  - pi context display and overflow logic must match the actual Cursor context.
384
393
  - pi has no generic provider-parameter system that can change `contextWindow` while keeping the same model ID.
385
394
 
395
+ ### Grok 4.7 Default-context Compatibility
396
+
397
+ Grok 4.7 selections (including unambiguous SDK aliases and `:fast` / `:slow` variants) omit only an outgoing `context` equal to the base catalog's default-variant context.
398
+ The baseline comes from `isDefault`, falling back to the first variant, before applying the selected context or speed override.
399
+ If the catalog supplies no default context, no context is omitted.
400
+ Non-default contexts and all effort and fast values remain explicit, including catalog-default effort and speed.
401
+ Selected context metadata, native `contextWindow`, and catalog params are not changed, and other models keep their complete selections.
402
+
403
+ Retained LOCAL evidence with SDK 1.0.35 covered all 16 combinations of `256k` / `500k`, `low` / `medium` / `high` / `xhigh`, and fast on/off: all explicit `256k` selections succeeded and all explicit `500k` selections were rejected.
404
+ Separate SDK 1.0.35 checks succeeded with context omitted at medium and high effort with `fast=true`.
405
+ An unmodified SDK 1.0.36 build reproduced the rejection for explicit `context=500k`, `reasoning_effort=medium`, and `fast=true`.
406
+ The revised context-only builder is verified offline; this is not a successful live matrix on SDK 1.0.36 or Cloud qualification.
407
+
408
+ ## SDK-native Custom Agent Definitions
409
+
410
+ `cursor-sdk.json` top-level `subagents` supplies public SDK `AgentOptions.agents` for ordinary LOCAL create/resume and Cloud creation. One usable trusted project set replaces the entire user set; empty/all-invalid sets do not shadow it. The existing immutable Pi project-trust provenance controls loading. CLI, environment, session and builtin overrides do not supply definitions.
411
+
412
+ The extension validates names with `/^[A-Za-z][A-Za-z0-9._-]{0,63}$/` (extension policy, not an SDK restriction), trims required nonblank description/prompt and optional model, accepts Pi thinking levels and boolean fast, skips unusable entries, and drops unsupported fields. Own-entry construction preserves names such as `constructor` as data. Existing unrelated config saves retain definitions.
413
+
414
+ `buildCursorCustomSubagentDefinitions()` keeps omitted model absent and explicit `inherit` literal; installed SDK 1.0.36 conversion makes both inherit the parent. Their thinking/fast fields cannot override that inheritance. Explicit models reuse canonical catalog selection, with registered fast/slow identity ahead of entry fast and catalog defaults otherwise. Parent/session/process fast settings and parent thinking are independent. Unknown IDs stay ID-only; no additional discovery request or fabricated SDK ID encoding occurs.
415
+
416
+ The full resolved selection is submitted for both runtimes. **SDK 1.0.36 LOCAL conversion retains only ID/inherit and drops thinking/fast/context params.** Cloud conversion retains params, not a qualified claim about delegated service acceptance. `local.subagentInherit` controls child resources, not model params.
417
+
418
+ Nonempty definitions add a SHA256 pool-key suffix over name-sorted fixed-shape content with sorted model params. Definition/property/param order does not affect identity; text/model/param/add/remove changes do. No-feature keys stay byte-identical. Each turn captures one definition set, including forced rebootstrap; next-turn config edits repool and exact persisted-key matching rejects stale resumes. Existing persistence stores the key digest only, not definition prompts.
419
+
420
+ LOCAL compact/tree summary constructors remain fresh, tool-free, definition-free and ephemeral, without conversation resume/lineage. Bug-report streams have no public summary-purpose hook and retain ordinary capabilities. Bridge snapshots/manifests/routing are unchanged and `pi__subagent` stays preferred when available. User configuration and limits: [SDK-native custom agents](../README.md#sdk-native-custom-agents).
421
+
386
422
  ## Fast Behavior
387
423
 
388
424
  If a model supports `fast`:
@@ -535,6 +571,14 @@ composer-2.5 -> cursor/composer-2-5, fast=true
535
571
  grok-4.6 -> cursor/grok-4.6, fast=true
536
572
  ```
537
573
 
574
+ ### Local store migration and ownership
575
+
576
+ Persistent LOCAL storage selects `PI_CURSOR_SDK_STATE_ROOT > user local.storeRoot > undefined`, captured once before drain/acquisition or at explicit cleanup entry. Project/session/CLI/built-in roots are ignored. Invalid nonempty winners survive parsing and fail closed at persistent storage. Custom layout is `<canonical-root>/<sha256(resolve(cwd))[0:32]>/pi-sessions/<unchanged-session-hash>`. Auth/settings/rules/catalog caches/IDE data do not move. Root changes repool even with resume disabled; persisted pool-key bytes and identity version 1 are unchanged. Only the exact current custom session identity can resume or be cleaned up, with no custom legacy workspace/historical-root mapping. Wrong-root handles fall back with the existing one-shot transcript continuity notice. A/default history is retained when B is selected; cleanup under B can permanently exclude A candidates. Clean up before relocating if desired; returning to A does not undo durable exclusion.
577
+
578
+ Custom leases are keyed by raw cwd and captured normalized selected root and retained through admission/open/fallback/disposal. Creating/ready/busy reuse and same-key supersession compare storage compatibility too. Paths must be native fully qualified absolute non-root paths without explicit dot components or interpolation. POSIX ancestry rejects unowned/group/other-writable components except trusted sticky root-owned temporary ancestors; subsequent components must be current-user owned. Missing components are created individually (0700); only owned destinations are restricted through identity-checked no-follow directory descriptors. Verified root-owned system aliases may canonicalize; user-controlled ancestor/owned links are rejected. Bounded admission, fixed SQLite leaf checks and before/after-public-open identities protect the chain. This trusts current-user private contents, not hostile same-user/admin pathname races or arbitrary lazy checkpoint contents. Windows checks Node-visible links/junctions, identity/type and writability, not ACL hardening or every reparse tag; choose an ACL-protected location. Native Windows proof requires Windows execution, not POSIX platform mocks. Fileless and LOCAL compact/tree temporary paths bypass all persistent selection/validation/leases.
579
+
580
+ When default storage is selected, SDK 1.0.36's public default-root getter migrates MD5(cwd) to SHA256(cwd) with a whole-workspace rename. Persisted Pi identities are admitted only as exact cwd/scope-derived roots below the SDK-owned prefix. A missing legacy workspace can map to the current root only when that precise destination contains the recorded agent with the same cwd. Existing legacy roots retain ownership, including when both stores exist; no merge or sweep occurs. Resume and recorded-ID cleanup share this admission. Persistent same-cwd callers acquire ownership synchronously before any await or public root derivation, share the pending derivation, and retain it through resume/cleanup admission and store open/disposal. Failed acquisition/disposal releases ownership; no permanent root cache or whole-turn serialization is introduced. Other processes must be stopped before upgrading because this is not a cross-process lock. User-managed links/junctions above the SDK-owned prefix remain supported. A small pure layout preflight, contract-verified against the installed SDK factory/public getter because no public read-only resolver exists, rejects links/non-directories in the owned prefix and old/current workspace components before the migration-capable getter. Post-getter/open/removal guards remain in place. Recorded identities must first match exact derived current/legacy roots; only admitted roots enter a normalized finite component walk. Malformed/outside/sibling identities fall back on resume or become durably non-retryable cleanup candidates. A layout failure after exact admission names the rejected owned component and remains retryable for cleanup after that component is repaired; dangling destination links are rejected before a missing destination can be mistaken for absent migration proof. Persistent opens require an already-active matching derived workspace lease; no caller-supplied root adoption or unleased mode exists. Cleanup requires a durable session file and recorded intent before opening persistent storage. Fileless turns and LOCAL compaction/tree summaries open unique temporary stores directly, without workspace derivation, preflight, migration or a workspace lease; they never resume and retain guarded removal on failure/disposal. Pool keys, branch resume admission and native usage journals/footer are unchanged.
581
+
538
582
  ### Resume Session
539
583
 
540
584
  Restore:
@@ -560,9 +604,9 @@ Pi's SDK supplies a session-owned `before_provider_headers` callback for ordinar
560
604
 
561
605
  An explicitly shared ModelRuntime still has only one Cursor registration. A request can run only when its receipt belongs to that registration's active session. Mismatched or missing receipts fail before SDK/storage work:
562
606
 
563
- > Cursor provider ownership is unavailable: this request does not belong to the active Cursor registration. Bind this session's extensions and refresh Cursor models/reload it; use independent ModelRuntime instances for sibling sessions.
607
+ > Cursor provider ownership is unavailable: this request does not belong to the active Cursor registration. Reload this session's extensions to restore its Cursor registration; use independent ModelRuntime instances for sibling sessions.
564
608
 
565
- Pre-bind and shutdown closures also fail closed. Refreshing A while an unstarted shared sibling exists cannot let that sibling enter A's registration, including bug-report streams without lifecycle events. Catalog refresh keeps its binding's original closure, including when auth resolution races a sibling registration. Bare calls to a registered provider without the native headers receipt, including extension calls to `ctx.modelRegistry.streamSimple`, or reuse of a consumed receipt, fail closed. Bind/refresh/reload cannot supply a receipt to that bare API: use the owning AgentSession's native stream path or an independent child AgentSession. Direct `streamCursor` callers must also supply captured ownership, request provenance, and a usage recorder; there is no unbound global fallback. Default independent ModelRuntime instances remain the embedding recommendation.
609
+ Pre-bind and shutdown closures also fail closed. Refreshing A while an unstarted shared sibling exists cannot let that sibling enter A's registration, including bug-report streams without lifecycle events. Catalog refresh keeps the native registration's original closure and never re-registers over a sibling, including when auth resolution races a sibling registration. Bare calls to a registered provider without the native headers receipt, including extension calls to `ctx.modelRegistry.streamSimple`, or reuse of a consumed receipt, fail closed. Bind/refresh/reload cannot supply a receipt to that bare API: use the owning AgentSession's native stream path or an independent child AgentSession. Direct `streamCursor` callers must also supply captured ownership, request provenance, and a usage recorder; there is no unbound global fallback. Default independent ModelRuntime instances remain the embedding recommendation.
566
610
 
567
611
  Branch mode, runtime/cloud acknowledgement, fast and HTTP preferences are session-scoped. CLI snapshots follow their owning ExtensionRuntime, including independent sibling flags and one-shot local-force consumption across rebinding/reload. Environment overrides and user defaults remain process-wide. Cursor SDK HTTP/1.1 transport configuration remains process-global; different branch preferences are not independent simultaneous SDK configurations. Shutdown clears the extension-owned transport override only after the last binding leaves, and a never-started child cannot reset or terminally dispose a parent's pool. Cloud commands capture the original public manager, session file/id, branch anchor, and lifecycle authority before auth/SDK awaits, then reject changed ownership or authority before writing an intent or starting the SDK mutation. Authenticated orphan reconciliation uses only that unchanged captured authority. After SDK start, actual completion is persisted in the original durable journal with its post-intent anchor even across branch changes, reload, or shutdown; the optional Pi mirror is omitted if the original context/branch is no longer current. General provider recording retains live before/after branch-anchor checks, and no-follow/fsync guards remain in force.
568
612
 
@@ -23,9 +23,11 @@ Cursor SDK `plan` mode (`--cursor-mode plan` or `/cursor-mode plan`) can make Cu
23
23
 
24
24
  ## Local pi bridge summary
25
25
 
26
- The bridge is enabled by default when bridgeable active pi tools exist. Cursor sees bridge-owned MCP names such as `pi__sem_reindex`, while pi history and tool cards use the real pi tool name such as `sem_reindex`. The bridge hides overlapping built-in pi tools by default because Cursor already has native equivalents; extension/custom tools and non-overlapping active tools present in pi's active tool registry normally remain exposed. pi-cursor-sdk also registers `cursor_ask_question` for Cursor models when the bridge is enabled and default-on `PI_CURSOR_ASK_QUESTION` is left on, exposed to Cursor as `pi__cursor_ask_question`, so Cursor can ask the user to choose instead of silently defaulting when the pi UI is available. When pi has visible Agent Skills loaded, pi-cursor-sdk registers `cursor_activate_skill`, exposed as `pi__cursor_activate_skill`, so Cursor can load the full pi `SKILL.md` that corresponds to the current pi skill catalog. The bridge does not call pi tool `execute()` handlers directly; it queues the request, emits a real pi `toolCall`, waits for the matching pi `toolResult`, and resolves the Cursor MCP call back into the same live Cursor SDK run without creating a new `Agent`, unless the run was disposed, aborted, or cancelled.
26
+ The bridge is enabled by default when bridgeable active pi tools exist. Cursor sees bridge-owned MCP names such as `pi__sem_reindex`, while pi history and tool cards use the real pi tool name such as `sem_reindex`. The bridge hides overlapping built-in pi tools by default because Cursor already has native equivalents; extension/custom tools and non-overlapping active tools present in pi's active tool registry normally remain exposed. pi-cursor-sdk also registers `cursor_ask_question` for Cursor models when the bridge is enabled and `PI_CURSOR_ASK_QUESTION=1`, exposed to Cursor as `pi__cursor_ask_question`. The tool is off by default. When pi has visible Agent Skills loaded, pi-cursor-sdk registers `cursor_activate_skill`, exposed as `pi__cursor_activate_skill`, so Cursor can load the full pi `SKILL.md` that corresponds to the current pi skill catalog. The bridge does not call pi tool `execute()` handlers directly; it queues the request, emits a real pi `toolCall`, waits for the matching pi `toolResult`, and resolves the Cursor MCP call back into the same live Cursor SDK run without creating a new `Agent`, unless the run was disposed, aborted, or cancelled.
27
27
 
28
- The bridge migrated from legacy `@modelcontextprotocol/sdk` v1 to stable MCP v2. Its bundled runtime closure is `@modelcontextprotocol/server@2.1.0`, `@modelcontextprotocol/hono@2.0.1`, `hono@4.13.9`, and `@hono/node-server@2.1.1`; the server binds loopback and validates Hono `Host` and `Origin` headers.
28
+ Outstanding bridge calls pause the live run's idle-abandonment timer (five minutes by default), including queued/emitted requests and pi tools awaiting an answer. The full idle window resumes after the last matching call settles and the provider drain lease ends, including when cleanup was requested before the lease. Explicit abort/shutdown/reset/compaction and the fail-closed MCP/bridge deadline (one hour by default) still clean up pending work. Display-only native replay without pending bridge work retains its idle expiry.
29
+
30
+ The bridge migrated from legacy `@modelcontextprotocol/sdk` v1 to stable MCP v2. Its bundled runtime closure is `@modelcontextprotocol/server@2.3.1`, `@modelcontextprotocol/hono@2.0.2`, `hono@4.13.13`, and `@hono/node-server@2.1.3`; the server binds loopback and validates Hono `Host` and `Origin` headers.
29
31
 
30
32
  Rollback, timeout, and diagnostics controls:
31
33
 
@@ -41,7 +43,13 @@ PI_CURSOR_MCP_CONNECT_TIMEOUT_MS=5000 pi --model cursor/grok-4.6
41
43
  PI_CURSOR_PI_TOOL_BRIDGE_DEBUG=1 pi --model cursor/grok-4.6
42
44
  ```
43
45
 
44
- `PI_CURSOR_ASK_QUESTION=0` disables only `cursor_ask_question` / `pi__cursor_ask_question`, leaving the rest of the pi bridge available; it is enabled by default. `PI_CURSOR_PI_TOOL_BRIDGE=0` disables the bridge, including `pi__cursor_ask_question`. `PI_CURSOR_EXPOSE_BUILTIN_TOOLS=1` opts in to exposing overlapping pi tool names that Cursor already has native equivalents for (`read`, `bash`, `write`, `edit`, `grep`, `find`, and `ls`). By default those names are hidden even when pi's Cursor replay wrapper has registered them as extension tools; non-overlapping active built-ins remain bridgeable by default. The installed Cursor SDK uses a 60-second MCP protocol default; pi-cursor-sdk overrides that seam by default with 3600 seconds for MCP `callTool` requests and 10 seconds for verified initialize/listTools requests on first send. Bridged calls also have a local fail-closed deadline capped by the effective MCP tool timeout; lower it with `PI_CURSOR_PI_BRIDGE_CALL_TIMEOUT_MS` to reject stale pending state and abort active pi execution sooner. Unknown MCP protocol timeout stacks keep the SDK default. `PI_CURSOR_PI_TOOL_BRIDGE_DEBUG=1` emits typed, allowlisted, scrubbed single-line JSONL bridge diagnostics to `process.stderr` with prefix `[pi-cursor-sdk:bridge]`; it is off by default, uses run-safe IDs that are not reused in endpoint paths, and does not print endpoint URLs/path components/tokens, raw args/results, file contents, or secrets. Cursor-native tools, Cursor settings, plugins, and configured Cursor MCP servers still come from the Cursor SDK local agent path. Cloud Cursor agents are out of scope for this bridge.
46
+ `PI_CURSOR_ASK_QUESTION=1` enables only `cursor_ask_question` / `pi__cursor_ask_question`, leaving the rest of the pi bridge available; it is off by default. `PI_CURSOR_PI_TOOL_BRIDGE=0` disables the bridge, including `pi__cursor_ask_question`. `PI_CURSOR_EXPOSE_BUILTIN_TOOLS=1` opts in to exposing overlapping pi tool names that Cursor already has native equivalents for (`read`, `bash`, `write`, `edit`, `grep`, `find`, and `ls`). By default those names are hidden even when pi's Cursor replay wrapper has registered them as extension tools; non-overlapping active built-ins remain bridgeable by default. The installed Cursor SDK uses a 60-second MCP protocol default; pi-cursor-sdk overrides that seam by default with 3600 seconds for MCP `callTool` requests and 10 seconds for verified initialize/listTools requests on first send. Bridged calls also have a local fail-closed deadline capped by the effective MCP tool timeout; lower it with `PI_CURSOR_PI_BRIDGE_CALL_TIMEOUT_MS` to reject stale pending state and abort active pi execution sooner. Unknown MCP protocol timeout stacks keep the SDK default. `PI_CURSOR_PI_TOOL_BRIDGE_DEBUG=1` emits typed, allowlisted, scrubbed single-line JSONL bridge diagnostics to `process.stderr` with prefix `[pi-cursor-sdk:bridge]`; it is off by default, uses run-safe IDs that are not reused in endpoint paths, and does not print endpoint URLs/path components/tokens, raw args/results, file contents, or secrets. Cursor-native tools, Cursor settings, plugins, and configured Cursor MCP servers still come from the Cursor SDK local agent path. Cloud Cursor agents are out of scope for this bridge.
47
+
48
+ ## Shell correlation and evidence
49
+
50
+ Shell start/completion correlation accepts legacy shell aliases with identical arguments even if IDs differ, but only for a unique pending match. Multiple identical pending shells remain unmatched without an exact ID, which takes precedence. Unmatched shell starts remain visible; assistant text or stdout progress alone does not prove completion.
51
+
52
+ This alias handling is an extension compatibility contract, not an observed alias-changing SDK callback pair. SDK 1.0.36's public started/completed updates carry `callId`, `modelCallId`, and a ToolCall with `type: "shell"`. The installed `run-interaction-accumulator` copies the completed ToolCall into `onStep({ step: { type: "toolCall", message: toolCall } })`, without adding `step.id`, before forwarding the completed delta. An offline provider contract executes that installed producer and checks reconciliation/deduplication; legacy alias tests separately check compatibility inputs. No retained alias-changing service capture establishes that this fixes the reported stale-shell symptom.
45
53
 
46
54
  ## What gets replayed
47
55
 
@@ -66,13 +74,13 @@ When Cursor reports completed tool activity, the extension can display recorded
66
74
 
67
75
  Cursor `glob` activity is displayed through native `find` cards.
68
76
 
69
- For the full `@cursor/sdk@1.0.32` `ToolType` set, disposition matrix, and runtime alias normalization, see [SDK ToolType replay matrix](#sdk-tooltype-replay-matrix) below. Official SDK reference: https://cursor.com/docs/sdk/typescript
77
+ For the full `@cursor/sdk@1.0.36` `ToolType` set, disposition matrix, and runtime alias normalization, see [SDK ToolType replay matrix](#sdk-tooltype-replay-matrix) below. Official SDK reference: https://cursor.com/docs/sdk/typescript
70
78
 
71
79
  Edit and write activity replays through pi-facing `edit` and `write` cards only when replay arguments truthfully satisfy the matching pi schema, but still uses recorded Cursor results only. The adapter passes through truthful Cursor paths, content when Cursor reported it, and recorded diff/details; it does not pretend Cursor's editing schema is pi's schema and it fails closed if a recorded replay result is missing. Cursor `StrReplace` with recorded replacement text displays as native-looking `edit`; path-only Cursor `edit` and notebook edit activity fall back to neutral Cursor activity so pi does not reject the replay before recorded-result handling. Cursor `write` displays as native-looking `write`. Diagnostics, delete, todos/plans, task/subagent, image, MCP, semantic search, screen recording, and web search/fetch activity use neutral Cursor activity cards with pi's default success/error tool shell. Cursor SDK `task` activity is labeled **Cursor subagent** by default because it represents Cursor-spawned child-agent work; `PI_CURSOR_TASK_PRESENTATION=task` keeps the older **Cursor task** wording for comparison. MCP completions whose `toolName` is `WebSearch` / `web_search` / `WebFetch` / similar are labeled **Cursor web search** or **Cursor web fetch** instead of generic **Cursor MCP**. Neutral Cursor activity cards carry display metadata such as `activityTitle` and `activitySummary`, so partial/collapsed cards can say `Cursor plan`, `Cursor todos`, `Cursor subagent`, `Cursor MCP`, `Cursor semantic search`, `Cursor screen recording`, `Cursor web search`, `Cursor web fetch`, or `Cursor edit` instead of only `Cursor activity`. These replay tools only display recorded Cursor results; they never mutate files or execute tool work directly. Replay paths are normalized to workspace-relative paths when possible. Most collapsed replay cards include bounded previews for diffs and text details so small edits, todos, task output, and MCP results are visible without expanding; web search/fetch activity stays summary-only while collapsed because those cards often arrive after final text and can otherwise bury the answer. Ctrl+O expansion shows the recorded details. Edit previews omit raw unified diff headers and show compact numbered changed/context lines using pi's native diff added/removed/context colors, and write previews use syntax highlighting when pi can infer a language from the path. Image generation replay cards show the saved image path in the collapsed summary and render the image inline when pi terminal image display is enabled and the generated file is still readable.
72
80
 
73
81
  ## SDK ToolType replay matrix
74
82
 
75
- Source of truth for SDK tool names: `@cursor/sdk@1.0.32` conversation `ToolType` values and https://cursor.com/docs/sdk/typescript
83
+ Source of truth for SDK tool names: `@cursor/sdk@1.0.36` conversation `ToolType` values and https://cursor.com/docs/sdk/typescript
76
84
 
77
85
  Implementation owners: `src/cursor-tool-presentation-registry.ts` (canonical names, labels, visibility, replay policy, bridge exclusions for internal replay wrappers, alias normalization, and display-spec key completeness), `src/cursor-transcript-tool-specs.ts` (registry-keyed display implementations for transcript formatting and pi display builders), `src/cursor-native-tool-display-replay.ts` (replay card rendering derived from registry replay metadata), and `src/cursor-web-tool-activity.ts` (MCP/web alias remapping before display lookup).
78
86
 
@@ -6,7 +6,7 @@ This workflow is the canonical repo path for verifying Cursor SDK tool replay th
6
6
 
7
7
  Use it when changed replay-card behavior needs new visual proof not covered by offline rendering contracts or valid retained evidence. Text logs and JSONL are not enough for visual-parity claims: keep PNGs for the exact prompt, and before/after PNGs for a rendering comparison. Reuse a valid retained baseline instead of paying to recreate it.
8
8
 
9
- Current validation baseline: Node 24+, exact `@cursor/sdk@1.0.32`, official Pi 0.87.1/latest and current `fitchmultz/pi` main. Development Pi packages `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, and `@earendil-works/pi-tui` are exact 0.99.1, with host TypeBox 1.3.27. Optional published Pi and TypeBox peer dependencies use `"*"` ranges per Pi guidance.
9
+ Current validation baseline: Node 24+, exact `@cursor/sdk@1.0.36`, official Pi 0.87.1/latest and current `fitchmultz/pi` main. Development Pi packages `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, and `@earendil-works/pi-tui` are exact locked 1.0.4 snapshots, with host TypeBox 1.3.27. These locked development snapshots are not qualification targets; resolve latest stable official Pi and current `fitchmultz/pi` main once per workflow run. Optional published Pi and TypeBox peer dependencies use `"*"` ranges per Pi guidance.
10
10
 
11
11
  ## Cursor SDK 1.0.17 / pi 0.79.0 cutover visual record
12
12
 
@@ -50,9 +50,45 @@ If resync runs but `context.tools` is still stale (e.g. only `read` listed), the
50
50
 
51
51
  ## Stock/transcript provider contract
52
52
 
53
- `test/cursor-provider-pi-context.test.ts` drives real `ModelRuntime` / `ModelRegistry` requests into `streamCursor`, with only Cursor SDK execution mocked. Run it against each supported host with all Pi peer imports pinned to that host (including nested native imports); a top-level package version alone is not resolution evidence. Cover official Pi 0.87.1, official latest, and current `fitchmultz/pi` main. The exact development Pi cohort is 0.99.1, with host TypeBox 1.3.27.
53
+ `test/cursor-provider-pi-context.test.ts` drives real `ModelRuntime` / `ModelRegistry` requests into `streamCursor`, with only Cursor SDK execution mocked. Run it against each supported host with all Pi peer imports pinned to that host (including nested native imports); a top-level package version alone is not resolution evidence. Cover official Pi 0.87.1, official latest, and current `fitchmultz/pi` main. The direct development Pi packages are locked 1.0.4 snapshots, not qualification targets; resolve latest stable official Pi and current `fitchmultz/pi` main once per workflow run. Their actual nested resolution is recorded with each check, including host TypeBox 1.3.27.
54
54
 
55
- The test covers bootstrap/incremental prompts, empty-vs-absent request tools, native replay/drain, cloud fresh/bootstrap selection, and actual host prompt serialization for context files and skills. `test/native-cursor-flow.test.mjs` additionally exercises the compiled extension through the real loader and registered Cursor provider, substituting only the external SDK transport/storage. It verifies actual bridge tool execution, replay without file access, persisted usage/lineage, tree, compaction, queued steering, abort and reload/disposal. Explicit `tools` is now an allowlist, not merely an initial active set; use `defaultTools` for a native fixture that allows replay wrappers to activate. It is offline contract evidence. Add live proof only for changed behavior that still needs real-service evidence under the cost policy above; do not rerun unchanged live lanes or infer full live coverage from offline tests.
55
+ The test covers bootstrap/incremental prompts, empty-vs-absent request tools, native replay/drain, cloud fresh/bootstrap selection, and actual host prompt serialization for context files and skills. `test/native-cursor-flow.test.mjs` additionally exercises the compiled extension through the real loader and registered Cursor provider, substituting only the external SDK transport/storage. It verifies actual bridge tool execution, pending-work idle/abort/shutdown/deadline ownership, replay without file access, persisted usage/lineage, tree, compaction, queued steering, abort and reload/disposal. `test/native-cursor-prompt.test.mjs` owns genuine native input, hidden notices, required-budget input, current attachments, custom-only continuation, equivalent conversion, payload/order-changing rejection, and GitHub comment soft guidance across bootstrap/incremental/custom-only sends. Both owners use `test/helpers/native-cursor-harness.mjs` and run in the explicit `check:compat` list and manual official-host compatibility route; the native-platform Vitest job is not execution evidence for these Node test owners. Explicit `tools` is now an allowlist, not merely an initial active set; use `defaultTools` for a native fixture that allows replay wrappers to activate. `test/native-provider.test.mjs` additionally verifies canonical `SessionManager.appendContextEdit()` plus `refreshContext()`, unchanged raw history, and conversation filtering that preserves system instructions, the current tool declaration, and explicit tool removal (the focused native slice from #271). It is offline contract evidence. Add live proof only for changed behavior that still needs real-service evidence under the cost policy above; do not rerun unchanged live lanes or infer full live coverage from offline tests.
56
+
57
+ ## Maintainer-only offline proof retention
58
+
59
+ Native SQLite fixtures should open the public `SqliteLocalAgentStore` from `@cursor/sdk/sqlite` with an explicit `stateRoot` under their temporary directory, pass it as `localStore` to `createAgentPlatform`, and await `dispose()` in `finally` before removing that directory. `scopedWorkspaceRef` filters agents; it does not relocate storage. Assert the owned `index.db` exists to guard isolation. A fresh missing-agent `checkpointStore.loadLatest()` returning `null` checks the lookup boundary, not per-agent checkpoint database I/O; see `test/cursor-sdk-lazy-import.test.ts`.
60
+
61
+ Two existing test flags retain raw proof in a **fresh private** directory outside the repository (or a gitignored scratch directory):
62
+
63
+ - `PI_CURSOR_TEST_EVIDENCE_DIR` retains native SessionManager JSONL with run/metadata/options sidecars, prompt payloads/roles/images, accepted catalog bytes, terminal/late usage facts and byte-preserving journals, and custom-agent resume proof.
64
+ - `PI_CURSOR_BOOTSTRAP_PROOF_DIR` retains installed SDK output-filter captures as `sdk-capture-{plain,ansi}.json`. Run `test/cursor-sdk-output-filter.test.ts` **before** `test/native-cursor-flow.test.mjs`: the latter consumes `sdk-capture-ansi.json` for its receipt/deferred-wait diagnostic checks. Do not invent capture payloads or reuse an old sealed run directory.
65
+
66
+ The lightweight `test/helpers/raw-test-evidence.mjs` owns only directory/file writes. Payload construction and explicit flag guards stay with each owning test; unset flags perform no evidence I/O. Existing filenames, JSON fields and raw JSONL/journal/Buffer bytes are retained, not converted into a uniform schema. Writes overwrite the same filename within an owned run.
67
+
68
+ For an installed development checkout, this example builds and runs only the offline owners, with Node 24+ and no inherited credentials/profile/host selectors:
69
+
70
+ ```bash
71
+ NODE24="$(command -v node)" # must resolve to Node 24+
72
+ PROOF="$(mktemp -d "${TMPDIR:-/tmp}/cursor-offline-proof.XXXXXX")"
73
+ chmod 700 "$PROOF"
74
+ mkdir -p "$PROOF/home" "$PROOF/agent" "$PROOF/tmp" "$PROOF/xdg"
75
+ offline() {
76
+ env -i PATH="$(dirname "$NODE24"):/usr/bin:/bin" \
77
+ HOME="$PROOF/home" USERPROFILE="$PROOF/home" XDG_CONFIG_HOME="$PROOF/xdg" \
78
+ PI_CODING_AGENT_DIR="$PROOF/agent" TMPDIR="$PROOF/tmp" \
79
+ PI_OFFLINE=1 PI_TELEMETRY=0 PI_SKIP_VERSION_CHECK=1 PI_CURSOR_SETTING_SOURCES=none \
80
+ PI_CURSOR_TEST_EVIDENCE_DIR="$PROOF/sessions" \
81
+ PI_CURSOR_BOOTSTRAP_PROOF_DIR="$PROOF/bootstrap" "$NODE24" "$@"
82
+ }
83
+ offline scripts/build.mjs
84
+ offline node_modules/vitest/vitest.mjs run test/cursor-sdk-output-filter.test.ts \
85
+ test/cursor-provider-stream-usage.test.ts test/cursor-provider-replay-live-run.test.ts \
86
+ test/cursor-session-agent-local-resume.test.ts
87
+ offline --test test/native-provider.test.mjs test/native-cursor-flow.test.mjs \
88
+ test/native-cursor-prompt.test.mjs
89
+ ```
90
+
91
+ These artifacts may include prompts, tool arguments/results, local paths and private session facts. Never print, commit or publish them; never supply real keys to this offline workflow. Inspect persisted joins and bytes privately, then retain or remove only your owned proof directory. Offline artifacts establish the tested local SDK/native contracts, **not** all-host/backend qualification or paid-service acceptance.
56
92
 
57
93
  ## Auth: use `auth.json`, not only env
58
94
 
@@ -184,7 +220,7 @@ For LOCAL summary isolation, inspect actual SDK create/send options and persiste
184
220
 
185
221
  `test/cursor-usage-ledger.test.ts` uses real public SessionManager custom entries and bounded filesystem journals. It protects restart, optional mirror failure, backward/equal snapshot clocks, revised/aggregate-only/large bills, linear compact-revision storage, unavailable-to-late observations, abandon without a billing fetch, late abort, owner/sibling switches, inherited cross-directory gaps, lost native claims, pricing tiers, torn-tail prefix export/native-fork recovery and malformed/symlink files. Export is a canonical view of facts and uncertainty, not an invented client-run billing join. A failed durable append must not advance recognized accounting.
186
222
 
187
- For supported official hosts without committing a repair, use `node scripts/ci-compatibility.mjs --working-tree --official-only --versions 0.87.1,0.99.1,1.0.2`. This hashes an isolated source snapshot, builds/packs it, tests package loading and runs real native session contracts. Keep matching host-peer resolution and exact source evidence; offline SDK transport substitution proves integration, not live service availability. See [context/accounting boundaries](./cursor-model-ux-spec.md#context-and-accounting-boundaries) for the operational ledger ceiling and public-API limits.
223
+ For supported official hosts without committing a repair, use `node scripts/ci-compatibility.mjs --working-tree --official-only --versions 0.87.1,0.99.1,1.0.3`. This hashes an isolated source snapshot, builds/packs it, tests package loading and runs real native session contracts. Keep matching host-peer resolution and exact source evidence; offline SDK transport substitution proves integration, not live service availability. See [context/accounting boundaries](./cursor-model-ux-spec.md#context-and-accounting-boundaries) for the operational ledger ceiling and public-API limits.
188
224
 
189
225
  ### False-positive edge case (2026-05-23)
190
226
 
@@ -220,7 +256,7 @@ Pass criteria:
220
256
 
221
257
  Run offline checks first, then reuse retained proof whose tested inputs are unchanged. If changed behavior still needs real-service proof, choose one existing meaningful check on a representative environment. Do not run every command below as a paid ladder; docs/metadata-only changes need zero paid runs.
222
258
 
223
- TypeScript 7 owns builds and type checks. `@typescript/typescript6` is dev-only for the AST architecture test because TypeScript 7 has no stable compiler API. Vitest 5 defaults `clearMocks` to `true`.
259
+ TypeScript 7 owns builds and type checks. `@typescript/typescript6` is dev-only for AST architecture and installed-SDK contract tests because TypeScript 7 has no stable compiler API. Vitest 5 defaults `clearMocks` to `true`.
224
260
 
225
261
  ```bash
226
262
  npm test
@@ -289,7 +325,7 @@ The script writes timestamped artifacts under `--out` (default `/tmp/pi-cursor-s
289
325
 
290
326
  Stdout prints artifact paths and summary counts only. Raw payloads stay on disk and may contain local paths, project text, tool args/results, or secrets — do not commit or share them.
291
327
 
292
- Hard repo rule: Cursor SDK behavior claims must come from the installed `@cursor/sdk` package and/or https://cursor.com/docs/sdk/typescript, not from memory or ad-hoc probes alone. Current validation targets Node 24+, exact `@cursor/sdk@1.0.32`, official Pi 0.87.1/latest, and current `fitchmultz/pi` main.
328
+ Hard repo rule: Cursor SDK behavior claims must come from the installed `@cursor/sdk` package and/or https://cursor.com/docs/sdk/typescript, not from memory or ad-hoc probes alone. Current validation targets Node 24+, exact `@cursor/sdk@1.0.36`, official Pi 0.87.1/latest, and current `fitchmultz/pi` main.
293
329
 
294
330
  ## Pi provider SDK event capture
295
331
 
@@ -482,3 +518,5 @@ rg '"type": "toolCall"|Tool call \(Cursor|cursor-replay-' "$SMOKE_DIR/session"/*
482
518
  - `scripts/lib/` — maintainer plumbing (CLI arg parsing, secret-aware `fail()`, child-process shutdown, shell timeout/auth helpers). Re-exports `shared/` helpers so published smoke/debug scripts stay aligned with provider runtime (`test/maintainer-scripts-lib.test.ts`).
483
519
  - `test/helpers/pi-harness.ts` — canonical fake pi/extension harness (`createPiHarness`, shared model/context/event helpers)
484
520
  - `test/helpers/cursor-provider-harness.ts` — Cursor SDK provider mocks and stream helpers (re-exports pi-harness fixtures; `createNativeToolDisplayPiForTest` for native replay)
521
+
522
+ Compatibility campaign watchdogs must bound setup and suite phases separately. A Linux run passed all unit assertions in 153.52 seconds but exhausted the old combined 180-second build/verify/native command budget as native tests started; killing only npm left children alive while cleanup removed their workspace. A later Ubuntu run exhausted even the independent 180-second verification budget while tests were still passing; it produced no terminal suite summary, so eventual completion and success are unknown. The command helper now defaults build/native and other commands to 180 seconds, and exactly `npm` with arguments `["run", "verify"]` to 360 seconds; explicit caller timeouts, including zero, take precedence. The campaign retains independent phases, stops owned POSIX descendants on a watchdog error, and allows twenty minutes for the complete two-host job. Keep every individual case deadline/assertion unchanged; downstream ENOENT after workspace removal is teardown evidence, not a product regression.
@@ -30,11 +30,11 @@ Default behavior:
30
30
  - The pi bridge exposes **active pi tools** as `pi__*` MCP names when `PI_CURSOR_PI_TOOL_BRIDGE` is enabled (default on).
31
31
  - Overlapping pi builtins (`read`, `bash`, `write`, `edit`, `grep`, `find`, `ls`) are **hidden** from the bridge unless `PI_CURSOR_EXPOSE_BUILTIN_TOOLS=1`.
32
32
 
33
- `pi-cursor-sdk` registers `cursor_ask_question` for Cursor models when the bridge is on and `PI_CURSOR_ASK_QUESTION` is enabled (the default); Cursor sees `pi__cursor_ask_question`. The tool is sequential and emits `pi-cursor-sdk:ask-question:blocked` `{ active }` while awaiting UI input. Set `PI_CURSOR_ASK_QUESTION=0` to remove only this tool while preserving the rest of the bridge. Pending bridged calls use a local deadline capped by the effective MCP tool timeout; `PI_CURSOR_PI_BRIDGE_CALL_TIMEOUT_MS` can lower it. When pi has visible Agent Skills loaded, the extension also rewrites pi's skill catalog for Cursor and activates `cursor_activate_skill`; Cursor sees `pi__cursor_activate_skill` and should call it with a listed skill name before applying that skill. The activation result returns the full `SKILL.md`, the skill directory for relative paths, and a bounded list of bundled `scripts/`, `references/`, and `assets/` files without eagerly reading those resources.
33
+ `pi-cursor-sdk` registers `cursor_ask_question` for Cursor models when the bridge is on and `PI_CURSOR_ASK_QUESTION=1`; Cursor sees `pi__cursor_ask_question`. The tool is sequential and emits `pi-cursor-sdk:ask-question:blocked` `{ active }` while awaiting UI input. It is off by default so Cursor proceeds with a stated assumption instead of prompting. Pending bridged calls use a local deadline capped by the effective MCP tool timeout; `PI_CURSOR_PI_BRIDGE_CALL_TIMEOUT_MS` can lower it. When pi has visible Agent Skills loaded, the extension also rewrites pi's skill catalog for Cursor and activates `cursor_activate_skill`; Cursor sees `pi__cursor_activate_skill` and should call it with a listed skill name before applying that skill. The activation result returns the full `SKILL.md`, the skill directory for relative paths, and a bounded list of bundled `scripts/`, `references/`, and `assets/` files without eagerly reading those resources.
34
34
 
35
35
  ```bash
36
- # Disable only Cursor's interactive question tool
37
- PI_CURSOR_ASK_QUESTION=0 pi --model cursor/grok-4.6
36
+ # Enable Cursor's interactive question tool
37
+ PI_CURSOR_ASK_QUESTION=1 pi --model cursor/grok-4.6
38
38
 
39
39
  # Disable pi bridge entirely
40
40
  PI_CURSOR_PI_TOOL_BRIDGE=0 pi --model cursor/grok-4.6
@@ -5,20 +5,20 @@ Initially, Hono wasn't designed for Node.js, but with this adapter, you can now
5
5
 
6
6
  ## Benchmarks
7
7
 
8
- Hono is 4.1 times faster than Express.
8
+ Hono is 3.1 times faster than Express.
9
9
 
10
- Express:
10
+ Express v5:
11
11
 
12
12
  ```txt
13
13
  $ bombardier -d 10s --fasthttp http://localhost:3000/
14
14
 
15
15
  Statistics Avg Stdev Max
16
- Reqs/sec 20803.37 1713.06 24910.85
17
- Latency 6.01ms 5.21ms 451.37ms
16
+ Reqs/sec 24380.41 1409.74 26604.88
17
+ Latency 5.12ms 2.95ms 305.21ms
18
18
  HTTP codes:
19
- 1xx - 0, 2xx - 208131, 3xx - 0, 4xx - 0, 5xx - 0
19
+ 1xx - 0, 2xx - 243915, 3xx - 0, 4xx - 0, 5xx - 0
20
20
  others - 0
21
- Throughput: 5.75MB/s
21
+ Throughput: 6.98MB/s
22
22
  ```
23
23
 
24
24
  Hono + `@hono/node-server`:
@@ -27,12 +27,12 @@ Hono + `@hono/node-server`:
27
27
  $ bombardier -d 10s --fasthttp http://localhost:3000/
28
28
 
29
29
  Statistics Avg Stdev Max
30
- Reqs/sec 85405.51 7250.65 102658.51
31
- Latency 1.46ms 1.00ms 149.95ms
30
+ Reqs/sec 74428.96 3815.27 88228.32
31
+ Latency 1.68ms 621.25us 106.20ms
32
32
  HTTP codes:
33
- 1xx - 0, 2xx - 854120, 3xx - 0, 4xx - 0, 5xx - 0
33
+ 1xx - 0, 2xx - 744378, 3xx - 0, 4xx - 0, 5xx - 0
34
34
  others - 0
35
- Throughput: 18.49MB/s
35
+ Throughput: 16.82MB/s
36
36
  ```
37
37
 
38
38
  ## Requirements
@@ -226,6 +226,17 @@ Notice that `root` here is not relative to `src/index.ts`, rather to `my-hono-pr
226
226
 
227
227
  ### Options
228
228
 
229
+ #### `allowPercentInPath`
230
+
231
+ By default, `serveStatic` skips request paths that still contain `%` after routing. This prevents a second decoding step from serving a file under a different path than the one checked by route middleware. Set `allowPercentInPath: true` to keep the previous behavior when serving files whose names contain percent signs.
232
+
233
+ If you restrict access to only some paths under `root` (for example, `/static/admin/*`), enabling this option may let requests bypass those restrictions. Apply access control to the same route pattern as `serveStatic` (for example, `/static/*`), before the static middleware:
234
+
235
+ ```ts
236
+ app.use('/static/*', authMiddleware)
237
+ app.use('/static/*', serveStatic({ root: './static', allowPercentInPath: true }))
238
+ ```
239
+
229
240
  #### `rewriteRequestPath`
230
241
 
231
242
  If you want to serve files in `./.foojs` with the request path `/__foo/*`, you can write like the following.
@@ -15,7 +15,7 @@ const earlyHints = (options) => {
15
15
  const dest = c.req.header("Sec-Fetch-Dest");
16
16
  if (mode && mode !== "navigate" || dest && dest !== "document") return next();
17
17
  const env = c.env || {};
18
- const outgoing = (env.server ? env.server : env)?.outgoing;
18
+ const outgoing = ("server" in env ? env.server : env)?.outgoing;
19
19
  if (typeof outgoing?.writeEarlyHints !== "function") {
20
20
  if (!warned) {
21
21
  console.warn("Early Hints Middleware is not supported because writeEarlyHints is not defined.");