@rubytech/create-maxy-code 0.1.49 → 0.1.57

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 (317) hide show
  1. package/dist/__tests__/platform-port-stamp.test.js +24 -0
  2. package/dist/index.js +5 -2
  3. package/dist/port-resolution.js +2 -0
  4. package/package.json +1 -1
  5. package/payload/platform/lib/require-port-env/dist/index.d.ts +31 -0
  6. package/payload/platform/lib/require-port-env/dist/index.d.ts.map +1 -0
  7. package/payload/platform/lib/require-port-env/dist/index.js +52 -0
  8. package/payload/platform/lib/require-port-env/dist/index.js.map +1 -0
  9. package/payload/platform/lib/require-port-env/src/index.ts +56 -0
  10. package/payload/platform/lib/require-port-env/tsconfig.json +8 -0
  11. package/payload/platform/package-lock.json +0 -1
  12. package/payload/platform/package.json +2 -3
  13. package/payload/platform/plugins/admin/PLUGIN.md +16 -3
  14. package/payload/platform/plugins/admin/hooks/__tests__/turn-completed-graph-write.test.sh +184 -146
  15. package/payload/platform/plugins/admin/hooks/turn-completed-graph-write.sh +186 -112
  16. package/payload/platform/plugins/admin/mcp/dist/index.js +20 -12
  17. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  18. package/payload/platform/plugins/brochures/PLUGIN.md +2 -0
  19. package/payload/platform/plugins/brochures/skills/property-market-report/SKILL.md +100 -0
  20. package/payload/platform/plugins/brochures/skills/property-market-report/references/render.py +267 -0
  21. package/payload/platform/plugins/brochures/skills/property-market-report/references/template.html +266 -0
  22. package/payload/platform/plugins/brochures/skills/property-socials/SKILL.md +141 -0
  23. package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.d.ts.map +1 -1
  24. package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.js +2 -1
  25. package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.js.map +1 -1
  26. package/payload/platform/plugins/docs/PLUGIN.md +3 -1
  27. package/payload/platform/plugins/docs/references/admin-session.md +40 -0
  28. package/payload/platform/plugins/docs/references/deployment.md +25 -0
  29. package/payload/platform/plugins/docs/references/internals.md +30 -0
  30. package/payload/platform/plugins/docs/references/platform.md +3 -1
  31. package/payload/platform/plugins/docs/references/plugins-guide.md +1 -1
  32. package/payload/platform/plugins/docs/references/troubleshooting.md +1 -1
  33. package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.d.ts.map +1 -1
  34. package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js +2 -1
  35. package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js.map +1 -1
  36. package/payload/platform/plugins/loop/PLUGIN.md +24 -0
  37. package/payload/platform/plugins/loop/mcp/src/__tests__/plugin-md-time-doctrine.test.ts +132 -0
  38. package/payload/platform/plugins/memory/.claude-plugin/plugin.json +1 -1
  39. package/payload/platform/plugins/memory/PLUGIN.md +1 -1
  40. package/payload/platform/plugins/memory/mcp/dist/index.js +6 -1
  41. package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
  42. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.d.ts +2 -0
  43. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.d.ts.map +1 -0
  44. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.js +107 -0
  45. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.js.map +1 -0
  46. package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.d.ts +4 -2
  47. package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.d.ts.map +1 -1
  48. package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js +22 -13
  49. package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js.map +1 -1
  50. package/payload/platform/plugins/memory/references/graph-primitives.md +42 -0
  51. package/payload/platform/plugins/memory/skills/concept-synthesis/SKILL.md +1 -1
  52. package/payload/platform/plugins/memory/skills/conversation-archive-enrich/SKILL.md +2 -2
  53. package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +1 -1
  54. package/payload/platform/plugins/property-data/.claude-plugin/plugin.json +17 -0
  55. package/payload/platform/plugins/property-data/PLUGIN.md +100 -0
  56. package/payload/platform/plugins/property-data/mcp/dist/index.d.ts +2 -0
  57. package/payload/platform/plugins/property-data/mcp/dist/index.d.ts.map +1 -0
  58. package/payload/platform/plugins/property-data/mcp/dist/index.js +153 -0
  59. package/payload/platform/plugins/property-data/mcp/dist/index.js.map +1 -0
  60. package/payload/platform/plugins/property-data/mcp/dist/lib/crypto.d.ts +3 -0
  61. package/payload/platform/plugins/property-data/mcp/dist/lib/crypto.d.ts.map +1 -0
  62. package/payload/platform/plugins/property-data/mcp/dist/lib/crypto.js +72 -0
  63. package/payload/platform/plugins/property-data/mcp/dist/lib/crypto.js.map +1 -0
  64. package/payload/platform/plugins/property-data/mcp/dist/lib/neo4j.d.ts +5 -0
  65. package/payload/platform/plugins/property-data/mcp/dist/lib/neo4j.d.ts.map +1 -0
  66. package/payload/platform/plugins/property-data/mcp/dist/lib/neo4j.js +38 -0
  67. package/payload/platform/plugins/property-data/mcp/dist/lib/neo4j.js.map +1 -0
  68. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts +29 -0
  69. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts.map +1 -0
  70. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.js +112 -0
  71. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.js.map +1 -0
  72. package/payload/platform/plugins/property-data/mcp/dist/tools/endpoints.d.ts +14 -0
  73. package/payload/platform/plugins/property-data/mcp/dist/tools/endpoints.d.ts.map +1 -0
  74. package/payload/platform/plugins/property-data/mcp/dist/tools/endpoints.js +20 -0
  75. package/payload/platform/plugins/property-data/mcp/dist/tools/endpoints.js.map +1 -0
  76. package/payload/platform/plugins/property-data/mcp/dist/tools/key-deregister.d.ts +4 -0
  77. package/payload/platform/plugins/property-data/mcp/dist/tools/key-deregister.d.ts.map +1 -0
  78. package/payload/platform/plugins/property-data/mcp/dist/tools/key-deregister.js +19 -0
  79. package/payload/platform/plugins/property-data/mcp/dist/tools/key-deregister.js.map +1 -0
  80. package/payload/platform/plugins/property-data/mcp/dist/tools/key-list.d.ts +4 -0
  81. package/payload/platform/plugins/property-data/mcp/dist/tools/key-list.d.ts.map +1 -0
  82. package/payload/platform/plugins/property-data/mcp/dist/tools/key-list.js +10 -0
  83. package/payload/platform/plugins/property-data/mcp/dist/tools/key-list.js.map +1 -0
  84. package/payload/platform/plugins/property-data/mcp/dist/tools/key-register.d.ts +5 -0
  85. package/payload/platform/plugins/property-data/mcp/dist/tools/key-register.d.ts.map +1 -0
  86. package/payload/platform/plugins/property-data/mcp/dist/tools/key-register.js +43 -0
  87. package/payload/platform/plugins/property-data/mcp/dist/tools/key-register.js.map +1 -0
  88. package/payload/platform/plugins/property-data/mcp/package-lock.json +2566 -0
  89. package/payload/platform/plugins/property-data/mcp/package.json +21 -0
  90. package/payload/platform/plugins/property-data/mcp/src/__tests__/key-roundtrip.test.ts +107 -0
  91. package/payload/platform/plugins/property-data/mcp/src/__tests__/propertydata-api.test.ts +184 -0
  92. package/payload/platform/plugins/property-data/mcp/src/__tests__/schema-parity.test.ts +48 -0
  93. package/payload/platform/plugins/property-data/mcp/src/index.ts +249 -0
  94. package/payload/platform/plugins/property-data/mcp/src/lib/crypto.ts +79 -0
  95. package/payload/platform/plugins/property-data/mcp/src/lib/neo4j.ts +47 -0
  96. package/payload/platform/plugins/property-data/mcp/src/lib/propertydata-api.ts +135 -0
  97. package/payload/platform/plugins/property-data/mcp/src/tools/endpoints.ts +27 -0
  98. package/payload/platform/plugins/property-data/mcp/src/tools/key-deregister.ts +21 -0
  99. package/payload/platform/plugins/property-data/mcp/src/tools/key-list.ts +10 -0
  100. package/payload/platform/plugins/property-data/mcp/src/tools/key-register.ts +58 -0
  101. package/payload/platform/plugins/property-data/mcp/tsconfig.json +20 -0
  102. package/payload/platform/plugins/property-data/mcp/vitest.config.ts +8 -0
  103. package/payload/platform/plugins/property-data/skills/property-data/SKILL.md +58 -0
  104. package/payload/platform/plugins/tasks/mcp/dist/index.js +1 -2
  105. package/payload/platform/plugins/tasks/mcp/dist/index.js.map +1 -1
  106. package/payload/platform/plugins/tasks/mcp/dist/tools/session-name.d.ts.map +1 -1
  107. package/payload/platform/plugins/tasks/mcp/dist/tools/session-name.js +3 -2
  108. package/payload/platform/plugins/tasks/mcp/dist/tools/session-name.js.map +1 -1
  109. package/payload/platform/plugins/waitlist/PLUGIN.md +6 -8
  110. package/payload/platform/plugins/waitlist/mcp/dist/index.js +33 -0
  111. package/payload/platform/plugins/waitlist/mcp/dist/index.js.map +1 -1
  112. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.d.ts +16 -0
  113. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.d.ts.map +1 -0
  114. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.js +58 -0
  115. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.js.map +1 -0
  116. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.d.ts +34 -0
  117. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.d.ts.map +1 -0
  118. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.js +129 -0
  119. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.js.map +1 -0
  120. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.d.ts +12 -18
  121. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.d.ts.map +1 -1
  122. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.js +89 -86
  123. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.js.map +1 -1
  124. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.d.ts.map +1 -1
  125. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.js +15 -53
  126. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.js.map +1 -1
  127. package/payload/platform/plugins/whatsapp/PLUGIN.md +1 -0
  128. package/payload/platform/plugins/whatsapp/mcp/dist/index.js +5 -5
  129. package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
  130. package/payload/platform/plugins/workflows/PLUGIN.md +10 -176
  131. package/payload/platform/plugins/workflows/mcp/dist/index.js +14 -142
  132. package/payload/platform/plugins/workflows/mcp/dist/index.js.map +1 -1
  133. package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.d.ts +1 -88
  134. package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.d.ts.map +1 -1
  135. package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.js +0 -86
  136. package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.js.map +1 -1
  137. package/payload/platform/plugins/workflows/mcp/dist/lib/validate-capabilities.d.ts +5 -12
  138. package/payload/platform/plugins/workflows/mcp/dist/lib/validate-capabilities.d.ts.map +1 -1
  139. package/payload/platform/plugins/workflows/mcp/dist/lib/validate-capabilities.js +5 -46
  140. package/payload/platform/plugins/workflows/mcp/dist/lib/validate-capabilities.js.map +1 -1
  141. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.d.ts +1 -16
  142. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.d.ts.map +1 -1
  143. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js +39 -75
  144. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js.map +1 -1
  145. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.d.ts +8 -21
  146. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.d.ts.map +1 -1
  147. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js +39 -266
  148. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js.map +1 -1
  149. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.d.ts +3 -8
  150. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.d.ts.map +1 -1
  151. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.js +3 -10
  152. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.js.map +1 -1
  153. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.d.ts.map +1 -1
  154. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js +38 -86
  155. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js.map +1 -1
  156. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-validate.d.ts.map +1 -1
  157. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-validate.js +8 -26
  158. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-validate.js.map +1 -1
  159. package/payload/platform/services/claude-session-manager/dist/fs-watcher.d.ts.map +1 -1
  160. package/payload/platform/services/claude-session-manager/dist/fs-watcher.js +1 -2
  161. package/payload/platform/services/claude-session-manager/dist/fs-watcher.js.map +1 -1
  162. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  163. package/payload/platform/services/claude-session-manager/dist/http-server.js +221 -25
  164. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  165. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +39 -1
  166. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  167. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +109 -10
  168. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  169. package/payload/platform/services/claude-session-manager/dist/reaper.d.ts.map +1 -1
  170. package/payload/platform/services/claude-session-manager/dist/reaper.js +11 -0
  171. package/payload/platform/services/claude-session-manager/dist/reaper.js.map +1 -1
  172. package/payload/platform/services/claude-session-manager/dist/session-store.d.ts +21 -0
  173. package/payload/platform/services/claude-session-manager/dist/session-store.d.ts.map +1 -1
  174. package/payload/platform/services/claude-session-manager/dist/session-store.js.map +1 -1
  175. package/payload/platform/services/claude-session-manager/vitest.config.ts +14 -0
  176. package/payload/platform/templates/agents/admin/IDENTITY.md +2 -0
  177. package/payload/platform/templates/agents/admin/SOUL.md +3 -1
  178. package/payload/premium-plugins/real-agent/BUNDLE.md +5 -3
  179. package/payload/premium-plugins/real-agent/agents/negotiator.md +1 -1
  180. package/payload/premium-plugins/real-agent/agents/valuer.md +1 -1
  181. package/payload/premium-plugins/real-agent/plugins/.claude-plugin/marketplace.json +5 -0
  182. package/payload/premium-plugins/real-agent/plugins/brochures/PLUGIN.md +2 -0
  183. package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-market-report/SKILL.md +100 -0
  184. package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-market-report/references/render.py +267 -0
  185. package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-market-report/references/template.html +266 -0
  186. package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-socials/SKILL.md +141 -0
  187. package/payload/premium-plugins/real-agent/plugins/loop/PLUGIN.md +24 -0
  188. package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/__tests__/plugin-md-time-doctrine.test.ts +132 -0
  189. package/payload/premium-plugins/real-agent/plugins/property-data/.claude-plugin/plugin.json +17 -0
  190. package/payload/premium-plugins/real-agent/plugins/property-data/PLUGIN.md +100 -0
  191. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/index.d.ts +2 -0
  192. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/index.d.ts.map +1 -0
  193. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/index.js +153 -0
  194. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/index.js.map +1 -0
  195. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/crypto.d.ts +3 -0
  196. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/crypto.d.ts.map +1 -0
  197. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/crypto.js +72 -0
  198. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/crypto.js.map +1 -0
  199. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/neo4j.d.ts +5 -0
  200. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/neo4j.d.ts.map +1 -0
  201. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/neo4j.js +38 -0
  202. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/neo4j.js.map +1 -0
  203. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts +29 -0
  204. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts.map +1 -0
  205. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.js +112 -0
  206. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.js.map +1 -0
  207. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/endpoints.d.ts +14 -0
  208. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/endpoints.d.ts.map +1 -0
  209. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/endpoints.js +20 -0
  210. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/endpoints.js.map +1 -0
  211. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-deregister.d.ts +4 -0
  212. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-deregister.d.ts.map +1 -0
  213. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-deregister.js +19 -0
  214. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-deregister.js.map +1 -0
  215. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-list.d.ts +4 -0
  216. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-list.d.ts.map +1 -0
  217. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-list.js +10 -0
  218. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-list.js.map +1 -0
  219. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-register.d.ts +5 -0
  220. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-register.d.ts.map +1 -0
  221. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-register.js +43 -0
  222. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-register.js.map +1 -0
  223. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/package-lock.json +2566 -0
  224. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/package.json +21 -0
  225. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/__tests__/key-roundtrip.test.ts +107 -0
  226. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/__tests__/propertydata-api.test.ts +184 -0
  227. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/__tests__/schema-parity.test.ts +48 -0
  228. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/index.ts +249 -0
  229. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/lib/crypto.ts +79 -0
  230. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/lib/neo4j.ts +47 -0
  231. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/lib/propertydata-api.ts +135 -0
  232. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/tools/endpoints.ts +27 -0
  233. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/tools/key-deregister.ts +21 -0
  234. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/tools/key-list.ts +10 -0
  235. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/tools/key-register.ts +58 -0
  236. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/tsconfig.json +20 -0
  237. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/vitest.config.ts +8 -0
  238. package/payload/premium-plugins/real-agent/plugins/property-data/skills/property-data/SKILL.md +58 -0
  239. package/payload/server/{chunk-MEGIQYUD.js → chunk-2IKQERHN.js} +33 -5
  240. package/payload/server/{chunk-XJVJ2B2Q.js → chunk-NPZKH5EC.js} +1 -1
  241. package/payload/server/{chunk-4P2MPERV.js → chunk-X3Y6ENKA.js} +0 -90
  242. package/payload/server/{cloudflare-task-tracker-R6MMORFU.js → cloudflare-task-tracker-TL6R364J.js} +2 -2
  243. package/payload/server/maxy-edge.js +54 -26
  244. package/payload/server/public/assets/admin-2ZJmzJ_g.js +216 -0
  245. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-Ch-JZ1Q0.js → architectureDiagram-Q4EWVU46-DgfgldJT.js} +1 -1
  246. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-C08tkD4C.js → blockDiagram-DXYQGD6D-agu8GDzA.js} +1 -1
  247. package/payload/server/public/assets/{brand-DCdOhh-I.css → brand-BDASZqMG.css} +1 -1
  248. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-IceRdWw3.js → c4Diagram-AHTNJAMY-CmNsUmAe.js} +1 -1
  249. package/payload/server/public/assets/channel-DXGOX55q.js +1 -0
  250. package/payload/server/public/assets/{chunk-336JU56O-Cey0rxmH.js → chunk-336JU56O-D9Uts7k9.js} +2 -2
  251. package/payload/server/public/assets/{chunk-426QAEUC-Dzk8s0or.js → chunk-426QAEUC-D4ABqXMn.js} +1 -1
  252. package/payload/server/public/assets/{chunk-4TB4RGXK-C10nuKc8.js → chunk-4TB4RGXK-D1KE4OAX.js} +1 -1
  253. package/payload/server/public/assets/{chunk-5FUZZQ4R-B1B8871D.js → chunk-5FUZZQ4R-CAh0GXe2.js} +1 -1
  254. package/payload/server/public/assets/{chunk-5PVQY5BW-jvHIkgqP.js → chunk-5PVQY5BW-DBHa6HOv.js} +1 -1
  255. package/payload/server/public/assets/{chunk-EDXVE4YY-7nDxvXHS.js → chunk-EDXVE4YY-BDC-6mL3.js} +1 -1
  256. package/payload/server/public/assets/{chunk-ENJZ2VHE-C8lJ1YYn.js → chunk-ENJZ2VHE-CH3uROkW.js} +1 -1
  257. package/payload/server/public/assets/{chunk-ICPOFSXX-CT1d7veI.js → chunk-ICPOFSXX-BzZf0nAw.js} +1 -1
  258. package/payload/server/public/assets/{chunk-OYMX7WX6-LTAfwxv0.js → chunk-OYMX7WX6-BrLHrI6O.js} +1 -1
  259. package/payload/server/public/assets/{chunk-U2HBQHQK-RoGrqrH0.js → chunk-U2HBQHQK-Bw4UkLe_.js} +1 -1
  260. package/payload/server/public/assets/{chunk-X2U36JSP-D89ZBg3z.js → chunk-X2U36JSP-23xgdk05.js} +1 -1
  261. package/payload/server/public/assets/{chunk-YZCP3GAM-Cyg122Hf.js → chunk-YZCP3GAM-BA8iGgRa.js} +1 -1
  262. package/payload/server/public/assets/{chunk-ZZ45TVLE-Dg59YYuG.js → chunk-ZZ45TVLE-B-ol4EgR.js} +1 -1
  263. package/payload/server/public/assets/classDiagram-6PBFFD2Q-DTuuDxpK.js +1 -0
  264. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-CIw8RU0q.js +1 -0
  265. package/payload/server/public/assets/clone-O4ZyuvYl.js +1 -0
  266. package/payload/server/public/assets/{dagre-BPzUsxie.js → dagre--kXszEIb.js} +1 -1
  267. package/payload/server/public/assets/{dagre-KV5264BT-CjDNXqPy.js → dagre-KV5264BT-amN1uU2d.js} +1 -1
  268. package/payload/server/public/assets/data-DlmoKxmN.js +1 -0
  269. package/payload/server/public/assets/{device-url-actions-B588ZlnE.js → device-url-actions-CPoz5fqz.js} +1 -1
  270. package/payload/server/public/assets/{diagram-5BDNPKRD-Bqq0vqWM.js → diagram-5BDNPKRD-Cwizs9tP.js} +1 -1
  271. package/payload/server/public/assets/{diagram-G4DWMVQ6-DSqocDhm.js → diagram-G4DWMVQ6-BpSu5Uao.js} +1 -1
  272. package/payload/server/public/assets/{diagram-MMDJMWI5-DZRWgKRL.js → diagram-MMDJMWI5-DiArtkto.js} +1 -1
  273. package/payload/server/public/assets/{diagram-TYMM5635-DXRm-FXu.js → diagram-TYMM5635-_tygK58Y.js} +1 -1
  274. package/payload/server/public/assets/{erDiagram-SMLLAGMA-CFVgkUCo.js → erDiagram-SMLLAGMA-CBV6LWYA.js} +1 -1
  275. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-C82XCt9-.js → flowDiagram-DWJPFMVM-CHZFrtOU.js} +1 -1
  276. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-C4tnImlS.js → ganttDiagram-T4ZO3ILL-B3vKq5ov.js} +1 -1
  277. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-DXHutP-a.js → gitGraphDiagram-UUTBAWPF-dnJPjbtj.js} +1 -1
  278. package/payload/server/public/assets/graph-BVvcFSEQ.js +1 -0
  279. package/payload/server/public/assets/graph-labels-cCvgu38Y.js +1 -0
  280. package/payload/server/public/assets/{graphlib-BvR5tL62.js → graphlib-CNXtnega.js} +1 -1
  281. package/payload/server/public/assets/{infoDiagram-42DDH7IO-DgFMqgZy.js → infoDiagram-42DDH7IO-D8DYwVAF.js} +1 -1
  282. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-_5gmh1-V.js → ishikawaDiagram-UXIWVN3A-CfEVY2Ud.js} +1 -1
  283. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-CNfDVgwI.js → journeyDiagram-VCZTEJTY-FmoBq7Kh.js} +1 -1
  284. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-Djifb_Z6.js → kanban-definition-6JOO6SKY-B-Q9qk99.js} +1 -1
  285. package/payload/server/public/assets/{line-0fRVrNiw.js → line-DZwbJENP.js} +1 -1
  286. package/payload/server/public/assets/{mermaid-parser.core-DXA7LKDt.js → mermaid-parser.core-C3ahKykw.js} +1 -1
  287. package/payload/server/public/assets/{mermaid.core-BCfYtdMJ.js → mermaid.core-B8OFZIE8.js} +3 -3
  288. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-sTRvikWi.js → mindmap-definition-QFDTVHPH-CqhkfbWa.js} +1 -1
  289. package/payload/server/public/assets/{page-nAY64ID7.js → page-BnAxPkmg.js} +1 -1
  290. package/payload/server/public/assets/{page-DDyny08O.js → page-BnaN3u86.js} +1 -1
  291. package/payload/server/public/assets/{pieDiagram-DEJITSTG-QLTieded.js → pieDiagram-DEJITSTG-CJqQ6u3-.js} +1 -1
  292. package/payload/server/public/assets/{public-rUUducAl.js → public-rWe9ADCS.js} +3 -3
  293. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-DOKCcqAZ.js → quadrantDiagram-34T5L4WZ-BtEqOXQM.js} +1 -1
  294. package/payload/server/public/assets/{requirementDiagram-MS252O5E-BX6Zpq1X.js → requirementDiagram-MS252O5E-DPHWUtE6.js} +1 -1
  295. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-B05NdgZX.js → sankeyDiagram-XADWPNL6-FBmc3wHT.js} +1 -1
  296. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-CHF8ZdUb.js → sequenceDiagram-FGHM5R23-BMSd2-1M.js} +1 -1
  297. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-DTAt7Ytz.js → stateDiagram-FHFEXIEX-DqFbU-LT.js} +1 -1
  298. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CXTnsHGq.js +1 -0
  299. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-Dzd6X_ei.js → timeline-definition-GMOUNBTQ-DsfvHVK8.js} +1 -1
  300. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-BAbM4QlQ.js → vennDiagram-DHZGUBPP-kHU05mqC.js} +1 -1
  301. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-CIOXXKJd.js → wardleyDiagram-NUSXRM2D-C696Mez_.js} +1 -1
  302. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-oF9sZesS.js → xychartDiagram-5P7HB3ND-yht-JyXJ.js} +1 -1
  303. package/payload/server/public/data.html +5 -5
  304. package/payload/server/public/graph.html +5 -5
  305. package/payload/server/public/index.html +7 -7
  306. package/payload/server/public/public.html +4 -4
  307. package/payload/server/server.js +261 -207
  308. package/payload/server/public/assets/admin-DBuCWSPS.js +0 -216
  309. package/payload/server/public/assets/channel-8QQB2Zoe.js +0 -1
  310. package/payload/server/public/assets/classDiagram-6PBFFD2Q-CViZOOjI.js +0 -1
  311. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-Dm7eGBqB.js +0 -1
  312. package/payload/server/public/assets/clone-BC8oes11.js +0 -1
  313. package/payload/server/public/assets/data-BeblX4m4.js +0 -1
  314. package/payload/server/public/assets/graph-ZuBiYril.js +0 -1
  315. package/payload/server/public/assets/graph-labels-CnbJR6cp.js +0 -1
  316. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-2bJIW7wn.js +0 -1
  317. /package/payload/server/public/assets/{brand-Dln107gD.js → brand-BWCtpG7_.js} +0 -0
@@ -14,7 +14,6 @@ import {
14
14
  USERS_FILE,
15
15
  VNC_DISPLAY,
16
16
  WEBSOCKIFY_PORT,
17
- appendStreamLogLine,
18
17
  autoDeliverPremiumPlugins,
19
18
  browserViewerLog,
20
19
  canAccessAdmin,
@@ -42,6 +41,7 @@ import {
42
41
  registerSession,
43
42
  renderLoginPage,
44
43
  requireAdminSession,
44
+ requirePortEnv,
45
45
  resolveAccount,
46
46
  resolveClientIp,
47
47
  resolveUserAccounts,
@@ -60,7 +60,7 @@ import {
60
60
  vncLog,
61
61
  waitForExit,
62
62
  walkPremiumBundles
63
- } from "./chunk-MEGIQYUD.js";
63
+ } from "./chunk-2IKQERHN.js";
64
64
  import {
65
65
  CLOUDFLARE_TASK_DIAGNOSTICS,
66
66
  appendCloudflareSteps,
@@ -69,16 +69,14 @@ import {
69
69
  openCloudflareTask,
70
70
  readTunnelState,
71
71
  resolveUnitGoneVerdict
72
- } from "./chunk-XJVJ2B2Q.js";
72
+ } from "./chunk-NPZKH5EC.js";
73
73
  import {
74
74
  GREETING_DIRECTIVE,
75
- HAIKU_MODEL,
76
75
  deleteAgentProjection,
77
76
  deleteConversation,
78
77
  embed,
79
78
  ensureConversation,
80
79
  fetchBranding,
81
- generateSessionLabel,
82
80
  getAgentSessionIdForConversation,
83
81
  getRecentMessages,
84
82
  getSession,
@@ -93,7 +91,7 @@ import {
93
91
  verifyAndGetConversationUpdatedAt,
94
92
  verifyConversationOwnership,
95
93
  writeAdminUserAndPerson
96
- } from "./chunk-4P2MPERV.js";
94
+ } from "./chunk-X3Y6ENKA.js";
97
95
  import {
98
96
  __commonJS,
99
97
  __toESM
@@ -4166,6 +4164,16 @@ async function callOauthLlm(params) {
4166
4164
  return { kind: "ok", text: textBlock.text, stopReason, outputTokens };
4167
4165
  }
4168
4166
 
4167
+ // ../lib/models/src/index.ts
4168
+ var OPUS_MODEL = "claude-opus-4-7";
4169
+ var SONNET_MODEL = "claude-sonnet-4-6";
4170
+ var HAIKU_MODEL = "claude-haiku-4-5";
4171
+ var MODEL_CONTEXT_WINDOW = {
4172
+ [OPUS_MODEL]: 2e5,
4173
+ [SONNET_MODEL]: 2e5,
4174
+ [HAIKU_MODEL]: 2e5
4175
+ };
4176
+
4169
4177
  // ../lib/screening-patterns/src/index.ts
4170
4178
  var PROMPT_INJECTION_PATTERNS = [
4171
4179
  "ignore your instructions",
@@ -4402,7 +4410,7 @@ import { resolve as resolve5 } from "path";
4402
4410
 
4403
4411
  // app/lib/channel-pty-bridge/manager-client.ts
4404
4412
  function managerBase() {
4405
- const port2 = Number(process.env.CLAUDE_SESSION_MANAGER_PORT ?? "19400");
4413
+ const port2 = requirePortEnv("CLAUDE_SESSION_MANAGER_PORT", { tag: "channel-pty-bridge:manager-client" });
4406
4414
  return `http://127.0.0.1:${port2}`;
4407
4415
  }
4408
4416
  async function managerSpawn(opts) {
@@ -6853,71 +6861,6 @@ app8.post("/", requireAdminSession, async (c) => {
6853
6861
  });
6854
6862
  var new_session_submit_default = app8;
6855
6863
 
6856
- // server/routes/admin/failure-report.ts
6857
- var SESSION_KEY_RE2 = /^sk_[0-9a-f]{16}$/i;
6858
- var UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
6859
- var ISO_RE3 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/;
6860
- var SAFE_TOKEN_RE = /^[\w.:-]{1,64}$/;
6861
- function validate(body) {
6862
- const missing = [];
6863
- if (typeof body.sessionKey !== "string" || !SESSION_KEY_RE2.test(body.sessionKey)) missing.push("sessionKey");
6864
- if (typeof body.conversationId !== "string" || !UUID_RE2.test(body.conversationId)) missing.push("conversationId");
6865
- if (typeof body.lastUserMessageId !== "string" || !SAFE_TOKEN_RE.test(body.lastUserMessageId)) missing.push("lastUserMessageId");
6866
- if (typeof body.clickTs !== "string" || !ISO_RE3.test(body.clickTs)) missing.push("clickTs");
6867
- const snap = body.clientSnapshot;
6868
- if (!snap || typeof snap !== "object") missing.push("clientSnapshot");
6869
- if (missing.length > 0) return { ok: false, missing };
6870
- const snapshot = snap;
6871
- const lastAssistantMessageId = typeof body.lastAssistantMessageId === "string" && SAFE_TOKEN_RE.test(body.lastAssistantMessageId) ? body.lastAssistantMessageId : "-";
6872
- const sseReadyState = typeof snapshot.sseReadyState === "string" && SAFE_TOKEN_RE.test(snapshot.sseReadyState) ? snapshot.sseReadyState : typeof snapshot.sseReadyState === "number" ? String(snapshot.sseReadyState) : "-";
6873
- const lastEventType = typeof snapshot.lastEventType === "string" && SAFE_TOKEN_RE.test(snapshot.lastEventType) ? snapshot.lastEventType : "-";
6874
- const lastAppliedMessageId = typeof snapshot.lastAppliedMessageId === "string" && SAFE_TOKEN_RE.test(snapshot.lastAppliedMessageId) ? snapshot.lastAppliedMessageId : "-";
6875
- return {
6876
- ok: true,
6877
- value: {
6878
- sessionKey: body.sessionKey,
6879
- conversationId: body.conversationId,
6880
- lastUserMessageId: body.lastUserMessageId,
6881
- lastAssistantMessageId,
6882
- clickTs: body.clickTs,
6883
- sseReadyState,
6884
- lastEventType,
6885
- lastAppliedMessageId
6886
- }
6887
- };
6888
- }
6889
- var app9 = new Hono();
6890
- app9.post("/", requireAdminSession, async (c) => {
6891
- let body;
6892
- try {
6893
- body = await c.req.json();
6894
- } catch {
6895
- return c.json({ ok: false, error: "missing-turn-identifiers", missing: ["body-not-json"] }, 400);
6896
- }
6897
- const v = validate(body);
6898
- if (!v.ok) {
6899
- return c.json({ ok: false, error: "missing-turn-identifiers", missing: v.missing }, 400);
6900
- }
6901
- const cacheKey = c.var.cacheKey;
6902
- const accountId = getAccountIdForSession(cacheKey);
6903
- if (!accountId) {
6904
- return c.json({ ok: false, error: "no-account" }, 401);
6905
- }
6906
- const line = [
6907
- `[failure-report] sessionKey=${v.value.sessionKey}`,
6908
- `conversationId=${v.value.conversationId}`,
6909
- `userMessageId=${v.value.lastUserMessageId}`,
6910
- `assistantMessageId=${v.value.lastAssistantMessageId}`,
6911
- `sseState=${v.value.sseReadyState}`,
6912
- `lastEventType=${v.value.lastEventType}`,
6913
- `lastAppliedMessageId=${v.value.lastAppliedMessageId}`,
6914
- `ts=${v.value.clickTs}`
6915
- ].join(" ");
6916
- appendStreamLogLine(accountId, v.value.sessionKey, line);
6917
- return c.json({ ok: true });
6918
- });
6919
- var failure_report_default = app9;
6920
-
6921
6864
  // server/routes/admin/logs.ts
6922
6865
  import { existsSync as existsSync10, readdirSync as readdirSync5, readFileSync as readFileSync11, statSync as statSync5 } from "fs";
6923
6866
  import { resolve as resolve8, basename as basename3 } from "path";
@@ -6939,8 +6882,8 @@ function resolveSessionLogPaths(filename, logDirs) {
6939
6882
 
6940
6883
  // server/routes/admin/logs.ts
6941
6884
  var TAIL_BYTES = 8192;
6942
- var app10 = new Hono();
6943
- app10.get("/", async (c) => {
6885
+ var app9 = new Hono();
6886
+ app9.get("/", async (c) => {
6944
6887
  const fileParam = c.req.query("file");
6945
6888
  const typeParam = c.req.query("type");
6946
6889
  const conversationIdParam = c.req.query("conversationId");
@@ -7082,12 +7025,12 @@ app10.get("/", async (c) => {
7082
7025
  }
7083
7026
  return c.json({ logs });
7084
7027
  });
7085
- var logs_default = app10;
7028
+ var logs_default = app9;
7086
7029
 
7087
7030
  // server/routes/admin/claude-info.ts
7088
7031
  import { execFileSync as execFileSync3 } from "child_process";
7089
- var app11 = new Hono();
7090
- app11.get("/", (c) => {
7032
+ var app10 = new Hono();
7033
+ app10.get("/", (c) => {
7091
7034
  let version = "unknown";
7092
7035
  try {
7093
7036
  const raw = execFileSync3("claude", ["--version"], { encoding: "utf-8", timeout: 5e3 });
@@ -7105,14 +7048,14 @@ app11.get("/", (c) => {
7105
7048
  const thinkingView = resolvedAccount?.config.thinkingView ?? "default";
7106
7049
  return c.json({ version, account, model, thinkingView });
7107
7050
  });
7108
- var claude_info_default = app11;
7051
+ var claude_info_default = app10;
7109
7052
 
7110
7053
  // server/routes/admin/attachment.ts
7111
7054
  import { readFile as readFile3, readdir } from "fs/promises";
7112
7055
  import { existsSync as existsSync11 } from "fs";
7113
7056
  import { resolve as resolve9 } from "path";
7114
- var app12 = new Hono();
7115
- app12.get("/:attachmentId", requireAdminSession, async (c) => {
7057
+ var app11 = new Hono();
7058
+ app11.get("/:attachmentId", requireAdminSession, async (c) => {
7116
7059
  const attachmentId = c.req.param("attachmentId");
7117
7060
  const cacheKey = c.var.cacheKey;
7118
7061
  const accountId = getAccountIdForSession(cacheKey);
@@ -7151,13 +7094,13 @@ app12.get("/:attachmentId", requireAdminSession, async (c) => {
7151
7094
  }
7152
7095
  });
7153
7096
  });
7154
- var attachment_default = app12;
7097
+ var attachment_default = app11;
7155
7098
 
7156
7099
  // server/routes/admin/agents.ts
7157
7100
  import { resolve as resolve10 } from "path";
7158
7101
  import { readdirSync as readdirSync6, readFileSync as readFileSync12, existsSync as existsSync12, rmSync } from "fs";
7159
- var app13 = new Hono();
7160
- app13.get("/", (c) => {
7102
+ var app12 = new Hono();
7103
+ app12.get("/", (c) => {
7161
7104
  const account = resolveAccount();
7162
7105
  if (!account) return c.json({ agents: [] });
7163
7106
  const agentsDir = resolve10(account.accountDir, "agents");
@@ -7187,7 +7130,7 @@ app13.get("/", (c) => {
7187
7130
  }
7188
7131
  return c.json({ agents });
7189
7132
  });
7190
- app13.delete("/:slug", async (c) => {
7133
+ app12.delete("/:slug", async (c) => {
7191
7134
  const slug = c.req.param("slug");
7192
7135
  const account = resolveAccount();
7193
7136
  if (!account) return c.json({ error: "No account resolved" }, 400);
@@ -7217,7 +7160,7 @@ app13.delete("/:slug", async (c) => {
7217
7160
  return c.json({ error: "Failed to delete agent" }, 500);
7218
7161
  }
7219
7162
  });
7220
- app13.post("/:slug/project", async (c) => {
7163
+ app12.post("/:slug/project", async (c) => {
7221
7164
  const slug = c.req.param("slug");
7222
7165
  const account = resolveAccount();
7223
7166
  if (!account) return c.json({ error: "No account resolved" }, 400);
@@ -7239,7 +7182,7 @@ app13.post("/:slug/project", async (c) => {
7239
7182
  return c.json({ error: `Projection failed: ${msg}` }, 500);
7240
7183
  }
7241
7184
  });
7242
- var agents_default = app13;
7185
+ var agents_default = app12;
7243
7186
 
7244
7187
  // server/routes/admin/sessions.ts
7245
7188
  import crypto from "crypto";
@@ -7408,8 +7351,8 @@ function formatAge(updatedAtStr) {
7408
7351
  return "unknown";
7409
7352
  }
7410
7353
  }
7411
- var app14 = new Hono();
7412
- app14.get("/", requireAdminSession, async (c) => {
7354
+ var app13 = new Hono();
7355
+ app13.get("/", requireAdminSession, async (c) => {
7413
7356
  const cacheKey = c.var.cacheKey;
7414
7357
  const accountId = getAccountIdForSession(cacheKey);
7415
7358
  if (!accountId) return c.json({ error: "Account not found for session" }, 401);
@@ -7439,7 +7382,7 @@ app14.get("/", requireAdminSession, async (c) => {
7439
7382
  return c.json({ error: "Failed to fetch sessions" }, 500);
7440
7383
  }
7441
7384
  });
7442
- app14.post("/new", requireAdminSession, async (c) => {
7385
+ app13.post("/new", requireAdminSession, async (c) => {
7443
7386
  const oldCacheKey = c.var.cacheKey;
7444
7387
  console.log(`[admin-chat] new-conversation outcome=ingress cacheKey=${oldCacheKey.slice(0, 8)}`);
7445
7388
  const accountId = getAccountIdForSession(oldCacheKey);
@@ -7456,7 +7399,7 @@ app14.post("/new", requireAdminSession, async (c) => {
7456
7399
  console.log(`[admin-chat] new-conversation outcome=ok oldKey=${oldCacheKey.slice(0, 8)} newKey=${newCacheKey.slice(0, 8)}`);
7457
7400
  return c.json({ session_key: newSignedSessionToken, conversationId: null });
7458
7401
  });
7459
- app14.post("/switch", requireAdminSession, async (c) => {
7402
+ app13.post("/switch", requireAdminSession, async (c) => {
7460
7403
  const cacheKey = c.var.cacheKey;
7461
7404
  const accountId = getAccountIdForSession(cacheKey);
7462
7405
  const userId = getUserIdForSession(cacheKey);
@@ -7484,7 +7427,7 @@ app14.post("/switch", requireAdminSession, async (c) => {
7484
7427
  console.log(`[session-switch] from=${cacheKey.slice(0, 8)} to=${targetCacheKey.slice(0, 8)} targetConvId=${targetConversationId?.slice(0, 8) ?? "none"} accountId=${accountId.slice(0, 8)}`);
7485
7428
  return c.json({ session_key: targetSignedSessionToken, conversationId: targetConversationId });
7486
7429
  });
7487
- app14.delete("/:id", requireAdminSession, async (c) => {
7430
+ app13.delete("/:id", requireAdminSession, async (c) => {
7488
7431
  const conversationId = c.req.param("id");
7489
7432
  const cacheKey = c.var.cacheKey;
7490
7433
  const accountId = getAccountIdForSession(cacheKey);
@@ -7499,7 +7442,7 @@ app14.delete("/:id", requireAdminSession, async (c) => {
7499
7442
  return c.json({ error: "Failed to delete session" }, 500);
7500
7443
  }
7501
7444
  });
7502
- app14.post("/:id/resume", async (c) => {
7445
+ app13.post("/:id/resume", async (c) => {
7503
7446
  const conversationId = c.req.param("id");
7504
7447
  const t0 = Date.now();
7505
7448
  const signedSessionToken = c.req.query("session_key") ?? "";
@@ -7772,34 +7715,7 @@ app14.post("/:id/resume", async (c) => {
7772
7715
  }
7773
7716
  });
7774
7717
  });
7775
- app14.post("/:id/label", requireAdminSession, async (c) => {
7776
- const conversationId = c.req.param("id");
7777
- const cacheKey = c.var.cacheKey;
7778
- const accountId = getAccountIdForSession(cacheKey);
7779
- if (!accountId) return c.json({ error: "Account not found for session" }, 401);
7780
- const owned = await verifyConversationOwnership(conversationId, accountId);
7781
- if (!owned) return c.json({ error: "Conversation not found" }, 404);
7782
- console.error(`[admin] manual-label: requesting suggestion for ${conversationId}`);
7783
- try {
7784
- const messages = await getRecentMessages(conversationId, 50);
7785
- const userMessages = messages.filter((m) => m.role === "user").map((m) => m.content);
7786
- if (userMessages.length === 0) {
7787
- console.error(`[admin] manual-label: haiku failed for ${conversationId} \u2014 no user messages`);
7788
- return c.json({ label: null });
7789
- }
7790
- const label = await generateSessionLabel(userMessages);
7791
- if (label) {
7792
- console.error(`[admin] manual-label: haiku suggested "${label}" for ${conversationId}`);
7793
- } else {
7794
- console.error(`[admin] manual-label: haiku failed for ${conversationId} \u2014 null response`);
7795
- }
7796
- return c.json({ label });
7797
- } catch (err) {
7798
- console.error(`[admin] manual-label: haiku failed for ${conversationId} \u2014 ${err instanceof Error ? err.message : String(err)}`);
7799
- return c.json({ label: null });
7800
- }
7801
- });
7802
- app14.put("/:id/label", requireAdminSession, async (c) => {
7718
+ app13.put("/:id/label", requireAdminSession, async (c) => {
7803
7719
  const conversationId = c.req.param("id");
7804
7720
  const cacheKey = c.var.cacheKey;
7805
7721
  let body;
@@ -7825,7 +7741,7 @@ app14.put("/:id/label", requireAdminSession, async (c) => {
7825
7741
  return c.json({ error: "Failed to rename session" }, 500);
7826
7742
  }
7827
7743
  });
7828
- var sessions_default = app14;
7744
+ var sessions_default = app13;
7829
7745
 
7830
7746
  // app/lib/claude-agent/spawn-context.ts
7831
7747
  import { existsSync as existsSync14, readFileSync as readFileSync13, readdirSync as readdirSync7, statSync as statSync6 } from "fs";
@@ -8125,58 +8041,38 @@ function resolveTunnelUrl() {
8125
8041
  }
8126
8042
  var TAG18 = "[claude-session-manager:wrapper]";
8127
8043
  function managerBase2() {
8128
- const port2 = Number(process.env.CLAUDE_SESSION_MANAGER_PORT ?? "19400");
8044
+ const port2 = requirePortEnv("CLAUDE_SESSION_MANAGER_PORT", { tag: "claude-session-manager:wrapper" });
8129
8045
  return `http://127.0.0.1:${port2}`;
8130
8046
  }
8131
- var app15 = new Hono();
8132
- app15.use("*", requireAdminSession);
8133
- app15.post("/", async (c) => {
8134
- const routeStart = Date.now();
8135
- const cacheKey = c.get("cacheKey") ?? "";
8136
- const senderId = getAccountIdForSession(cacheKey) ?? "";
8137
- if (!senderId) {
8138
- console.error(`${TAG18} reject reason=no-account-id cacheKey-prefix=${cacheKey.slice(0, 8)}`);
8139
- return c.json({ error: "admin-account-not-resolved" }, 500);
8140
- }
8141
- const userId = getUserIdForSession(cacheKey);
8142
- let body = {};
8143
- try {
8144
- body = await c.req.json();
8145
- } catch {
8146
- }
8147
- const channel = typeof body.channel === "string" ? body.channel : "browser";
8148
- const initialMessage = typeof body.initialMessage === "string" && body.initialMessage.trim() ? body.initialMessage : null;
8149
- const permissionMode = typeof body.permissionMode === "string" ? body.permissionMode : void 0;
8150
- console.log(`${TAG18} spawn-request-in cacheKey-prefix=${cacheKey.slice(0, 8)} senderId=${senderId.slice(0, 8)} userId=${userId ? userId.slice(0, 8) : "absent"} channel=${channel} permissionMode=${permissionMode ?? "default"} initialMessage=${initialMessage ? "yes" : "no"}`);
8047
+ var app14 = new Hono();
8048
+ var UUID_PATTERN = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
8049
+ async function performSpawnWithInitialMessage(args) {
8151
8050
  const ownerStart = Date.now();
8152
- const aboutOwner = await resolveOwnerProfileBlock(senderId, userId);
8051
+ const aboutOwner = await resolveOwnerProfileBlock(args.senderId, args.userId);
8153
8052
  const ownerMs = Date.now() - ownerStart;
8154
8053
  const aboutOwnerStatus = aboutOwner == null ? "absent" : "ok" in aboutOwner && aboutOwner.ok === false ? `unresolved:${aboutOwner.reason}` : "ok";
8155
8054
  console.log(`${TAG18} about-owner-resolved status=${aboutOwnerStatus} ms=${ownerMs}`);
8156
- const dormantStart = Date.now();
8157
- const dormantPlugins = computeDormantPlugins(senderId);
8158
- console.log(`${TAG18} dormant-plugins-computed count=${Array.isArray(dormantPlugins) ? dormantPlugins.length : 0} ms=${Date.now() - dormantStart}`);
8159
- const activeStart = Date.now();
8160
- const activePlugins = computeActivePlugins(senderId);
8161
- console.log(`${TAG18} active-plugins-computed count=${activePlugins.length} ms=${Date.now() - activeStart}`);
8162
- const specStart = Date.now();
8163
- const specialistDomains = computeSpecialistDomains(senderId);
8164
- console.log(`${TAG18} specialist-domains-computed count=${specialistDomains.length} ms=${Date.now() - specStart}`);
8055
+ const dormantPlugins = computeDormantPlugins(args.senderId);
8056
+ const activePlugins = computeActivePlugins(args.senderId);
8057
+ const specialistDomains = computeSpecialistDomains(args.senderId);
8165
8058
  const tunnelUrl = resolveTunnelUrl();
8166
8059
  console.log(`${TAG18} tunnel-url-resolved value=${tunnelUrl ?? "null"}`);
8167
- const forwardStart = Date.now();
8168
8060
  const upstreamPayload = JSON.stringify({
8169
- senderId,
8170
- role: "admin",
8171
- channel,
8172
- permissionMode,
8061
+ senderId: args.senderId,
8062
+ role: args.role,
8063
+ channel: args.channel,
8064
+ permissionMode: args.permissionMode,
8065
+ hidden: args.hidden,
8066
+ specialist: args.specialist,
8173
8067
  aboutOwner,
8174
8068
  dormantPlugins,
8175
8069
  activePlugins,
8176
8070
  specialistDomains,
8177
- tunnelUrl
8071
+ tunnelUrl,
8072
+ originatingSessionId: args.originatingSessionId
8178
8073
  });
8179
- console.log(`${TAG18} forward-spawn-start managerBase=${managerBase2()} bytes=${upstreamPayload.length}`);
8074
+ console.log(`${TAG18} forward-spawn-start managerBase=${managerBase2()} bytes=${upstreamPayload.length} hidden=${args.hidden} specialist=${args.specialist ?? "none"}`);
8075
+ const forwardStart = Date.now();
8180
8076
  const upstream = await fetch(`${managerBase2()}/spawn`, {
8181
8077
  method: "POST",
8182
8078
  headers: { "content-type": "application/json" },
@@ -8185,27 +8081,143 @@ app15.post("/", async (c) => {
8185
8081
  console.error(`${TAG18} fetch-failed op=spawn message=${err instanceof Error ? err.message : String(err)} ms=${Date.now() - forwardStart}`);
8186
8082
  return null;
8187
8083
  });
8188
- if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8189
- console.log(`${TAG18} forward-spawn-done status=${upstream.status} ms=${Date.now() - forwardStart} route-ms=${Date.now() - routeStart}`);
8084
+ if (!upstream) return new Response(JSON.stringify({ error: "manager-unreachable" }), { status: 503, headers: { "content-type": "application/json" } });
8085
+ console.log(`${TAG18} forward-spawn-done status=${upstream.status} ms=${Date.now() - forwardStart}`);
8190
8086
  let spawnedSessionId = null;
8191
- if (upstream.ok && initialMessage) {
8087
+ if (upstream.ok && args.initialMessage) {
8192
8088
  const buffered = await upstream.clone().json().catch(() => null);
8193
8089
  if (buffered && typeof buffered.sessionId === "string" && buffered.sessionId) {
8194
8090
  spawnedSessionId = buffered.sessionId;
8195
8091
  }
8196
8092
  }
8197
- if (initialMessage && spawnedSessionId) {
8198
- fetch(`${managerBase2()}/${encodeURIComponent(spawnedSessionId)}/input`, {
8093
+ if (args.initialMessage && spawnedSessionId) {
8094
+ const inputBytes = Buffer.byteLength(args.initialMessage, "utf8");
8095
+ console.log(`${TAG18} initial-input-start sessionId=${spawnedSessionId.slice(0, 8)} bytes=${inputBytes}`);
8096
+ await fetch(`${managerBase2()}/${encodeURIComponent(spawnedSessionId)}/input`, {
8199
8097
  method: "POST",
8200
8098
  headers: { "content-type": "application/json" },
8201
- body: JSON.stringify({ text: initialMessage })
8099
+ body: JSON.stringify({ text: args.initialMessage })
8202
8100
  }).catch((err) => {
8203
8101
  console.error(`${TAG18} fetch-failed op=initial-input message=${err instanceof Error ? err.message : String(err)}`);
8204
8102
  });
8205
8103
  }
8206
8104
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8105
+ }
8106
+ var requireAdminSessionUnlessLoopbackSpawn = async (c, next) => {
8107
+ if (c.req.method === "POST" && c.req.path === "/api/admin/claude-sessions") {
8108
+ const remoteAddr = c.env?.incoming?.socket?.remoteAddress ?? "";
8109
+ const isLoopback = remoteAddr === "127.0.0.1" || remoteAddr === "::1" || remoteAddr === "::ffff:127.0.0.1";
8110
+ if (isLoopback) {
8111
+ console.log(`${TAG18} loopback-spawn-bypass remoteAddr=${remoteAddr}`);
8112
+ return next();
8113
+ }
8114
+ }
8115
+ return requireAdminSession(c, next);
8116
+ };
8117
+ app14.use("*", requireAdminSessionUnlessLoopbackSpawn);
8118
+ app14.post("/", async (c) => {
8119
+ const routeStart = Date.now();
8120
+ const cacheKey = c.get("cacheKey") ?? "";
8121
+ let body = {};
8122
+ try {
8123
+ body = await c.req.json();
8124
+ } catch {
8125
+ }
8126
+ let senderId;
8127
+ let userId;
8128
+ let specialist;
8129
+ let originatingSessionId;
8130
+ let authSurface;
8131
+ if (cacheKey) {
8132
+ authSurface = "cookie";
8133
+ senderId = getAccountIdForSession(cacheKey) ?? "";
8134
+ if (!senderId) {
8135
+ console.error(`${TAG18} reject reason=no-account-id cacheKey-prefix=${cacheKey.slice(0, 8)}`);
8136
+ return c.json({ error: "admin-account-not-resolved" }, 500);
8137
+ }
8138
+ userId = getUserIdForSession(cacheKey) ?? void 0;
8139
+ specialist = void 0;
8140
+ originatingSessionId = void 0;
8141
+ } else {
8142
+ authSurface = "loopback";
8143
+ if (typeof body.originatingSessionId !== "string" || !UUID_PATTERN.test(body.originatingSessionId)) {
8144
+ console.log(`[turn-recorder] spawn-failed sessionId=unknown reason=missing-originating-session-id`);
8145
+ return c.json({ error: "originating-session-id-required" }, 400);
8146
+ }
8147
+ originatingSessionId = body.originatingSessionId;
8148
+ const operatorMeta = await fetch(
8149
+ `${managerBase2()}/${encodeURIComponent(originatingSessionId)}/meta`
8150
+ ).then((r) => r.ok ? r.json() : null).catch((err) => {
8151
+ console.error(`${TAG18} fetch-failed op=operator-meta-lookup message=${err instanceof Error ? err.message : String(err)}`);
8152
+ return null;
8153
+ });
8154
+ const operatorSenderId = operatorMeta && typeof operatorMeta.senderId === "string" && operatorMeta.senderId.length > 0 ? operatorMeta.senderId : null;
8155
+ if (!operatorSenderId) {
8156
+ console.log(
8157
+ `[turn-recorder] spawn-failed sessionId=${originatingSessionId} reason=originating-session-not-found`
8158
+ );
8159
+ return c.json({ error: "originating-session-not-found" }, 404);
8160
+ }
8161
+ senderId = operatorSenderId;
8162
+ userId = void 0;
8163
+ specialist = typeof body.specialist === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(body.specialist) ? body.specialist : "database-operator";
8164
+ }
8165
+ const channel = typeof body.channel === "string" ? body.channel : "browser";
8166
+ const initialMessage = typeof body.initialMessage === "string" && body.initialMessage.trim() ? body.initialMessage : null;
8167
+ const initialMessageBytes = initialMessage ? Buffer.byteLength(initialMessage, "utf8") : 0;
8168
+ const permissionMode = typeof body.permissionMode === "string" ? body.permissionMode : void 0;
8169
+ if (authSurface === "cookie") {
8170
+ console.log(`${TAG18} spawn-request-in surface=cookie cacheKey-prefix=${cacheKey.slice(0, 8)} accountId=${senderId.slice(0, 8)} userId=${userId ? userId.slice(0, 8) : "absent"} channel=${channel} permissionMode=${permissionMode ?? "default"} initialMessage=${initialMessage ? "yes" : "no"}`);
8171
+ } else {
8172
+ console.log(`[turn-recorder] spawn-request sessionId=${originatingSessionId} specialist=${specialist ?? "none"} initialMessageBytes=${initialMessageBytes}`);
8173
+ }
8174
+ const t0 = Date.now();
8175
+ const response = await performSpawnWithInitialMessage({
8176
+ senderId,
8177
+ userId,
8178
+ role: "admin",
8179
+ channel,
8180
+ permissionMode,
8181
+ hidden: false,
8182
+ specialist,
8183
+ initialMessage,
8184
+ originatingSessionId
8185
+ });
8186
+ if (authSurface === "loopback" && originatingSessionId) {
8187
+ const respText = await response.text().catch(() => "");
8188
+ const respStatus = response.status;
8189
+ const replay = new Response(respText, { status: respStatus, headers: response.headers });
8190
+ let parsed = null;
8191
+ try {
8192
+ parsed = JSON.parse(respText);
8193
+ } catch {
8194
+ parsed = null;
8195
+ }
8196
+ if (respStatus >= 200 && respStatus < 300 && parsed && typeof parsed.sessionId === "string") {
8197
+ const recorderSessionId = parsed.sessionId;
8198
+ console.log(
8199
+ `[turn-recorder] spawn-success sessionId=${originatingSessionId} recorderSessionId=${recorderSessionId} pid=${parsed.pid ?? 0} latency-ms=${Date.now() - t0}`
8200
+ );
8201
+ if (initialMessage) {
8202
+ console.log(
8203
+ `[turn-recorder] input-delivered sessionId=${originatingSessionId} recorderSessionId=${recorderSessionId} bytes=${initialMessageBytes} multiline=${initialMessage.includes("\n")}`
8204
+ );
8205
+ }
8206
+ } else {
8207
+ const reasonRaw = parsed && typeof parsed.error === "string" ? parsed.error : "unknown";
8208
+ if (reasonRaw !== "tool-surface-missing" && reasonRaw !== "missing-originating-session-id") {
8209
+ const detail = parsed && typeof parsed.detail === "string" ? parsed.detail.slice(0, 200) : "";
8210
+ console.log(
8211
+ `[turn-recorder] spawn-failed sessionId=${originatingSessionId} reason=manager-spawn http=${respStatus} err=${JSON.stringify(detail || reasonRaw)}`
8212
+ );
8213
+ }
8214
+ }
8215
+ return replay;
8216
+ }
8217
+ console.log(`${TAG18} route-done surface=cookie status=${response.status} route-ms=${Date.now() - routeStart}`);
8218
+ return response;
8207
8219
  });
8208
- app15.get("/events", async (c) => {
8220
+ app14.get("/events", async (c) => {
8209
8221
  const upstream = await fetch(`${managerBase2()}/events`, {
8210
8222
  headers: { accept: "text/event-stream" }
8211
8223
  }).catch((err) => {
@@ -8223,7 +8235,7 @@ app15.get("/events", async (c) => {
8223
8235
  }
8224
8236
  });
8225
8237
  });
8226
- app15.get("/", async (c) => {
8238
+ app14.get("/", async (c) => {
8227
8239
  const cacheKey = c.get("cacheKey") ?? "";
8228
8240
  const senderId = getAccountIdForSession(cacheKey) ?? "";
8229
8241
  if (!senderId) return c.json({ error: "admin-account-not-resolved" }, 500);
@@ -8236,7 +8248,7 @@ app15.get("/", async (c) => {
8236
8248
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8237
8249
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8238
8250
  });
8239
- app15.post("/resume", async (c) => {
8251
+ app14.post("/resume", async (c) => {
8240
8252
  const cacheKey = c.get("cacheKey") ?? "";
8241
8253
  const senderId = getAccountIdForSession(cacheKey) ?? "";
8242
8254
  if (!senderId) return c.json({ error: "admin-account-not-resolved" }, 500);
@@ -8247,8 +8259,8 @@ app15.post("/resume", async (c) => {
8247
8259
  } catch {
8248
8260
  return c.json({ error: "body-not-json" }, 400);
8249
8261
  }
8250
- if (typeof body.claudeSessionId !== "string" || !body.claudeSessionId) {
8251
- return c.json({ error: "claudeSessionId-required" }, 400);
8262
+ if (typeof body.sessionId !== "string" || !body.sessionId) {
8263
+ return c.json({ error: "sessionId-required" }, 400);
8252
8264
  }
8253
8265
  const channel = typeof body.channel === "string" ? body.channel : "browser";
8254
8266
  const aboutOwner = await resolveOwnerProfileBlock(senderId, userId);
@@ -8263,7 +8275,7 @@ app15.post("/resume", async (c) => {
8263
8275
  senderId,
8264
8276
  role: "admin",
8265
8277
  channel,
8266
- claudeSessionId: body.claudeSessionId,
8278
+ sessionId: body.sessionId,
8267
8279
  aboutOwner,
8268
8280
  dormantPlugins,
8269
8281
  activePlugins,
@@ -8277,7 +8289,7 @@ app15.post("/resume", async (c) => {
8277
8289
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8278
8290
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8279
8291
  });
8280
- app15.post("/:sessionId/stop", async (c) => {
8292
+ app14.post("/:sessionId/stop", async (c) => {
8281
8293
  const sessionId = c.req.param("sessionId");
8282
8294
  const upstream = await fetch(
8283
8295
  `${managerBase2()}/${encodeURIComponent(sessionId)}/stop`,
@@ -8289,7 +8301,7 @@ app15.post("/:sessionId/stop", async (c) => {
8289
8301
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8290
8302
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8291
8303
  });
8292
- app15.delete("/:sessionId", async (c) => {
8304
+ app14.delete("/:sessionId", async (c) => {
8293
8305
  const sessionId = c.req.param("sessionId");
8294
8306
  const upstream = await fetch(
8295
8307
  `${managerBase2()}/${encodeURIComponent(sessionId)}`,
@@ -8301,7 +8313,7 @@ app15.delete("/:sessionId", async (c) => {
8301
8313
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8302
8314
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8303
8315
  });
8304
- app15.post("/:sessionId/archive", async (c) => {
8316
+ app14.post("/:sessionId/archive", async (c) => {
8305
8317
  const sessionId = c.req.param("sessionId");
8306
8318
  const body = await c.req.text();
8307
8319
  const upstream = await fetch(
@@ -8318,7 +8330,7 @@ app15.post("/:sessionId/archive", async (c) => {
8318
8330
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8319
8331
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8320
8332
  });
8321
- app15.get("/:sessionId/meta", async (c) => {
8333
+ app14.get("/:sessionId/meta", async (c) => {
8322
8334
  const sessionId = c.req.param("sessionId");
8323
8335
  const upstream = await fetch(
8324
8336
  `${managerBase2()}/${encodeURIComponent(sessionId)}/meta`
@@ -8329,7 +8341,7 @@ app15.get("/:sessionId/meta", async (c) => {
8329
8341
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8330
8342
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8331
8343
  });
8332
- app15.patch("/:sessionId", async (c) => {
8344
+ app14.patch("/:sessionId", async (c) => {
8333
8345
  const sessionId = c.req.param("sessionId");
8334
8346
  const body = await c.req.text();
8335
8347
  const upstream = await fetch(
@@ -8346,7 +8358,7 @@ app15.patch("/:sessionId", async (c) => {
8346
8358
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8347
8359
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8348
8360
  });
8349
- app15.post("/:sessionId/input", async (c) => {
8361
+ app14.post("/:sessionId/input", async (c) => {
8350
8362
  const sessionId = c.req.param("sessionId");
8351
8363
  const rawBody = await c.req.text();
8352
8364
  const upstream = await fetch(
@@ -8363,7 +8375,7 @@ app15.post("/:sessionId/input", async (c) => {
8363
8375
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8364
8376
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8365
8377
  });
8366
- app15.get("/:sessionId/log", async (c) => {
8378
+ app14.get("/:sessionId/log", async (c) => {
8367
8379
  const sessionId = c.req.param("sessionId");
8368
8380
  const follow = c.req.query("follow") === "1" ? "?follow=1" : "";
8369
8381
  const upstream = await fetch(
@@ -8375,7 +8387,49 @@ app15.get("/:sessionId/log", async (c) => {
8375
8387
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
8376
8388
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
8377
8389
  });
8378
- var claude_sessions_default = app15;
8390
+ var claude_sessions_default = app14;
8391
+
8392
+ // server/routes/admin/log-ingest.ts
8393
+ var TAG19 = "[log-ingest]";
8394
+ var TAG_PATTERN = /^[A-Za-z0-9_-]{1,32}$/;
8395
+ var LEVELS = /* @__PURE__ */ new Set(["debug", "info", "warn", "error"]);
8396
+ var MAX_LINE_BYTES = 4096;
8397
+ var app15 = new Hono();
8398
+ app15.post("/", async (c) => {
8399
+ const remoteAddr = c.env?.incoming?.socket?.remoteAddress ?? "";
8400
+ const isLoopback = remoteAddr === "127.0.0.1" || remoteAddr === "::1" || remoteAddr === "::ffff:127.0.0.1";
8401
+ if (!isLoopback) {
8402
+ console.error(`${TAG19} reject reason=non-loopback remoteAddr=${remoteAddr}`);
8403
+ return c.json({ error: "log-ingest-loopback-only" }, 403);
8404
+ }
8405
+ let body = {};
8406
+ try {
8407
+ body = await c.req.json();
8408
+ } catch {
8409
+ return c.json({ error: "body-not-json" }, 400);
8410
+ }
8411
+ if (typeof body.tag !== "string" || !TAG_PATTERN.test(body.tag)) {
8412
+ return c.json({ error: "tag-invalid" }, 400);
8413
+ }
8414
+ if (typeof body.level !== "string" || !LEVELS.has(body.level)) {
8415
+ return c.json({ error: "level-invalid" }, 400);
8416
+ }
8417
+ if (typeof body.line !== "string" || body.line.length === 0) {
8418
+ return c.json({ error: "line-required" }, 400);
8419
+ }
8420
+ if (body.line.includes("\n") || body.line.includes("\r")) {
8421
+ return c.json({ error: "line-must-be-single-line" }, 400);
8422
+ }
8423
+ if (Buffer.byteLength(body.line, "utf8") > MAX_LINE_BYTES) {
8424
+ return c.json({ error: "line-too-long", max: MAX_LINE_BYTES }, 400);
8425
+ }
8426
+ const formatted = `[${body.tag}] ${body.line}`;
8427
+ if (body.level === "error") console.error(formatted);
8428
+ else if (body.level === "warn") console.warn(formatted);
8429
+ else console.log(formatted);
8430
+ return c.json({ ok: true }, 200);
8431
+ });
8432
+ var log_ingest_default = app15;
8379
8433
 
8380
8434
  // server/routes/admin/browser.ts
8381
8435
  var app16 = new Hono();
@@ -8485,13 +8539,13 @@ async function cdpNavigateNewTab(url, opts = {}) {
8485
8539
  // server/routes/admin/device-browser.ts
8486
8540
  var app18 = new Hono();
8487
8541
  app18.post("/navigate", async (c) => {
8488
- const TAG20 = "[device-url:click]";
8542
+ const TAG21 = "[device-url:click]";
8489
8543
  let body;
8490
8544
  try {
8491
8545
  body = await c.req.json();
8492
8546
  } catch (err) {
8493
8547
  const detail = err instanceof Error ? err.message : String(err);
8494
- console.error(`${TAG20} reject reason=body-not-json detail=${detail} browser=fallback navigateResult=error`);
8548
+ console.error(`${TAG21} reject reason=body-not-json detail=${detail} browser=fallback navigateResult=error`);
8495
8549
  return c.json(
8496
8550
  { ok: false, navigateResult: "error", browser: "fallback", detail: "Request body was not valid JSON" },
8497
8551
  400
@@ -8501,7 +8555,7 @@ app18.post("/navigate", async (c) => {
8501
8555
  const intent = typeof body.intent === "string" ? body.intent : "";
8502
8556
  const hostname2 = typeof body.hostname === "string" ? body.hostname : "";
8503
8557
  if (!url) {
8504
- console.error(`${TAG20} reject reason=missing-url intent=${JSON.stringify(intent)} browser=fallback navigateResult=error`);
8558
+ console.error(`${TAG21} reject reason=missing-url intent=${JSON.stringify(intent)} browser=fallback navigateResult=error`);
8505
8559
  return c.json(
8506
8560
  { ok: false, navigateResult: "error", browser: "fallback", detail: "url field is required" },
8507
8561
  400
@@ -8511,7 +8565,7 @@ app18.post("/navigate", async (c) => {
8511
8565
  try {
8512
8566
  parsed = new URL(url);
8513
8567
  } catch {
8514
- console.error(`${TAG20} reject reason=url-malformed intent=${JSON.stringify(intent)} url=${url} browser=fallback navigateResult=error`);
8568
+ console.error(`${TAG21} reject reason=url-malformed intent=${JSON.stringify(intent)} url=${url} browser=fallback navigateResult=error`);
8515
8569
  return c.json(
8516
8570
  { ok: false, navigateResult: "error", browser: "fallback", detail: "url is not a valid URL" },
8517
8571
  400
@@ -8519,7 +8573,7 @@ app18.post("/navigate", async (c) => {
8519
8573
  }
8520
8574
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
8521
8575
  console.error(
8522
- `${TAG20} reject reason=scheme-not-allowed scheme=${parsed.protocol} intent=${JSON.stringify(intent)} browser=fallback navigateResult=error`
8576
+ `${TAG21} reject reason=scheme-not-allowed scheme=${parsed.protocol} intent=${JSON.stringify(intent)} browser=fallback navigateResult=error`
8523
8577
  );
8524
8578
  return c.json(
8525
8579
  {
@@ -8535,7 +8589,7 @@ app18.post("/navigate", async (c) => {
8535
8589
  const cdpOk = await ensureCdp(transport);
8536
8590
  if (!cdpOk) {
8537
8591
  console.error(
8538
- `${TAG20} intent=${JSON.stringify(intent)} browser=fallback navigateResult=cdp-unreachable hostname=${JSON.stringify(hostname2)}`
8592
+ `${TAG21} intent=${JSON.stringify(intent)} browser=fallback navigateResult=cdp-unreachable hostname=${JSON.stringify(hostname2)}`
8539
8593
  );
8540
8594
  return c.json(
8541
8595
  {
@@ -8551,7 +8605,7 @@ app18.post("/navigate", async (c) => {
8551
8605
  const browser = outcome.result === "ok" ? "vnc" : "fallback";
8552
8606
  const detailStr = outcome.detail ? ` detail=${JSON.stringify(outcome.detail.length > 230 ? outcome.detail.slice(0, 227) + "..." : outcome.detail)}` : "";
8553
8607
  console.error(
8554
- `${TAG20} intent=${JSON.stringify(intent)} browser=${browser} navigateResult=${outcome.result} hostname=${JSON.stringify(hostname2)} targetId=${outcome.targetId ?? "none"}${detailStr}`
8608
+ `${TAG21} intent=${JSON.stringify(intent)} browser=${browser} navigateResult=${outcome.result} hostname=${JSON.stringify(hostname2)} targetId=${outcome.targetId ?? "none"}${detailStr}`
8555
8609
  );
8556
8610
  if (outcome.result !== "ok") {
8557
8611
  return c.json(
@@ -8582,18 +8636,18 @@ var ALLOWED_EVENTS2 = /* @__PURE__ */ new Set([
8582
8636
  ]);
8583
8637
  var app19 = new Hono();
8584
8638
  app19.post("/", async (c) => {
8585
- const TAG20 = "[admin:events]";
8639
+ const TAG21 = "[admin:events]";
8586
8640
  let body;
8587
8641
  try {
8588
8642
  body = await c.req.json();
8589
8643
  } catch (err) {
8590
8644
  const detail = err instanceof Error ? err.message : String(err);
8591
- console.error(`${TAG20} reject reason=body-not-json detail=${detail}`);
8645
+ console.error(`${TAG21} reject reason=body-not-json detail=${detail}`);
8592
8646
  return c.json({ ok: false, detail: "Request body was not valid JSON" }, 400);
8593
8647
  }
8594
8648
  const event = typeof body.event === "string" ? body.event : "";
8595
8649
  if (!ALLOWED_EVENTS2.has(event)) {
8596
- console.error(`${TAG20} reject reason=event-not-allowed event=${JSON.stringify(event)}`);
8650
+ console.error(`${TAG21} reject reason=event-not-allowed event=${JSON.stringify(event)}`);
8597
8651
  return c.json({ ok: false, detail: `Event "${event}" is not allowed` }, 400);
8598
8652
  }
8599
8653
  const rawFields = body.fields && typeof body.fields === "object" ? body.fields : {};
@@ -9759,7 +9813,7 @@ async function restoreNode(params) {
9759
9813
  }
9760
9814
 
9761
9815
  // app/lib/file-delete-cascade.ts
9762
- var UUID_RE3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9816
+ var UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9763
9817
  function parseAttachmentPath(relPath2) {
9764
9818
  const segments = relPath2.split("/").filter(Boolean);
9765
9819
  if (segments.length !== 4) return null;
@@ -9767,7 +9821,7 @@ function parseAttachmentPath(relPath2) {
9767
9821
  const accountId = segments[1];
9768
9822
  const attachmentId = segments[2];
9769
9823
  const filename = segments[3];
9770
- if (!UUID_RE3.test(accountId) || !UUID_RE3.test(attachmentId)) return null;
9824
+ if (!UUID_RE2.test(accountId) || !UUID_RE2.test(attachmentId)) return null;
9771
9825
  const dot = filename.lastIndexOf(".");
9772
9826
  if (dot === -1) return null;
9773
9827
  const stem = filename.slice(0, dot);
@@ -9839,7 +9893,7 @@ async function cascadeDeleteDocument(params) {
9839
9893
  }
9840
9894
 
9841
9895
  // server/routes/admin/files.ts
9842
- var UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9896
+ var UUID_RE3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9843
9897
  async function readMeta(absDir, baseName) {
9844
9898
  try {
9845
9899
  const raw = await readFile4(join11(absDir, `${baseName}.meta.json`), "utf8");
@@ -9861,7 +9915,7 @@ async function readAccountNames() {
9861
9915
  return map;
9862
9916
  }
9863
9917
  for (const name of names) {
9864
- if (!UUID_RE4.test(name)) continue;
9918
+ if (!UUID_RE3.test(name)) continue;
9865
9919
  const configPath2 = resolve16(accountsDir, name, "account.json");
9866
9920
  try {
9867
9921
  const raw = await readFile4(configPath2, "utf8");
@@ -9879,7 +9933,7 @@ async function readAccountNames() {
9879
9933
  return map;
9880
9934
  }
9881
9935
  async function enrich(absolute, entry, accountNames) {
9882
- if (entry.kind === "directory" && UUID_RE4.test(entry.name)) {
9936
+ if (entry.kind === "directory" && UUID_RE3.test(entry.name)) {
9883
9937
  const meta = await readMeta(join11(absolute, entry.name), entry.name);
9884
9938
  if (meta?.filename) {
9885
9939
  entry.displayName = meta.filename;
@@ -9895,7 +9949,7 @@ async function enrich(absolute, entry, accountNames) {
9895
9949
  if (entry.kind === "file") {
9896
9950
  const dot = entry.name.lastIndexOf(".");
9897
9951
  const base = dot === -1 ? entry.name : entry.name.slice(0, dot);
9898
- if (UUID_RE4.test(base)) {
9952
+ if (UUID_RE3.test(base)) {
9899
9953
  const meta = await readMeta(absolute, base);
9900
9954
  if (meta?.filename) {
9901
9955
  entry.displayName = meta.filename;
@@ -9907,7 +9961,7 @@ async function enrich(absolute, entry, accountNames) {
9907
9961
  function buildDisplayPath(relPath2, accountNames) {
9908
9962
  if (relPath2 === "." || relPath2 === "") return [];
9909
9963
  return relPath2.split("/").filter(Boolean).map((seg) => {
9910
- const dn = UUID_RE4.test(seg) ? accountNames.get(seg) : void 0;
9964
+ const dn = UUID_RE3.test(seg) ? accountNames.get(seg) : void 0;
9911
9965
  return dn ? { name: seg, displayName: dn } : { name: seg };
9912
9966
  });
9913
9967
  }
@@ -9935,7 +9989,7 @@ app21.get("/", requireAdminSession, async (c) => {
9935
9989
  const names = await readdir2(absolute);
9936
9990
  const entries = [];
9937
9991
  for (const name of names) {
9938
- if (UUID_RE4.test(name.replace(/\.meta\.json$/, "")) && name.endsWith(".meta.json")) {
9992
+ if (UUID_RE3.test(name.replace(/\.meta\.json$/, "")) && name.endsWith(".meta.json")) {
9939
9993
  continue;
9940
9994
  }
9941
9995
  try {
@@ -10112,7 +10166,7 @@ app21.delete("/", requireAdminSession, async (c) => {
10112
10166
  }
10113
10167
  const dot = base.lastIndexOf(".");
10114
10168
  const stem = dot === -1 ? base : base.slice(0, dot);
10115
- const sidecarPath = UUID_RE4.test(stem) && base !== `${stem}.meta.json` ? join11(dirname5(absolute), `${stem}.meta.json`) : null;
10169
+ const sidecarPath = UUID_RE3.test(stem) && base !== `${stem}.meta.json` ? join11(dirname5(absolute), `${stem}.meta.json`) : null;
10116
10170
  await unlink2(absolute);
10117
10171
  if (sidecarPath) {
10118
10172
  try {
@@ -11992,7 +12046,7 @@ import { mkdir as mkdir4, readdir as readdir4, stat as stat6, writeFile as write
11992
12046
  import { resolve as resolve18 } from "path";
11993
12047
  import { existsSync as existsSync17 } from "fs";
11994
12048
  var ADMIN_AGENT_FILES2 = /* @__PURE__ */ new Set(["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"]);
11995
- var UUID_RE5 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12049
+ var UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
11996
12050
  var app30 = new Hono();
11997
12051
  app30.post("/", requireAdminSession, async (c) => {
11998
12052
  const cacheKey = c.var.cacheKey;
@@ -12056,7 +12110,7 @@ async function resolveSavePath(id, accountId, accountDir) {
12056
12110
  }
12057
12111
  return { kind: "admin-template", path: resolve18(parent, filename) };
12058
12112
  }
12059
- if (UUID_RE5.test(id)) {
12113
+ if (UUID_RE4.test(id)) {
12060
12114
  const dir = resolve18(ATTACHMENTS_ROOT, accountId, id);
12061
12115
  if (!existsSync17(dir)) {
12062
12116
  const attShort = id.slice(0, 8);
@@ -12112,14 +12166,14 @@ var sidebar_artefact_save_default = app30;
12112
12166
  import { readFile as readFile6, readdir as readdir5 } from "fs/promises";
12113
12167
  import { existsSync as existsSync18 } from "fs";
12114
12168
  import { resolve as resolve19 } from "path";
12115
- var UUID_RE6 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12169
+ var UUID_RE5 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12116
12170
  var app31 = new Hono();
12117
12171
  app31.get("/", requireAdminSession, async (c) => {
12118
12172
  const cacheKey = c.var.cacheKey;
12119
12173
  const accountId = getAccountIdForSession(cacheKey);
12120
12174
  if (!accountId) return new Response("Unauthorized", { status: 401 });
12121
12175
  const id = c.req.query("id") ?? "";
12122
- if (!UUID_RE6.test(id)) {
12176
+ if (!UUID_RE5.test(id)) {
12123
12177
  console.error(`[admin/sidebar-artefact-content] not-found id=${id.slice(0, 8)}`);
12124
12178
  return new Response("Not found", { status: 404 });
12125
12179
  }
@@ -12230,13 +12284,13 @@ var app33 = new Hono();
12230
12284
  app33.route("/session", session_default);
12231
12285
  app33.route("/new-session-failure", new_session_failure_default);
12232
12286
  app33.route("/new-session-submit", new_session_submit_default);
12233
- app33.route("/failure-report", failure_report_default);
12234
12287
  app33.route("/logs", logs_default);
12235
12288
  app33.route("/claude-info", claude_info_default);
12236
12289
  app33.route("/attachment", attachment_default);
12237
12290
  app33.route("/agents", agents_default);
12238
12291
  app33.route("/sessions", sessions_default);
12239
12292
  app33.route("/claude-sessions", claude_sessions_default);
12293
+ app33.route("/log-ingest", log_ingest_default);
12240
12294
  app33.route("/browser", browser_default);
12241
12295
  app33.route("/browser-iframe", browser_iframe_default);
12242
12296
  app33.route("/device-browser", device_browser_default);
@@ -12477,7 +12531,7 @@ function startGraphHealthTimer() {
12477
12531
  }
12478
12532
 
12479
12533
  // app/lib/whatsapp/inbound/claude-bridge.ts
12480
- var TAG19 = "[whatsapp-adaptor]";
12534
+ var TAG20 = "[whatsapp-adaptor]";
12481
12535
  function whatsappTurnTimeoutMs() {
12482
12536
  return Number(process.env.WHATSAPP_PTY_TURN_TIMEOUT_MS ?? String(5 * 6e4));
12483
12537
  }
@@ -12498,7 +12552,7 @@ async function dispatchToClaude(input) {
12498
12552
  await input.reply(result.turnText);
12499
12553
  } catch (err) {
12500
12554
  const m = err instanceof Error ? err.message : String(err);
12501
- console.error(`${TAG19} reject reason=reply-failed senderId=${input.senderId} message=${m}`);
12555
+ console.error(`${TAG20} reject reason=reply-failed senderId=${input.senderId} message=${m}`);
12502
12556
  }
12503
12557
  }
12504
12558
  function startReaper2() {
@@ -13434,7 +13488,7 @@ if (brandFaviconPath !== "/favicon.ico") {
13434
13488
  });
13435
13489
  }
13436
13490
  app35.use("/*", serveStatic({ root: "./public" }));
13437
- var port = parseInt(process.env.MAXY_UI_INTERNAL_PORT ?? process.env.PORT ?? "19199", 10);
13491
+ var port = requirePortEnv("MAXY_UI_INTERNAL_PORT", { tag: "ui-server" });
13438
13492
  var hostname = process.env.HOSTNAME ?? "127.0.0.1";
13439
13493
  var httpServer = serve({ fetch: app35.fetch, port, hostname });
13440
13494
  console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
@@ -13527,7 +13581,7 @@ reconcileEnabledPlugins(bootAccount?.accountDir, bootAccount?.config);
13527
13581
  (async () => {
13528
13582
  if (!bootAccount) return;
13529
13583
  try {
13530
- const { recoverRunningCloudflareTasks } = await import("./cloudflare-task-tracker-R6MMORFU.js");
13584
+ const { recoverRunningCloudflareTasks } = await import("./cloudflare-task-tracker-TL6R364J.js");
13531
13585
  const result = await recoverRunningCloudflareTasks(
13532
13586
  bootAccount.accountId,
13533
13587
  configDirForWhatsApp,