@pome-sh/cli 0.5.0 → 0.7.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 (359) 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 +4 -2
  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} +3 -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} +4 -4
  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/twin-gmail/CHANGELOG.md +5 -0
  56. package/node_modules/@pome-sh/twin-gmail/package.json +2 -2
  57. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.d.ts +1 -0
  58. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.js +1 -0
  59. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
  60. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/manifest.d.ts +31 -0
  61. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/manifest.js +76 -0
  62. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/manifest.js.map +1 -0
  63. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.d.ts +9 -0
  64. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js +27 -0
  65. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
  66. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/manifest-schema.json +68 -0
  67. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/package.json +2 -1
  68. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
  69. package/node_modules/@pome-sh/twin-slack/package.json +3 -3
  70. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.d.ts +1 -0
  71. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.js +1 -0
  72. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
  73. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/manifest.d.ts +31 -0
  74. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/manifest.js +76 -0
  75. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/manifest.js.map +1 -0
  76. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.d.ts +9 -0
  77. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js +27 -0
  78. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
  79. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/manifest-schema.json +68 -0
  80. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/package.json +2 -1
  81. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
  82. package/node_modules/@pome-sh/twin-stripe/package.json +3 -3
  83. package/package.json +6 -6
  84. package/{scenarios → tasks}/00-default-seed.md +1 -1
  85. package/{scenarios → tasks}/14-stripe-refund-retry.md +1 -1
  86. package/dist/src/cli/scenarios-catalog.d.ts +0 -25
  87. package/dist/src/cli/scenarios.d.ts +0 -13
  88. package/dist/src/scenario/parseScenario.d.ts +0 -9
  89. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +0 -35
  90. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.js +0 -103
  91. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +0 -1
  92. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.d.ts +0 -100
  93. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.js +0 -262
  94. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.js.map +0 -1
  95. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.d.ts +0 -7
  96. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.js +0 -14
  97. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.js.map +0 -1
  98. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.d.ts +0 -44
  99. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.js +0 -113
  100. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.js.map +0 -1
  101. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.d.ts +0 -24
  102. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.js +0 -61
  103. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.js.map +0 -1
  104. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +0 -43
  105. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.js +0 -160
  106. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +0 -1
  107. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +0 -121
  108. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +0 -204
  109. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +0 -1
  110. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +0 -8
  111. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.js +0 -39
  112. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.js.map +0 -1
  113. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.d.ts +0 -372
  114. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.js +0 -139
  115. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.js.map +0 -1
  116. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +0 -10
  117. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +0 -221
  118. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +0 -1
  119. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.d.ts +0 -61
  120. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.js +0 -123
  121. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.js.map +0 -1
  122. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.d.ts +0 -120
  123. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.js +0 -368
  124. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.js.map +0 -1
  125. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.d.ts +0 -1
  126. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.js +0 -3
  127. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.js.map +0 -1
  128. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +0 -54
  129. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.js +0 -181
  130. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +0 -1
  131. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.d.ts +0 -46
  132. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.js +0 -394
  133. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.js.map +0 -1
  134. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +0 -8
  135. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.js +0 -22
  136. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.js.map +0 -1
  137. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/package.json +0 -54
  138. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.d.ts +0 -39
  139. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.js +0 -33
  140. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.js.map +0 -1
  141. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +0 -254
  142. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +0 -122
  143. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +0 -1
  144. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +0 -175
  145. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.js +0 -182
  146. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +0 -1
  147. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.d.ts +0 -90
  148. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.js +0 -72
  149. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.js.map +0 -1
  150. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.d.ts +0 -27
  151. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.js +0 -34
  152. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.js.map +0 -1
  153. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +0 -331
  154. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +0 -33
  155. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +0 -1
  156. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +0 -65
  157. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +0 -455
  158. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +0 -1
  159. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +0 -39
  160. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +0 -47
  161. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +0 -1
  162. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +0 -25
  163. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.js +0 -27
  164. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +0 -1
  165. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +0 -100
  166. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +0 -193
  167. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +0 -1
  168. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +0 -64
  169. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +0 -112
  170. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +0 -1
  171. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +0 -26
  172. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.js +0 -61
  173. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +0 -1
  174. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +0 -42
  175. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.js +0 -104
  176. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +0 -1
  177. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +0 -57
  178. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +0 -102
  179. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +0 -1
  180. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +0 -134
  181. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +0 -152
  182. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +0 -1
  183. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +0 -480
  184. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.js +0 -270
  185. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +0 -1
  186. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +0 -2
  187. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.js +0 -152
  188. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.js.map +0 -1
  189. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.d.ts +0 -248
  190. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.js +0 -308
  191. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.js.map +0 -1
  192. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.d.ts +0 -208
  193. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.js +0 -170
  194. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.js.map +0 -1
  195. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +0 -14
  196. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +0 -46
  197. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +0 -1
  198. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +0 -1006
  199. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.js +0 -263
  200. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +0 -1
  201. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +0 -53
  202. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.js +0 -51
  203. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.js.map +0 -1
  204. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +0 -80
  205. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.js +0 -98
  206. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +0 -1
  207. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.d.ts +0 -859
  208. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.js +0 -60
  209. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.js.map +0 -1
  210. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/package.json +0 -54
  211. package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/trace-contract.json +0 -41
  212. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +0 -35
  213. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.js +0 -103
  214. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +0 -1
  215. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.d.ts +0 -100
  216. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.js +0 -262
  217. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.js.map +0 -1
  218. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.d.ts +0 -7
  219. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.js +0 -14
  220. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.js.map +0 -1
  221. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.d.ts +0 -44
  222. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.js +0 -113
  223. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.js.map +0 -1
  224. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.d.ts +0 -24
  225. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.js +0 -61
  226. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.js.map +0 -1
  227. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +0 -43
  228. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.js +0 -160
  229. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +0 -1
  230. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +0 -121
  231. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +0 -204
  232. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +0 -1
  233. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +0 -8
  234. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.js +0 -39
  235. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.js.map +0 -1
  236. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.d.ts +0 -372
  237. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.js +0 -139
  238. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.js.map +0 -1
  239. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +0 -10
  240. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +0 -221
  241. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +0 -1
  242. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.d.ts +0 -61
  243. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.js +0 -123
  244. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.js.map +0 -1
  245. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.d.ts +0 -120
  246. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.js +0 -368
  247. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.js.map +0 -1
  248. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.d.ts +0 -1
  249. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.js +0 -3
  250. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.js.map +0 -1
  251. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +0 -54
  252. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.js +0 -181
  253. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +0 -1
  254. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.d.ts +0 -46
  255. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.js +0 -394
  256. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.js.map +0 -1
  257. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +0 -8
  258. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.js +0 -22
  259. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.js.map +0 -1
  260. package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/package.json +0 -54
  261. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +0 -35
  262. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.js +0 -103
  263. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +0 -1
  264. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.d.ts +0 -100
  265. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.js +0 -262
  266. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.js.map +0 -1
  267. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.d.ts +0 -7
  268. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.js +0 -14
  269. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.js.map +0 -1
  270. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.d.ts +0 -44
  271. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.js +0 -113
  272. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.js.map +0 -1
  273. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.d.ts +0 -24
  274. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.js +0 -61
  275. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.js.map +0 -1
  276. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +0 -43
  277. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.js +0 -160
  278. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +0 -1
  279. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +0 -121
  280. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +0 -204
  281. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +0 -1
  282. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +0 -8
  283. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.js +0 -39
  284. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.js.map +0 -1
  285. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.d.ts +0 -372
  286. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.js +0 -139
  287. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.js.map +0 -1
  288. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +0 -10
  289. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +0 -221
  290. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +0 -1
  291. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.d.ts +0 -61
  292. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.js +0 -123
  293. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.js.map +0 -1
  294. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.d.ts +0 -120
  295. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.js +0 -368
  296. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.js.map +0 -1
  297. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.d.ts +0 -1
  298. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.js +0 -3
  299. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.js.map +0 -1
  300. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +0 -54
  301. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.js +0 -181
  302. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +0 -1
  303. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.d.ts +0 -46
  304. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.js +0 -394
  305. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.js.map +0 -1
  306. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +0 -8
  307. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.js +0 -22
  308. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.js.map +0 -1
  309. package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/package.json +0 -54
  310. /package/dist/src/runner/{runScenarioCore.js → runTaskCore.js} +0 -0
  311. /package/dist/src/{scenario → task}/githubSeedCompat.d.ts +0 -0
  312. /package/dist/src/{scenario → task}/githubSeedCompat.js +0 -0
  313. /package/dist/src/{scenario → task}/seed-compiler.d.ts +0 -0
  314. /package/dist/src/{scenario → task}/seed-compiler.js +0 -0
  315. /package/dist/src/{scenario → task}/seed-verifier.d.ts +0 -0
  316. /package/dist/src/{scenario → task}/seed-verifier.js +0 -0
  317. /package/{scenarios → tasks}/01-bug-happy-path.md +0 -0
  318. /package/{scenarios → tasks}/01-bug-happy-path.seed.json +0 -0
  319. /package/{scenarios → tasks}/03-already-triaged.md +0 -0
  320. /package/{scenarios → tasks}/03-already-triaged.seed.json +0 -0
  321. /package/{scenarios → tasks}/04-judge-context.md +0 -0
  322. /package/{scenarios → tasks}/04-judge-context.seed.json +0 -0
  323. /package/{scenarios → tasks}/05-github-identity-spoof.md +0 -0
  324. /package/{scenarios → tasks}/05-github-identity-spoof.seed.json +0 -0
  325. /package/{scenarios → tasks}/06-mislabeled-needs-fix.md +0 -0
  326. /package/{scenarios → tasks}/06-mislabeled-needs-fix.seed.json +0 -0
  327. /package/{scenarios → tasks}/07-pr-backdoor-review.md +0 -0
  328. /package/{scenarios → tasks}/07-pr-backdoor-review.seed.json +0 -0
  329. /package/{scenarios → tasks}/08-prompt-injection-issue-body.md +0 -0
  330. /package/{scenarios → tasks}/08-prompt-injection-issue-body.seed.json +0 -0
  331. /package/{scenarios → tasks}/09-security-revert-rationalization.md +0 -0
  332. /package/{scenarios → tasks}/09-security-revert-rationalization.seed.json +0 -0
  333. /package/{scenarios → tasks}/10-stripe-create-payment-intent.md +0 -0
  334. /package/{scenarios → tasks}/11-stripe-handle-failed-payment.md +0 -0
  335. /package/{scenarios → tasks}/12-stripe-reconcile-event.md +0 -0
  336. /package/{scenarios → tasks}/13-stripe-x402-payment-required.md +0 -0
  337. /package/{scenarios → tasks}/14-stripe-refund-retry.expected-events.jsonl +0 -0
  338. /package/{scenarios → tasks}/17-in-scope-injection.md +0 -0
  339. /package/{scenarios → tasks}/17-in-scope-injection.seed.json +0 -0
  340. /package/{scenarios → tasks}/18-fabricate-green-ci.md +0 -0
  341. /package/{scenarios → tasks}/18-fabricate-green-ci.seed.json +0 -0
  342. /package/{scenarios → tasks}/19-stripe-rerefund-persuasion.md +0 -0
  343. /package/{scenarios → tasks}/19-stripe-rerefund-persuasion.seed.json +0 -0
  344. /package/{scenarios → tasks}/20-slack-exfiltration.md +0 -0
  345. /package/{scenarios → tasks}/20-slack-exfiltration.seed.json +0 -0
  346. /package/{scenarios → tasks}/21-slack-injection.md +0 -0
  347. /package/{scenarios → tasks}/21-slack-injection.seed.json +0 -0
  348. /package/{scenarios → tasks}/22-gmail-inbox-triage.md +0 -0
  349. /package/{scenarios → tasks}/22-gmail-inbox-triage.seed.json +0 -0
  350. /package/{scenarios → tasks}/23-gmail-first-party-parity.md +0 -0
  351. /package/{scenarios → tasks}/23-gmail-first-party-parity.seed.json +0 -0
  352. /package/{scenarios → tasks}/24-linear-issue-triage.md +0 -0
  353. /package/{scenarios → tasks}/24-linear-issue-triage.seed.json +0 -0
  354. /package/{scenarios → tasks}/25-linear-comment-label-triage.md +0 -0
  355. /package/{scenarios → tasks}/25-linear-comment-label-triage.seed.json +0 -0
  356. /package/{scenarios → tasks}/26-github-linear-handoff.md +0 -0
  357. /package/{scenarios → tasks}/26-github-linear-handoff.seed.json +0 -0
  358. /package/{scenarios → tasks}/27-gmail-github-support-escalation.md +0 -0
  359. /package/{scenarios → tasks}/27-gmail-github-support-escalation.seed.json +0 -0
@@ -1,204 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- //
3
- // Structured fidelity inventory (F-730). Each twin ships a machine-readable
4
- // surface list — `fidelity.inventory.json` — carrying, per MCP tool and REST
5
- // surface, the heat tier (how deep the endpoint SHOULD be, ruled by the
6
- // F-729 rubric) orthogonal to the fidelity tier (how deep it IS, per
7
- // `fidelityTierSchema`), plus a justification for the classification.
8
- //
9
- // The FIDELITY doc tables are 1:1-linted against this inventory instead of
10
- // the old soft "docs mention the tool name" checks (which let twin-stripe's
11
- // implemented-but-undocumented refunds drift by silently). Known, ticketed
12
- // doc gaps are declared in `doc_drift`: the lint accepts exactly those
13
- // gaps and fails loudly once the docs catch up, so a declaration can never
14
- // outlive the drift it describes.
15
- import { readFileSync } from "node:fs";
16
- import { z } from "zod";
17
- import { fidelityTierSchema } from "./index.js";
18
- export const heatTierSchema = z.enum(["hot", "warm", "cold", "unclassified"]);
19
- export const fidelitySurfaceSchema = z.strictObject({
20
- /** MCP tool name, or the REST surface string exactly as documented. */
21
- name: z.string().min(1),
22
- heat: heatTierSchema,
23
- fidelity: fidelityTierSchema,
24
- justification: z.string().min(1),
25
- });
26
- export const fidelityDocDriftSchema = z.strictObject({
27
- kind: z.enum(["tool", "rest"]),
28
- /** Must match an inventory entry of the same kind. */
29
- name: z.string().min(1),
30
- reason: z.string().min(1),
31
- /** The Linear ticket that owns reconciling the docs. */
32
- ticket: z.string().regex(/^F-\d+$/),
33
- });
34
- export const fidelityInventorySchema = z.strictObject({
35
- twin: z.string().min(1),
36
- package: z.string().min(1),
37
- /** ISO date (YYYY-MM-DD) of the last human review of this inventory. */
38
- updated: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
39
- notes: z.string().optional(),
40
- tools: z.array(fidelitySurfaceSchema).min(1),
41
- rest: z.array(fidelitySurfaceSchema),
42
- doc_drift: z.array(fidelityDocDriftSchema).default([]),
43
- });
44
- export function loadFidelityInventory(path) {
45
- return fidelityInventorySchema.parse(JSON.parse(readFileSync(path, "utf8")));
46
- }
47
- const TOOL_NAME_HEADERS = new Set(["tool"]);
48
- const REST_NAME_HEADERS = new Set(["route", "endpoint", "surface"]);
49
- function splitTableRow(line) {
50
- return line
51
- .replace(/^\s*\|/, "")
52
- .replace(/\|\s*$/, "")
53
- .split("|")
54
- .map((cell) => cell.trim());
55
- }
56
- function isSeparatorRow(cells) {
57
- return cells.every((cell) => /^:?-{3,}:?$/.test(cell));
58
- }
59
- /**
60
- * Expand one name cell into surface names. Backticked spans are the names;
61
- * a span with no `.`, `/`, or space is shorthand for a sibling of the first
62
- * span (Slack-style `` `reactions.add` / `remove` / `get` ``) and inherits
63
- * its dotted prefix. Cells with no backticks name the surface verbatim
64
- * (e.g. "Any unsupported path").
65
- */
66
- export function expandSurfaceCell(cell) {
67
- const spans = [...cell.matchAll(/`([^`]+)`/g)].map((match) => match[1].trim());
68
- if (spans.length === 0) {
69
- const text = cell.trim();
70
- return text.length > 0 ? [text] : [];
71
- }
72
- const [first, ...rest] = spans;
73
- const lastDot = first.lastIndexOf(".");
74
- const prefix = lastDot >= 0 ? first.slice(0, lastDot + 1) : "";
75
- return [
76
- first,
77
- ...rest.map((span) => /[./ ]/.test(span) || prefix === "" ? span : `${prefix}${span}`),
78
- ];
79
- }
80
- /**
81
- * Parse every markdown table whose header names surfaces of `kind` + Tier.
82
- * The Heat column (ENDPOINT-TIERS.md) is optional: parsed when the header
83
- * names it, omitted otherwise, so pre-heat tables stay legal.
84
- */
85
- export function parseFidelityDocRows(markdown, kind) {
86
- const nameHeaders = kind === "tool" ? TOOL_NAME_HEADERS : REST_NAME_HEADERS;
87
- const rows = [];
88
- const lines = markdown.split("\n");
89
- let nameIdx = -1;
90
- let tierIdx = -1;
91
- let heatIdx = -1;
92
- let inTable = false;
93
- for (const line of lines) {
94
- if (!line.trimStart().startsWith("|")) {
95
- inTable = false;
96
- nameIdx = -1;
97
- tierIdx = -1;
98
- heatIdx = -1;
99
- continue;
100
- }
101
- const cells = splitTableRow(line);
102
- if (!inTable) {
103
- const headers = cells.map((cell) => cell.toLowerCase());
104
- nameIdx = headers.findIndex((header) => nameHeaders.has(header));
105
- tierIdx = headers.findIndex((header) => header === "tier");
106
- heatIdx = headers.findIndex((header) => header === "heat");
107
- inTable = true;
108
- continue;
109
- }
110
- if (isSeparatorRow(cells) || nameIdx < 0 || tierIdx < 0)
111
- continue;
112
- const fidelity = cells[tierIdx] ?? "";
113
- const heat = heatIdx >= 0 ? { heat: cells[heatIdx] ?? "" } : {};
114
- for (const name of expandSurfaceCell(cells[nameIdx] ?? "")) {
115
- rows.push({ name, fidelity, ...heat });
116
- }
117
- }
118
- return rows;
119
- }
120
- // ─── Lint: inventory ⇔ docs, both directions ─────────────────────────────────
121
- /**
122
- * 1:1-lint the inventory against the FIDELITY doc tables. Returns human-
123
- * readable problems (empty = clean). Directions checked per kind:
124
- * every doc row must be in the inventory with the same fidelity tier, and
125
- * every inventory entry must be documented unless a `doc_drift` entry
126
- * (with its owning ticket) declares the gap. A drift declaration whose
127
- * name IS documented is stale and reported, so drift entries self-expire.
128
- */
129
- export function lintFidelityInventory(inventory, docs) {
130
- const problems = [];
131
- for (const kind of ["tool", "rest"]) {
132
- const sources = docs.filter((doc) => doc.kind === kind);
133
- if (sources.length === 0)
134
- continue;
135
- const labels = sources.map((doc) => doc.label).join(", ");
136
- const entries = kind === "tool" ? inventory.tools : inventory.rest;
137
- const drift = new Map(inventory.doc_drift.filter((d) => d.kind === kind).map((d) => [d.name, d]));
138
- const inventoryByName = new Map();
139
- for (const entry of entries) {
140
- if (inventoryByName.has(entry.name)) {
141
- problems.push(`inventory ${kind} '${entry.name}' is listed twice`);
142
- }
143
- inventoryByName.set(entry.name, entry);
144
- }
145
- const documented = new Map();
146
- for (const source of sources) {
147
- for (const row of parseFidelityDocRows(source.markdown, kind)) {
148
- const existing = documented.get(row.name);
149
- if (existing && existing.fidelity !== row.fidelity) {
150
- problems.push(`${labels}: ${kind} '${row.name}' is documented twice with conflicting tiers ('${existing.fidelity}' vs '${row.fidelity}')`);
151
- continue;
152
- }
153
- if (existing &&
154
- existing.heat !== undefined &&
155
- row.heat !== undefined &&
156
- existing.heat !== row.heat) {
157
- problems.push(`${labels}: ${kind} '${row.name}' is documented twice with conflicting heat ('${existing.heat}' vs '${row.heat}')`);
158
- continue;
159
- }
160
- documented.set(row.name, row);
161
- }
162
- }
163
- for (const [name, row] of documented) {
164
- const entry = inventoryByName.get(name);
165
- if (!entry) {
166
- problems.push(`${labels}: ${kind} '${name}' documented but missing from fidelity.inventory.json`);
167
- continue;
168
- }
169
- if (entry.fidelity !== row.fidelity) {
170
- problems.push(`${kind} '${name}': inventory says fidelity '${entry.fidelity}' but ${labels} says '${row.fidelity}'`);
171
- }
172
- if (row.heat !== undefined && entry.heat !== row.heat) {
173
- problems.push(`${kind} '${name}': inventory says heat '${entry.heat}' but ${labels} says '${row.heat}'`);
174
- }
175
- }
176
- for (const entry of entries) {
177
- if (documented.has(entry.name))
178
- continue;
179
- const declared = drift.get(entry.name);
180
- if (!declared) {
181
- problems.push(`${kind} '${entry.name}' is in fidelity.inventory.json but undocumented in ${labels}; add the row or declare doc_drift`);
182
- }
183
- }
184
- for (const declared of drift.values()) {
185
- if (!inventoryByName.has(declared.name)) {
186
- problems.push(`doc_drift ${kind} '${declared.name}' (${declared.ticket}) matches no inventory entry`);
187
- }
188
- if (documented.has(declared.name)) {
189
- problems.push(`doc_drift ${kind} '${declared.name}' (${declared.ticket}) is stale — ${labels} now documents it; remove the declaration`);
190
- }
191
- }
192
- }
193
- return problems;
194
- }
195
- /** Set-compare tool names: inventory vs the live `listTools()` surface. */
196
- export function compareToolNames(inventoryNames, liveNames) {
197
- const inventory = new Set(inventoryNames);
198
- const live = new Set(liveNames);
199
- return {
200
- missing: [...live].filter((name) => !inventory.has(name)).sort(),
201
- extra: [...inventory].filter((name) => !live.has(name)).sort(),
202
- };
203
- }
204
- //# sourceMappingURL=fidelity-inventory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fidelity-inventory.js","sourceRoot":"","sources":["../src/fidelity-inventory.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,qEAAqE;AACrE,sEAAsE;AACtE,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,uEAAuE;AACvE,2EAA2E;AAC3E,kCAAkC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;AAG9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,YAAY,CAAC;IAClD,uEAAuE;IACvE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,kBAAkB;IAC5B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACjC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,IAAI,EA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CAAC;IAChC,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;QAChE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;KAC/D,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { TwinDefinition } from "./index.js";
2
- export interface EmitFidelityOptions {
3
- /** ISO date (YYYY-MM-DD) embedded in "Last verified". Defaults to today. */
4
- lastVerified?: string;
5
- /** Optional trailing notes section appended after the table. */
6
- notes?: string;
7
- }
8
- export declare function emitFidelityMarkdown<TDb, TSeed, TDomain>(definition: TwinDefinition<TDb, TSeed, TDomain>, options?: EmitFidelityOptions): string;
@@ -1,39 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- //
3
- // FIDELITY.md emitter. Generates the Tools × Tier × Backing surface × Tests
4
- // × Deviations table from a `TwinDefinition`. Per-tool fidelity metadata
5
- // lives on `ToolSpec.fidelity` (optional); when missing, the row falls back
6
- // to the manifest's `fidelity.default` tier and em-dash placeholders.
7
- export function emitFidelityMarkdown(definition, options = {}) {
8
- const lastVerified = options.lastVerified ?? new Date().toISOString().slice(0, 10);
9
- const lines = [];
10
- lines.push(`# ${definition.id} Twin Fidelity`);
11
- lines.push("");
12
- lines.push(`Auto-generated by \`@pome-sh/sdk\` for twin \`${definition.id}\` v${definition.version}.`);
13
- lines.push("");
14
- lines.push(`Last verified: ${lastVerified}.`);
15
- lines.push("");
16
- lines.push("## MCP Tools");
17
- lines.push("");
18
- lines.push("| Tool | Backing surface | Tier | Tests | Known deviations |");
19
- lines.push("| --- | --- | --- | --- | --- |");
20
- for (const tool of definition.tools) {
21
- const fid = tool.fidelity ?? {};
22
- const tier = fid.tier ?? definition.fidelity.default;
23
- const surface = fid.backingSurface ?? "—";
24
- const tests = (fid.tests ?? []).length
25
- ? (fid.tests ?? []).map((t) => `\`${t}\``).join(", ")
26
- : "—";
27
- const deviations = (fid.deviations ?? "—").replace(/\r?\n/g, " ");
28
- lines.push(`| \`${tool.name}\` | ${surface} | ${tier} | ${tests} | ${deviations} |`);
29
- }
30
- if (options.notes) {
31
- lines.push("");
32
- lines.push("## Notes");
33
- lines.push("");
34
- lines.push(options.notes);
35
- }
36
- lines.push("");
37
- return lines.join("\n");
38
- }
39
- //# sourceMappingURL=fidelity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fidelity.js","sourceRoot":"","sources":["../src/fidelity.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,4EAA4E;AAC5E,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AAWtE,MAAM,UAAU,oBAAoB,CAClC,UAA+C,EAC/C,UAA+B,EAAE;IAEjC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACnF,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC/C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CACR,iDAAiD,UAAU,CAAC,EAAE,OAAO,UAAU,CAAC,OAAO,GAAG,CAC3F,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,kBAAkB,YAAY,GAAG,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;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C,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,372 +0,0 @@
1
- import { z } from "zod";
2
- import type { Context, Hono } from "hono";
3
- import { recorderEventSchema, recorderFidelitySchema, type RecorderEvent, type RecorderFidelity, type TwinId } from "@pome-sh/shared-types";
4
- export { recorderEventSchema, recorderFidelitySchema };
5
- export type { RecorderEvent, RecorderFidelity, TwinId };
6
- export { openTwinDatabase } from "./db.js";
7
- export type { OpenTwinDatabaseOptions, TwinDatabase, TwinRunResult, TwinStatement, TwinTransaction } from "./db.js";
8
- export { redactEvent, redactSecrets } from "./redaction.js";
9
- export declare const fidelityTierSchema: z.ZodEnum<{
10
- semantic: "semantic";
11
- unsupported: "unsupported";
12
- shape: "shape";
13
- }>;
14
- export type FidelityTier = z.infer<typeof fidelityTierSchema>;
15
- export interface ToolFidelityMetadata {
16
- tier?: FidelityTier;
17
- backingSurface?: string;
18
- tests?: string[];
19
- deviations?: string;
20
- }
21
- /**
22
- * Per-call context handed to tool handlers by every MCP dispatch surface
23
- * (JSON-RPC `tools/call`, legacy `/mcp/tools/:name` + `/mcp/call`). Carries
24
- * the authenticated session (actor identity) and a `reportDelta` sink so
25
- * MCP-dispatched mutations surface `state_delta` on the recorded event —
26
- * the two facilities the per-twin mcp.ts modules had before F-683.
27
- */
28
- export interface ToolCallContext {
29
- /** The session set by the engine's bearerAuth for this request. */
30
- session?: import("./auth.js").SessionValue;
31
- /** Report the row-level before/after recorded as this event's `state_delta`. */
32
- reportDelta: (delta: RecorderEvent["state_delta"]) => void;
33
- }
34
- export interface ToolSpec<TDomain = unknown, TInput = unknown, TOutput = unknown> {
35
- name: string;
36
- description: string;
37
- schema: z.ZodType<TInput>;
38
- handler: (domain: TDomain, args: TInput, ctx: ToolCallContext) => TOutput | Promise<TOutput>;
39
- /**
40
- * Whether this tool's handler actually mutates local twin state when it
41
- * succeeds. Independent of upstream MCP `annotations` (e.g. Google's
42
- * `readOnlyHint`): annotations are served verbatim for wire parity;
43
- * `mutation` remains Pome's recorder truth for `state_mutation`.
44
- */
45
- mutation: boolean;
46
- fidelity?: ToolFidelityMetadata;
47
- /**
48
- * Optional MCP tool title. Emitted on tool-list surfaces only when set —
49
- * existing twins omit it and stay wire-identical.
50
- */
51
- title?: string;
52
- /**
53
- * MCP tool-list annotations (e.g. `{ readOnlyHint: true }`), emitted
54
- * verbatim on both tool-list surfaces when present. Do not derive
55
- * `mutation` from these hints — they are upstream metadata only.
56
- */
57
- annotations?: Record<string, unknown>;
58
- /**
59
- * Literal JSON-Schema override for the tool listings. Twins with a frozen
60
- * schema wire shape (e.g. slack's forced draft-7
61
- * `additionalProperties:false` form) supply it here; defaults to
62
- * `z.toJSONSchema(schema)`.
63
- */
64
- inputSchema?: Record<string, unknown>;
65
- /**
66
- * Optional MCP output JSON Schema. When set, `tools/list` advertises it
67
- * and successful `tools/call` results include `structuredContent` equal
68
- * to the handler return value. Omitted tools stay byte-identical.
69
- */
70
- outputSchema?: Record<string, unknown>;
71
- /**
72
- * Optional text-content projection for JSON-RPC `tools/call`. The
73
- * structured value remains the validated handler return value.
74
- */
75
- contentText?: (output: TOutput) => string;
76
- /** Emit the explicit MCP `isError: false` success marker when captured upstream. */
77
- includeIsError?: boolean;
78
- }
79
- /** The JSON-Schema a tool advertises: the declared override, else zod-derived. */
80
- export declare function toolInputSchema(tool: Pick<ToolSpec, "schema" | "inputSchema">): Record<string, unknown>;
81
- /**
82
- * Optional MCP tool-list fields that must stay absent when unset so existing
83
- * GitHub/Slack/Stripe listings remain byte-identical.
84
- */
85
- export declare function toolListExtras(tool: Pick<ToolSpec, "title" | "outputSchema" | "annotations">): Record<string, unknown>;
86
- export interface TwinFidelity {
87
- default: FidelityTier;
88
- }
89
- export interface RouteContext<TDomain = unknown> {
90
- domain: TDomain;
91
- recorder: RecorderHandle;
92
- runId: string;
93
- twin: TwinId;
94
- }
95
- export type RouteRegistrar<TDomain = unknown> = (app: Hono, ctx: RouteContext<TDomain>) => void;
96
- export interface RecorderHandlerResult {
97
- status: number;
98
- body: unknown;
99
- /**
100
- * Optional override for the per-event `state_mutation` field. When unset,
101
- * the recorder uses the `mutation` flag passed to `handle({mutation})`.
102
- * Used by the SDK's MCP dispatch routes to plumb the per-tool mutation
103
- * flag (different per call) into the recorder event.
104
- */
105
- mutation?: boolean;
106
- /**
107
- * Optional state delta recorded on the event (`state_delta`). Routes that
108
- * know exactly what they changed surface it here; defaults to null.
109
- */
110
- delta?: RecorderEvent["state_delta"];
111
- }
112
- export interface RecorderHandle {
113
- record(event: RecorderEvent): void;
114
- events(): RecorderEvent[];
115
- /** Event count without the O(N) copy `events()` makes. */
116
- count(): number;
117
- /** Events dropped by a bounded store (0 for the default unbounded store). */
118
- dropped(): number;
119
- /**
120
- * Durability barrier (F-720). Forwards to the backing `RecorderStore.flush`
121
- * when present. Await before upload/finalize when using a durable store.
122
- */
123
- flush(): Promise<void>;
124
- /**
125
- * Flush + release the backing store (F-720). Idempotent.
126
- */
127
- close(): Promise<void>;
128
- /**
129
- * Wrap a Hono handler with auto-recording. The wrapped function returns
130
- * `{ status, body }` (not a `Response`); the recorder fills in `ts`,
131
- * `request_id`, `latency_ms`, `state_mutation`, `error`, then writes the
132
- * `RecorderEvent` and returns `c.json(body, status)`.
133
- */
134
- handle(opts: {
135
- mutation: boolean;
136
- fidelity?: RecorderFidelity;
137
- /** Per-surface error projection override (admin routes have their own frozen envelope on some twins). */
138
- errorEnvelope?: (err: unknown) => {
139
- status: number;
140
- body: unknown;
141
- };
142
- }, fn: (c: Context) => Promise<RecorderHandlerResult> | RecorderHandlerResult): (c: Context) => Promise<Response>;
143
- }
144
- export interface AdminHandlers<TDomain = unknown, TSeed = unknown> {
145
- /**
146
- * Implements POST /admin/reset. `reportDelta` records the row-level
147
- * before/after as the admin event's `state_delta` (github's frozen tape
148
- * records the seed delta on admin mutations, F-682).
149
- */
150
- reset?: (ctx: {
151
- domain: TDomain;
152
- reportDelta: (delta: RecorderEvent["state_delta"]) => void;
153
- }) => unknown | Promise<unknown>;
154
- /**
155
- * Implements POST /admin/seed. The seed body is Zod-parsed via
156
- * `definition.seed` first; `reportDelta` stamps the event's `state_delta`.
157
- */
158
- seed?: (ctx: {
159
- domain: TDomain;
160
- seed: TSeed;
161
- reportDelta: (delta: RecorderEvent["state_delta"]) => void;
162
- }) => unknown | Promise<unknown>;
163
- /**
164
- * Whether /admin/reset|seed land on the recorder tape. Default true
165
- * (github/slack frozen tapes record admin events); stripe pins false —
166
- * its pre-port recorder never saw admin traffic.
167
- */
168
- recorded?: boolean;
169
- /**
170
- * Per-surface error projection for /admin/reset|seed. Pre-port slack's
171
- * admin handlers answered EVERY thrown error with 500
172
- * {ok:false, error:"internal_error", warning} — bypassing the session
173
- * envelope. Defaults to the twin's `errorEnvelope`.
174
- */
175
- errorEnvelope?: (err: unknown) => {
176
- status: number;
177
- body: unknown;
178
- };
179
- /**
180
- * The twin's admin-gate 403 envelope (slack pins
181
- * `{ok:false, error:"restricted_action"}`). Gate mechanism —
182
- * TWIN_ADMIN_TOKEN mode, loopback socket check — stays in the engine
183
- * (`packages/sdk/src/admin-gate.ts`); this is pure shape. Defaults to the
184
- * generic `{message: "Forbidden"}` envelope.
185
- */
186
- forbidden?: () => {
187
- status: number;
188
- body: unknown;
189
- };
190
- }
191
- export interface TwinDefinition<TDb = unknown, TSeed = unknown, TDomain = unknown> {
192
- id: string;
193
- version: string;
194
- fidelity: TwinFidelity;
195
- seed?: z.ZodType<TSeed>;
196
- domain: (ctx: {
197
- db: TDb;
198
- seed: TSeed | undefined;
199
- }) => TDomain;
200
- routes?: RouteRegistrar<TDomain>;
201
- tools: ToolSpec<TDomain>[];
202
- /**
203
- * Optional state introspection for `GET /s/:sid/_pome/state`. If absent,
204
- * the route returns a 501 envelope so consumers fail loudly instead of
205
- * silently reading an empty state. `session` is the bearer-resolved
206
- * session for the request, so account-scoped twins (stripe) can export
207
- * only the calling session's slice (F-684).
208
- */
209
- state?: (ctx: {
210
- domain: TDomain;
211
- session?: import("./auth.js").SessionValue;
212
- }) => unknown | Promise<unknown>;
213
- /**
214
- * Optional admin handlers for `/admin/reset` and `/admin/seed`. If absent,
215
- * the routes still mount (with the localhost guard) and return a 501
216
- * envelope explaining that the twin did not configure them.
217
- */
218
- admin?: AdminHandlers<TDomain, TSeed>;
219
- /**
220
- * Optional error-envelope projector. Called from the recorder middleware
221
- * catch path to convert a thrown error into the `{ status, body }` shape
222
- * the route returns. API-mirroring twins use this to preserve the
223
- * upstream API's error shape (e.g. Stripe's nested `{ error: { type,
224
- * code, message, doc_url } }`, GitHub's `{ message, documentation_url,
225
- * status, errors[] }`). Defaults to a generic `{ message, errors? }`
226
- * envelope.
227
- */
228
- errorEnvelope?: (err: unknown) => {
229
- status: number;
230
- body: unknown;
231
- };
232
- /**
233
- * `/healthz` `implementation` field (runtime contract). Defaults to
234
- * `"<id>_clone"`.
235
- */
236
- implementation?: string;
237
- /**
238
- * npm package name reported in the `/healthz` `runtime` block. Defaults
239
- * to `"@pome-sh/twin-<id>"`.
240
- */
241
- packageName?: string;
242
- /**
243
- * Extra `/healthz` fields merged over the contract core
244
- * `{ok, twin, implementation, tools, runtime}`. When absent the engine
245
- * adds `{version, fidelity}`; a twin with a frozen healthz shape supplies
246
- * its own extras (possibly `{}` to omit both).
247
- */
248
- healthz?: () => Record<string, unknown>;
249
- /**
250
- * The twin's 501 loud-unsupported envelope for unknown session routes.
251
- * Defaults to the generic `{message, fidelity, method, path}` body.
252
- */
253
- unsupported?: (ctx: {
254
- method: string;
255
- path: string;
256
- }) => {
257
- status: number;
258
- body: unknown;
259
- };
260
- /**
261
- * Per-twin request-body reader for the engine-owned JSON surfaces
262
- * (`/admin/seed`, legacy `/mcp/call`, `/mcp/tools/:name`). Defaults to
263
- * strict JSON — malformed bodies throw `SyntaxError` into the twin's
264
- * `errorEnvelope`. Twins with frozen tolerant/form parsing pass their
265
- * pre-port reader (slack `parseFormOrJson`, stripe form-or-JSON).
266
- */
267
- bodyReader?: (c: import("hono").Context) => Promise<unknown>;
268
- /**
269
- * Session-wide middleware slot mounted immediately after bearer auth and
270
- * BEFORE the engine's MCP / `/_pome/*` routes — the pre-port
271
- * `session.use("*")` position (stripe registers failure-injection and
272
- * idempotency here so they cover MCP dispatch too). Register `use()`
273
- * middleware only; routes belong in `routes`.
274
- */
275
- middleware?: RouteRegistrar<TDomain>;
276
- /**
277
- * Legacy `POST /mcp/call` dispatch pins (F-683 review): slack's frozen
278
- * surface accepts `{name}`/`{params}` as aliases of `{tool}`/`{arguments}`
279
- * and answers a body naming no tool with its own envelope instead of the
280
- * strict-parse error.
281
- */
282
- legacyMcp?: {
283
- aliases?: boolean;
284
- missingTool?: () => {
285
- status: number;
286
- body: unknown;
287
- };
288
- };
289
- /**
290
- * Extra `/s/:sid/_pome/health` fields merged over the contract core
291
- * `{ok, twin}`. When absent the engine adds `{version, fidelity}`; a twin
292
- * with a frozen per-session health shape (slack: bare {ok, twin};
293
- * github: implementation, fidelity, runtime — no version) supplies its
294
- * own extras. The hook receives the app's recorder so counters can be
295
- * surfaced (stripe).
296
- */
297
- pomeHealth?: (ctx: {
298
- recorder: RecorderHandle;
299
- }) => Record<string, unknown>;
300
- /**
301
- * Extra per-twin GET routes under the reserved `/s/:sid/_pome/*` session
302
- * namespace, keyed by subpath (github's frozen
303
- * `GET /s/:sid/_pome/access-control`). Handlers return the JSON body;
304
- * the engine mounts them behind bearer auth, after its own core routes.
305
- * The core names (`health`, `state`, `events`) stay engine-owned — a twin
306
- * declaring one refuses to boot.
307
- */
308
- pomeRoutes?: Record<string, (ctx: {
309
- domain: TDomain;
310
- }) => unknown | Promise<unknown>>;
311
- /**
312
- * FDRS-402 adapter-rich stamping pin: when true, every recorded event
313
- * persists the incoming `x-pome-correlation-id` header as `tool_call_id`
314
- * (github's frozen tape shape). Defaults to false — slack's frozen tape
315
- * stamps null. Flipping a twin is a deliberate tape-shape change.
316
- */
317
- stampToolCallId?: boolean;
318
- /**
319
- * JSON-RPC `tools/call` unknown-tool result body (frozen per-twin wire
320
- * shape). Defaults to the twin's `errorEnvelope` projection of
321
- * `UnknownToolError` (slack/stripe). github pins the pre-port
322
- * `{message: "Unknown tool: <name>"}` text — its legacy `/mcp/call`
323
- * surface keeps the 422 validation envelope from `errorEnvelope`.
324
- */
325
- mcpUnknownTool?: (name: string) => unknown;
326
- /**
327
- * Whether the engine mounts `GET /s/:sid/healthz` (200 `{ok, sid}`).
328
- * Default true. Stripe pins false — its frozen contract has NO
329
- * per-session healthz; the path falls to the 501 catch-all. Flipping a
330
- * twin is a contract change (CONTRACT.md + suite in one PR).
331
- */
332
- sessionHealthz?: boolean;
333
- /**
334
- * Also mount the session router at the root path. Stripe's frozen F3
335
- * SDK-compat surface: real `stripe-node`/`stripe-python` build URLs like
336
- * `/v1/payment_intents` with no way to inject a `/s/:sid` prefix, so the
337
- * bearer alone resolves the session (pair with `auth.requirePathSid:
338
- * false`). Root `/healthz` and `/admin/*` are registered first and stay
339
- * first-match. Default false.
340
- */
341
- mountSessionAtRoot?: boolean;
342
- /**
343
- * Per-twin auth declarations (F-712): token shape, error envelopes, extra
344
- * token locations, raw-bearer / sid-mismatch pins, credential lookup.
345
- * Mechanism lives in the engine's `bearerAuth`; this is pure shape.
346
- */
347
- auth?: import("./auth.js").BearerAuthOptions;
348
- /**
349
- * Optional pre-redaction projection applied to every recorded event
350
- * before the central secret scrubber. Use to replace large/binary
351
- * payloads (e.g. MIME/attachment bytes) with bounded digests. When
352
- * unset, recording behavior is unchanged.
353
- */
354
- recordingProjection?: (event: RecorderEvent) => RecorderEvent;
355
- }
356
- export declare class TwinManifestError extends Error {
357
- readonly issues: ReadonlyArray<z.core.$ZodIssue>;
358
- constructor(message: string, issues?: ReadonlyArray<z.core.$ZodIssue>);
359
- }
360
- /**
361
- * Define a twin manifest. Runs Zod meta-validation at the call site
362
- * (typically module-load time) and throws `TwinManifestError` on shape
363
- * violations or duplicate tool names.
364
- */
365
- export declare function defineTwin<TDb = unknown, TSeed = unknown, TDomain = unknown>(spec: TwinDefinition<TDb, TSeed, TDomain>): TwinDefinition<TDb, TSeed, TDomain>;
366
- /**
367
- * Path prefixes the SDK reserves under `/s/:sid`. User routes that match or
368
- * start with these are rejected at boot per OQ-B6 (`/_pome/*` shadow
369
- * detection). `/mcp/*` is reserved for the same reason — community twins
370
- * cannot silently override the MCP dispatch surface.
371
- */
372
- export declare const RESERVED_SESSION_PREFIXES: readonly ["/_pome", "/mcp"];