@uniqbit/mate-core 0.18.5 → 1.0.0-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/marketplace.json +14 -0
  2. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +8 -0
  3. package/claude-capability-plugins/companion-mentions/hooks/companion.ts +457 -0
  4. package/claude-capability-plugins/companion-mentions/hooks/hooks.json +1 -0
  5. package/claude-capability-plugins/companion-mentions/hooks/register.ts +403 -0
  6. package/claude-plugin/hooks/companion-instructions.mjs +9 -0
  7. package/claude-plugin/hooks/hooks.json +21 -2
  8. package/claude-plugin/hooks/tokensave-route.mjs +52 -0
  9. package/opencode-plugin/src/server.ts +4 -0
  10. package/opencode-plugin/src/tui.tsx +2 -0
  11. package/opencode-plugin/tui.tsx +2 -0
  12. package/package.json +52 -15
  13. package/src/brand/art.generated.ts +69 -0
  14. package/src/brand/index.ts +12 -0
  15. package/src/brand/palette.ts +19 -0
  16. package/src/brand/svg.generated.ts +8 -0
  17. package/src/brand/terminal.ts +88 -0
  18. package/src/brand/types.ts +33 -0
  19. package/src/cli/commands/artifact/apply-context.ts +275 -0
  20. package/src/cli/commands/artifact/artifact.ts +12 -0
  21. package/src/cli/commands/artifact/delivery/archive.ts +125 -0
  22. package/src/cli/commands/artifact/delivery/branch-flags.ts +55 -0
  23. package/src/cli/commands/artifact/delivery/environment.ts +127 -0
  24. package/src/cli/commands/artifact/delivery/link.ts +174 -0
  25. package/src/cli/commands/artifact/delivery/output.ts +89 -0
  26. package/src/cli/commands/artifact/finish/command.ts +83 -8
  27. package/src/cli/commands/artifact/finish/engine.ts +91 -14
  28. package/src/cli/commands/artifact/finish/finisher.ts +10 -0
  29. package/src/cli/commands/artifact/finish/git.ts +132 -19
  30. package/src/cli/commands/artifact/finish/openspec.ts +182 -138
  31. package/src/cli/commands/artifact/finish/secret-scan.ts +43 -0
  32. package/src/cli/commands/artifact/finish/worktree-cleanup.ts +92 -0
  33. package/src/cli/commands/artifact/pending/command.ts +31 -3
  34. package/src/cli/commands/artifact/pending/discovery.ts +21 -57
  35. package/src/cli/commands/cap/graphify.ts +52 -3
  36. package/src/cli/commands/cap/index-cmd.ts +71 -15
  37. package/src/cli/commands/cap/openspec.ts +13 -25
  38. package/src/cli/commands/cap/tokensave.ts +7 -5
  39. package/src/cli/commands/companion/link.ts +14 -1
  40. package/src/cli/commands/companion/open.ts +68 -46
  41. package/src/cli/commands/companion/sync.ts +10 -0
  42. package/src/cli/commands/companion/tui.ts +17 -7
  43. package/src/cli/commands/companion/update.ts +143 -48
  44. package/src/cli/commands/doctor.ts +195 -7
  45. package/src/cli/commands/factory/factory.ts +301 -0
  46. package/src/cli/commands/install.ts +133 -9
  47. package/src/cli/commands/launch/shared.ts +16 -11
  48. package/src/cli/commands/plugin/install.ts +9 -4
  49. package/src/cli/commands/plugin/plugin.ts +3 -2
  50. package/src/cli/commands/report/adapter.ts +11 -2
  51. package/src/cli/commands/report/contract.ts +21 -0
  52. package/src/cli/commands/report/highlight.ts +34 -4
  53. package/src/cli/commands/report/index.ts +20 -1
  54. package/src/cli/commands/report/markdown.ts +110 -0
  55. package/src/cli/commands/report/palette.ts +118 -0
  56. package/src/cli/commands/report/renderer.ts +456 -153
  57. package/src/cli/commands/report/types.ts +16 -0
  58. package/src/cli/commands/session/context.ts +102 -0
  59. package/src/cli/commands/setup.ts +50 -24
  60. package/src/cli/commands/studio/factory-credential.ts +49 -0
  61. package/src/cli/commands/studio/index.ts +29 -2
  62. package/src/cli/commands/studio/openspec-cli.ts +10 -58
  63. package/src/cli/commands/studio/payload.ts +249 -15
  64. package/src/cli/commands/studio/routes.ts +41 -6
  65. package/src/cli/commands/studio/selection.ts +161 -17
  66. package/src/cli/commands/studio/server.ts +404 -324
  67. package/src/cli/commands/studio/services.ts +60 -0
  68. package/src/cli/commands/studio/studio-app.ts +67 -0
  69. package/src/cli/commands/studio/terminal-assets.ts +21 -33
  70. package/src/cli/commands/studio/terminal.ts +85 -15
  71. package/src/cli/commands/studio/views/model.ts +18 -0
  72. package/src/cli/commands/studio/views/vault/markdown-tree.ts +267 -0
  73. package/src/cli/commands/studio/views/vault/view.ts +185 -0
  74. package/src/cli/commands/studio/workset-session.ts +131 -0
  75. package/src/cli/commands/unwrap.ts +8 -0
  76. package/src/cli/commands/update.ts +27 -1
  77. package/src/cli/commands/working/cleanup.ts +10 -1
  78. package/src/cli/commands/working/link.ts +76 -0
  79. package/src/cli/commands/working/working.ts +10 -0
  80. package/src/cli/commands/working/worktree.ts +356 -0
  81. package/src/cli/commands/wrap.ts +5 -13
  82. package/src/cli/companion-link-wizard.tsx +2 -0
  83. package/src/cli/companion-selector.tsx +2 -0
  84. package/src/cli/confirm.ts +2 -0
  85. package/src/cli/install-plan.tsx +127 -160
  86. package/src/cli/launch-selector.tsx +2 -0
  87. package/src/cli/main.ts +22 -1
  88. package/src/cli/parse-flags.ts +32 -6
  89. package/src/cli/repo-list-table.tsx +2 -0
  90. package/src/cli/setup-selector.tsx +86 -151
  91. package/src/cli/usage.ts +14 -0
  92. package/src/create-mate.ts +5 -4
  93. package/src/hooks/companion-instructions.ts +190 -0
  94. package/src/hooks/hook-io.ts +63 -0
  95. package/src/hooks/session-banner.ts +21 -29
  96. package/src/hooks/session-guidance.ts +9 -17
  97. package/src/hooks/session-prepare.ts +115 -28
  98. package/src/hooks/tokensave-route.ts +26 -0
  99. package/src/hooks/validate-artifact-path.ts +82 -24
  100. package/src/index.ts +4 -0
  101. package/src/lib/apply-context/fingerprint.ts +174 -0
  102. package/src/lib/apply-context/protocol.ts +193 -0
  103. package/src/lib/change-layout.ts +154 -0
  104. package/src/lib/components/confirm-prompt.tsx +21 -9
  105. package/src/lib/components/select-menu.tsx +10 -3
  106. package/src/lib/components/spinner.tsx +4 -2
  107. package/src/lib/components/startup-progress.tsx +227 -41
  108. package/src/lib/components/text-input-display.tsx +2 -0
  109. package/src/lib/components/wizard-footer.tsx +2 -0
  110. package/src/lib/components/wizard-header.tsx +16 -12
  111. package/src/lib/context-mode-package.ts +24 -11
  112. package/src/lib/delivery/archive-change.ts +166 -0
  113. package/src/lib/delivery/branches.ts +132 -0
  114. package/src/lib/delivery/environment.ts +35 -0
  115. package/src/lib/delivery/forge.ts +279 -0
  116. package/src/lib/delivery/merge-git.ts +261 -0
  117. package/src/lib/delivery/overlap.ts +209 -0
  118. package/src/lib/delivery/record-delivery.ts +283 -0
  119. package/src/lib/delivery/record.ts +403 -0
  120. package/src/lib/delivery/refresh.ts +268 -0
  121. package/src/lib/delivery/repository-access.ts +141 -0
  122. package/src/lib/delivery/resolve-branch.ts +162 -0
  123. package/src/lib/delivery/stages.ts +111 -0
  124. package/src/lib/delivery/token.ts +24 -0
  125. package/src/lib/factory/attach-client.ts +113 -0
  126. package/src/lib/factory/attach.ts +178 -0
  127. package/src/lib/factory/broker.ts +190 -0
  128. package/src/lib/factory/bun-commands.ts +39 -0
  129. package/src/lib/factory/client.ts +92 -0
  130. package/src/lib/factory/command.ts +61 -0
  131. package/src/lib/factory/credential-store.ts +153 -0
  132. package/src/lib/factory/frames.ts +77 -0
  133. package/src/lib/factory/ids.ts +58 -0
  134. package/src/lib/factory/keyed-serial.ts +27 -0
  135. package/src/lib/factory/outcomes/actions.ts +114 -0
  136. package/src/lib/factory/outcomes/index.ts +381 -0
  137. package/src/lib/factory/outcomes/lifecycle.ts +205 -0
  138. package/src/lib/factory/outcomes/runs.ts +81 -0
  139. package/src/lib/factory/outcomes/sessions.ts +38 -0
  140. package/src/lib/factory/prepare.ts +49 -0
  141. package/src/lib/factory/pty.ts +103 -0
  142. package/src/lib/factory/runner/companion-context.ts +178 -0
  143. package/src/lib/factory/runner/control.ts +92 -0
  144. package/src/lib/factory/runner/harness-agent.ts +250 -0
  145. package/src/lib/factory/runner/live.ts +159 -0
  146. package/src/lib/factory/runner/questions.ts +22 -0
  147. package/src/lib/factory/runner/rank.ts +26 -0
  148. package/src/lib/factory/runner/run-policy.ts +12 -0
  149. package/src/lib/factory/runner/run.ts +199 -0
  150. package/src/lib/factory/runner/scheduler.ts +416 -0
  151. package/src/lib/factory/runner/state.ts +233 -0
  152. package/src/lib/factory/runner/workflow.ts +542 -0
  153. package/src/lib/factory/runtime.ts +972 -0
  154. package/src/lib/factory/sandbox.ts +292 -0
  155. package/src/lib/factory/worktree-branch.ts +17 -0
  156. package/src/lib/frontmatter.ts +18 -0
  157. package/src/lib/install.ts +66 -14
  158. package/src/lib/live-progress.ts +36 -0
  159. package/src/lib/member-choices.ts +67 -0
  160. package/src/lib/opencode-plugin-package.ts +5 -5
  161. package/src/lib/openspec-cli.ts +116 -0
  162. package/src/lib/openspec-scopes.ts +86 -0
  163. package/src/lib/orchestrator/adapters/base.ts +55 -22
  164. package/src/lib/orchestrator/adapters/claude-args.ts +50 -0
  165. package/src/lib/orchestrator/adapters/claude.ts +54 -41
  166. package/src/lib/orchestrator/adapters/opencode.ts +2 -0
  167. package/src/lib/orchestrator/config-store.ts +3 -2
  168. package/src/lib/orchestrator/editor.ts +31 -25
  169. package/src/lib/orchestrator/openspec-store.ts +14 -54
  170. package/src/lib/orchestrator/projection-claude-commands.ts +36 -0
  171. package/src/lib/orchestrator/projection-claude-links.ts +159 -0
  172. package/src/lib/orchestrator/projection-claude-skills.ts +19 -137
  173. package/src/lib/orchestrator/projection-entries.ts +100 -34
  174. package/src/lib/orchestrator/projection-opencode-copies.ts +32 -15
  175. package/src/lib/orchestrator/projection-openspec-store.ts +54 -9
  176. package/src/lib/orchestrator/projection-runtime-documents.ts +15 -6
  177. package/src/lib/orchestrator/projection-types.ts +36 -1
  178. package/src/lib/orchestrator/refresh-working-claude-links.ts +87 -0
  179. package/src/lib/orchestrator/session-context-link.ts +67 -0
  180. package/src/lib/orchestrator/session-prepare.ts +45 -5
  181. package/src/lib/orchestrator/setup-compatibilities.ts +56 -70
  182. package/src/lib/orchestrator/types.ts +7 -2
  183. package/src/lib/orchestrator/working-repo-projection.ts +50 -7
  184. package/src/lib/orchestrator/workspace-document.ts +105 -0
  185. package/src/lib/orchestrator/wrap-pass.ts +22 -1
  186. package/src/lib/package-paths.ts +37 -0
  187. package/src/lib/runtime-directory-refresh.ts +17 -1
  188. package/src/lib/workset/record.ts +513 -0
  189. package/src/lib/workset/repositories.ts +55 -0
  190. package/src/lib/workset/stage.ts +148 -0
  191. package/src/lib/workset/stages.ts +113 -0
  192. package/src/lib/workset/worktree-index.ts +116 -0
  193. package/src/lib/workset/worktree.ts +830 -0
  194. package/src/opencode/companion-hooks.ts +109 -7
  195. package/src/opencode/companion-policy.ts +37 -18
  196. package/src/opencode/enter-worktree.ts +72 -0
  197. package/src/opencode/projected-guidance.ts +4 -1
  198. package/src/opencode/session-prepare.ts +2 -1
  199. package/src/opencode/tui.tsx +13 -6
  200. package/src/plugins.ts +1 -0
  201. package/src/runtime/artifact-refusal.ts +63 -0
  202. package/src/runtime/claude-delivery-plan.ts +107 -8
  203. package/src/runtime/commit-attribution-guard.ts +181 -0
  204. package/src/runtime/companion-git.ts +52 -10
  205. package/src/runtime/companion-guidance.ts +20 -8
  206. package/src/runtime/companion-instructions.ts +340 -0
  207. package/src/runtime/companion-lock.ts +30 -7
  208. package/src/runtime/env.ts +48 -3
  209. package/src/runtime/error-message.ts +4 -0
  210. package/src/runtime/git-layout.ts +219 -0
  211. package/src/runtime/index.ts +29 -0
  212. package/src/runtime/managed-block.ts +117 -0
  213. package/src/runtime/markdown-scan.ts +266 -0
  214. package/src/runtime/physical-path.ts +111 -0
  215. package/src/runtime/policy.ts +50 -2
  216. package/src/runtime/projected-flag.ts +7 -0
  217. package/src/runtime/projected-guidance.ts +1 -0
  218. package/src/runtime/runtime-directory.ts +5 -0
  219. package/src/runtime/runtime-document-manifest.ts +62 -11
  220. package/src/runtime/secret-guard.ts +162 -0
  221. package/src/runtime/secret-patterns.ts +397 -0
  222. package/src/runtime/secret-scan.ts +90 -0
  223. package/src/runtime/session-context.ts +98 -0
  224. package/src/runtime/session-kind.ts +13 -0
  225. package/src/runtime/shell-heredoc.ts +81 -0
  226. package/src/runtime/tokensave-route.ts +152 -0
  227. package/src/runtime/wrap-state.ts +44 -2
  228. package/src/runtime/write-atomic.ts +64 -0
  229. package/src/studio.ts +124 -0
  230. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +14 -10
  231. package/src/templates/capabilities/openspec-cap/mate-minimal/templates/spec.md +3 -5
  232. package/src/templates/capabilities/openspec-cap/mate-v1/schema.yaml +18 -102
  233. package/src/templates/capabilities/openspec-cap/mate-v1/templates/spec.md +3 -5
  234. package/src/templates/capabilities/openspec-cap/openspec-conventions.yaml +20 -14
  235. package/src/templates/mate-skills/THIRD-PARTY-NOTICES.md +40 -0
  236. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +134 -0
  237. package/src/templates/mate-skills/agents/mate-apply-change/references/mate-compact-apply.md +47 -0
  238. package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +200 -0
  239. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +86 -0
  240. package/src/templates/mate-skills/{claude/mate-openspec-backfill → agents/mate-backfill-spec}/SKILL.md +11 -4
  241. package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +110 -0
  242. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +66 -0
  243. package/src/templates/mate-skills/agents/mate-explore-change/references/openspec-explore.md +350 -0
  244. package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +11 -4
  245. package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +2 -2
  246. package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +12 -5
  247. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +108 -0
  248. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +47 -0
  249. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-propose.md +169 -0
  250. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +103 -0
  251. package/src/templates/mate-skills/agents/{mate-artifact-publish → mate-publish-artifact}/SKILL.md +111 -24
  252. package/src/templates/mate-skills/{claude/mate-artifact-publish → agents/mate-publish-artifact}/references/openspec.md +8 -5
  253. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +95 -16
  254. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +87 -68
  255. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +134 -0
  256. package/src/templates/mate-skills/claude/mate-apply-change/references/mate-compact-apply.md +47 -0
  257. package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +200 -0
  258. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +86 -0
  259. package/src/templates/mate-skills/{agents/mate-openspec-backfill → claude/mate-backfill-spec}/SKILL.md +11 -4
  260. package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +110 -0
  261. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +66 -0
  262. package/src/templates/mate-skills/claude/mate-explore-change/references/openspec-explore.md +350 -0
  263. package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +11 -4
  264. package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +2 -2
  265. package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +12 -5
  266. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +108 -0
  267. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +47 -0
  268. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-propose.md +169 -0
  269. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +103 -0
  270. package/src/templates/mate-skills/claude/{mate-artifact-publish → mate-publish-artifact}/SKILL.md +111 -24
  271. package/src/templates/mate-skills/{agents/mate-artifact-publish → claude/mate-publish-artifact}/references/openspec.md +8 -5
  272. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +95 -16
  273. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +87 -68
  274. package/src/templates/mate-skills/openspec-references.ts +142 -0
  275. package/src/templates/root/TEMPLATE_AGENTS.md +2 -2
  276. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +3938 -391
  277. package/src/tools/setup/capabilities/companion-mentions.ts +27 -0
  278. package/src/tools/setup/capabilities/context-mode.ts +56 -7
  279. package/src/tools/setup/capabilities/graphify-gate.ts +31 -0
  280. package/src/tools/setup/capabilities/graphify-secrets.ts +243 -0
  281. package/src/tools/setup/capabilities/graphify.ts +46 -7
  282. package/src/tools/setup/capabilities/openspec.ts +163 -272
  283. package/src/tools/setup/capabilities/react-doctor.ts +8 -1
  284. package/src/tools/setup/capabilities/rtk.ts +4 -0
  285. package/src/tools/setup/capabilities/tokensave.ts +113 -71
  286. package/src/tools/setup/context-services.ts +9 -17
  287. package/src/tools/setup/dynamic-plugins/install.ts +24 -28
  288. package/src/tools/setup/engine.ts +100 -23
  289. package/src/tools/setup/install-contract.ts +8 -0
  290. package/src/tools/setup/managed-output.ts +51 -0
  291. package/src/tools/setup/mate-skill-copies.ts +51 -0
  292. package/src/tools/setup/mate.ts +86 -11
  293. package/src/tools/setup/package-managers/uv.ts +73 -11
  294. package/src/tools/setup/plugin.ts +40 -0
  295. package/src/tools/setup/plugins/guidance.ts +7 -4
  296. package/src/tools/setup/providers/agent-file-sections.ts +4 -2
  297. package/src/tools/setup/providers/claude-attribution.ts +65 -0
  298. package/src/tools/setup/providers/claude-plugin-folders.ts +625 -0
  299. package/src/tools/setup/providers/claude-plugin-hooks.ts +51 -19
  300. package/src/tools/setup/providers/claude-worktree-plugins.ts +122 -0
  301. package/src/tools/setup/providers/claude.ts +290 -8
  302. package/src/tools/setup/providers/opencode.ts +180 -1
  303. package/src/tools/setup/utils.ts +18 -4
  304. package/src/tools/setup/working-repo-cleanup.ts +29 -1
  305. package/src/tools/setup/working-repo-local-state.ts +252 -75
  306. package/src/tools/setup.ts +183 -26
  307. package/studio-dist/client/assets/companion-view-Csva26Ir.js +1 -0
  308. package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +1 -0
  309. package/studio-dist/client/assets/dist-Dm7MtyHc.js +5 -0
  310. package/studio-dist/client/assets/factory-B7l9ZQyx.js +4 -0
  311. package/studio-dist/client/assets/index-n6uo_92S.js +40 -0
  312. package/studio-dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
  313. package/studio-dist/client/assets/prepaint-CD5OpmTM.js +24 -0
  314. package/studio-dist/client/assets/queries-CN3JwMBX.js +1 -0
  315. package/studio-dist/client/assets/react-CabXf2Ds.js +1 -0
  316. package/studio-dist/client/assets/report-time-Dc-KOqQu.js +1 -0
  317. package/studio-dist/client/assets/reports-C01RsnMA.js +1 -0
  318. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +1 -0
  319. package/studio-dist/client/assets/routes-4pbC-2Hj.js +1 -0
  320. package/studio-dist/client/assets/skills-CihQganl.js +1 -0
  321. package/studio-dist/client/assets/spec-areas-C2L48N4C.js +1 -0
  322. package/studio-dist/client/assets/specs-D24_35_K.js +1 -0
  323. package/studio-dist/client/assets/studio-DKxfi691.css +1 -0
  324. package/studio-dist/client/assets/studio-queries-rvbJupCy.js +3 -0
  325. package/studio-dist/client/assets/terminal-eU5fzQzv.css +1 -0
  326. package/studio-dist/client/assets/vault-Bd4CQiTK.js +1 -0
  327. package/studio-dist/client/assets/warnings-V_Ys51wJ.js +1 -0
  328. package/studio-dist/client/assets/wasm-inline-C2en61B5.js +1 -0
  329. package/studio-dist/client/assets/workflow-BJejeVwQ.js +1 -0
  330. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-BQKuMdJW.js +3881 -0
  331. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +85 -0
  332. package/studio-dist/server/assets/actions-Bvgj9eb8.js +54 -0
  333. package/studio-dist/server/assets/actions-D8erOphH.js +44 -0
  334. package/studio-dist/server/assets/companion-view-aBady57v.js +33 -0
  335. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +459 -0
  336. package/studio-dist/server/assets/createServerRpc-tK2lE9R2.js +11 -0
  337. package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +778 -0
  338. package/studio-dist/server/assets/dist-DpJWKyCm.js +5582 -0
  339. package/studio-dist/server/assets/empty-plugin-adapters-Cipd4ZH4.js +4 -0
  340. package/studio-dist/server/assets/factory-D6xnjedJ.js +2385 -0
  341. package/studio-dist/server/assets/factory-DT3UzHlh.js +68 -0
  342. package/studio-dist/server/assets/model-PyPALjii.js +18 -0
  343. package/studio-dist/server/assets/prepaint-BMke0fo1.js +41 -0
  344. package/studio-dist/server/assets/queries-Ag2iL8q2.js +107 -0
  345. package/studio-dist/server/assets/react-COs0LHn-.js +51 -0
  346. package/studio-dist/server/assets/report-time-DAfzln-N.js +8 -0
  347. package/studio-dist/server/assets/reports-BnUNJVtx.js +126 -0
  348. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +34 -0
  349. package/studio-dist/server/assets/router-BH--drIx.js +4298 -0
  350. package/studio-dist/server/assets/routes-khSDK1bV.js +361 -0
  351. package/studio-dist/server/assets/search-JAKurDNh.js +36 -0
  352. package/studio-dist/server/assets/shell-CboT2f66.js +51 -0
  353. package/studio-dist/server/assets/skills-MWYnWoKs.js +106 -0
  354. package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +16 -0
  355. package/studio-dist/server/assets/specs-DE3w8hZP.js +155 -0
  356. package/studio-dist/server/assets/start-BW5ovN0k.js +33 -0
  357. package/studio-dist/server/assets/studio-BeltxxKt.js +216 -0
  358. package/studio-dist/server/assets/studio-queries-CLnP9kGu.js +3365 -0
  359. package/studio-dist/server/assets/utils-C9CX1kcy.js +221 -0
  360. package/studio-dist/server/assets/vault-BGulVoNh.js +70 -0
  361. package/studio-dist/server/assets/vault-CuyyhLyB.js +832 -0
  362. package/studio-dist/server/assets/views-Bd7cRr27.js +82 -0
  363. package/studio-dist/server/assets/warnings-BH05rOuG.js +15 -0
  364. package/studio-dist/server/assets/wasm-inline-CNeBKGwC.js +3 -0
  365. package/studio-dist/server/assets/workflow-BSuIKWqH.js +42 -0
  366. package/studio-dist/server/server.js +16220 -0
  367. package/wrappers/bin/graphify +52 -4
  368. package/wrappers/bin/openspec +33 -9
  369. package/wrappers/lib/graphify-gate.mjs +8 -0
  370. package/src/cli/commands/studio/views/client.ts +0 -654
  371. package/src/cli/commands/studio/views/companion-picker.tsx +0 -95
  372. package/src/cli/commands/studio/views/companion-selector.tsx +0 -94
  373. package/src/cli/commands/studio/views/dashboard/changes.tsx +0 -107
  374. package/src/cli/commands/studio/views/dashboard/index.tsx +0 -19
  375. package/src/cli/commands/studio/views/document.tsx +0 -842
  376. package/src/cli/commands/studio/views/error.tsx +0 -20
  377. package/src/cli/commands/studio/views/reports/index.tsx +0 -49
  378. package/src/cli/commands/studio/views/selection-fields.tsx +0 -14
  379. package/src/cli/commands/studio/views/skills/index.tsx +0 -87
  380. package/src/cli/commands/studio/views/specs/index.tsx +0 -157
  381. package/src/cli/commands/studio/views/styles.ts +0 -519
  382. package/src/cli/commands/studio/views/terminal.tsx +0 -484
  383. package/src/cli/commands/studio/views/vault/state.ts +0 -43
  384. package/src/cli/commands/studio/views/warnings.tsx +0 -21
  385. package/src/cli/commands/studio/views/workflow/index.tsx +0 -21
  386. package/src/cli/commands/studio/views/workflow/steps.ts +0 -337
  387. package/src/cli/commands/studio/views/workflow/transcript.tsx +0 -190
  388. package/src/lib/components/theme.ts +0 -2
  389. package/src/tools/setup/git-utils.ts +0 -30
  390. package/src/tools/setup/runtime-documents.ts +0 -291
@@ -0,0 +1,85 @@
1
+ // \0tanstack-start-manifest:v
2
+ var tsrStartManifest = () => ({ routes: {
3
+ __root__: {
4
+ filePath: "src/routes/__root.tsx",
5
+ children: [
6
+ "/",
7
+ "/factory",
8
+ "/reports",
9
+ "/skills",
10
+ "/specs",
11
+ "/vault",
12
+ "/workflow"
13
+ ],
14
+ preloads: [
15
+ "/assets/index-n6uo_92S.js",
16
+ "/assets/rolldown-runtime-WkwZ5CU-.js",
17
+ "/assets/studio-queries-rvbJupCy.js",
18
+ "/assets/prepaint-CD5OpmTM.js",
19
+ "/assets/queries-CN3JwMBX.js",
20
+ "/assets/react-CabXf2Ds.js",
21
+ "/assets/preload-helper-BLdHbfdN.js"
22
+ ],
23
+ scripts: [{ attrs: {
24
+ type: "module",
25
+ async: !0,
26
+ src: "/assets/index-n6uo_92S.js"
27
+ } }]
28
+ },
29
+ "/": {
30
+ filePath: "src/routes/index.tsx",
31
+ children: void 0,
32
+ preloads: [
33
+ "/assets/routes-4pbC-2Hj.js",
34
+ "/assets/companion-view-Csva26Ir.js",
35
+ "/assets/spec-areas-C2L48N4C.js",
36
+ "/assets/report-time-Dc-KOqQu.js",
37
+ "/assets/warnings-V_Ys51wJ.js"
38
+ ]
39
+ },
40
+ "/factory": {
41
+ filePath: "src/routes/factory.tsx",
42
+ children: void 0,
43
+ preloads: [
44
+ "/assets/factory-B7l9ZQyx.js",
45
+ "/assets/warnings-V_Ys51wJ.js",
46
+ "/assets/delivery-path-DJMpRmiY.js"
47
+ ]
48
+ },
49
+ "/reports": {
50
+ filePath: "src/routes/reports.tsx",
51
+ children: void 0,
52
+ preloads: ["/assets/reports-C01RsnMA.js", "/assets/report-time-Dc-KOqQu.js"]
53
+ },
54
+ "/skills": {
55
+ filePath: "src/routes/skills.tsx",
56
+ children: void 0,
57
+ preloads: ["/assets/skills-CihQganl.js", "/assets/companion-view-Csva26Ir.js"]
58
+ },
59
+ "/specs": {
60
+ filePath: "src/routes/specs.tsx",
61
+ children: void 0,
62
+ preloads: [
63
+ "/assets/specs-D24_35_K.js",
64
+ "/assets/companion-view-Csva26Ir.js",
65
+ "/assets/warnings-V_Ys51wJ.js",
66
+ "/assets/spec-areas-C2L48N4C.js"
67
+ ]
68
+ },
69
+ "/vault": {
70
+ filePath: "src/routes/vault.tsx",
71
+ children: void 0,
72
+ preloads: ["/assets/vault-Bd4CQiTK.js"]
73
+ },
74
+ "/workflow": {
75
+ filePath: "src/routes/workflow.tsx",
76
+ children: void 0,
77
+ preloads: [
78
+ "/assets/workflow-BJejeVwQ.js",
79
+ "/assets/companion-view-Csva26Ir.js",
80
+ "/assets/warnings-V_Ys51wJ.js",
81
+ "/assets/delivery-path-DJMpRmiY.js"
82
+ ]
83
+ }
84
+ } });
85
+ export { tsrStartManifest };
@@ -0,0 +1,54 @@
1
+ // ../mate-core/src/lib/factory/runner/run-policy.ts
2
+ /** Shared run predicates; safe for the browser's Outcome policy. */
3
+ function retryRefusal(id, state) {
4
+ return state === "failed" || state === "interrupted" ? null : `Workset ${id} has no failed or interrupted run to retry`;
5
+ }
6
+ // ../mate-core/src/lib/factory/outcomes/actions.ts
7
+ /** Every action a person can take on an Outcome. None sets a stage. */
8
+ var OUTCOME_ACTIONS = [
9
+ "start",
10
+ "later",
11
+ "answer",
12
+ "take-control",
13
+ "return",
14
+ "retry",
15
+ "cancel",
16
+ "feedback",
17
+ "regenerate",
18
+ "start-apply",
19
+ "publish"
20
+ ];
21
+ /** Why an action needing the AFK runner is refused for a companion the factory does not run. */
22
+ var NO_RUNNER_REFUSAL = "the AFK runner needs the appliance's factory mode for this companion";
23
+ /**
24
+ * Why the factory refuses `action` on this Outcome now, or `null` when it accepts it. Checks
25
+ * the factory can only make at the time, such as a live terminal session, come on top.
26
+ */
27
+ function outcomeRefusal(action, workset, run, companion) {
28
+ const { id, stage, stageLabel } = workset;
29
+ const state = run?.state ?? "idle";
30
+ switch (action) {
31
+ case "start":
32
+ case "later": return stage === "done" ? `Workset ${id} is done` : null;
33
+ }
34
+ if (!companion.runner) return NO_RUNNER_REFUSAL;
35
+ switch (action) {
36
+ case "answer": return state === "waiting" ? null : "this question was already answered";
37
+ case "take-control":
38
+ if (!run?.conversation) return "this Outcome has no factory conversation to take over";
39
+ if (run.control) return "a person already has, or asked for, this Outcome's conversation";
40
+ return stage === "done" ? `Workset ${id} is done` : null;
41
+ case "return": return run?.control && run.control.mode !== "automatic" ? null : "the factory already drives this Outcome";
42
+ case "retry": return retryRefusal(id, state);
43
+ case "cancel": return state === "queued" || state === "running" ? null : `Workset ${id} has no run to cancel`;
44
+ case "feedback": return stage === "human-review" || stage === "apply" || stage === "merge-wait" ? null : `Workset ${id} takes no feedback at ${stageLabel}; start a new outcome instead`;
45
+ case "regenerate":
46
+ case "start-apply": return stage === "human-review" ? null : `Workset ${id} is not in the Human Reviews; it is at ${stageLabel}`;
47
+ case "publish": return stage === "publish" ? null : `Workset ${id} is not merged and archived; it is at ${stageLabel}`;
48
+ }
49
+ }
50
+ /** The actions the factory accepts on this Outcome now; the board offers no others. */
51
+ function outcomeActions(workset, run, companion) {
52
+ return new Set(OUTCOME_ACTIONS.filter((action) => outcomeRefusal(action, workset, run, companion) === null));
53
+ }
54
+ export { outcomeActions as n, OUTCOME_ACTIONS as t };
@@ -0,0 +1,44 @@
1
+ // ../mate-core/src/cli/commands/studio/actions.ts
2
+ /** Lowercase letters, digits and hyphens, so a subject can never carry shell syntax or a flag. */
3
+ var SUBJECT_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
4
+ var STUDIO_ACTIONS = [{
5
+ id: "show-me",
6
+ skill: "mate-show-me",
7
+ label: "Show me",
8
+ subject: "spec",
9
+ prompts: {
10
+ claude: (subject) => `/mate-show-me ${subject}`,
11
+ opencode: (subject) => `Use the mate-show-me skill on spec ${subject}.`
12
+ }
13
+ }];
14
+ function findAction(id) {
15
+ return STUDIO_ACTIONS.find((action) => action.id === id) ?? null;
16
+ }
17
+ /** Skill trees each agent loads; Claude does not read the shared Agents tree. */
18
+ var SKILL_TREES = {
19
+ claude: ["claude"],
20
+ opencode: ["opencode", "agents"]
21
+ };
22
+ /** Availability only: a directory shows the skill is installed, not that Mate shipped it. */
23
+ function skillInstalledFor(inventory, skill, agent) {
24
+ return SKILL_TREES[agent].some((tree) => inventory[tree].includes(skill));
25
+ }
26
+ var AGENTS = ["claude", "opencode"];
27
+ /**
28
+ * Run needs a terminal targeting the displayed companion and a launchable
29
+ * agent with the skill; Copy needs only the installed skill.
30
+ */
31
+ function specActionOffers(companionPath, inventory, terminal) {
32
+ if (!inventory) return [];
33
+ const targeted = terminal?.target?.path === companionPath;
34
+ return STUDIO_ACTIONS.flatMap((action) => {
35
+ const copyAgents = AGENTS.filter((agent) => skillInstalledFor(inventory, action.skill, agent));
36
+ if (copyAgents.length === 0) return [];
37
+ return [{
38
+ action,
39
+ runAgents: targeted ? copyAgents.filter((agent) => terminal?.agents.includes(agent)) : [],
40
+ copyAgents
41
+ }];
42
+ });
43
+ }
44
+ export { findAction as n, specActionOffers as r, SUBJECT_PATTERN as t };
@@ -0,0 +1,33 @@
1
+ import { i as useSuspenseQuery } from "./queries-Ag2iL8q2.js";
2
+ import { o as companionViewQuery } from "./studio-queries-CLnP9kGu.js";
3
+ import { l as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-BQKuMdJW.js";
4
+ // src/shell/companion-error.tsx
5
+ var import_jsx_runtime = require_jsx_runtime();
6
+ /**
7
+ * A companion that could not be read costs its content, never the page: the
8
+ * selector stays rendered around this so another companion can be reached.
9
+ */
10
+ function CompanionError({ companionPath, reason }) {
11
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
12
+ className: "panel error",
13
+ children: [
14
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Could not read this companion" }),
15
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
16
+ className: "mono",
17
+ children: companionPath
18
+ }),
19
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: reason })
20
+ ]
21
+ });
22
+ }
23
+ // src/shell/companion-view.tsx
24
+ /** A companion view's data, or the companion's error in its place; the rest of the page stays. */
25
+ function CompanionView({ view, search, children }) {
26
+ const { data } = useSuspenseQuery(companionViewQuery(view, search));
27
+ if (data.error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionError, {
28
+ companionPath: data.error.companionPath,
29
+ reason: data.error.reason
30
+ });
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: children(data) });
32
+ }
33
+ export { CompanionView as t };
@@ -0,0 +1,459 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ // ../../node_modules/.bun/@tanstack+router-core@1.171.39/node_modules/@tanstack/router-core/dist/esm/redirect.js
3
+ /**
4
+ * Create a redirect Response understood by TanStack Router.
5
+ *
6
+ * Use from route `loader`/`beforeLoad` or server functions to trigger a
7
+ * navigation. If `throw: true` is set, the redirect is thrown instead of
8
+ * returned. External `href` values are classified as full-document
9
+ * navigations when the router resolves the redirect.
10
+ *
11
+ * @param opts Options for the redirect. Common fields:
12
+ * - `href`: absolute URL for external redirects.
13
+ * - `statusCode`: HTTP status code to use (defaults to 307).
14
+ * - `headers`: additional headers to include on the Response.
15
+ * - Standard navigation options like `to`, `params`, `search`, `replace`,
16
+ * and `reloadDocument` for internal redirects.
17
+ * @returns A Response augmented with router navigation options.
18
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
19
+ */
20
+ function redirect(opts) {
21
+ opts.statusCode = opts.statusCode || opts.code || 307;
22
+ const headers = new Headers(opts.headers);
23
+ if (opts.href && headers.get("Location") === null) headers.set("Location", opts.href);
24
+ const response = new Response(null, {
25
+ status: opts.statusCode,
26
+ headers
27
+ });
28
+ response.options = opts;
29
+ if (opts.throw) throw response;
30
+ return response;
31
+ }
32
+ /** Check whether a value is a TanStack Router redirect Response. */
33
+ function isRedirect(obj) {
34
+ return obj instanceof Response && !!obj.options;
35
+ }
36
+ /** Parse a serialized redirect object back into a redirect Response. */
37
+ function parseRedirect(obj) {
38
+ if (obj !== null && typeof obj === "object" && obj.isSerializedRedirect) return redirect(obj);
39
+ }
40
+ // ../../node_modules/.bun/cookie-es@3.1.1/node_modules/cookie-es/dist/index.mjs
41
+ var COOKIE_MAX_AGE_LIMIT = 3456e4;
42
+ var maxAgeRegExp = /^-?\d+$/;
43
+ var _nullProto = /* @__PURE__ */ Object.getPrototypeOf({});
44
+ function parseSetCookie(str, options) {
45
+ const len = str.length;
46
+ let _endIdx = len;
47
+ let eqIdx = -1;
48
+ for (let i = 0; i < len; i++) {
49
+ const c = str.charCodeAt(i);
50
+ if (c === 59) {
51
+ _endIdx = i;
52
+ break;
53
+ }
54
+ if (c === 61 && eqIdx === -1) eqIdx = i;
55
+ }
56
+ if (eqIdx >= _endIdx) eqIdx = -1;
57
+ const name = eqIdx === -1 ? "" : _trim(str, 0, eqIdx);
58
+ if (name && name in _nullProto) return void 0;
59
+ let value = eqIdx === -1 ? _trim(str, 0, _endIdx) : _trim(str, eqIdx + 1, _endIdx);
60
+ if (!name && !value) return void 0;
61
+ if (name.length + value.length > 4096) return void 0;
62
+ if (options?.decode !== false) value = _decode(value, options?.decode);
63
+ const setCookie = {
64
+ name,
65
+ value
66
+ };
67
+ let index = _endIdx + 1;
68
+ while (index < len) {
69
+ let endIdx = len;
70
+ let attrEqIdx = -1;
71
+ for (let i = index; i < len; i++) {
72
+ const c = str.charCodeAt(i);
73
+ if (c === 59) {
74
+ endIdx = i;
75
+ break;
76
+ }
77
+ if (c === 61 && attrEqIdx === -1) attrEqIdx = i;
78
+ }
79
+ if (attrEqIdx >= endIdx) attrEqIdx = -1;
80
+ const attr = attrEqIdx === -1 ? _trim(str, index, endIdx) : _trim(str, index, attrEqIdx);
81
+ const val = attrEqIdx === -1 ? void 0 : _trim(str, attrEqIdx + 1, endIdx);
82
+ if (val === void 0 || val.length <= 1024) switch (attr.toLowerCase()) {
83
+ case "httponly":
84
+ setCookie.httpOnly = true;
85
+ break;
86
+ case "secure":
87
+ setCookie.secure = true;
88
+ break;
89
+ case "partitioned":
90
+ setCookie.partitioned = true;
91
+ break;
92
+ case "domain":
93
+ if (val) setCookie.domain = (val.charCodeAt(0) === 46 ? val.slice(1) : val).toLowerCase();
94
+ break;
95
+ case "path":
96
+ setCookie.path = val;
97
+ break;
98
+ case "max-age":
99
+ if (val && maxAgeRegExp.test(val)) setCookie.maxAge = Math.min(Number(val), COOKIE_MAX_AGE_LIMIT);
100
+ break;
101
+ case "expires": {
102
+ if (!val) break;
103
+ const date = new Date(val);
104
+ if (Number.isFinite(date.valueOf())) {
105
+ const maxDate = new Date(Date.now() + COOKIE_MAX_AGE_LIMIT * 1e3);
106
+ setCookie.expires = date > maxDate ? maxDate : date;
107
+ }
108
+ break;
109
+ }
110
+ case "priority": {
111
+ if (!val) break;
112
+ const priority = val.toLowerCase();
113
+ if (priority === "low" || priority === "medium" || priority === "high") setCookie.priority = priority;
114
+ break;
115
+ }
116
+ case "samesite": {
117
+ if (!val) break;
118
+ const sameSite = val.toLowerCase();
119
+ if (sameSite === "lax" || sameSite === "strict" || sameSite === "none") setCookie.sameSite = sameSite;
120
+ else setCookie.sameSite = "lax";
121
+ break;
122
+ }
123
+ default: {
124
+ const attrLower = attr.toLowerCase();
125
+ if (attrLower && !(attrLower in _nullProto)) setCookie[attrLower] = val;
126
+ }
127
+ }
128
+ index = endIdx + 1;
129
+ }
130
+ return setCookie;
131
+ }
132
+ function _trim(str, start, end) {
133
+ if (start === end) return "";
134
+ let s = start;
135
+ let e = end;
136
+ while (s < e && (str.charCodeAt(s) === 32 || str.charCodeAt(s) === 9)) s++;
137
+ while (e > s && (str.charCodeAt(e - 1) === 32 || str.charCodeAt(e - 1) === 9)) e--;
138
+ return str.slice(s, e);
139
+ }
140
+ function _decode(value, decode) {
141
+ if (!decode && !value.includes("%")) return value;
142
+ try {
143
+ return (decode || decodeURIComponent)(value);
144
+ } catch {
145
+ return value;
146
+ }
147
+ }
148
+ function splitSetCookieString(cookiesString) {
149
+ if (Array.isArray(cookiesString)) return cookiesString.flatMap((c) => splitSetCookieString(c));
150
+ if (typeof cookiesString !== "string") return [];
151
+ const cookiesStrings = [];
152
+ let pos = 0;
153
+ let start;
154
+ let ch;
155
+ let lastComma;
156
+ let nextStart;
157
+ let cookiesSeparatorFound;
158
+ const skipWhitespace = () => {
159
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
160
+ return pos < cookiesString.length;
161
+ };
162
+ const notSpecialChar = () => {
163
+ ch = cookiesString.charAt(pos);
164
+ return ch !== "=" && ch !== ";" && ch !== ",";
165
+ };
166
+ while (pos < cookiesString.length) {
167
+ start = pos;
168
+ cookiesSeparatorFound = false;
169
+ while (skipWhitespace()) {
170
+ ch = cookiesString.charAt(pos);
171
+ if (ch === ",") {
172
+ lastComma = pos;
173
+ pos += 1;
174
+ skipWhitespace();
175
+ nextStart = pos;
176
+ while (pos < cookiesString.length && notSpecialChar()) pos += 1;
177
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
178
+ cookiesSeparatorFound = true;
179
+ pos = nextStart;
180
+ cookiesStrings.push(cookiesString.slice(start, lastComma));
181
+ start = pos;
182
+ } else pos = lastComma + 1;
183
+ } else pos += 1;
184
+ }
185
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));
186
+ }
187
+ return cookiesStrings;
188
+ }
189
+ // ../../node_modules/.bun/@tanstack+router-core@1.171.39/node_modules/@tanstack/router-core/dist/esm/ssr/headers.js
190
+ function toHeadersInstance(init) {
191
+ if (init instanceof Headers) return init;
192
+ else if (Array.isArray(init)) return new Headers(init);
193
+ else if (typeof init === "object") return new Headers(init);
194
+ else return null;
195
+ }
196
+ function mergeHeaders(...headers) {
197
+ return headers.reduce((acc, header) => {
198
+ const headersInstance = toHeadersInstance(header);
199
+ if (!headersInstance) return acc;
200
+ for (const [key, value] of headersInstance.entries()) if (key === "set-cookie") splitSetCookieString(value).forEach((cookie) => acc.append("set-cookie", cookie));
201
+ else acc.set(key, value);
202
+ return acc;
203
+ }, new Headers());
204
+ }
205
+ // ../../node_modules/.bun/@tanstack+start-client-core@1.170.39/node_modules/@tanstack/start-client-core/dist/esm/constants.js
206
+ var TSS_FORMDATA_CONTEXT = "__TSS_CONTEXT";
207
+ var TSS_SERVER_FUNCTION = Symbol.for("TSS_SERVER_FUNCTION");
208
+ var TSS_SERVER_FUNCTION_FACTORY = Symbol.for("TSS_SERVER_FUNCTION_FACTORY");
209
+ var X_TSS_SERIALIZED = "x-tss-serialized";
210
+ var X_TSS_RAW_RESPONSE = "x-tss-raw";
211
+ /** Content-Type for multiplexed framed responses (RawStream support) */
212
+ var TSS_CONTENT_TYPE_FRAMED = "application/x-tss-framed";
213
+ /** Largest payload accepted by one framed-protocol record. */
214
+ var MAX_FRAME_PAYLOAD_SIZE = 16777216;
215
+ /** Largest number of raw streams accepted in one framed response. */
216
+ var MAX_FRAMED_STREAMS = 1024;
217
+ /** Full Content-Type header value with version parameter */
218
+ var TSS_CONTENT_TYPE_FRAMED_VERSIONED = `${TSS_CONTENT_TYPE_FRAMED}; v=1`;
219
+ // ../../node_modules/.bun/@tanstack+start-storage-context@1.167.41/node_modules/@tanstack/start-storage-context/dist/esm/async-local-storage.js
220
+ var GLOBAL_STORAGE_KEY = Symbol.for("tanstack-start:start-storage-context");
221
+ var globalObj = globalThis;
222
+ if (!globalObj[GLOBAL_STORAGE_KEY]) globalObj[GLOBAL_STORAGE_KEY] = new AsyncLocalStorage();
223
+ var startStorage = globalObj[GLOBAL_STORAGE_KEY];
224
+ function runWithStartContext(context, fn) {
225
+ return startStorage.run(context, fn);
226
+ }
227
+ function getStartContext(opts) {
228
+ const context = startStorage.getStore();
229
+ if (!context && opts?.throwIfNotFound !== false) throw new Error(`No Start context found in AsyncLocalStorage. Make sure you are using the function within the server runtime.`);
230
+ return context;
231
+ }
232
+ // ../../node_modules/.bun/@tanstack+start-client-core@1.170.39/node_modules/@tanstack/start-client-core/dist/esm/getStartOptions.js
233
+ var getStartOptions = () => getStartContext().startOptions;
234
+ // ../../node_modules/.bun/@tanstack+start-client-core@1.170.39/node_modules/@tanstack/start-client-core/dist/esm/safeObjectMerge.js
235
+ function isSafeKey(key) {
236
+ return key !== "__proto__" && key !== "constructor" && key !== "prototype";
237
+ }
238
+ /**
239
+ * Merge target and source into a new null-proto object, filtering dangerous keys.
240
+ */
241
+ function safeObjectMerge(target, source) {
242
+ const result = Object.create(null);
243
+ if (target) {
244
+ const keys = Object.keys(target);
245
+ for (let i = 0; i < keys.length; i++) {
246
+ const key = keys[i];
247
+ if (isSafeKey(key)) result[key] = target[key];
248
+ }
249
+ }
250
+ if (source && typeof source === "object") {
251
+ const keys = Object.keys(source);
252
+ for (let i = 0; i < keys.length; i++) {
253
+ const key = keys[i];
254
+ if (isSafeKey(key)) result[key] = source[key];
255
+ }
256
+ }
257
+ return result;
258
+ }
259
+ /**
260
+ * Create a null-prototype object, optionally copying from source.
261
+ */
262
+ function createNullProtoObject(source) {
263
+ return source ? safeObjectMerge(source, void 0) : Object.create(null);
264
+ }
265
+ // ../../node_modules/.bun/@tanstack+start-client-core@1.170.39/node_modules/@tanstack/start-client-core/dist/esm/getStartContextServerOnly.js
266
+ var getStartContextServerOnly = getStartContext;
267
+ // ../../node_modules/.bun/@tanstack+start-client-core@1.170.39/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js
268
+ var createServerFn = (options, __opts) => {
269
+ const resolvedOptions = __opts || options || {};
270
+ if (typeof resolvedOptions.method === "undefined") resolvedOptions.method = "GET";
271
+ const res = {
272
+ options: resolvedOptions,
273
+ middleware: (middleware) => {
274
+ const newMiddleware = [...resolvedOptions.middleware || []];
275
+ middleware.forEach((item) => {
276
+ if (TSS_SERVER_FUNCTION_FACTORY in item) {
277
+ if (item.options.middleware) newMiddleware.push(...item.options.middleware);
278
+ } else newMiddleware.push(item);
279
+ });
280
+ const res = createServerFn(void 0, {
281
+ ...resolvedOptions,
282
+ middleware: newMiddleware
283
+ });
284
+ res[TSS_SERVER_FUNCTION_FACTORY] = true;
285
+ return res;
286
+ },
287
+ validator: (validator) => {
288
+ return createServerFn(void 0, {
289
+ ...resolvedOptions,
290
+ validator
291
+ });
292
+ },
293
+ handler: (...args) => {
294
+ const [extractedFn, serverFn] = args;
295
+ const newOptions = {
296
+ ...resolvedOptions,
297
+ extractedFn,
298
+ serverFn
299
+ };
300
+ const resolvedMiddleware = [...newOptions.middleware || [], serverFnBaseToMiddleware(newOptions)];
301
+ extractedFn.method = resolvedOptions.method;
302
+ return Object.assign(async (opts) => {
303
+ const result = await executeMiddleware(resolvedMiddleware, "client", {
304
+ ...extractedFn,
305
+ ...newOptions,
306
+ data: opts?.data,
307
+ headers: opts?.headers,
308
+ signal: opts?.signal,
309
+ fetch: opts?.fetch,
310
+ context: createNullProtoObject()
311
+ });
312
+ if ("error" in result) throw parseRedirect(result.error) ?? result.error;
313
+ return result.result;
314
+ }, {
315
+ ...extractedFn,
316
+ method: resolvedOptions.method,
317
+ __executeServer: async (opts) => {
318
+ const startContext = getStartContextServerOnly();
319
+ const serverContextAfterGlobalMiddlewares = startContext.contextAfterGlobalMiddlewares;
320
+ const ctx = {
321
+ ...extractedFn,
322
+ data: opts.data,
323
+ method: opts.method ?? resolvedOptions.method,
324
+ serverFnMeta: extractedFn.serverFnMeta,
325
+ context: safeObjectMerge(opts.context, serverContextAfterGlobalMiddlewares),
326
+ request: startContext.request
327
+ };
328
+ const result = await executeMiddleware(resolvedMiddleware, "server", ctx);
329
+ if ("error" in result) return { error: result.error };
330
+ return result.sendContext === void 0 ? { result: result.result } : {
331
+ result: result.result,
332
+ context: result.sendContext
333
+ };
334
+ }
335
+ });
336
+ }
337
+ };
338
+ const fun = (options) => {
339
+ return createServerFn(void 0, {
340
+ ...resolvedOptions,
341
+ ...options
342
+ });
343
+ };
344
+ return Object.assign(fun, res);
345
+ };
346
+ function mergeOptionalSendContext(target, source) {
347
+ return target === void 0 && source === void 0 ? void 0 : safeObjectMerge(target, source);
348
+ }
349
+ function mergeOptionalHeaders(target, source) {
350
+ return target || source ? mergeHeaders(target, source) : void 0;
351
+ }
352
+ async function executeMiddleware(middlewares, env, opts) {
353
+ const flattenedMiddlewares = flattenMiddlewares((getStartOptions()?.functionMiddleware || []).concat(middlewares), void 0, env === "server" ? new Set(getStartContextServerOnly({ throwIfNotFound: false })?.executedRequestMiddlewares) : void 0);
354
+ let index = 0;
355
+ const callNextMiddleware = async (callerCtx, userCtx) => {
356
+ let ctx = callerCtx;
357
+ if (userCtx !== void 0) {
358
+ ctx = {
359
+ ...callerCtx,
360
+ ...userCtx
361
+ };
362
+ ctx.context = safeObjectMerge(callerCtx.context, userCtx.context);
363
+ ctx.sendContext = mergeOptionalSendContext(callerCtx.sendContext, userCtx.sendContext);
364
+ ctx.headers = mergeOptionalHeaders(callerCtx.headers, userCtx.headers);
365
+ ctx._callSiteFetch = callerCtx._callSiteFetch;
366
+ ctx.fetch = callerCtx._callSiteFetch ?? userCtx.fetch ?? callerCtx.fetch;
367
+ ctx.result = userCtx.result !== void 0 ? userCtx.result : userCtx instanceof Response ? userCtx : callerCtx.result;
368
+ }
369
+ let result = ctx;
370
+ while (index < flattenedMiddlewares.length) {
371
+ const options = flattenedMiddlewares[index++].options;
372
+ const validator = options.validator;
373
+ if (validator && env === "server") ctx.data = await execValidator(validator, ctx.data);
374
+ const middlewareFn = env === "client" ? options.client : options.server;
375
+ if (middlewareFn) {
376
+ result = await middlewareFn({
377
+ ...ctx,
378
+ next: (nextCtx = {}) => callNextMiddleware(ctx, nextCtx)
379
+ });
380
+ if (result instanceof Response) {
381
+ if (isRedirect(result)) throw result;
382
+ result = {
383
+ ...ctx,
384
+ result
385
+ };
386
+ } else if (!result) throw new Error("User middleware returned undefined. You must call next() or return a result in your middlewares.");
387
+ break;
388
+ }
389
+ }
390
+ if ("error" in result) throw result.error;
391
+ return result;
392
+ };
393
+ const initialCtx = {
394
+ ...opts,
395
+ headers: opts.headers || (env === "client" ? {} : void 0),
396
+ sendContext: opts.sendContext,
397
+ context: opts.context || createNullProtoObject(),
398
+ _callSiteFetch: opts.fetch
399
+ };
400
+ if (initialCtx.sendContext !== void 0) initialCtx.sendContext ||= {};
401
+ try {
402
+ return await callNextMiddleware(initialCtx);
403
+ } catch (error) {
404
+ return {
405
+ ...initialCtx,
406
+ error
407
+ };
408
+ }
409
+ }
410
+ function flattenMiddlewares(middlewares, maxDepth = 100, seen = /* @__PURE__ */ new Set()) {
411
+ const flattened = [];
412
+ const recurse = (middleware, depth) => {
413
+ if (depth > maxDepth) throw new Error(`Middleware nesting depth exceeded maximum of ${maxDepth}. Check for circular references.`);
414
+ middleware.forEach((m) => {
415
+ if (m.options.middleware) recurse(m.options.middleware, depth + 1);
416
+ if (!seen.has(m)) {
417
+ seen.add(m);
418
+ flattened.push(m);
419
+ }
420
+ });
421
+ };
422
+ recurse(middlewares, 0);
423
+ return flattened;
424
+ }
425
+ async function execValidator(validator, input) {
426
+ if (validator == null) return {};
427
+ if ("~standard" in validator) {
428
+ const result = await validator["~standard"].validate(input);
429
+ if (result.issues) throw new Error(JSON.stringify(result.issues, void 0, 2));
430
+ return result.value;
431
+ }
432
+ if ("parse" in validator) return validator.parse(input);
433
+ if (typeof validator === "function") return validator(input);
434
+ throw new Error("Invalid validator type!");
435
+ }
436
+ function serverFnBaseToMiddleware(options) {
437
+ return {
438
+ "~types": void 0,
439
+ options: {
440
+ validator: options.validator,
441
+ client: async ({ next, sendContext, fetch, ...ctx }) => {
442
+ const payload = {
443
+ ...ctx,
444
+ context: sendContext,
445
+ fetch
446
+ };
447
+ return next(await options.extractedFn?.(payload));
448
+ },
449
+ server: async ({ next: _next, ...ctx }) => {
450
+ const result = await options.serverFn?.(ctx);
451
+ return {
452
+ ...ctx,
453
+ result
454
+ };
455
+ }
456
+ }
457
+ };
458
+ }
459
+ export { splitSetCookieString as _, getStartOptions as a, MAX_FRAMED_STREAMS as c, TSS_FORMDATA_CONTEXT as d, TSS_SERVER_FUNCTION as f, parseSetCookie as g, mergeHeaders as h, safeObjectMerge as i, MAX_FRAME_PAYLOAD_SIZE as l, X_TSS_SERIALIZED as m, flattenMiddlewares as n, getStartContext as o, X_TSS_RAW_RESPONSE as p, createNullProtoObject as r, runWithStartContext as s, createServerFn as t, TSS_CONTENT_TYPE_FRAMED_VERSIONED as u, isRedirect as v, redirect as y };
@@ -0,0 +1,11 @@
1
+ import { f as TSS_SERVER_FUNCTION } from "./createServerFn-F5sAOF8V.js";
2
+ // ../../node_modules/.bun/@tanstack+start-server-core@1.169.45/node_modules/@tanstack/start-server-core/dist/esm/createServerRpc.js
3
+ var createServerRpc = (serverFnMeta, splitImportFn) => {
4
+ const url = "/_serverFn/" + serverFnMeta.id;
5
+ return Object.assign(splitImportFn, {
6
+ url,
7
+ serverFnMeta,
8
+ [TSS_SERVER_FUNCTION]: true
9
+ });
10
+ };
11
+ export { createServerRpc as t };