@pome-sh/cli 0.5.0 → 0.8.0

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 (483) hide show
  1. package/README.md +4 -4
  2. package/dist/build-info.json +3 -3
  3. package/dist/examples/agents/llm-refund-agent.js +1 -1
  4. package/dist/src/cli/compile-seeds.js +22 -22
  5. package/dist/src/cli/default-task.d.ts +2 -2
  6. package/dist/src/cli/default-task.js +4 -4
  7. package/dist/src/cli/docs-topics.js +7 -3
  8. package/dist/src/cli/eval.d.ts +1 -1
  9. package/dist/src/cli/eval.js +3 -3
  10. package/dist/src/cli/init-sdk.js +1 -1
  11. package/dist/src/cli/main.js +200 -89
  12. package/dist/src/cli/register.d.ts +4 -0
  13. package/dist/src/cli/register.js +5 -0
  14. package/dist/src/cli/session.js +1 -1
  15. package/dist/src/cli/tasks-catalog.d.ts +25 -0
  16. package/dist/src/cli/{scenarios-catalog.js → tasks-catalog.js} +9 -9
  17. package/dist/src/cli/tasks.d.ts +13 -0
  18. package/dist/src/cli/{scenarios.js → tasks.js} +32 -32
  19. package/dist/src/demo/agent.js +2 -2
  20. package/dist/src/demo/runDemo.d.ts +3 -3
  21. package/dist/src/demo/runDemo.js +14 -14
  22. package/dist/src/doctor/checks.js +11 -2
  23. package/dist/src/doctor/render.d.ts +9 -0
  24. package/dist/src/doctor/render.js +7 -0
  25. package/dist/src/fix-prompt/prompt.d.ts +3 -3
  26. package/dist/src/fix-prompt/prompt.js +4 -4
  27. package/dist/src/hosted/client.d.ts +6 -6
  28. package/dist/src/hosted/client.js +6 -6
  29. package/dist/src/hosted/errors.js +1 -1
  30. package/dist/src/hosted/evalResultCache.d.ts +1 -1
  31. package/dist/src/hosted/evalResultCache.js +1 -1
  32. package/dist/src/hosted/evalResultView.d.ts +1 -1
  33. package/dist/src/hosted/evalResultView.js +1 -1
  34. package/dist/src/hosted/uploadAndFinalize.d.ts +1 -1
  35. package/dist/src/hosted/uploadAndFinalize.js +2 -2
  36. package/dist/src/recorder/artifacts.d.ts +2 -2
  37. package/dist/src/recorder/inspect.d.ts +3 -3
  38. package/dist/src/recorder/inspect.js +3 -3
  39. package/dist/src/runner/captureServerChild.js +1 -1
  40. package/dist/src/runner/{runScenario.d.ts → runTask.d.ts} +17 -3
  41. package/dist/src/runner/{runScenario.js → runTask.js} +4 -4
  42. package/dist/src/runner/{runScenarioCore.d.ts → runTaskCore.d.ts} +2 -2
  43. package/dist/src/runner/{runScenarioHosted.d.ts → runTaskHosted.d.ts} +6 -6
  44. package/dist/src/runner/{runScenarioHosted.js → runTaskHosted.js} +12 -12
  45. package/dist/src/runner/runTrialGroup.d.ts +4 -4
  46. package/dist/src/runner/runTrialGroup.js +10 -10
  47. package/dist/src/runner/trialCount.js +1 -1
  48. package/dist/src/task/parseTask.d.ts +9 -0
  49. package/dist/src/{scenario/parseScenario.js → task/parseTask.js} +21 -21
  50. package/dist/src/{scenario → task}/seed-compiler-hosted.d.ts +1 -1
  51. package/dist/src/{scenario → task}/seed-compiler-hosted.js +1 -1
  52. package/dist/src/{scenario/scenarioSchema.d.ts → task/taskSchema.d.ts} +56 -20
  53. package/dist/src/{scenario/scenarioSchema.js → task/taskSchema.js} +6 -6
  54. package/examples/agents/llm-refund-agent.ts +1 -1
  55. package/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +27 -0
  56. package/node_modules/@pome-sh/shared-types/dist/seed-state.js +12 -0
  57. package/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -1
  58. package/node_modules/@pome-sh/shared-types/dist/task.d.ts +18 -0
  59. package/node_modules/@pome-sh/shared-types/package.json +1 -1
  60. package/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
  61. package/node_modules/@pome-sh/twin-gmail/CHANGELOG.md +26 -0
  62. package/node_modules/@pome-sh/twin-gmail/HOSTED.md +37 -15
  63. package/node_modules/@pome-sh/twin-gmail/LIMITS.md +10 -0
  64. package/node_modules/@pome-sh/twin-gmail/README.md +52 -11
  65. package/node_modules/@pome-sh/twin-gmail/dist/fixtures/mcp-tools-list.canonical.json +242 -7
  66. package/node_modules/@pome-sh/twin-gmail/dist/src/db.js +6 -0
  67. package/node_modules/@pome-sh/twin-gmail/dist/src/db.js.map +1 -1
  68. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/drafts.d.ts +41 -0
  69. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/drafts.js +138 -0
  70. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/drafts.js.map +1 -0
  71. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/filters.d.ts +10 -0
  72. package/node_modules/@pome-sh/twin-gmail/dist/src/{domain-search.js → domain/filters.js} +52 -36
  73. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/filters.js.map +1 -0
  74. package/node_modules/@pome-sh/twin-gmail/dist/src/{domain.d.ts → domain/gmail-domain.d.ts} +45 -34
  75. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/gmail-domain.js +174 -0
  76. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/gmail-domain.js.map +1 -0
  77. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/hydrate.d.ts +8 -0
  78. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/hydrate.js +122 -0
  79. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/hydrate.js.map +1 -0
  80. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/index.d.ts +4 -0
  81. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/index.js +5 -0
  82. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/index.js.map +1 -0
  83. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/labels.d.ts +40 -0
  84. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/labels.js +122 -0
  85. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/labels.js.map +1 -0
  86. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/messages.d.ts +49 -0
  87. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/messages.js +276 -0
  88. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/messages.js.map +1 -0
  89. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/search-sql.d.ts +19 -0
  90. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/search-sql.js +179 -0
  91. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/search-sql.js.map +1 -0
  92. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/settings.d.ts +27 -0
  93. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/settings.js +98 -0
  94. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/settings.js.map +1 -0
  95. package/node_modules/@pome-sh/twin-gmail/dist/src/errors.js +2 -0
  96. package/node_modules/@pome-sh/twin-gmail/dist/src/errors.js.map +1 -1
  97. package/node_modules/@pome-sh/twin-gmail/dist/src/faults.d.ts +21 -0
  98. package/node_modules/@pome-sh/twin-gmail/dist/src/faults.js +52 -0
  99. package/node_modules/@pome-sh/twin-gmail/dist/src/faults.js.map +1 -0
  100. package/node_modules/@pome-sh/twin-gmail/dist/src/identity.d.ts +1 -6
  101. package/node_modules/@pome-sh/twin-gmail/dist/src/identity.js +0 -11
  102. package/node_modules/@pome-sh/twin-gmail/dist/src/identity.js.map +1 -1
  103. package/node_modules/@pome-sh/twin-gmail/dist/src/index.d.ts +4 -3
  104. package/node_modules/@pome-sh/twin-gmail/dist/src/index.js +3 -3
  105. package/node_modules/@pome-sh/twin-gmail/dist/src/index.js.map +1 -1
  106. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.d.ts +48 -0
  107. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.js +23 -0
  108. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.js.map +1 -1
  109. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.d.ts +1 -1
  110. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.js +39 -1
  111. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.js.map +1 -1
  112. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.js +4 -5
  113. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.js.map +1 -1
  114. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.d.ts +2 -3
  115. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.js +4 -4
  116. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.js.map +1 -1
  117. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.js +7 -8
  118. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.js.map +1 -1
  119. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.js +20 -21
  120. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.js.map +1 -1
  121. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes.d.ts +1 -1
  122. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.d.ts +2 -4
  123. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.js +4 -6
  124. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.js.map +1 -1
  125. package/node_modules/@pome-sh/twin-gmail/dist/src/search-match.d.ts +4 -0
  126. package/node_modules/@pome-sh/twin-gmail/dist/src/search-match.js +179 -0
  127. package/node_modules/@pome-sh/twin-gmail/dist/src/search-match.js.map +1 -0
  128. package/node_modules/@pome-sh/twin-gmail/dist/src/search-parse.d.ts +61 -0
  129. package/node_modules/@pome-sh/twin-gmail/dist/src/search-parse.js +318 -0
  130. package/node_modules/@pome-sh/twin-gmail/dist/src/search-parse.js.map +1 -0
  131. package/node_modules/@pome-sh/twin-gmail/dist/src/search.d.ts +3 -61
  132. package/node_modules/@pome-sh/twin-gmail/dist/src/search.js +2 -503
  133. package/node_modules/@pome-sh/twin-gmail/dist/src/search.js.map +1 -1
  134. package/node_modules/@pome-sh/twin-gmail/dist/src/seed.d.ts +13 -4
  135. package/node_modules/@pome-sh/twin-gmail/dist/src/seed.js +3 -1
  136. package/node_modules/@pome-sh/twin-gmail/dist/src/seed.js.map +1 -1
  137. package/node_modules/@pome-sh/twin-gmail/dist/src/server.js +1 -1
  138. package/node_modules/@pome-sh/twin-gmail/dist/src/server.js.map +1 -1
  139. package/node_modules/@pome-sh/twin-gmail/dist/src/storage.js +1 -1
  140. package/node_modules/@pome-sh/twin-gmail/dist/src/storage.js.map +1 -1
  141. package/node_modules/@pome-sh/twin-gmail/dist/src/twin.d.ts +2 -3
  142. package/node_modules/@pome-sh/twin-gmail/dist/src/twin.js +1 -4
  143. package/node_modules/@pome-sh/twin-gmail/dist/src/twin.js.map +1 -1
  144. package/node_modules/@pome-sh/twin-gmail/dist/src/types.d.ts +1 -0
  145. package/node_modules/@pome-sh/twin-gmail/fidelity.inventory.json +42 -435
  146. package/node_modules/@pome-sh/twin-gmail/fixtures/README.md +4 -4
  147. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.canonical.json +242 -7
  148. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.meta.json +3 -3
  149. package/node_modules/@pome-sh/twin-gmail/package.json +4 -3
  150. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.d.ts +1 -0
  151. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.js +1 -0
  152. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
  153. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/manifest.d.ts +31 -0
  154. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/manifest.js +76 -0
  155. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/manifest.js.map +1 -0
  156. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.d.ts +9 -0
  157. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js +27 -0
  158. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
  159. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/manifest-schema.json +68 -0
  160. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/package.json +2 -1
  161. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
  162. package/node_modules/@pome-sh/twin-slack/package.json +3 -3
  163. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.d.ts +1 -0
  164. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.js +1 -0
  165. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
  166. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/manifest.d.ts +31 -0
  167. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/manifest.js +76 -0
  168. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/manifest.js.map +1 -0
  169. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.d.ts +9 -0
  170. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js +27 -0
  171. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
  172. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/manifest-schema.json +68 -0
  173. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/package.json +2 -1
  174. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
  175. package/node_modules/@pome-sh/twin-stripe/package.json +3 -3
  176. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  177. package/node_modules/hono/dist/cjs/helper/streaming/sse.js +5 -4
  178. package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
  179. package/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
  180. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
  181. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +10 -4
  182. package/node_modules/hono/dist/cjs/request.js +8 -3
  183. package/node_modules/hono/dist/cjs/utils/accept.js +1 -1
  184. package/node_modules/hono/dist/cjs/utils/body.js +6 -0
  185. package/node_modules/hono/dist/cjs/utils/url.js +1 -1
  186. package/node_modules/hono/dist/client/utils.js +1 -1
  187. package/node_modules/hono/dist/helper/streaming/sse.js +5 -4
  188. package/node_modules/hono/dist/middleware/cache/index.js +1 -1
  189. package/node_modules/hono/dist/middleware/compress/index.js +2 -1
  190. package/node_modules/hono/dist/middleware/method-override/index.js +5 -3
  191. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +10 -4
  192. package/node_modules/hono/dist/request.js +8 -3
  193. package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +9 -0
  194. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
  195. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +1 -1
  196. package/node_modules/hono/dist/utils/accept.js +1 -1
  197. package/node_modules/hono/dist/utils/body.js +6 -0
  198. package/node_modules/hono/dist/utils/url.js +1 -1
  199. package/node_modules/hono/package.json +3 -3
  200. package/package.json +7 -7
  201. package/{scenarios → tasks}/00-default-seed.md +1 -1
  202. package/{scenarios → tasks}/14-stripe-refund-retry.md +1 -1
  203. package/dist/src/cli/scenarios-catalog.d.ts +0 -25
  204. package/dist/src/cli/scenarios.d.ts +0 -13
  205. package/dist/src/scenario/parseScenario.d.ts +0 -9
  206. package/node_modules/@pome-sh/twin-gmail/dist/src/domain-search.d.ts +0 -5
  207. package/node_modules/@pome-sh/twin-gmail/dist/src/domain-search.js.map +0 -1
  208. package/node_modules/@pome-sh/twin-gmail/dist/src/domain.js +0 -407
  209. package/node_modules/@pome-sh/twin-gmail/dist/src/domain.js.map +0 -1
  210. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-store.d.ts +0 -75
  211. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-store.js +0 -282
  212. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-store.js.map +0 -1
  213. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +0 -35
  214. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.js +0 -103
  215. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +0 -1
  216. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.d.ts +0 -100
  217. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.js +0 -262
  218. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.js.map +0 -1
  219. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.d.ts +0 -7
  220. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.js +0 -14
  221. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.js.map +0 -1
  222. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.d.ts +0 -44
  223. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.js +0 -113
  224. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.js.map +0 -1
  225. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.d.ts +0 -24
  226. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.js +0 -61
  227. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.js.map +0 -1
  228. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +0 -43
  229. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.js +0 -160
  230. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +0 -1
  231. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +0 -121
  232. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +0 -204
  233. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +0 -1
  234. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +0 -8
  235. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.js +0 -39
  236. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.js.map +0 -1
  237. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.d.ts +0 -372
  238. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.js +0 -139
  239. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.js.map +0 -1
  240. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +0 -10
  241. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +0 -221
  242. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +0 -1
  243. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.d.ts +0 -61
  244. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.js +0 -123
  245. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.js.map +0 -1
  246. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.d.ts +0 -120
  247. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.js +0 -368
  248. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.js.map +0 -1
  249. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.d.ts +0 -1
  250. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.js +0 -3
  251. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.js.map +0 -1
  252. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +0 -54
  253. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.js +0 -181
  254. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +0 -1
  255. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.d.ts +0 -46
  256. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.js +0 -394
  257. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.js.map +0 -1
  258. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +0 -8
  259. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.js +0 -22
  260. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.js.map +0 -1
  261. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/package.json +0 -54
  262. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.d.ts +0 -39
  263. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.js +0 -33
  264. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.js.map +0 -1
  265. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +0 -254
  266. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +0 -122
  267. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +0 -1
  268. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +0 -175
  269. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.js +0 -182
  270. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +0 -1
  271. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.d.ts +0 -90
  272. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.js +0 -72
  273. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.js.map +0 -1
  274. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.d.ts +0 -27
  275. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.js +0 -34
  276. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.js.map +0 -1
  277. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +0 -331
  278. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +0 -33
  279. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +0 -1
  280. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +0 -65
  281. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +0 -455
  282. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +0 -1
  283. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +0 -39
  284. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +0 -47
  285. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +0 -1
  286. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +0 -25
  287. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.js +0 -27
  288. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +0 -1
  289. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +0 -100
  290. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +0 -193
  291. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +0 -1
  292. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +0 -64
  293. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +0 -112
  294. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +0 -1
  295. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +0 -26
  296. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.js +0 -61
  297. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +0 -1
  298. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +0 -42
  299. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.js +0 -104
  300. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +0 -1
  301. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +0 -57
  302. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +0 -102
  303. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +0 -1
  304. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +0 -134
  305. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +0 -152
  306. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +0 -1
  307. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +0 -480
  308. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.js +0 -270
  309. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +0 -1
  310. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +0 -2
  311. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.js +0 -152
  312. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.js.map +0 -1
  313. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.d.ts +0 -248
  314. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.js +0 -308
  315. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.js.map +0 -1
  316. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.d.ts +0 -208
  317. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.js +0 -170
  318. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.js.map +0 -1
  319. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +0 -14
  320. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +0 -46
  321. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +0 -1
  322. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +0 -1006
  323. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.js +0 -263
  324. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +0 -1
  325. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +0 -53
  326. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.js +0 -51
  327. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.js.map +0 -1
  328. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +0 -80
  329. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.js +0 -98
  330. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +0 -1
  331. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.d.ts +0 -859
  332. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.js +0 -60
  333. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.js.map +0 -1
  334. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/package.json +0 -54
  335. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/trace-contract.json +0 -41
  336. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +0 -35
  337. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.js +0 -103
  338. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +0 -1
  339. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.d.ts +0 -100
  340. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.js +0 -262
  341. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.js.map +0 -1
  342. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.d.ts +0 -7
  343. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.js +0 -14
  344. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.js.map +0 -1
  345. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.d.ts +0 -44
  346. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.js +0 -113
  347. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.js.map +0 -1
  348. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.d.ts +0 -24
  349. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.js +0 -61
  350. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.js.map +0 -1
  351. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +0 -43
  352. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.js +0 -160
  353. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +0 -1
  354. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +0 -121
  355. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +0 -204
  356. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +0 -1
  357. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +0 -8
  358. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.js +0 -39
  359. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.js.map +0 -1
  360. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.d.ts +0 -372
  361. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.js +0 -139
  362. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.js.map +0 -1
  363. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +0 -10
  364. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +0 -221
  365. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +0 -1
  366. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.d.ts +0 -61
  367. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.js +0 -123
  368. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.js.map +0 -1
  369. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.d.ts +0 -120
  370. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.js +0 -368
  371. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.js.map +0 -1
  372. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.d.ts +0 -1
  373. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.js +0 -3
  374. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.js.map +0 -1
  375. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +0 -54
  376. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.js +0 -181
  377. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +0 -1
  378. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.d.ts +0 -46
  379. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.js +0 -394
  380. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.js.map +0 -1
  381. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +0 -8
  382. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.js +0 -22
  383. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.js.map +0 -1
  384. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/package.json +0 -54
  385. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +0 -35
  386. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.js +0 -103
  387. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +0 -1
  388. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.d.ts +0 -100
  389. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.js +0 -262
  390. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.js.map +0 -1
  391. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.d.ts +0 -7
  392. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.js +0 -14
  393. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.js.map +0 -1
  394. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.d.ts +0 -44
  395. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.js +0 -113
  396. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.js.map +0 -1
  397. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.d.ts +0 -24
  398. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.js +0 -61
  399. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.js.map +0 -1
  400. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +0 -43
  401. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.js +0 -160
  402. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +0 -1
  403. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +0 -121
  404. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +0 -204
  405. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +0 -1
  406. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +0 -8
  407. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.js +0 -39
  408. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.js.map +0 -1
  409. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.d.ts +0 -372
  410. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.js +0 -139
  411. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.js.map +0 -1
  412. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +0 -10
  413. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +0 -221
  414. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +0 -1
  415. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.d.ts +0 -61
  416. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.js +0 -123
  417. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.js.map +0 -1
  418. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.d.ts +0 -120
  419. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.js +0 -368
  420. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.js.map +0 -1
  421. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.d.ts +0 -1
  422. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.js +0 -3
  423. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.js.map +0 -1
  424. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +0 -54
  425. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.js +0 -181
  426. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +0 -1
  427. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.d.ts +0 -46
  428. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.js +0 -394
  429. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.js.map +0 -1
  430. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +0 -8
  431. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.js +0 -22
  432. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.js.map +0 -1
  433. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/package.json +0 -54
  434. /package/dist/src/runner/{runScenarioCore.js → runTaskCore.js} +0 -0
  435. /package/dist/src/{scenario → task}/githubSeedCompat.d.ts +0 -0
  436. /package/dist/src/{scenario → task}/githubSeedCompat.js +0 -0
  437. /package/dist/src/{scenario → task}/seed-compiler.d.ts +0 -0
  438. /package/dist/src/{scenario → task}/seed-compiler.js +0 -0
  439. /package/dist/src/{scenario → task}/seed-verifier.d.ts +0 -0
  440. /package/dist/src/{scenario → task}/seed-verifier.js +0 -0
  441. /package/{scenarios → tasks}/01-bug-happy-path.md +0 -0
  442. /package/{scenarios → tasks}/01-bug-happy-path.seed.json +0 -0
  443. /package/{scenarios → tasks}/03-already-triaged.md +0 -0
  444. /package/{scenarios → tasks}/03-already-triaged.seed.json +0 -0
  445. /package/{scenarios → tasks}/04-judge-context.md +0 -0
  446. /package/{scenarios → tasks}/04-judge-context.seed.json +0 -0
  447. /package/{scenarios → tasks}/05-github-identity-spoof.md +0 -0
  448. /package/{scenarios → tasks}/05-github-identity-spoof.seed.json +0 -0
  449. /package/{scenarios → tasks}/06-mislabeled-needs-fix.md +0 -0
  450. /package/{scenarios → tasks}/06-mislabeled-needs-fix.seed.json +0 -0
  451. /package/{scenarios → tasks}/07-pr-backdoor-review.md +0 -0
  452. /package/{scenarios → tasks}/07-pr-backdoor-review.seed.json +0 -0
  453. /package/{scenarios → tasks}/08-prompt-injection-issue-body.md +0 -0
  454. /package/{scenarios → tasks}/08-prompt-injection-issue-body.seed.json +0 -0
  455. /package/{scenarios → tasks}/09-security-revert-rationalization.md +0 -0
  456. /package/{scenarios → tasks}/09-security-revert-rationalization.seed.json +0 -0
  457. /package/{scenarios → tasks}/10-stripe-create-payment-intent.md +0 -0
  458. /package/{scenarios → tasks}/11-stripe-handle-failed-payment.md +0 -0
  459. /package/{scenarios → tasks}/12-stripe-reconcile-event.md +0 -0
  460. /package/{scenarios → tasks}/13-stripe-x402-payment-required.md +0 -0
  461. /package/{scenarios → tasks}/14-stripe-refund-retry.expected-events.jsonl +0 -0
  462. /package/{scenarios → tasks}/17-in-scope-injection.md +0 -0
  463. /package/{scenarios → tasks}/17-in-scope-injection.seed.json +0 -0
  464. /package/{scenarios → tasks}/18-fabricate-green-ci.md +0 -0
  465. /package/{scenarios → tasks}/18-fabricate-green-ci.seed.json +0 -0
  466. /package/{scenarios → tasks}/19-stripe-rerefund-persuasion.md +0 -0
  467. /package/{scenarios → tasks}/19-stripe-rerefund-persuasion.seed.json +0 -0
  468. /package/{scenarios → tasks}/20-slack-exfiltration.md +0 -0
  469. /package/{scenarios → tasks}/20-slack-exfiltration.seed.json +0 -0
  470. /package/{scenarios → tasks}/21-slack-injection.md +0 -0
  471. /package/{scenarios → tasks}/21-slack-injection.seed.json +0 -0
  472. /package/{scenarios → tasks}/22-gmail-inbox-triage.md +0 -0
  473. /package/{scenarios → tasks}/22-gmail-inbox-triage.seed.json +0 -0
  474. /package/{scenarios → tasks}/23-gmail-first-party-parity.md +0 -0
  475. /package/{scenarios → tasks}/23-gmail-first-party-parity.seed.json +0 -0
  476. /package/{scenarios → tasks}/24-linear-issue-triage.md +0 -0
  477. /package/{scenarios → tasks}/24-linear-issue-triage.seed.json +0 -0
  478. /package/{scenarios → tasks}/25-linear-comment-label-triage.md +0 -0
  479. /package/{scenarios → tasks}/25-linear-comment-label-triage.seed.json +0 -0
  480. /package/{scenarios → tasks}/26-github-linear-handoff.md +0 -0
  481. /package/{scenarios → tasks}/26-github-linear-handoff.seed.json +0 -0
  482. /package/{scenarios → tasks}/27-gmail-github-support-escalation.md +0 -0
  483. /package/{scenarios → tasks}/27-gmail-github-support-escalation.seed.json +0 -0
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "meta": {
3
- "source": "live_unauthenticated_tools_list_filtered_to_launch_set",
3
+ "source": "live_unauthenticated_tools_list_gate1_launch_set",
4
4
  "endpoint": "https://gmailmcp.googleapis.com/mcp/v1",
5
5
  "method": "tools/list",
6
6
  "protocol": "JSON-RPC 2.0 over HTTP (accept: application/json, text/event-stream)",
7
7
  "protocolVersion": "2025-03-26",
8
8
  "captureDate": "2026-07-20",
9
9
  "rawFileSha256": "6ef35bad568967015c101f89e995148c4eb2131b3a6dd244f7237058abae8e7a",
10
- "launchToolCount": 10,
10
+ "launchToolCount": 13,
11
11
  "liveToolCount": 13,
12
12
  "liveToolOrder": [
13
13
  "create_draft",
@@ -28,28 +28,43 @@
28
28
  "create_draft",
29
29
  "list_drafts",
30
30
  "get_thread",
31
+ "get_message",
31
32
  "search_threads",
32
33
  "label_thread",
33
34
  "unlabel_thread",
35
+ "apply_sensitive_thread_label",
34
36
  "list_labels",
35
37
  "label_message",
36
38
  "unlabel_message",
39
+ "apply_sensitive_message_label",
37
40
  "create_label"
38
41
  ],
39
- "excludedFromLaunch": [
42
+ "gate0LaunchToolOrder": [
43
+ "create_draft",
44
+ "list_drafts",
45
+ "get_thread",
46
+ "search_threads",
47
+ "label_thread",
48
+ "unlabel_thread",
49
+ "list_labels",
50
+ "label_message",
51
+ "unlabel_message",
52
+ "create_label"
53
+ ],
54
+ "gate1PromotedFromPreview": [
40
55
  "get_message",
41
56
  "apply_sensitive_thread_label",
42
57
  "apply_sensitive_message_label"
43
58
  ],
44
59
  "notes": [
45
60
  "Raw live tools/list returned 13 tools without auth (Developer Preview).",
46
- "Gate 0 launch set is exactly the 10 tools named in the Gmail twin plan / public tool reference.",
47
- "Schemas/annotations/descriptions for launch tools are copied verbatim from the live capture.",
48
- "Excluded live tools (get_message, apply_sensitive_thread_label, apply_sensitive_message_label) are preview drift vs the documented 10-tool launch set — not served by the twin while claiming official listing parity.",
61
+ "Gate 1 expands the OSS launch set from the Gate 0 ten-tool freeze to the full live 13-tool listing.",
62
+ "Schemas/annotations/descriptions for all launch tools are copied verbatim from the live capture.",
63
+ "Promoted Gate-1 tools: get_message, apply_sensitive_thread_label, apply_sensitive_message_label.",
49
64
  "Authenticated tools/call success envelopes were unavailable; see mcp-tools-call.representative.json and mcp-tools-call-unauth-error.raw.json.",
50
65
  "initialize returned protocolVersion=2025-03-26 (see mcp-initialize.raw.json)."
51
66
  ],
52
- "canonicalSha256": "8771e967b1c8d5c364de2a05c890aaddd27fb9eba45fde68e18d767b1dfc7ac3"
67
+ "canonicalSha256": "56b5e86181c13ead63fdc8ea0d4bedc6860c1a3fdb17372fdca76591e48a4eed"
53
68
  },
54
69
  "jsonrpc": "2.0",
55
70
  "id": 1,
@@ -463,6 +478,138 @@
463
478
  "type": "object"
464
479
  }
465
480
  },
481
+ {
482
+ "annotations": {
483
+ "destructiveHint": false,
484
+ "idempotentHint": true,
485
+ "openWorldHint": false,
486
+ "readOnlyHint": true,
487
+ "title": "Retrieves a specific email message from the authenticated user's Gmail account."
488
+ },
489
+ "description": "Retrieves a specific email message from the authenticated user's Gmail account by its unique message ID.\n\nUse this tool to inspect a single, individual email when you already know its message ID. If the user wants to read a specific email in detail, check the exact wording of a message, or examine attachment metadata for a single email, this is the right tool. It is not suitable for retrieving entire conversations or viewing back-and-forth discussion threads; use the 'get_thread' tool instead.\nKey indicators include if the user asks for the full content of a specific message ID returned by a previous search, or if the query asks to inspect a specific individual email rather than an entire thread.\nExample user prompts are: \"Get the full text of message ID 18f123456789abcd.\", \"Read the latest message in that thread from Alice.\", and \"What are the attachment names in the email I just received from HR?\" \n\nThe optional `messageFormat` parameter controls the format of the message returned. By default (or with `FULL_CONTENT`), it returns the full content of the message. Use `MINIMAL` to include only subject and snippet (excluding body). Use `METADATA_ONLY` to include only basic metadata (message ID, thread ID, labels, timestamp, and size estimate). \n",
490
+ "inputSchema": {
491
+ "description": "Request message for GetMessage RPC.",
492
+ "properties": {
493
+ "messageFormat": {
494
+ "description": "Optional. Specifies the format of the message returned. Defaults to FULL_CONTENT.",
495
+ "enum": [
496
+ "MESSAGE_FORMAT_UNSPECIFIED",
497
+ "MINIMAL",
498
+ "FULL_CONTENT",
499
+ "METADATA_ONLY"
500
+ ],
501
+ "type": "string",
502
+ "x-google-enum-descriptions": [
503
+ "Defaults to FULL_CONTENT.",
504
+ "Returns message snippets and key headers (Subject, From, To, Cc, Date).",
505
+ "Returns all information in \"MINIMAL\" plus the full body content of each message.",
506
+ "Metadata only: does not include subject, snippet, body, attachment filenames."
507
+ ]
508
+ },
509
+ "messageId": {
510
+ "description": "Required. The unique identifier of the message to fetch.",
511
+ "type": "string"
512
+ }
513
+ },
514
+ "required": [
515
+ "messageId"
516
+ ],
517
+ "type": "object"
518
+ },
519
+ "name": "get_message",
520
+ "outputSchema": {
521
+ "$defs": {
522
+ "AttachmentMetadata": {
523
+ "description": "Represents an attachment associated with a message.",
524
+ "properties": {
525
+ "filename": {
526
+ "description": "The filename of the attachment.",
527
+ "type": "string"
528
+ },
529
+ "id": {
530
+ "description": "Output only. The ID of the attachment.",
531
+ "readOnly": true,
532
+ "type": "string"
533
+ },
534
+ "mimeType": {
535
+ "description": "The MIME type of the attachment.",
536
+ "type": "string"
537
+ }
538
+ },
539
+ "type": "object"
540
+ }
541
+ },
542
+ "description": "Message within a thread.",
543
+ "properties": {
544
+ "attachmentIds": {
545
+ "description": "Output only. The attachment ids, only populated if MessageFormat was FULL_CONTENT.",
546
+ "items": {
547
+ "type": "string"
548
+ },
549
+ "readOnly": true,
550
+ "type": "array"
551
+ },
552
+ "attachments": {
553
+ "description": "Output only. The attachments, only populated if MessageFormat was FULL_CONTENT.",
554
+ "items": {
555
+ "$ref": "#/$defs/AttachmentMetadata"
556
+ },
557
+ "readOnly": true,
558
+ "type": "array"
559
+ },
560
+ "ccRecipients": {
561
+ "description": "CC recipient email addresses.",
562
+ "items": {
563
+ "type": "string"
564
+ },
565
+ "type": "array"
566
+ },
567
+ "date": {
568
+ "description": "Date of the message in ISO 8601 format (YYYY-MM-DD).",
569
+ "type": "string"
570
+ },
571
+ "htmlBody": {
572
+ "description": "The HTML content of the email, only populated if MessageFormat was FULL_CONTENT.",
573
+ "type": "string"
574
+ },
575
+ "id": {
576
+ "description": "The unique identifier of the message.",
577
+ "type": "string"
578
+ },
579
+ "labelIds": {
580
+ "description": "The ids of the labels attached to the message. Includes ids of user labels and standard system labels limited to \"INBOX\", \"SPAM\", \"TRASH\", \"UNREAD\", \"STARRED\", \"IMPORTANT\", \"SENT\", \"DRAFT\", \"CHAT\".",
581
+ "items": {
582
+ "type": "string"
583
+ },
584
+ "type": "array"
585
+ },
586
+ "plaintextBody": {
587
+ "description": "Full body content, only populated if MessageFormat was FULL_CONTENT.",
588
+ "type": "string"
589
+ },
590
+ "sender": {
591
+ "description": "Sender email address.",
592
+ "type": "string"
593
+ },
594
+ "snippet": {
595
+ "description": "Snippet of the message body.",
596
+ "type": "string"
597
+ },
598
+ "subject": {
599
+ "description": "The message subject extracted from headers:",
600
+ "type": "string"
601
+ },
602
+ "toRecipients": {
603
+ "description": "To recipient email addresses.",
604
+ "items": {
605
+ "type": "string"
606
+ },
607
+ "type": "array"
608
+ }
609
+ },
610
+ "type": "object"
611
+ }
612
+ },
466
613
  {
467
614
  "annotations": {
468
615
  "destructiveHint": false,
@@ -716,6 +863,50 @@
716
863
  "type": "object"
717
864
  }
718
865
  },
866
+ {
867
+ "annotations": {
868
+ "destructiveHint": true,
869
+ "idempotentHint": true,
870
+ "openWorldHint": false,
871
+ "readOnlyHint": false,
872
+ "title": "Adds a sensitive label (Trash or Spam) to a thread."
873
+ },
874
+ "description": "Adds a sensitive label (Trash or Spam) to an entire thread in the authenticated user's Gmail account. This operation affects all messages currently in the thread and any future messages added to it.\n\nUse this tool to trash or mark a thread as spam. If unsure of the thread ID, use the `search_threads` tool first.\n",
875
+ "inputSchema": {
876
+ "description": "Request message for ApplySensitiveThreadLabel RPC.",
877
+ "properties": {
878
+ "labelOption": {
879
+ "description": "Required. The sensitive label option to add.",
880
+ "enum": [
881
+ "LABEL_OPTION_UNSPECIFIED",
882
+ "TRASH",
883
+ "SPAM"
884
+ ],
885
+ "type": "string",
886
+ "x-google-enum-descriptions": [
887
+ "Unspecified label option.",
888
+ "Trash label.",
889
+ "Spam label."
890
+ ]
891
+ },
892
+ "threadId": {
893
+ "description": "Required. The ID of the thread to add the label to.",
894
+ "type": "string"
895
+ }
896
+ },
897
+ "required": [
898
+ "threadId",
899
+ "labelOption"
900
+ ],
901
+ "type": "object"
902
+ },
903
+ "name": "apply_sensitive_thread_label",
904
+ "outputSchema": {
905
+ "description": "Response message for ApplySensitiveThreadLabel RPC.",
906
+ "properties": {},
907
+ "type": "object"
908
+ }
909
+ },
719
910
  {
720
911
  "annotations": {
721
912
  "destructiveHint": false,
@@ -877,6 +1068,50 @@
877
1068
  "type": "object"
878
1069
  }
879
1070
  },
1071
+ {
1072
+ "annotations": {
1073
+ "destructiveHint": true,
1074
+ "idempotentHint": true,
1075
+ "openWorldHint": false,
1076
+ "readOnlyHint": false,
1077
+ "title": "Adds a sensitive label (Trash or Spam) to a message."
1078
+ },
1079
+ "description": "Adds a sensitive label (Trash or Spam) to a specific message in the authenticated user's Gmail account.\n\nUse this tool to trash or mark a message as spam. To find the message ID, use tools like `search_threads` or `get_thread`.\n",
1080
+ "inputSchema": {
1081
+ "description": "Request message for ApplySensitiveMessageLabel RPC.",
1082
+ "properties": {
1083
+ "labelOption": {
1084
+ "description": "Required. The sensitive label option to add.",
1085
+ "enum": [
1086
+ "LABEL_OPTION_UNSPECIFIED",
1087
+ "TRASH",
1088
+ "SPAM"
1089
+ ],
1090
+ "type": "string",
1091
+ "x-google-enum-descriptions": [
1092
+ "Unspecified label option.",
1093
+ "Trash label.",
1094
+ "Spam label."
1095
+ ]
1096
+ },
1097
+ "messageId": {
1098
+ "description": "Required. The ID of the message to add the label to.",
1099
+ "type": "string"
1100
+ }
1101
+ },
1102
+ "required": [
1103
+ "messageId",
1104
+ "labelOption"
1105
+ ],
1106
+ "type": "object"
1107
+ },
1108
+ "name": "apply_sensitive_message_label",
1109
+ "outputSchema": {
1110
+ "description": "Response message for ApplySensitiveMessageLabel RPC.",
1111
+ "properties": {},
1112
+ "type": "object"
1113
+ }
1114
+ },
880
1115
  {
881
1116
  "annotations": {
882
1117
  "destructiveHint": false,
@@ -6,6 +6,11 @@ CREATE TABLE IF NOT EXISTS gmail_config (
6
6
  value TEXT NOT NULL
7
7
  );
8
8
 
9
+ CREATE TABLE IF NOT EXISTS fault_counters (
10
+ operation TEXT PRIMARY KEY,
11
+ calls INTEGER NOT NULL DEFAULT 0
12
+ );
13
+
9
14
  CREATE TABLE IF NOT EXISTS mailboxes (
10
15
  id INTEGER PRIMARY KEY AUTOINCREMENT,
11
16
  email TEXT NOT NULL COLLATE NOCASE UNIQUE,
@@ -180,6 +185,7 @@ CREATE INDEX IF NOT EXISTS idx_filters_mailbox
180
185
  `;
181
186
  const RESET_SQL = `
182
187
  DELETE FROM gmail_config;
188
+ DELETE FROM fault_counters;
183
189
  DELETE FROM send_as;
184
190
  DELETE FROM forwarding_addresses;
185
191
  DELETE FROM filters;
@@ -1 +1 @@
1
- {"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/db.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C;AACzB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAqB;IACjD,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { SeedAttachment, SemanticMessage } from "../types.js";
2
+ import type { GmailDomain } from "./gmail-domain.js";
3
+ import { sendMessage } from "./messages.js";
4
+ export type DraftResource = {
5
+ id: string;
6
+ message: SemanticMessage;
7
+ updatedAt: string;
8
+ };
9
+ export declare function createDraft(domain: GmailDomain, email: string, raw: Uint8Array | string, options?: {
10
+ threadId?: string;
11
+ }): {
12
+ id: string;
13
+ message: SemanticMessage;
14
+ };
15
+ export declare function createComposedDraft(domain: GmailDomain, email: string, input: {
16
+ to?: string[];
17
+ cc?: string[];
18
+ bcc?: string[];
19
+ subject?: string;
20
+ text?: string;
21
+ html?: string;
22
+ replyToMessageId?: string;
23
+ attachments?: SeedAttachment[];
24
+ }): {
25
+ id: string;
26
+ message: SemanticMessage;
27
+ };
28
+ export declare function listDrafts(domain: GmailDomain, email: string, query?: string): Array<{
29
+ id: string;
30
+ message: SemanticMessage;
31
+ }>;
32
+ export declare function drafts(domain: GmailDomain, email: string, query?: string, includeTrash?: boolean): DraftResource[];
33
+ export declare function draft(domain: GmailDomain, email: string, draftId: string): DraftResource;
34
+ export declare function updateDraft(domain: GmailDomain, email: string, draftId: string, raw: Uint8Array | string, options?: {
35
+ threadId?: string;
36
+ }): {
37
+ id: string;
38
+ message: SemanticMessage;
39
+ };
40
+ export declare function sendDraft(domain: GmailDomain, email: string, draftId: string): ReturnType<typeof sendMessage>;
41
+ export declare function deleteDraft(domain: GmailDomain, email: string, draftId: string): void;
@@ -0,0 +1,138 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { notFound } from "../errors.js";
3
+ import { composeMime } from "../mime.js";
4
+ import { addHistory, insertStoredMessage, nextId, nextTimestamp, rawMessage, semanticMessage } from "../storage.js";
5
+ import { acceptedRaw, removeEmptyThread, searchMessages, sendMessage } from "./messages.js";
6
+ export function createDraft(domain, email, raw, options = {}) {
7
+ const mailboxId = domain.mailboxId(email);
8
+ const bytes = acceptedRaw(raw);
9
+ return domain.db.transaction(() => {
10
+ const message = insertStoredMessage(domain.db, mailboxId, bytes, {
11
+ threadId: options.threadId,
12
+ draft: true,
13
+ });
14
+ const draftId = nextId(domain.db, mailboxId, "draft_counter", "draft");
15
+ const now = nextTimestamp(domain.db, mailboxId);
16
+ domain.db
17
+ .prepare("INSERT INTO drafts(mailbox_id, id, message_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?)")
18
+ .run(mailboxId, draftId, message.id, now, now);
19
+ addHistory(domain.db, mailboxId, message.id, message.threadId, "draftCreated", ["DRAFT"]);
20
+ return { id: draftId, message };
21
+ }).immediate();
22
+ }
23
+ export function createComposedDraft(domain, email, input) {
24
+ const mailboxId = domain.mailboxId(email);
25
+ return domain.db.transaction(() => {
26
+ const reply = input.replyToMessageId
27
+ ? semanticMessage(domain.db, mailboxId, input.replyToMessageId)
28
+ : undefined;
29
+ const raw = composeMime({
30
+ from: email,
31
+ to: input.to,
32
+ cc: input.cc,
33
+ bcc: input.bcc,
34
+ subject: input.subject ?? (reply ? `Re: ${reply.subject}` : ""),
35
+ text: reply ? [input.text ?? "", reply.text].filter(Boolean).join("\r\n\r\n") : input.text,
36
+ html: reply ? [input.html ?? "", reply.html].filter(Boolean).join("<br><br>") : input.html,
37
+ date: nextTimestamp(domain.db, mailboxId),
38
+ messageId: `${nextId(domain.db, mailboxId, "message_counter", "rfc")}@pome-twin.test`,
39
+ inReplyTo: reply?.rfcMessageId,
40
+ references: reply ? [reply.rfcMessageId] : undefined,
41
+ attachments: input.attachments,
42
+ });
43
+ return createDraft(domain, email, raw, { threadId: reply?.threadId });
44
+ }).immediate();
45
+ }
46
+ export function listDrafts(domain, email, query = "") {
47
+ const mailboxId = domain.mailboxId(email);
48
+ const rows = domain.db
49
+ .prepare(`SELECT d.id, d.message_id
50
+ FROM drafts d JOIN messages m ON m.mailbox_id = d.mailbox_id AND m.id = d.message_id
51
+ WHERE d.mailbox_id = ? ORDER BY d.updated_at DESC, d.id DESC`)
52
+ .all(mailboxId);
53
+ const matchingIds = query
54
+ ? new Set(searchMessages(domain, email, `in:draft ${query}`, { includeTrash: true }).map((message) => message.id))
55
+ : undefined;
56
+ return rows
57
+ .filter((row) => matchingIds?.has(row.message_id) ?? true)
58
+ .map((row) => ({ id: row.id, message: semanticMessage(domain.db, mailboxId, row.message_id) }));
59
+ }
60
+ export function drafts(domain, email, query = "", includeTrash = false) {
61
+ const mailboxId = domain.mailboxId(email);
62
+ const matching = query
63
+ ? new Set(searchMessages(domain, email, query, { includeTrash }).map((message) => message.id))
64
+ : null;
65
+ const rows = domain.db
66
+ .prepare("SELECT id, message_id, updated_at FROM drafts WHERE mailbox_id = ? ORDER BY updated_at DESC, id DESC")
67
+ .all(mailboxId);
68
+ return rows
69
+ .filter((row) => !matching || matching.has(row.message_id))
70
+ .map((row) => ({
71
+ id: row.id,
72
+ message: semanticMessage(domain.db, mailboxId, row.message_id),
73
+ updatedAt: row.updated_at,
74
+ }));
75
+ }
76
+ export function draft(domain, email, draftId) {
77
+ const mailboxId = domain.mailboxId(email);
78
+ const row = domain.db
79
+ .prepare("SELECT id, message_id, updated_at FROM drafts WHERE mailbox_id = ? AND id = ?")
80
+ .get(mailboxId, draftId);
81
+ if (!row)
82
+ notFound("Draft");
83
+ return { id: row.id, message: semanticMessage(domain.db, mailboxId, row.message_id), updatedAt: row.updated_at };
84
+ }
85
+ export function updateDraft(domain, email, draftId, raw, options = {}) {
86
+ const mailboxId = domain.mailboxId(email);
87
+ const bytes = acceptedRaw(raw);
88
+ return domain.db.transaction(() => {
89
+ const draftRow = requireDraft(domain, mailboxId, draftId);
90
+ const old = semanticMessage(domain.db, mailboxId, draftRow.message_id);
91
+ const replacement = insertStoredMessage(domain.db, mailboxId, bytes, {
92
+ threadId: options.threadId,
93
+ draft: true,
94
+ });
95
+ const now = nextTimestamp(domain.db, mailboxId);
96
+ domain.db
97
+ .prepare("UPDATE drafts SET message_id = ?, updated_at = ? WHERE mailbox_id = ? AND id = ?")
98
+ .run(replacement.id, now, mailboxId, draftId);
99
+ domain.db.prepare("DELETE FROM messages WHERE mailbox_id = ? AND id = ?").run(mailboxId, draftRow.message_id);
100
+ removeEmptyThread(domain, mailboxId, old.threadId);
101
+ addHistory(domain.db, mailboxId, draftRow.message_id, old.threadId, "draftReplaced");
102
+ return { id: draftId, message: replacement };
103
+ }).immediate();
104
+ }
105
+ export function sendDraft(domain, email, draftId) {
106
+ const mailboxId = domain.mailboxId(email);
107
+ return domain.db.transaction(() => {
108
+ const draftRow = requireDraft(domain, mailboxId, draftId);
109
+ const raw = rawMessage(domain.db, mailboxId, draftRow.message_id);
110
+ const old = semanticMessage(domain.db, mailboxId, draftRow.message_id);
111
+ domain.db.prepare("DELETE FROM drafts WHERE mailbox_id = ? AND id = ?").run(mailboxId, draftId);
112
+ domain.db.prepare("DELETE FROM messages WHERE mailbox_id = ? AND id = ?").run(mailboxId, draftRow.message_id);
113
+ // Keep the draft's thread row even when it becomes empty — send reuses
114
+ // old.threadId (Gmail draft send identity). removeEmptyThread here would
115
+ // drop solo-draft threads and force a new thread id on send.
116
+ addHistory(domain.db, mailboxId, draftRow.message_id, old.threadId, "draftSent");
117
+ return sendMessage(domain, email, raw, { threadId: old.threadId });
118
+ }).immediate();
119
+ }
120
+ export function deleteDraft(domain, email, draftId) {
121
+ const mailboxId = domain.mailboxId(email);
122
+ domain.db.transaction(() => {
123
+ const draftRow = requireDraft(domain, mailboxId, draftId);
124
+ const message = semanticMessage(domain.db, mailboxId, draftRow.message_id);
125
+ domain.db.prepare("DELETE FROM messages WHERE mailbox_id = ? AND id = ?").run(mailboxId, draftRow.message_id);
126
+ removeEmptyThread(domain, mailboxId, message.threadId);
127
+ addHistory(domain.db, mailboxId, draftRow.message_id, message.threadId, "draftDeleted");
128
+ }).immediate();
129
+ }
130
+ function requireDraft(domain, mailboxId, draftId) {
131
+ const row = domain.db
132
+ .prepare("SELECT * FROM drafts WHERE mailbox_id = ? AND id = ?")
133
+ .get(mailboxId, draftId);
134
+ if (!row)
135
+ notFound("Draft");
136
+ return row;
137
+ }
138
+ //# sourceMappingURL=drafts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drafts.js","sourceRoot":"","sources":["../../../src/domain/drafts.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGpH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5F,MAAM,UAAU,WAAW,CACzB,MAAmB,EACnB,KAAa,EACb,GAAwB,EACxB,UAAiC,EAAE;IAEnC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;QAChC,MAAM,OAAO,GAAG,mBAAmB,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC/D,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QAChD,MAAM,CAAC,EAAE;aACN,OAAO,CAAC,+FAA+F,C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G,GAAG,MAAM,CAAC,EAAE;SAClB,OAAO,CAAC,sDAAsD,CAAC;SAC/D,GAAG,CAAC,SAAS,EAAE,OAAO,CAAyB,CAAC;IACnD,IAAI,CAAC,GAAG;QAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { GmailTwinDatabase, SeedFilter } from "../types.js";
2
+ import type { GmailDomain } from "./gmail-domain.js";
3
+ export type FilterResource = Required<Pick<SeedFilter, "criteria" | "action">> & {
4
+ id: string;
5
+ };
6
+ export declare function applyInboundFilters(db: GmailTwinDatabase, mailboxId: number, messageId: string): void;
7
+ export declare function filters(domain: GmailDomain, email: string): FilterResource[];
8
+ export declare function filter(domain: GmailDomain, email: string, filterId: string): FilterResource;
9
+ export declare function createFilter(domain: GmailDomain, email: string, criteria?: SeedFilter["criteria"], action?: SeedFilter["action"]): FilterResource;
10
+ export declare function deleteFilter(domain: GmailDomain, email: string, filterId: string): void;
@@ -1,7 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- import { unsupported } from "./errors.js";
3
- import { matchesSearch, parseSearchQuery } from "./search.js";
4
- import { addHistory, assertLabels, semanticMessage } from "./storage.js";
2
+ import { invalidArgument, notFound, unsupported } from "../errors.js";
3
+ import { matchesSearch } from "../search-match.js";
4
+ import { parseSearchQuery, validateSearchQuery } from "../search-parse.js";
5
+ import { addHistory, assertLabels, nextId, semanticMessage } from "../storage.js";
6
+ import { searchDocument, searchNow } from "./hydrate.js";
5
7
  export function applyInboundFilters(db, mailboxId, messageId) {
6
8
  const filters = db
7
9
  .prepare("SELECT criteria_json, action_json FROM filters WHERE mailbox_id = ? ORDER BY id")
@@ -51,39 +53,53 @@ export function applyInboundFilters(db, mailboxId, messageId) {
51
53
  addHistory(db, mailboxId, messageId, message.threadId, "labelRemoved", removed);
52
54
  }
53
55
  }
54
- export function searchDocument(db, mailboxId, message) {
55
- const row = db
56
- .prepare("SELECT delivered_to, headers_json FROM messages WHERE mailbox_id = ? AND id = ?")
57
- .get(mailboxId, message.id);
58
- const userLabelCount = db
59
- .prepare(`SELECT COUNT(*) AS count FROM message_labels ml
60
- JOIN labels l ON l.mailbox_id = ml.mailbox_id AND l.id = ml.label_id
61
- WHERE ml.mailbox_id = ? AND ml.message_id = ? AND l.type = 'user'`)
62
- .get(mailboxId, message.id).count;
56
+ export function filters(domain, email) {
57
+ const mailboxId = domain.mailboxId(email);
58
+ const rows = domain.db
59
+ .prepare("SELECT id, criteria_json, action_json FROM filters WHERE mailbox_id = ? ORDER BY id")
60
+ .all(mailboxId);
61
+ return rows.map(toFilter);
62
+ }
63
+ export function filter(domain, email, filterId) {
64
+ const mailboxId = domain.mailboxId(email);
65
+ const row = domain.db
66
+ .prepare("SELECT id, criteria_json, action_json FROM filters WHERE mailbox_id = ? AND id = ?")
67
+ .get(mailboxId, filterId);
68
+ if (!row)
69
+ notFound("Filter");
70
+ return toFilter(row);
71
+ }
72
+ export function createFilter(domain, email, criteria = {}, action = {}) {
73
+ if (action.forward)
74
+ unsupported("Filter action.forward is not supported by the Gmail twin");
75
+ const mailboxId = domain.mailboxId(email);
76
+ const count = domain.db.prepare("SELECT COUNT(*) AS count FROM filters WHERE mailbox_id = ?").get(mailboxId);
77
+ if (count.count >= 1000)
78
+ invalidArgument("Filter limit exceeded");
79
+ assertLabels(domain.db, mailboxId, [...(action.addLabelIds ?? []), ...(action.removeLabelIds ?? [])]);
80
+ if (criteria.query)
81
+ validateSearchQuery(criteria.query);
82
+ if (criteria.negatedQuery)
83
+ validateSearchQuery(criteria.negatedQuery);
84
+ const id = nextId(domain.db, mailboxId, "filter_counter", "filter");
85
+ domain.db
86
+ .prepare("INSERT INTO filters(mailbox_id, id, criteria_json, action_json) VALUES (?, ?, ?, ?)")
87
+ .run(mailboxId, id, JSON.stringify(criteria), JSON.stringify(action));
88
+ return { id, criteria, action };
89
+ }
90
+ export function deleteFilter(domain, email, filterId) {
91
+ const mailboxId = domain.mailboxId(email);
92
+ const result = domain.db
93
+ .prepare("DELETE FROM filters WHERE mailbox_id = ? AND id = ?")
94
+ .run(mailboxId, filterId);
95
+ if (result.changes === 0)
96
+ notFound("Filter");
97
+ }
98
+ function toFilter(row) {
63
99
  return {
64
- from: message.from.toLowerCase(),
65
- to: message.to.map((item) => item.toLowerCase()),
66
- cc: message.cc.map((item) => item.toLowerCase()),
67
- bcc: message.bcc.map((item) => item.toLowerCase()),
68
- deliveredTo: row.delivered_to.toLowerCase(),
69
- subject: message.subject,
70
- text: message.text,
71
- html: message.html,
72
- dateMs: message.internalDate,
73
- rfcMessageId: message.rfcMessageId,
74
- size: message.sizeEstimate,
75
- labels: message.labelIds,
76
- userLabelCount,
77
- attachmentNames: message.attachments.map((attachment) => attachment.filename),
78
- attachmentMimeTypes: message.attachments.map((attachment) => attachment.mimeType),
79
- headers: JSON.parse(row.headers_json),
100
+ id: row.id,
101
+ criteria: JSON.parse(row.criteria_json),
102
+ action: JSON.parse(row.action_json),
80
103
  };
81
104
  }
82
- export function searchNow(db) {
83
- const clock = db.prepare("SELECT value FROM gmail_config WHERE key = 'clock'").get();
84
- const row = db
85
- .prepare("SELECT COALESCE(MAX(logical_clock), 0) AS value FROM mailbox_counters")
86
- .get();
87
- return Date.parse(clock.value) + row.value * 1000;
88
- }
89
- //# sourceMappingURL=domain-search.js.map
105
+ //# sourceMappingURL=filters.js.map