@xopcai/xopc 0.0.254 → 0.0.255

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 (154) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-Ci5Rxmi_.js → activity-store-DvjK5FEm.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D82jpmFL.js → agent-avatar-dicebear-Cqspzbf_.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CL3Mi-uM.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-odqXmGhA.js +1 -0
  7. package/dist/gateway/static/root/assets/{api-CXIzQJ2Z.js → api-CsYi3heY.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-mhxcQpkQ.js → app-management-settings-panel-Gd4a5hdE.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-BIMwACUF.js → appearance-settings-CZ6KOnbd.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-DyBDoCam.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-C63Xp_sU.js → archive-plugin-y82Rwhjm.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-D12KYOav.js → attachment-load-D46SGNpv.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-DXj0o5CY.js → automations-page-wilciIZ1.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-8U86Umig.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-Bcv8hun6.js → binary-plugins-CuMkNNCe.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-C61LqK_-.js → block-editor-DFnPsrxI.js} +24 -24
  17. package/dist/gateway/static/root/assets/{browser-automation-inputs-CAclu735.js → browser-automation-inputs-hlmcSp4p.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automations-page-BITfKX8L.js → browser-automations-page-OjZvbARU.js} +2 -2
  19. package/dist/gateway/static/root/assets/browser-settings-page-DOUG84qV.js +8 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-CG73Mwi8.js +7 -0
  21. package/dist/gateway/static/root/assets/channels-settings-MDywEWWM.js +1 -0
  22. package/dist/gateway/static/root/assets/{channels-status-swr-Cmbx0E8O.js → channels-status-swr-D1HHFzkE.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-CNBgHN9U.js → chat-terminal-dock-Ce_T9BPq.js} +2 -2
  24. package/dist/gateway/static/root/assets/connectors-page-D29p6Zvm.js +2 -0
  25. package/dist/gateway/static/root/assets/{cron-expression-DCTN4QAG.js → cron-expression-BRrCwYyD.js} +1 -1
  26. package/dist/gateway/static/root/assets/date-picker-C35RuuWW.js +1 -0
  27. package/dist/gateway/static/root/assets/{dependency-picker-l6IXzk0C.js → dependency-picker-4pNXVcRM.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-DIfccDKS.js → desktop-pet-settings-BvV1UA5g.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-cGn_20DO.js → desktop-pet-z91GYnPf.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-debug-page-CTS5RP_D.js → extension-debug-page-CkVF5HvV.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-Dg9YssYH.js → extension-page-DW0zQGaB.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-CWZYL8Fi.js → extension-settings-page-BLQhizZ3.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-swr-Chsr5wGH.js → gateway-config-swr-02BBC1mK.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-settings-vHI_Que8.js → gateway-settings-rAXx8FGP.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-C9ynH6VV.js → gateway-startup-retry-XZnY6621.js} +1 -1
  36. package/dist/gateway/static/root/assets/heartbeat-settings-BaW_r1t9.js +1 -0
  37. package/dist/gateway/static/root/assets/home-page-BoTS8-Z9.js +1 -0
  38. package/dist/gateway/static/root/assets/{image-generation-api-D_TsVe7h.js → image-generation-api-CIcKz4Xs.js} +1 -1
  39. package/dist/gateway/static/root/assets/index-DsonmRCH.css +2 -0
  40. package/dist/gateway/static/root/assets/index-PksHo9hS.js +74 -0
  41. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGBf6YfD.js → keyboard-shortcuts-settings-yfaGz6SE.js} +1 -1
  42. package/dist/gateway/static/root/assets/local-app-workbench-page-B3flRQH1.js +2 -0
  43. package/dist/gateway/static/root/assets/{local-apps-page-DGWP_xsQ.js → local-apps-page-Cp-nEtgV.js} +1 -1
  44. package/dist/gateway/static/root/assets/{locale-store-B2v8mNJw.js → locale-store-VsboRLD7.js} +1 -1
  45. package/dist/gateway/static/root/assets/logs-page-DkqsRCri.js +2 -0
  46. package/dist/gateway/static/root/assets/{management-settings-DUAZ-dtt.js → management-settings-24_JyDPk.js} +1 -1
  47. package/dist/gateway/static/root/assets/{markdown-view-DBWu9d_n.js → markdown-view-CPXhy6nh.js} +1 -1
  48. package/dist/gateway/static/root/assets/{media-plugins-CsUjcIBy.js → media-plugins-CwLvIb9r.js} +1 -1
  49. package/dist/gateway/static/root/assets/messages-DngsF_Kx.js +3 -0
  50. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-Dxu8twiQ.js → mobile-pairing-wizard-BbJCDv57.js} +1 -1
  51. package/dist/gateway/static/root/assets/note-detail-panel-OklYXK7y.js +5 -0
  52. package/dist/gateway/static/root/assets/notes-page-BjfgJIQw.js +8 -0
  53. package/dist/gateway/static/root/assets/{page-tabs-YeJKwV-7.js → page-tabs-0YXn9Gkl.js} +1 -1
  54. package/dist/gateway/static/root/assets/popover-select-CKBYnT3c.js +1 -0
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-BfJ3jMDG.js → preview-open-alternatives-2jVV5kfZ.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-B7NRGPox.js → product-open-page-D7p0NfTK.js} +1 -1
  57. package/dist/gateway/static/root/assets/project-detail-page-rLNM2mP0.js +1 -0
  58. package/dist/gateway/static/root/assets/projects-page-D6jY2ZWl.js +1 -0
  59. package/dist/gateway/static/root/assets/{registry-api-B9OZUdwC.js → registry-api-DlTWbXQA.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-DTO-faxH.js → remote-access-hub-CZZg0kXc.js} +1 -1
  61. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-uJ8Br3ZL.js → runtime-tools-settings-panel-B-NDgmJ4.js} +2 -2
  62. package/dist/gateway/static/root/assets/{schema-form-CXwn6up5.js → schema-form-DZYeBS1v.js} +1 -1
  63. package/dist/gateway/static/root/assets/sessions-page-BvuxJegi.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-BAQHP4mB.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-YVNYsR0U.js → settings-form-section-zy5UMvPk.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-cHqrIdVR.js → settings-page-CTuipbJq.js} +1 -1
  67. package/dist/gateway/static/root/assets/setup-status-panel-BkWoc5j5.js +1 -0
  68. package/dist/gateway/static/root/assets/{share-preview-page-DnjSDQru.js → share-preview-page-D3Uawo_h.js} +1 -1
  69. package/dist/gateway/static/root/assets/shares-settings-B2doziIn.js +1 -0
  70. package/dist/gateway/static/root/assets/skill-reload-api-D2ymjqG5.js +1 -0
  71. package/dist/gateway/static/root/assets/{skills-page-DkrGEdiY.js → skills-page-DDbabz7p.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skills-page.utils-CqZbiZuK.js → skills-page.utils-DkGhbiMa.js} +1 -1
  73. package/dist/gateway/static/root/assets/{system-settings-panel-Dmw0RfxZ.js → system-settings-panel-Fc-WbX6-.js} +1 -1
  74. package/dist/gateway/static/root/assets/task-detail-page-7w7eB9nB.js +1 -0
  75. package/dist/gateway/static/root/assets/{theme-store-CubltMKm.js → theme-store-vdB57bTn.js} +1 -1
  76. package/dist/gateway/static/root/assets/{tunnel-api-CiieC6HP.js → tunnel-api-DZ0evABj.js} +1 -1
  77. package/dist/gateway/static/root/assets/{use-autosave-XQ3SuyB9.js → use-autosave-Ckof_m7e.js} +1 -1
  78. package/dist/gateway/static/root/assets/user-model-page-CcNCyrXZ.js +2 -0
  79. package/dist/gateway/static/root/assets/{voice-api-key-field-D4QzVgdt.js → voice-api-key-field-CnmtpWlq.js} +1 -1
  80. package/dist/gateway/static/root/assets/{voice-config-api-B1ZbyVmF.js → voice-config-api-OA04c71t.js} +1 -1
  81. package/dist/gateway/static/root/assets/{work-discovery-overlay-D5Tf8GRZ.js → work-discovery-overlay-sxvsDIC3.js} +1 -1
  82. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CUCfBpPF.js +3 -0
  83. package/dist/gateway/static/root/assets/workflows-page-Bp-nvnLa.js +5 -0
  84. package/dist/gateway/static/root/index.html +11 -11
  85. package/dist/package.js +1 -1
  86. package/dist/src/agent/tools/create-share-tool.js +39 -1
  87. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  88. package/dist/src/cli/commands/tunnel.js +3 -3
  89. package/dist/src/gateway/device-routes.js +1 -1
  90. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  91. package/dist/src/gateway/hono/routes/lazy-bundles.js +2 -2
  92. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  93. package/dist/src/gateway/hono/routes/shares.js +404 -7
  94. package/dist/src/gateway/hono/routes/site-shares.js +19 -13
  95. package/dist/src/gateway/hono/routes/tunnel.js +1 -1
  96. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  97. package/dist/src/gateway/service/sessions-api.js +1 -1
  98. package/dist/src/gateway/service.js +3 -3
  99. package/dist/src/remote-access/exposure-manager.js +1 -1
  100. package/dist/src/session/index.js +1 -1
  101. package/dist/src/session/store.js +1 -1
  102. package/dist/src/share/hosted-note-publication.d.ts +22 -0
  103. package/dist/src/share/hosted-note-publication.js +96 -0
  104. package/dist/src/share/hosted-session-share.d.ts +86 -7
  105. package/dist/src/share/hosted-session-share.js +72 -15
  106. package/dist/src/share/hosted-static-site-publication.d.ts +16 -0
  107. package/dist/src/share/hosted-static-site-publication.js +108 -0
  108. package/dist/src/share/hosted-static-site-publish.d.ts +23 -0
  109. package/dist/src/share/hosted-static-site-publish.js +53 -0
  110. package/dist/src/share/note-share-service.d.ts +1 -0
  111. package/dist/src/share/note-share-service.js +4 -4
  112. package/dist/src/share/share-url.d.ts +1 -1
  113. package/dist/src/share/share-url.js +14 -9
  114. package/dist/src/tasks/home-query-service.js +2 -2
  115. package/dist/src/tui/backends/embedded-backend.js +2 -2
  116. package/dist/src/tui/tui-agent-events.js +1 -1
  117. package/dist/src/tunnel/index.js +1 -1
  118. package/dist/src/tunnel/tunnel-service.js +1 -1
  119. package/dist/src/voice/realtime/agentEngine.js +17 -0
  120. package/dist/src/voice/realtime/memory-context.js +1 -1
  121. package/dist/src/voice/realtime/playback-echo.d.ts +2 -0
  122. package/dist/src/voice/realtime/playback-echo.js +15 -0
  123. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  124. package/package.json +3 -3
  125. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-vul32IsP.js +0 -1
  126. package/dist/gateway/static/root/assets/agents-p3kWyz1T.js +0 -1
  127. package/dist/gateway/static/root/assets/apps-page-CJFJKNwS.js +0 -1
  128. package/dist/gateway/static/root/assets/automations-workspace-B2wxcpgq.js +0 -6
  129. package/dist/gateway/static/root/assets/browser-settings-page-BMjY8cyv.js +0 -8
  130. package/dist/gateway/static/root/assets/capabilities-settings-panel-wB3Vgmp3.js +0 -7
  131. package/dist/gateway/static/root/assets/channels-settings-U5ffzu4r.js +0 -1
  132. package/dist/gateway/static/root/assets/connectors-page-BGaF--m5.js +0 -2
  133. package/dist/gateway/static/root/assets/date-picker-BuEyUxZn.js +0 -1
  134. package/dist/gateway/static/root/assets/heartbeat-settings-WUhSfvob.js +0 -1
  135. package/dist/gateway/static/root/assets/home-page-CYjlMzPx.js +0 -1
  136. package/dist/gateway/static/root/assets/index-BBlJYVxR.js +0 -74
  137. package/dist/gateway/static/root/assets/index-_I0dD2LN.css +0 -2
  138. package/dist/gateway/static/root/assets/local-app-workbench-page-CLlIl83V.js +0 -2
  139. package/dist/gateway/static/root/assets/logs-page-DuhCigiB.js +0 -2
  140. package/dist/gateway/static/root/assets/messages-ChSTFZR5.js +0 -3
  141. package/dist/gateway/static/root/assets/note-detail-panel-DMdbaTZp.js +0 -5
  142. package/dist/gateway/static/root/assets/notes-page-xe_vX0nM.js +0 -8
  143. package/dist/gateway/static/root/assets/popover-select-C-Hj-nXR.js +0 -1
  144. package/dist/gateway/static/root/assets/project-detail-page-hG7ELibZ.js +0 -1
  145. package/dist/gateway/static/root/assets/projects-page-C5G2ET4w.js +0 -1
  146. package/dist/gateway/static/root/assets/sessions-page-CwzsUCgP.js +0 -1
  147. package/dist/gateway/static/root/assets/settings-advanced-gate-Djc3EdoO.js +0 -1
  148. package/dist/gateway/static/root/assets/setup-status-panel-MUAMcZLD.js +0 -1
  149. package/dist/gateway/static/root/assets/shares-settings-C7A0aywX.js +0 -1
  150. package/dist/gateway/static/root/assets/skill-reload-api-D1xSGJAQ.js +0 -1
  151. package/dist/gateway/static/root/assets/task-detail-page-BvZSCLUH.js +0 -1
  152. package/dist/gateway/static/root/assets/user-model-page-BKJC7tyW.js +0 -2
  153. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BW9p8Maz.js +0 -3
  154. package/dist/gateway/static/root/assets/workflows-page-DuqRodIc.js +0 -5
@@ -1,9 +1,9 @@
1
1
  import { buildSessionKey, init_session_key } from "../../../routing/session-key.js";
2
2
  import { resolveProjectAgentId } from "../../../projects/project-agent.js";
3
3
  import "../../../projects/index.js";
4
+ import { messagesToClientHistory } from "../../../session/client-history.js";
4
5
  import { evictEmbeddedSessionRunner } from "../../../agent/embedded/session-runner.js";
5
6
  import { SessionEnvironmentService } from "../../../execution-environments/session-environment-service.js";
6
- import { messagesToClientHistory } from "../../../session/client-history.js";
7
7
  import { deleteMediaUrisNoLongerReferenced } from "../../../media/session-references.js";
8
8
  import { getGatewayPrincipal } from "../../security/gateway-principal.js";
9
9
  import { createGatewayRouteLogger, logRouteError } from "../lib/route-logger.js";
@@ -8,6 +8,10 @@ import { logShareAudit } from "../../../share/share-audit.js";
8
8
  import { getShareStore, shareResponseContentType } from "../../../share/share-store.js";
9
9
  import { getSiteShareStore } from "../../../share/site-share-store.js";
10
10
  import { resolveShareUrl, resolveSiteShareUrl } from "../../../share/share-url.js";
11
+ import { SessionShareService, SessionShareSnapshotConflictError } from "../../../share/session-share-service.js";
12
+ import { HostedPublicationPublisher, HostedSessionShareBuilder, HostedShareAuthorizationError, HostedShareBindingStore, HostedShareRemoteError } from "../../../share/hosted-session-share.js";
13
+ import { HostedStaticSitePublicationBuilder } from "../../../share/hosted-static-site-publication.js";
14
+ import { publishHostedStaticSite } from "../../../share/hosted-static-site-publish.js";
11
15
  import { resolveReverseProxyPublicUrl } from "../../public-url.js";
12
16
  import { audienceDefaults, cleanupStagedSite, decideShareKind, forgetStagedSite, makeDescription, makeTitle, probeShareTarget, rememberStagedSite, stageSingleHtmlAsSite } from "../../../share/share-auto.js";
13
17
  import { deleteThumbnail, placeholderSvg, readThumbnail, scheduleThumbnail, thumbnailContentType, thumbnailExists } from "../../../share/share-thumbnail.js";
@@ -17,9 +21,8 @@ import { getClientIpFromHeaders } from "../../security/loopback.js";
17
21
  import { SHARED_HTML_CSP } from "../../security/csp.js";
18
22
  import { renderFolderLandingPage, renderShareExpiredPage, renderShareLandingPage, renderSnapshotShareLandingPage } from "../../../share/share-landing.js";
19
23
  import { resolveScopedMediaReference } from "../../media-access.js";
20
- import { SessionShareService, SessionShareSnapshotConflictError } from "../../../share/session-share-service.js";
21
- import { HostedSessionShareBuilder, HostedSessionSharePublisher, HostedShareAuthorizationError, HostedShareBindingStore } from "../../../share/hosted-session-share.js";
22
24
  import { NoteShareService } from "../../../share/note-share-service.js";
25
+ import { HostedNotePublicationBuilder, HostedNoteVersionConflictError } from "../../../share/hosted-note-publication.js";
23
26
  import { consumeSharePublicLimit } from "../../../share/share-rate-limit.js";
24
27
  import { createZipStream, planDirectoryFiles } from "../../../share/share-zip.js";
25
28
  import { basename, dirname } from "node:path";
@@ -529,7 +532,9 @@ function registerShareRoutes(authenticated, deps) {
529
532
  const noteShares = new NoteShareService(store, service.notesServiceInstance);
530
533
  const sessionShares = createSessionShareService(service, store);
531
534
  const hostedBuilder = new HostedSessionShareBuilder(createSessionShareSource(service));
532
- const hostedPublisher = new HostedSessionSharePublisher();
535
+ const hostedNoteBuilder = new HostedNotePublicationBuilder(service.notesServiceInstance);
536
+ const hostedSiteBuilder = new HostedStaticSitePublicationBuilder();
537
+ const hostedPublisher = new HostedPublicationPublisher();
533
538
  const hostedBindings = new HostedShareBindingStore();
534
539
  getSiteShareStore(resolveSiteShareConfig(service)).setCleanupHook((rec) => {
535
540
  const dir = forgetStagedSite(rec.id);
@@ -696,7 +701,7 @@ function registerShareRoutes(authenticated, deps) {
696
701
  error: { message: "Session not found" }
697
702
  }, 404);
698
703
  try {
699
- await hostedBindings.reconcile(await hostedPublisher.list());
704
+ await hostedBindings.reconcile(await hostedPublisher.listPublications());
700
705
  return c.json({
701
706
  ok: true,
702
707
  payload: { shares: (await hostedBindings.list(metadata.sessionId)).map(hostedBindingResponse) }
@@ -720,6 +725,17 @@ function registerShareRoutes(authenticated, deps) {
720
725
  const now = (/* @__PURE__ */ new Date()).toISOString();
721
726
  const binding = {
722
727
  ...result,
728
+ kind: "session_document",
729
+ source: {
730
+ kind: "session",
731
+ id: snapshot.sessionId,
732
+ version: String(snapshot.cutoffSeq)
733
+ },
734
+ revisionSources: { [String(result.snapshotRevision)]: {
735
+ kind: "session",
736
+ id: snapshot.sessionId,
737
+ version: String(snapshot.cutoffSeq)
738
+ } },
723
739
  sessionId: snapshot.sessionId,
724
740
  cutoffSeq: snapshot.cutoffSeq,
725
741
  title: snapshot.manifest.title,
@@ -763,6 +779,20 @@ function registerShareRoutes(authenticated, deps) {
763
779
  const binding = {
764
780
  ...previous,
765
781
  ...result,
782
+ kind: "session_document",
783
+ source: {
784
+ kind: "session",
785
+ id: snapshot.sessionId,
786
+ version: String(snapshot.cutoffSeq)
787
+ },
788
+ revisionSources: {
789
+ ...previous.revisionSources,
790
+ [String(result.snapshotRevision)]: {
791
+ kind: "session",
792
+ id: snapshot.sessionId,
793
+ version: String(snapshot.cutoffSeq)
794
+ }
795
+ },
766
796
  cutoffSeq: snapshot.cutoffSeq,
767
797
  title: snapshot.manifest.title,
768
798
  messageCount: snapshot.manifest.messages.length,
@@ -806,6 +836,299 @@ function registerShareRoutes(authenticated, deps) {
806
836
  return hostedShareErrorResponse(c, err);
807
837
  }
808
838
  });
839
+ authenticated.get("/api/hosted-publications/capabilities", async (c) => {
840
+ try {
841
+ return c.json({
842
+ ok: true,
843
+ payload: await hostedPublisher.capabilities()
844
+ });
845
+ } catch (err) {
846
+ return hostedShareErrorResponse(c, err);
847
+ }
848
+ });
849
+ authenticated.get("/api/notes/:id/hosted-publications", async (c) => {
850
+ try {
851
+ return c.json({
852
+ ok: true,
853
+ payload: { publications: (await hostedBindings.listBySource("note", c.req.param("id"))).map(hostedPublicationBindingResponse) }
854
+ });
855
+ } catch (err) {
856
+ return hostedShareErrorResponse(c, err);
857
+ }
858
+ });
859
+ authenticated.post("/api/notes/:id/hosted-publications", async (c) => {
860
+ const body = await c.req.json().catch(() => ({}));
861
+ try {
862
+ const snapshot = await hostedNoteBuilder.build(c.req.param("id"), {
863
+ expectedNoteVersion: typeof body.expectedNoteVersion === "number" ? body.expectedNoteVersion : void 0,
864
+ attachmentIds: Array.isArray(body.attachmentIds) ? body.attachmentIds.filter((id) => typeof id === "string") : void 0,
865
+ description: typeof body.description === "string" ? body.description : void 0
866
+ });
867
+ const result = await hostedPublisher.createPublication(snapshot, {
868
+ ttlMs: typeof body.ttlMs === "number" ? body.ttlMs : 864e5,
869
+ maxViews: body.maxViews === null ? null : typeof body.maxViews === "number" ? body.maxViews : null
870
+ });
871
+ const now = (/* @__PURE__ */ new Date()).toISOString();
872
+ const binding = {
873
+ ...result,
874
+ kind: "note_document",
875
+ source: {
876
+ kind: "note",
877
+ id: snapshot.sourceNoteId,
878
+ version: String(snapshot.sourceVersion)
879
+ },
880
+ revisionSources: { [String(result.snapshotRevision)]: {
881
+ kind: "note",
882
+ id: snapshot.sourceNoteId,
883
+ version: String(snapshot.sourceVersion)
884
+ } },
885
+ title: snapshot.title,
886
+ description: typeof body.description === "string" ? body.description.trim() || null : null,
887
+ attachmentCount: snapshot.attachmentCount,
888
+ attachmentIds: snapshot.assets.map((asset) => asset.id),
889
+ createdAt: now,
890
+ updatedAt: now,
891
+ revoked: false
892
+ };
893
+ await hostedBindings.upsert(binding);
894
+ return c.json({
895
+ ok: true,
896
+ payload: hostedPublicationBindingResponse(binding)
897
+ }, 201);
898
+ } catch (err) {
899
+ return hostedShareErrorResponse(c, err);
900
+ }
901
+ });
902
+ authenticated.post("/api/notes/:id/hosted-publications/:publicationId/refresh", async (c) => {
903
+ const body = await c.req.json().catch(() => ({}));
904
+ const previous = (await hostedBindings.listBySource("note", c.req.param("id"))).find((binding) => binding.id === c.req.param("publicationId") && !binding.revoked);
905
+ if (!previous) return c.json({
906
+ ok: false,
907
+ error: { message: "Hosted publication not found" }
908
+ }, 404);
909
+ try {
910
+ const snapshot = await hostedNoteBuilder.build(c.req.param("id"), {
911
+ expectedNoteVersion: typeof body.expectedNoteVersion === "number" ? body.expectedNoteVersion : void 0,
912
+ attachmentIds: Array.isArray(body.attachmentIds) ? body.attachmentIds.filter((id) => typeof id === "string") : previous.attachmentIds,
913
+ description: previous.description ?? void 0
914
+ });
915
+ const result = await hostedPublisher.refreshPublication(previous.id, previous.snapshotRevision, previous.shareUrl, snapshot);
916
+ const binding = {
917
+ ...previous,
918
+ ...result,
919
+ kind: "note_document",
920
+ source: {
921
+ kind: "note",
922
+ id: snapshot.sourceNoteId,
923
+ version: String(snapshot.sourceVersion)
924
+ },
925
+ revisionSources: {
926
+ ...previous.revisionSources,
927
+ [String(result.snapshotRevision)]: {
928
+ kind: "note",
929
+ id: snapshot.sourceNoteId,
930
+ version: String(snapshot.sourceVersion)
931
+ }
932
+ },
933
+ title: snapshot.title,
934
+ attachmentCount: snapshot.attachmentCount,
935
+ attachmentIds: snapshot.assets.map((asset) => asset.id),
936
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
937
+ };
938
+ await hostedBindings.upsert(binding);
939
+ return c.json({
940
+ ok: true,
941
+ payload: hostedPublicationBindingResponse(binding)
942
+ });
943
+ } catch (err) {
944
+ return hostedShareErrorResponse(c, err);
945
+ }
946
+ });
947
+ authenticated.post("/api/hosted-publications/static-sites", async (c) => {
948
+ const body = await c.req.json().catch(() => ({}));
949
+ if (typeof body.path !== "string") return c.json({
950
+ ok: false,
951
+ error: { message: "Static site path is required" }
952
+ }, 400);
953
+ try {
954
+ const workspaceRoot = await resolveWorkspaceRootForShare(service, typeof body.sessionKey === "string" ? body.sessionKey : void 0, typeof body.agentId === "string" ? body.agentId : void 0);
955
+ if (!workspaceRoot) return c.json({
956
+ ok: false,
957
+ error: { message: "Workspace not configured" }
958
+ }, 400);
959
+ const { binding, snapshot } = await publishHostedStaticSite({
960
+ workspaceRoot,
961
+ path: body.path,
962
+ title: typeof body.title === "string" ? body.title : void 0,
963
+ description: typeof body.description === "string" ? body.description : void 0,
964
+ spaFallback: typeof body.spaFallback === "boolean" ? body.spaFallback : void 0,
965
+ ttlMs: typeof body.ttlMs === "number" ? body.ttlMs : 864e5,
966
+ maxViews: body.maxViews === null ? null : typeof body.maxViews === "number" ? body.maxViews : null,
967
+ sessionKey: typeof body.sessionKey === "string" ? body.sessionKey : void 0,
968
+ agentId: typeof body.agentId === "string" ? body.agentId : void 0
969
+ }, {
970
+ builder: hostedSiteBuilder,
971
+ publisher: hostedPublisher,
972
+ bindings: hostedBindings
973
+ });
974
+ return c.json({
975
+ ok: true,
976
+ payload: {
977
+ ...hostedPublicationBindingResponse(binding),
978
+ fileCount: snapshot.fileCount,
979
+ totalBytes: snapshot.totalBytes
980
+ }
981
+ }, 201);
982
+ } catch (err) {
983
+ return hostedShareErrorResponse(c, err);
984
+ }
985
+ });
986
+ authenticated.post("/api/hosted-publications/static-sites/:publicationId/refresh", async (c) => {
987
+ const previous = (await hostedBindings.listAll()).find((binding) => binding.id === c.req.param("publicationId") && binding.kind === "static_site" && !binding.revoked);
988
+ if (!previous || previous.source.kind !== "static_site") return c.json({
989
+ ok: false,
990
+ error: { message: "Hosted publication not found" }
991
+ }, 404);
992
+ try {
993
+ const workspaceRoot = previous.workspaceContext?.workspaceRoot ?? await resolveWorkspaceRootForShare(service, previous.workspaceContext?.sessionKey, previous.workspaceContext?.agentId);
994
+ if (!workspaceRoot) return c.json({
995
+ ok: false,
996
+ error: { message: "Workspace not configured" }
997
+ }, 400);
998
+ const snapshot = await hostedSiteBuilder.build(workspaceRoot, {
999
+ path: previous.source.id,
1000
+ title: previous.title,
1001
+ description: previous.description ?? void 0,
1002
+ spaFallback: true
1003
+ });
1004
+ const result = await hostedPublisher.refreshPublication(previous.id, previous.snapshotRevision, previous.shareUrl, snapshot);
1005
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1006
+ const binding = {
1007
+ ...previous,
1008
+ ...result,
1009
+ source: {
1010
+ kind: "static_site",
1011
+ id: previous.source.id,
1012
+ version: now
1013
+ },
1014
+ revisionSources: {
1015
+ ...previous.revisionSources,
1016
+ [String(result.snapshotRevision)]: {
1017
+ kind: "static_site",
1018
+ id: previous.source.id,
1019
+ version: now
1020
+ }
1021
+ },
1022
+ attachmentCount: snapshot.fileCount,
1023
+ attachmentIds: snapshot.assets.map((asset) => asset.id),
1024
+ updatedAt: now
1025
+ };
1026
+ await hostedBindings.upsert(binding);
1027
+ return c.json({
1028
+ ok: true,
1029
+ payload: {
1030
+ ...hostedPublicationBindingResponse(binding),
1031
+ fileCount: snapshot.fileCount,
1032
+ totalBytes: snapshot.totalBytes
1033
+ }
1034
+ });
1035
+ } catch (err) {
1036
+ return hostedShareErrorResponse(c, err);
1037
+ }
1038
+ });
1039
+ authenticated.get("/api/hosted-publications/:publicationId/revisions", async (c) => {
1040
+ try {
1041
+ return c.json({
1042
+ ok: true,
1043
+ payload: { revisions: await hostedPublisher.listRevisions(c.req.param("publicationId")) }
1044
+ });
1045
+ } catch (err) {
1046
+ return hostedShareErrorResponse(c, err);
1047
+ }
1048
+ });
1049
+ authenticated.post("/api/hosted-publications/:publicationId/rollback", async (c) => {
1050
+ const body = await c.req.json().catch(() => ({}));
1051
+ if (typeof body.expectedRevision !== "number" || typeof body.targetRevision !== "number") return c.json({
1052
+ ok: false,
1053
+ error: { message: "Expected and target revisions are required" }
1054
+ }, 400);
1055
+ try {
1056
+ const id = c.req.param("publicationId");
1057
+ const binding = (await hostedBindings.listAll()).find((item) => item.id === id);
1058
+ const targetSource = binding?.revisionSources[String(body.targetRevision)];
1059
+ if (binding && !targetSource) return c.json({
1060
+ ok: false,
1061
+ error: { message: "Publication revision source not found" }
1062
+ }, 409);
1063
+ const item = await hostedPublisher.rollbackPublication(id, body.expectedRevision, body.targetRevision);
1064
+ if (binding) await hostedBindings.upsert({
1065
+ ...binding,
1066
+ source: targetSource,
1067
+ snapshotRevision: item.revision,
1068
+ title: item.title,
1069
+ description: item.description,
1070
+ expiresAt: item.expiresAt,
1071
+ maxViews: item.maxViews,
1072
+ viewCount: item.viewCount,
1073
+ updatedAt: item.updatedAt
1074
+ });
1075
+ return c.json({
1076
+ ok: true,
1077
+ payload: {
1078
+ publicationId: id,
1079
+ revision: body.targetRevision
1080
+ }
1081
+ });
1082
+ } catch (err) {
1083
+ return hostedShareErrorResponse(c, err);
1084
+ }
1085
+ });
1086
+ authenticated.get("/api/hosted-publications", async (c) => {
1087
+ try {
1088
+ const [remote, localBindings] = await Promise.all([hostedPublisher.listPublications(), hostedBindings.listAll()]);
1089
+ const bindingById = new Map(localBindings.map((binding) => [binding.id, binding]));
1090
+ return c.json({
1091
+ ok: true,
1092
+ payload: { publications: remote.map((item) => {
1093
+ const binding = bindingById.get(item.id);
1094
+ return {
1095
+ id: item.id,
1096
+ kind: item.kind,
1097
+ delivery: item.deliveryMode,
1098
+ title: item.title,
1099
+ description: item.description,
1100
+ status: item.status,
1101
+ revision: item.revision,
1102
+ expiresAt: item.expiresAt,
1103
+ maxViews: item.maxViews,
1104
+ viewCount: item.viewCount,
1105
+ createdAt: item.createdAt,
1106
+ updatedAt: item.updatedAt,
1107
+ owner: item.owner ?? null,
1108
+ workspaceId: item.workspaceId ?? null,
1109
+ createdByPrincipalId: item.createdByPrincipalId ?? null,
1110
+ shareUrl: binding?.shareUrl ?? null,
1111
+ managedFromThisDevice: Boolean(binding)
1112
+ };
1113
+ }) }
1114
+ });
1115
+ } catch (err) {
1116
+ return hostedShareErrorResponse(c, err);
1117
+ }
1118
+ });
1119
+ authenticated.delete("/api/hosted-publications/:publicationId", async (c) => {
1120
+ try {
1121
+ const id = c.req.param("publicationId");
1122
+ await hostedPublisher.revokePublication(id);
1123
+ await hostedBindings.markRevoked(id);
1124
+ return c.json({
1125
+ ok: true,
1126
+ payload: { revoked: id }
1127
+ });
1128
+ } catch (err) {
1129
+ return hostedShareErrorResponse(c, err);
1130
+ }
1131
+ });
809
1132
  authenticated.post("/api/shares", async (c) => {
810
1133
  const gatewayToken = extractToken({ authorization: c.req.header("authorization") ?? void 0 });
811
1134
  if (!gatewayToken) return c.json({
@@ -993,6 +1316,61 @@ function registerShareRoutes(authenticated, deps) {
993
1316
  const siteStore = getSiteShareStore(resolveSiteShareConfig(service));
994
1317
  let sitePath = path;
995
1318
  let stagedDir = null;
1319
+ const titleOut = makeTitle(probe.kind === "directory" ? path.split("/").pop() || path : path, title);
1320
+ if (resolveSiteShareUrl({
1321
+ ...urlCtx,
1322
+ token: "reachability-check",
1323
+ subdomainLabel: "reachability-check",
1324
+ publicHostSuffix: siteStore.getConfig().publicHostSuffix
1325
+ }).reachability !== "public") {
1326
+ const { binding } = await publishHostedStaticSite({
1327
+ workspaceRoot,
1328
+ path: sitePath,
1329
+ title: titleOut,
1330
+ description,
1331
+ spaFallback: true,
1332
+ ttlMs,
1333
+ maxViews: maxViews ?? null,
1334
+ sessionKey,
1335
+ agentId
1336
+ }, {
1337
+ builder: hostedSiteBuilder,
1338
+ publisher: hostedPublisher,
1339
+ bindings: hostedBindings
1340
+ });
1341
+ return c.json({
1342
+ ok: true,
1343
+ payload: {
1344
+ share: {
1345
+ id: binding.id,
1346
+ kind: "site",
1347
+ delivery: "hosted",
1348
+ title: binding.title,
1349
+ description: makeDescription({
1350
+ audience,
1351
+ expiresAt: binding.expiresAt,
1352
+ override: description
1353
+ }),
1354
+ shareUrl: binding.shareUrl,
1355
+ lanUrl: null,
1356
+ reachability: "public",
1357
+ reachabilityHint: null,
1358
+ expiresAt: binding.expiresAt,
1359
+ maxViews: binding.maxViews
1360
+ },
1361
+ thumbnail: {
1362
+ url: "",
1363
+ status: "unavailable",
1364
+ width: SHARE_CONFIG_DEFAULTS.thumbnail.viewportWidth,
1365
+ height: SHARE_CONFIG_DEFAULTS.thumbnail.viewportHeight
1366
+ },
1367
+ routing: {
1368
+ reason: decision.reason,
1369
+ hint: decision.hint
1370
+ }
1371
+ }
1372
+ }, 201);
1373
+ }
996
1374
  if (probe.kind === "file") {
997
1375
  const staged = await stageSingleHtmlAsSite(workspaceRoot, probe.absolutePath);
998
1376
  sitePath = staged.relativePath;
@@ -1028,7 +1406,6 @@ function registerShareRoutes(authenticated, deps) {
1028
1406
  }, thumbnailRenderContext(service));
1029
1407
  siteStore.setThumbnailStatus(siteRec.id, "pending");
1030
1408
  }
1031
- const titleOut = makeTitle(probe.kind === "directory" ? path.split("/").pop() || path : path, title);
1032
1409
  return c.json({
1033
1410
  ok: true,
1034
1411
  payload: {
@@ -1267,14 +1644,34 @@ function hostedBindingResponse(binding) {
1267
1644
  cutoffSeq: binding.cutoffSeq
1268
1645
  };
1269
1646
  }
1647
+ function hostedPublicationBindingResponse(binding) {
1648
+ return {
1649
+ id: binding.id,
1650
+ kind: binding.kind,
1651
+ delivery: "hosted_snapshot",
1652
+ shareUrl: binding.shareUrl,
1653
+ expiresAt: binding.expiresAt,
1654
+ maxViews: binding.maxViews,
1655
+ viewCount: binding.viewCount,
1656
+ revision: binding.snapshotRevision,
1657
+ title: binding.title,
1658
+ description: binding.description,
1659
+ attachmentCount: binding.attachmentCount,
1660
+ createdAt: binding.createdAt,
1661
+ updatedAt: binding.updatedAt,
1662
+ revoked: binding.revoked,
1663
+ expired: Date.now() >= new Date(binding.expiresAt).getTime(),
1664
+ source: binding.source
1665
+ };
1666
+ }
1270
1667
  function hostedShareErrorResponse(c, err) {
1271
1668
  const message = err instanceof Error ? err.message : String(err);
1272
- const status = err instanceof HostedShareAuthorizationError ? 401 : err instanceof SessionShareSnapshotConflictError ? 409 : message === "Session not found" || message === "Hosted share not found" ? 404 : 400;
1669
+ const status = err instanceof HostedShareAuthorizationError ? 401 : err instanceof HostedShareRemoteError && err.status === 403 ? 403 : err instanceof SessionShareSnapshotConflictError || err instanceof HostedNoteVersionConflictError ? 409 : message === "Session not found" || message === "Hosted share not found" || message === "Hosted publication not found" || message === "Note not found" ? 404 : 400;
1273
1670
  return c.json({
1274
1671
  ok: false,
1275
1672
  error: {
1276
1673
  message,
1277
- code: err instanceof HostedShareAuthorizationError ? "hosted_share_auth_required" : status === 409 ? "session_snapshot_conflict" : void 0
1674
+ code: err instanceof HostedShareAuthorizationError ? "hosted_share_auth_required" : err instanceof HostedShareRemoteError && err.status === 403 ? err.code ?? "hosted_share_forbidden" : status === 409 ? "session_snapshot_conflict" : void 0
1278
1675
  }
1279
1676
  }, status);
1280
1677
  }
@@ -1,16 +1,29 @@
1
1
  import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
2
2
  import { resolveSiteShareConfig } from "../../../share/site-share-config.js";
3
3
  import { getSiteShareStore } from "../../../share/site-share-store.js";
4
+ import { resolveSiteShareUrl } from "../../../share/share-url.js";
5
+ import { resolveReverseProxyPublicUrl } from "../../public-url.js";
4
6
  import { extractToken } from "../../auth.js";
5
7
  import { createHash } from "node:crypto";
6
8
  //#region src/gateway/hono/routes/site-shares.ts
7
9
  function hashGatewayToken(token) {
8
10
  return createHash("sha256").update(token, "utf8").digest("hex").slice(0, 12);
9
11
  }
10
- function buildShareUrls(record, publicHostSuffix, gatewayHost, gatewayPort) {
12
+ function buildShareUrls(record, publicHostSuffix, service) {
13
+ const label = record.subdomain ?? record.token;
14
+ const gatewayHost = resolveGatewayEffectiveHost(service.currentConfig);
15
+ const gatewayPort = service.currentConfig.gateway.port ?? 18790;
16
+ const subpathUrl = `http://${gatewayHost}:${gatewayPort}/site/${record.token}/`;
11
17
  return {
12
- publicUrl: `https://${record.subdomain ?? record.token}.${publicHostSuffix}/`,
13
- subpathUrl: `http://${gatewayHost}:${gatewayPort}/site/${record.token}/`
18
+ publicUrl: resolveSiteShareUrl({
19
+ gatewayHost,
20
+ gatewayPort,
21
+ reverseProxyPublicUrl: resolveReverseProxyPublicUrl(service.currentConfig),
22
+ token: record.token,
23
+ subdomainLabel: label,
24
+ publicHostSuffix
25
+ }).shareUrl,
26
+ subpathUrl
14
27
  };
15
28
  }
16
29
  function registerSiteShareRoutes(authenticated, deps) {
@@ -85,9 +98,7 @@ function registerSiteShareRoutes(authenticated, deps) {
85
98
  workspaceRoot,
86
99
  gatewayTokenHash: hashGatewayToken(gatewayToken)
87
100
  });
88
- const cfg = store.getConfig();
89
- const gw = service.currentConfig.gateway;
90
- const urls = buildShareUrls(record, cfg.publicHostSuffix, resolveGatewayEffectiveHost(service.currentConfig), gw.port ?? 18790);
101
+ const urls = buildShareUrls(record, store.getConfig().publicHostSuffix, service);
91
102
  return c.json({
92
103
  ok: true,
93
104
  payload: {
@@ -114,11 +125,8 @@ function registerSiteShareRoutes(authenticated, deps) {
114
125
  authenticated.get("/api/site-shares", (c) => {
115
126
  store.updateConfig(resolveSiteShareConfig(service));
116
127
  const cfg = store.getConfig();
117
- const gw = service.currentConfig.gateway;
118
- const gatewayHost = resolveGatewayEffectiveHost(service.currentConfig);
119
- const gatewayPort = gw.port ?? 18790;
120
128
  const items = store.getAllShares().map((r) => {
121
- const urls = buildShareUrls(r, cfg.publicHostSuffix, gatewayHost, gatewayPort);
129
+ const urls = buildShareUrls(r, cfg.publicHostSuffix, service);
122
130
  const expired = Date.now() >= new Date(r.expiresAt).getTime();
123
131
  return {
124
132
  id: r.id,
@@ -150,9 +158,7 @@ function registerSiteShareRoutes(authenticated, deps) {
150
158
  ok: false,
151
159
  error: { message: "Not found" }
152
160
  }, 404);
153
- const cfg = store.getConfig();
154
- const gw = service.currentConfig.gateway;
155
- const urls = buildShareUrls(record, cfg.publicHostSuffix, resolveGatewayEffectiveHost(service.currentConfig), gw.port ?? 18790);
161
+ const urls = buildShareUrls(record, store.getConfig().publicHostSuffix, service);
156
162
  return c.json({
157
163
  ok: true,
158
164
  payload: {
@@ -1,8 +1,8 @@
1
1
  import { init_public_url, validatePublicUrl } from "../../../config/public-url.js";
2
- import { extractToken } from "../../auth.js";
3
2
  import { TUNNEL_REGISTRATION_SECRET_REQUIRED_CODE, TunnelRegistrationSecretError, getTunnelRegistrationSecretMeta, readTunnelRegistrationSecretFromConfigOnly, resolveTunnelBrokerUrl } from "../../../tunnel/env.js";
4
3
  import { logTunnelAudit } from "../../../tunnel/tunnel-audit.js";
5
4
  import { getTunnelService, hashGatewayToken } from "../../../tunnel/tunnel-service.js";
5
+ import { extractToken } from "../../auth.js";
6
6
  import { TUNNEL_CONSENT_REQUIRED_CODE, TunnelConsentError, assertTunnelMayStart, getTunnelConsentState } from "../../../tunnel/consent.js";
7
7
  import { configureTunnelFromGatewayConfig } from "../../../tunnel/gateway-lifecycle.js";
8
8
  import { applyTunnelConsentToConfig, mergeTunnelConfigPatch, setTunnelEnabledInConfig } from "../../../tunnel/tunnel-config.js";
@@ -1,16 +1,16 @@
1
1
  import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
2
2
  import { resolveProjectAgentId } from "../../../projects/project-agent.js";
3
3
  import "../../../projects/index.js";
4
+ import { messagesToClientHistory } from "../../../session/client-history.js";
4
5
  import { validateWorkflowDefinitionInput } from "../../../workflows/domain/validation.js";
5
6
  import { WorkflowNameConflictError, WorkflowRevisionConflictError, createWorkflowCatalog } from "../../../agent/workflow/catalog.js";
6
- import { messagesToClientHistory } from "../../../session/client-history.js";
7
7
  import "../../../workflows/domain/index.js";
8
8
  import { resolveWorkflowRunArtifactsDir } from "../../../workflows/store/paths.js";
9
9
  import { WorkflowDraftService } from "../../../workflows/draft/workflow-draft-service.js";
10
10
  import { WorkflowDraftConflictError, WorkflowDraftStore } from "../../../workflows/authoring/workflow-draft-store.js";
11
11
  import "../../../workflows/authoring/index.js";
12
- import "../../../workflows/draft/index.js";
13
12
  import { ProjectWorkflowPresetRepository } from "../../../workflows/project-presets/project-workflow-preset-repository.js";
13
+ import "../../../workflows/draft/index.js";
14
14
  import { basename, join } from "node:path";
15
15
  import { readFile, stat } from "node:fs/promises";
16
16
  //#region src/gateway/hono/routes/workflows.ts
@@ -1,9 +1,9 @@
1
1
  import { init_agent_session_key, resolveAgentIdFromSessionKey } from "../../routing/agent-session-key.js";
2
2
  import { buildSessionKey, init_session_key } from "../../routing/session-key.js";
3
3
  import { retireSessionMcpRuntimeForSessionKey } from "../../agent/mcp/bundle-mcp-runtime.js";
4
- import "../../agent/mcp/bundle-mcp-tools.js";
5
4
  import { buildSessionTimeline } from "../../session/transcript-outline.js";
6
5
  import { transcriptRowsToClientHistory } from "../../session/client-history.js";
6
+ import "../../agent/mcp/bundle-mcp-tools.js";
7
7
  import { collectMediaUrisFromValues, deleteMediaUris } from "../../media/session-references.js";
8
8
  import { withModelConfigLock } from "../../session/model-config-lock.js";
9
9
  import { getDistinctSessionChatIds } from "./session-chat-ids.js";
@@ -21,6 +21,9 @@ import { loadConfig, saveConfig } from "../config/loader.js";
21
21
  import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
22
22
  import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
23
23
  import { init_providers, providers_exports } from "../providers/index.js";
24
+ import { AutomationService } from "../automations/service/automation-service.js";
25
+ import { onAutomationProductEvent, publishAutomationProductEvent } from "../automations/product-events.js";
26
+ import "../automations/index.js";
24
27
  import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
25
28
  import { TaskRepository } from "../tasks/task-repository.js";
26
29
  import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
@@ -31,9 +34,6 @@ import { resolveProjectAgentId } from "../projects/project-agent.js";
31
34
  import "../projects/index.js";
32
35
  import { resolveEffectiveGatewayPort } from "./host.js";
33
36
  import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
34
- import { AutomationService } from "../automations/service/automation-service.js";
35
- import { onAutomationProductEvent, publishAutomationProductEvent } from "../automations/product-events.js";
36
- import "../automations/index.js";
37
37
  import { TaskApplicationService } from "../tasks/task-application-service.js";
38
38
  import { ProactiveScenarioService } from "../proactive/scenarios/service.js";
39
39
  import { TaskOutboxDispatcher } from "../tasks/task-outbox-dispatcher.js";
@@ -2,9 +2,9 @@ import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
3
  import { isTailscaleInstalled } from "../infra/tailscale.js";
4
4
  import { resolveGatewayBindMode } from "../config/gateway-bind.js";
5
+ import { getTunnelService } from "../tunnel/tunnel-service.js";
5
6
  import { collectExposureConflicts } from "./exposure-guards.js";
6
7
  import { getTailscaleExposureState, maybeStartTailscaleFromConfig, stopTailscaleExposure } from "../gateway/tailscale-lifecycle.js";
7
- import { getTunnelService } from "../tunnel/tunnel-service.js";
8
8
  import { getTunnelConsentState } from "../tunnel/consent.js";
9
9
  import { maybeAutoStartTunnelFromConfig } from "../tunnel/gateway-lifecycle.js";
10
10
  //#region src/remote-access/exposure-manager.ts
@@ -1,9 +1,9 @@
1
1
  import { buildSessionContextForLlm, isTranscriptContextEntry, mergeLlmMessagesPreservingContextRows, transcriptRowsFromJsonArray } from "./session-context-for-llm.js";
2
2
  import { SessionStatus } from "./types.js";
3
3
  import { effectiveWorkspacePathForSession, normalizeWorkingDirectoryInput, projectWorkspacePath } from "./session-workspace.js";
4
+ import { flattenMessageContent, messagesToClientHistory } from "./client-history.js";
4
5
  import { emitSessionTranscriptUpdate, onSessionTranscriptUpdate } from "./transcript-events.js";
5
6
  import { fallbackTitleFromMessages, generateSessionTitleFromMessages, getSessionTitleSource, isWebchatSessionKey, maybeRefineSessionTitleWithLlm, maybeSetProvisionalSessionTitle, provisionalTitleFromUserText, sanitizeGeneratedSessionTitle, sanitizeSessionTitle, shouldAutoTitleSessionKey, shouldRefineSessionTitleWithLlm } from "./session-title.js";
6
- import { flattenMessageContent, messagesToClientHistory } from "./client-history.js";
7
7
  import { SessionStore } from "./store.js";
8
8
  import { applySessionPatchToMetadata } from "./patch-metadata.js";
9
9
  import { SessionIndex } from "./manager.js";
@@ -12,6 +12,7 @@ import { appendCompactionBoundaryIfUnchanged, appendTranscriptEntry, listCompact
12
12
  import { getSessionConfig, setSessionConfig } from "../storage/sqlite/config-repository.js";
13
13
  import "../storage/sqlite/index.js";
14
14
  import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
15
+ import { transcriptRowsToClientHistory } from "./client-history.js";
15
16
  import { SessionCompactor } from "../agent/memory/compaction.js";
16
17
  import { resolveUserContextSessionAccess } from "../user-context/access-policy.js";
17
18
  import { readPostCompactionContext } from "../agent/reply/post-compaction-context.js";
@@ -19,7 +20,6 @@ import { resolveCompactionPolicy } from "../agent/memory/compaction-policy.js";
19
20
  import { promoteCompactionLedger } from "../agent/memory/compaction-promotion.js";
20
21
  import { SlidingWindow } from "../agent/memory/window.js";
21
22
  import { isAppendOnlyLlmTranscriptMessage } from "./transcript-stats.js";
22
- import { transcriptRowsToClientHistory } from "./client-history.js";
23
23
  import { backfillStructuredTurnOutcomes } from "./turn-outcome-projector.js";
24
24
  import { computeTranscriptUserRoundDeleteRange } from "./user-round-delete.js";
25
25
  //#region src/session/store.ts