frizz-server 0.15.1 → 0.15.3

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 (106) hide show
  1. package/dist/dev-child.js +363 -974
  2. package/package.json +2 -4
  3. package/web-dist/assets/{abnfDiagram-VRR7QNED-CZEP8flc.js → abnfDiagram-VRR7QNED-xE-9g5UC.js} +1 -1
  4. package/web-dist/assets/{arc-BSyeo0Gb.js → arc-Dlkuw4wF.js} +1 -1
  5. package/web-dist/assets/architecture-TIHT7OUA-Bmfqof7U.js +1 -0
  6. package/web-dist/assets/architectureDiagram-ZJ3FMSHR-C-b0cKp-.js +36 -0
  7. package/web-dist/assets/{blockDiagram-677ZJIJ3-CsJ7cQv7.js → blockDiagram-677ZJIJ3-BaOaWvmK.js} +1 -1
  8. package/web-dist/assets/{c4Diagram-LMCZKHZV-BueHBn6U.js → c4Diagram-LMCZKHZV-ChIle3EG.js} +1 -1
  9. package/web-dist/assets/channel-DD1fV2rW.js +1 -0
  10. package/web-dist/assets/{chunk-32BRIVSS-DxkYbkXg.js → chunk-32BRIVSS-BxewakNX.js} +1 -1
  11. package/web-dist/assets/{chunk-52WLFC77-B4RUR7JZ.js → chunk-52WLFC77-CXqawcfS.js} +1 -1
  12. package/web-dist/assets/{chunk-C7G6YPKG-BLRgwvy4.js → chunk-C7G6YPKG-Bbe4eSpI.js} +1 -1
  13. package/web-dist/assets/{chunk-EX3LRPZG-BAtxNbJC.js → chunk-EX3LRPZG-DH4d2paR.js} +1 -1
  14. package/web-dist/assets/chunk-FWX5IMBZ-0BYwUwYi.js +2 -0
  15. package/web-dist/assets/{chunk-HOUHSVGY-0dpVw62j.js → chunk-HOUHSVGY-BMIdG8x1.js} +1 -1
  16. package/web-dist/assets/{chunk-ICXQ74PX-BZZPAhRZ.js → chunk-ICXQ74PX-D1a3x5nQ.js} +1 -1
  17. package/web-dist/assets/{chunk-MOJQB5TN-ooRCpdkt.js → chunk-MOJQB5TN-CnB4ztIN.js} +1 -1
  18. package/web-dist/assets/{chunk-OGEWGWER-Ah-NEmel.js → chunk-OGEWGWER-Cz9wz0M2.js} +1 -1
  19. package/web-dist/assets/{chunk-PUDLZKDR-LtHfx3UY.js → chunk-PUDLZKDR-BDNzRQUE.js} +1 -1
  20. package/web-dist/assets/{chunk-Q4XR5HBZ-Bd3maQzn.js → chunk-Q4XR5HBZ-Dd5GMfhf.js} +1 -1
  21. package/web-dist/assets/{chunk-RYQCIY6F-Cu_KplZW.js → chunk-RYQCIY6F-DiuH-Yn9.js} +1 -1
  22. package/web-dist/assets/{chunk-V7JOEXUC-Baak7qeE.js → chunk-V7JOEXUC-DGaU5Tbk.js} +1 -1
  23. package/web-dist/assets/{chunk-VAUOI2AC-DmUeRv29.js → chunk-VAUOI2AC-Dnzgmkh6.js} +1 -1
  24. package/web-dist/assets/{chunk-VR4S4FIN-BpgSzLFF.js → chunk-VR4S4FIN-DgbRtXBy.js} +1 -1
  25. package/web-dist/assets/{chunk-WYO6CB5R-PnbowZ3i.js → chunk-WYO6CB5R-B43ozEtN.js} +1 -1
  26. package/web-dist/assets/{chunk-XXDRQBXY-DYlTP5J-.js → chunk-XXDRQBXY-B0cmKTUd.js} +1 -1
  27. package/web-dist/assets/{chunk-ZGVPDNZ5-D5-YXqW9.js → chunk-ZGVPDNZ5-C7ArvNab.js} +1 -1
  28. package/web-dist/assets/classDiagram-OUVF2IWQ-xZMTG9nn.js +1 -0
  29. package/web-dist/assets/classDiagram-v2-EOCWNBFH-xZMTG9nn.js +1 -0
  30. package/web-dist/assets/cose-bilkent-JH36ORCC-Dfd05rJV.js +1 -0
  31. package/web-dist/assets/{cynefin-VYW2F7L2-8VyxZobI.js → cynefin-VYW2F7L2-PPMqG0--.js} +1 -1
  32. package/web-dist/assets/{cynefinDiagram-TSTJHNR4-yFUBmk3y.js → cynefinDiagram-TSTJHNR4-CNxEXSRp.js} +1 -1
  33. package/web-dist/assets/{dagre-VKFMJZFB-wUCK5Cyw.js → dagre-VKFMJZFB-FLiXT3bq.js} +1 -1
  34. package/web-dist/assets/{diagram-FQU43EPY-CGzrn40X.js → diagram-FQU43EPY-B45zjofi.js} +1 -1
  35. package/web-dist/assets/{diagram-G47NLZAW-DuhlaKXR.js → diagram-G47NLZAW-C_zePZIT.js} +1 -1
  36. package/web-dist/assets/{diagram-NH7WQ7WH-CryBrnG8.js → diagram-NH7WQ7WH-BrzAgqOE.js} +1 -1
  37. package/web-dist/assets/{diagram-OA4YK3LP-C_6Ugdyv.js → diagram-OA4YK3LP-DfntP14U.js} +1 -1
  38. package/web-dist/assets/{diagram-WEI45ONY-CklWH5cu.js → diagram-WEI45ONY-BPzGjrT3.js} +1 -1
  39. package/web-dist/assets/dist-6vV1H_0G.js +1 -0
  40. package/web-dist/assets/{ebnfDiagram-CCIWWBDH-DmMOqNaR.js → ebnfDiagram-CCIWWBDH-BKjFCq6G.js} +1 -1
  41. package/web-dist/assets/{erDiagram-Q63AITRT-DBpmNhHP.js → erDiagram-Q63AITRT-BWX5Lkpo.js} +1 -1
  42. package/web-dist/assets/eventmodeling-45OFAUF4-fpw6U6qT.js +1 -0
  43. package/web-dist/assets/flowDiagram-23GEKE2U-BopRFH7c.js +1 -0
  44. package/web-dist/assets/ganttDiagram-NO4QXBWP-DW_v-dIb.js +292 -0
  45. package/web-dist/assets/{gitGraph-TEB2WS4Q-CdNkzLjA.js → gitGraph-TEB2WS4Q-BKlcCHJ6.js} +1 -1
  46. package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-BrIGgHoU.js → gitGraphDiagram-IHSO6WYX-DhHS1gmC.js} +1 -1
  47. package/web-dist/assets/index-BGha5d3h.css +2 -0
  48. package/web-dist/assets/index-DOYb6G27.js +321 -0
  49. package/web-dist/assets/{info-DKCQHKI2-BYiyjhUV.js → info-DKCQHKI2-MzQc40xO.js} +1 -1
  50. package/web-dist/assets/{infoDiagram-FWYZ7A6U-5zjTG5N-.js → infoDiagram-FWYZ7A6U-BNp0nmN1.js} +1 -1
  51. package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-Ca2QU8ga.js → ishikawaDiagram-FXEZZL3T-BYWBHI4k.js} +1 -1
  52. package/web-dist/assets/{journeyDiagram-5HDEW3XC-CzUGQDiX.js → journeyDiagram-5HDEW3XC-DMkdBmb8.js} +1 -1
  53. package/web-dist/assets/{kanban-definition-HUTT4EX6-CjTCAZS0.js → kanban-definition-HUTT4EX6-Dep9rGfb.js} +1 -1
  54. package/web-dist/assets/{line-uxNpP2NX.js → line-DarVoAdc.js} +1 -1
  55. package/web-dist/assets/{linear-z2V0wJk9.js → linear-BY6nHlV9.js} +1 -1
  56. package/web-dist/assets/{mermaid-parser.core-BADU525L.js → mermaid-parser.core-IqU1B8M-.js} +3 -3
  57. package/web-dist/assets/{mermaid.core-OvwlqnDg.js → mermaid.core-r3vr2F-c.js} +3 -3
  58. package/web-dist/assets/{mindmap-definition-LN4V7U3C-BtbgfcR8.js → mindmap-definition-LN4V7U3C-C9_ELGZ9.js} +1 -1
  59. package/web-dist/assets/{packet-7NZHBO7P-BsfLS3kE.js → packet-7NZHBO7P-DPKnKSB0.js} +1 -1
  60. package/web-dist/assets/{pegDiagram-2B236MQR-CB5AkYXG.js → pegDiagram-2B236MQR-Cz9AZoag.js} +1 -1
  61. package/web-dist/assets/{pie-RZYD4A2V-DgnPemgQ.js → pie-RZYD4A2V-C3bmkrku.js} +1 -1
  62. package/web-dist/assets/{pieDiagram-ENE6RG2P-DgiTOSOg.js → pieDiagram-ENE6RG2P-Dxz8C52f.js} +1 -1
  63. package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-D56bxzKq.js → quadrantDiagram-ABIIQ3AL-CFlVqAMM.js} +1 -1
  64. package/web-dist/assets/{radar-I7S5WNFK-Buix85nx.js → radar-I7S5WNFK-BHZ05xTk.js} +1 -1
  65. package/web-dist/assets/{railroad-3IZDKUUU-_-csUIwQ.js → railroad-3IZDKUUU-cgELr3Gy.js} +1 -1
  66. package/web-dist/assets/railroad-abnf-AHOZXSZD-BThnYg_c.js +1 -0
  67. package/web-dist/assets/railroad-ebnf-EBAXGLYW-qjlwdhQZ.js +1 -0
  68. package/web-dist/assets/railroad-peg-LSFZ7HO6-C3qNQuDB.js +1 -0
  69. package/web-dist/assets/{railroadDiagram-RFXS5EU6-C5pjXI43.js → railroadDiagram-RFXS5EU6-D203e-HH.js} +1 -1
  70. package/web-dist/assets/{requirementDiagram-TGXJPOKE-DKG82b1A.js → requirementDiagram-TGXJPOKE-CGq-KVAB.js} +1 -1
  71. package/web-dist/assets/{sankeyDiagram-HTMAVEWB-xNsa0WzO.js → sankeyDiagram-HTMAVEWB-BL1NMRnt.js} +1 -1
  72. package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-CWHvrs9Q.js → sequenceDiagram-DBY2YBRQ-CzRXvd69.js} +1 -1
  73. package/web-dist/assets/src-LR6irJgd.js +1 -0
  74. package/web-dist/assets/{stateDiagram-2N3HPSRC-DirRfNzF.js → stateDiagram-2N3HPSRC-BeHnUxPo.js} +1 -1
  75. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-B6jH-oGw.js +1 -0
  76. package/web-dist/assets/{swimlanes-5IMT3BWC-B0GC66v6.js → swimlanes-5IMT3BWC-BcdRyYGY.js} +1 -1
  77. package/web-dist/assets/swimlanesDiagram-G3AALYLV-BNywSea5.js +8 -0
  78. package/web-dist/assets/{timeline-definition-FHXFAJF6-D-UsR0sc.js → timeline-definition-FHXFAJF6-BTEc1dtl.js} +1 -1
  79. package/web-dist/assets/{treeView-QDETBFTQ-BcjBpVxS.js → treeView-QDETBFTQ-8Lpl8nrn.js} +1 -1
  80. package/web-dist/assets/{treemap-6X3UGDF4-CrsT6ziM.js → treemap-6X3UGDF4-Dt41Ym6i.js} +1 -1
  81. package/web-dist/assets/{vennDiagram-L72KCM5P-DrY93og0.js → vennDiagram-L72KCM5P-CmQAQTDt.js} +1 -1
  82. package/web-dist/assets/{wardley-OPB4EBWU-D1WgLKZM.js → wardley-OPB4EBWU-C-bYya3K.js} +1 -1
  83. package/web-dist/assets/{wardleyDiagram-EHGQE667-BJ5hU4aG.js → wardleyDiagram-EHGQE667-BgSP-M-y.js} +1 -1
  84. package/web-dist/assets/{xychartDiagram-FW5EYKEG-DS28rhax.js → xychartDiagram-FW5EYKEG-CFnliqwY.js} +1 -1
  85. package/web-dist/index.html +2 -3
  86. package/web-dist/assets/TerminalPane-ChkS6RgS.js +0 -7
  87. package/web-dist/assets/architecture-TIHT7OUA-D3wgsRS5.js +0 -1
  88. package/web-dist/assets/architectureDiagram-ZJ3FMSHR-BEXzrjrX.js +0 -36
  89. package/web-dist/assets/channel-DCxTKTH_.js +0 -1
  90. package/web-dist/assets/chunk-FWX5IMBZ-BSC2st3T.js +0 -2
  91. package/web-dist/assets/classDiagram-OUVF2IWQ-DWiNurp2.js +0 -1
  92. package/web-dist/assets/classDiagram-v2-EOCWNBFH-DWiNurp2.js +0 -1
  93. package/web-dist/assets/cose-bilkent-JH36ORCC-BUIsLrGc.js +0 -1
  94. package/web-dist/assets/dist-DoH_9pyS.js +0 -1
  95. package/web-dist/assets/eventmodeling-45OFAUF4-CRp1CVTM.js +0 -1
  96. package/web-dist/assets/flowDiagram-23GEKE2U-lZUkMIKX.js +0 -1
  97. package/web-dist/assets/ganttDiagram-NO4QXBWP-BVFPEPZK.js +0 -292
  98. package/web-dist/assets/index-D5dploZD.js +0 -321
  99. package/web-dist/assets/index-Wees4UUL.css +0 -1
  100. package/web-dist/assets/railroad-abnf-AHOZXSZD-BGBPTyyT.js +0 -1
  101. package/web-dist/assets/railroad-ebnf-EBAXGLYW-isH8svgX.js +0 -1
  102. package/web-dist/assets/railroad-peg-LSFZ7HO6-DAuLC_Z3.js +0 -1
  103. package/web-dist/assets/rolldown-runtime-Bh1tDfsg.js +0 -1
  104. package/web-dist/assets/src-C4XfhTaE.js +0 -1
  105. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-D58IKdqf.js +0 -1
  106. package/web-dist/assets/swimlanesDiagram-G3AALYLV-B1vaMvkV.js +0 -8
package/dist/dev-child.js CHANGED
@@ -13812,7 +13812,7 @@ function parseGithubWakeSteer(text2) {
13812
13812
  function frizzRoute(path3) {
13813
13813
  return `${FRIZZ_ROUTE_PREFIX}${path3.startsWith("/") ? path3 : `/${path3}`}`;
13814
13814
  }
13815
- var import_yaml, ATTACHMENT_IMAGE_EXTENSIONS, ATTACHMENT_TEXT_EXTENSIONS, ATTACHMENT_OFFICE_EXTENSIONS, ATTACHMENT_DATA_EXTENSIONS, ATTACHMENT_ARCHIVE_EXTENSIONS, ATTACHMENT_DOC_EXTENSIONS, ATTACHMENT_EXTENSIONS, ATTACHMENT_MAX_BASE64_CHARS, ATTACHMENT_MAX_BYTES, ATTACHMENT_EXT_SET, ATTACHMENT_ACCEPT, FrizzStatus, BlockMechanism, RuntimeState, Backend, CodexModel, ClaudeModel, AcpAgent, ACP_MODEL_PREFIX, AcpAgentModel, AcpAgentModels, AcpAgentModelsInput, ThreadProfileOption, ThreadAgent, SubAgentView, BgShellView, CompletionHoldOp, CompletionHold, AskOption, AskQuestion, PendingAsk, AwaitingHint, RETIRED_AWAITING_KINDS, RETIRED_LINE_RE, RETIRED_AWAITING_REPLACEMENT, AWAITING_KEY_RE, AWAITING_YAML_KEYS, AWAITING_SEQUENCE_KEYS, AWAITING_HINT_MAX, AWAITING_HINT_VALUE_MAX, AWAITING_TITLE_MAX, AWAITING_ITEM_KINDS, AWAITING_DURATION_RE, DURATION_UNIT_MS, AWAITING_FOR_MAX_MS, SnoozeUntil, SNOOZE_PROMPT_MAX, SnoozePrompt, RECURRING_PROMPT_MAX, RECURRING_MIN_INTERVAL_SECONDS, RECURRING_MAX_INTERVAL_SECONDS, RecurringPromptText, RecurringIntervalSeconds, ThreadRecurringPrompt, INTERRUPT_MARKERS, ALLDONE_SENTINEL, OPT_OUT_NOTE, OVER_QUESTION_NOTE, TIMER_PROMPT_MAX, TIMER_MAX_DELAY_SECONDS, TIMER_MAX_ARMED, TimerPromptText, PR_WATCH_SPENT_TRAILER, PR_WATCH_ARMED_TRAILER, SHELL_DONE_TRAILER, ISSUE_WATCH_SPENT_TRAILER, ISSUE_WATCH_ARMED_TRAILER, INTERRUPT_ENDED_LEAD, SIGNOFF_NUDGE_MARKER, SIGNOFF_NUDGE_MESSAGE, PARK_CORRECTION_NAMES_LEAD, PARK_CORRECTION_RETIRED_LEAD, PARK_CORRECTION_QUESTION_LEAD, ThreadWatchKind, GithubChecksState, GithubMergeState, GithubWatchStatus, GithubIssueStatus, ThreadWatchView, PR_WATCH_FOR_MAX_MS, PR_WATCH_DEFAULT_FOR_MS, PR_WATCH_MAX_ARMED, PrWatchView, AddOwnPrWatchInput, AddOwnPrWatchResult, DropOwnPrWatchInput, DropOwnPrWatchResult, OwnWatchKind, AddOwnWatchInput, OwnWatchView, AddOwnWatchResult, DropOwnWatchInput, DropOwnWatchResult, OWN_WATCH_MAX_ARMED, QUESTION_FENCE_RETIRED_AT, AskQuestionKind, ASK_MAX_DEPTH, AskedOptionSchema, AskedQuestionSchema, AskInput, RegisteredQuestionView, AskResult, UnaskInput, UnaskResult, QuestionAnswerSchema, AnswerQuestionsInput, AnswerQuestionsResult, DismissQuestionsInput, DismissQuestionsResult, BURIED_ANSWERS_HEADER, ANSWER_FOLLOW_UP_MARKER, ANSWER_CONTINUATION_INDENT, indentAnswerContinuation, DISMISSED_ANSWER, MarkOwnDoneInput, MarkOwnDoneResult, ListOwnPrWatchesInput, OwnPrWatchesResult, ThreadTimerView, ThreadFence, LimitWindow, LimitPause, ProviderError, ThreadLinkView, UpsertOwnLinkInput, UpsertOwnLinkResult, DropOwnLinkInput, DropOwnLinkResult, ThreadView, BoardErrorItem, BoardSnapshot, QuotaWindow, ProviderQuota, QuotaSnapshot, ProviderAuth, AccountEmails, AuthSnapshot, AccountBackend, AccountLogoutInput, AccountLogoutResult, AccountLoginStartInput, AccountLoginStartResult, AccountLoginStatusInput, AccountLoginStatusResult, PermissionMode, LocalFileOpener, Settings, DispatchProviderPreferences, DispatchPreferences, DispatchProfileSnapshotShape, DispatchProfileSnapshot, SetDispatchPreferenceInput, DispatchInput, ADOPT_THREAD_MESSAGE_MAX_CHARS, AdoptThreadInput, AdoptThreadResult, AdoptSessionInput, FollowUpInput, UnqueueFollowUpInput, UnqueueFollowUpResult, DeliverQueuedNowInput, DeliverQueuedNowResult, SetThreadSnoozeInput, SetThreadPinnedInput, SetThreadRecurringPromptInput, SetOwnThreadRecurringPromptInput, SetOwnThreadRecurringPromptResult, GetOwnThreadRecurringPromptInput, OwnThreadRecurringPromptResult, SetOwnThreadTimerInput, CancelOwnThreadTimerInput, ListOwnThreadTimersInput, OwnThreadTimersResult, ThreadActivityItem, ListOwnThreadActivityInput, OwnThreadActivityResult, SetOwnThreadTimerResult, CancelOwnThreadTimerResult, SetOwnThreadStopHookInput, SetOwnThreadHeartbeatInput, ThreadPluginReloadResult, RenameThreadInput, AiRenameThreadInput, AiRenameThreadResult, SetOwnThreadTitleInput, SetOwnThreadTitleResult, SetThreadPermissionInput, SetThreadPermissionResult, ThreadProfileOptionsInput, ThreadProfileOptionsResult, ThreadSkillSource, ThreadSkill, ThreadSkillsInput, ThreadSkillsResult, SetThreadProfileInput, SetThreadProfileResult, UpgradeThreadModelInput, UpgradeThreadModelResult, DISPATCH_TASK_BANNER, DISPATCH_TASK_BANNER_MARKER, GITHUB_DISPATCH_UI_BOUNDARY, WAKE_TIME_HEADER_TAIL, WAKE_TRAILERS, HUMAN_GAP_FLOOR_MS, HUMAN_GAP_NOTE_TAIL, WAKE_DELIVERY_TOKEN_TAIL, WAKE_DELIVERY_TOKEN_LINE, NOISE_PREFIXES, AGENT_MESSAGE_WRAPPER, GithubWakeItem, GithubWakeSteer, WAKE_SCOPE, WAKE_REVIEW_LEAD, WAKE_BACKLOG_TAIL, WAKE_REF, WAKE_SINGLE, WAKE_MULTI_HEAD, WAKE_ITEM, WAKE_MORE, PR_WATCH_FINISHED, PR_WATCH_CI_PASSED, PR_WATCH_CI_GATED, PR_WATCH_STATE, PR_WATCH_CI_FAILED, GithubStatus, GithubRefCard, GithubRefPreviewInput, GithubRefPreviewResult, GithubItem, GithubListInput, GithubListResult, GithubBatchInput, GithubBatchResult, BoardMeta, ServerEvent, TranscriptEdit, TranscriptTodo, TranscriptToolCall, TranscriptPart, TranscriptMessage, TranscriptPageCursor, EditedFile, TranscriptPage, TranscriptEarlierInput, SocketTranscriptSlug, SocketFilePath, SocketTranscriptClientMsg, SocketFileClientMsg, SocketClientMsg, ProjectCard, ProjectRailCounts, PROJECT_ICON_EXTENSIONS, PROJECT_ICON_MAX_BASE64_CHARS, DirectoryPickResult, ThreadLocation, FRIZZ_ROUTE_PREFIX, DEFAULT_PORT, threadIdentityName;
13815
+ var import_yaml, ATTACHMENT_IMAGE_EXTENSIONS, ATTACHMENT_TEXT_EXTENSIONS, ATTACHMENT_OFFICE_EXTENSIONS, ATTACHMENT_DATA_EXTENSIONS, ATTACHMENT_ARCHIVE_EXTENSIONS, ATTACHMENT_DOC_EXTENSIONS, ATTACHMENT_EXTENSIONS, ATTACHMENT_MAX_BASE64_CHARS, ATTACHMENT_MAX_BYTES, ATTACHMENT_EXT_SET, ATTACHMENT_ACCEPT, FrizzStatus, BlockMechanism, RuntimeState, Backend, CodexModel, ClaudeModel, AcpAgent, ACP_MODEL_PREFIX, AcpAgentModel, AcpAgentModels, AcpAgentModelsInput, ThreadProfileOption, ThreadAgent, SubAgentView, BgShellView, CompletionHoldOp, CompletionHold, AskOption, AskQuestion, PendingAsk, AwaitingHint, RETIRED_AWAITING_KINDS, RETIRED_LINE_RE, RETIRED_AWAITING_REPLACEMENT, AWAITING_KEY_RE, AWAITING_YAML_KEYS, AWAITING_SEQUENCE_KEYS, AWAITING_HINT_MAX, AWAITING_HINT_VALUE_MAX, AWAITING_TITLE_MAX, AWAITING_ITEM_KINDS, AWAITING_DURATION_RE, DURATION_UNIT_MS, AWAITING_FOR_MAX_MS, SnoozeUntil, SNOOZE_PROMPT_MAX, SnoozePrompt, RECURRING_PROMPT_MAX, RECURRING_MIN_INTERVAL_SECONDS, RECURRING_MAX_INTERVAL_SECONDS, RecurringPromptText, RecurringIntervalSeconds, ThreadRecurringPrompt, INTERRUPT_MARKERS, ALLDONE_SENTINEL, OPT_OUT_NOTE, OVER_QUESTION_NOTE, TIMER_PROMPT_MAX, TIMER_MAX_DELAY_SECONDS, TIMER_MAX_ARMED, TimerPromptText, PR_WATCH_SPENT_TRAILER, PR_WATCH_ARMED_TRAILER, SHELL_DONE_TRAILER, ISSUE_WATCH_SPENT_TRAILER, ISSUE_WATCH_ARMED_TRAILER, INTERRUPT_ENDED_LEAD, SIGNOFF_NUDGE_MARKER, SIGNOFF_NUDGE_MESSAGE, PARK_CORRECTION_NAMES_LEAD, PARK_CORRECTION_RETIRED_LEAD, PARK_CORRECTION_QUESTION_LEAD, ThreadWatchKind, GithubChecksState, GithubMergeState, GithubWatchStatus, GithubIssueStatus, ThreadWatchView, PR_WATCH_FOR_MAX_MS, PR_WATCH_DEFAULT_FOR_MS, PR_WATCH_MAX_ARMED, PrWatchView, AddOwnPrWatchInput, AddOwnPrWatchResult, DropOwnPrWatchInput, DropOwnPrWatchResult, OwnWatchKind, AddOwnWatchInput, OwnWatchView, AddOwnWatchResult, DropOwnWatchInput, DropOwnWatchResult, OWN_WATCH_MAX_ARMED, QUESTION_FENCE_RETIRED_AT, AskQuestionKind, ASK_MAX_DEPTH, AskedOptionSchema, AskedQuestionSchema, AskInput, RegisteredQuestionView, AskResult, UnaskInput, UnaskResult, QuestionAnswerSchema, AnswerQuestionsInput, AnswerQuestionsResult, DismissQuestionsInput, DismissQuestionsResult, SettledQuestionView, ThreadSettledQuestionsResult, BURIED_ANSWERS_HEADER, ANSWER_FOLLOW_UP_MARKER, ANSWER_CONTINUATION_INDENT, indentAnswerContinuation, DISMISSED_ANSWER, MarkOwnDoneInput, MarkOwnDoneResult, ListOwnPrWatchesInput, OwnPrWatchesResult, ThreadTimerView, ThreadFence, LimitWindow, LimitPause, ProviderError, ThreadLinkView, UpsertOwnLinkInput, UpsertOwnLinkResult, DropOwnLinkInput, DropOwnLinkResult, ThreadView, BoardErrorItem, BoardSnapshot, QuotaWindow, ProviderQuota, QuotaSnapshot, ProviderAuth, AccountEmails, AuthSnapshot, AccountBackend, AccountLogoutInput, AccountLogoutResult, PermissionMode, LocalFileOpener, Settings, DispatchProviderPreferences, DispatchPreferences, DispatchProfileSnapshotShape, DispatchProfileSnapshot, SetDispatchPreferenceInput, DispatchInput, ADOPT_THREAD_MESSAGE_MAX_CHARS, AdoptThreadInput, AdoptThreadResult, AdoptSessionInput, FollowUpInput, UnqueueFollowUpInput, UnqueueFollowUpResult, DeliverQueuedNowInput, DeliverQueuedNowResult, SetThreadSnoozeInput, SetThreadPinnedInput, SetThreadRecurringPromptInput, SetOwnThreadRecurringPromptInput, SetOwnThreadRecurringPromptResult, GetOwnThreadRecurringPromptInput, OwnThreadRecurringPromptResult, SetOwnThreadTimerInput, CancelOwnThreadTimerInput, ListOwnThreadTimersInput, OwnThreadTimersResult, ThreadActivityItem, ListOwnThreadActivityInput, OwnThreadActivityResult, SetOwnThreadTimerResult, CancelOwnThreadTimerResult, SetOwnThreadStopHookInput, SetOwnThreadHeartbeatInput, ThreadPluginReloadResult, RenameThreadInput, AiRenameThreadInput, AiRenameThreadResult, SetOwnThreadTitleInput, SetOwnThreadTitleResult, SetThreadPermissionInput, SetThreadPermissionResult, ThreadProfileOptionsInput, ThreadProfileOptionsResult, ThreadSkillSource, ThreadSkill, ThreadSkillsInput, ThreadSkillsResult, SetThreadProfileInput, SetThreadProfileResult, UpgradeThreadModelInput, UpgradeThreadModelResult, DISPATCH_TASK_BANNER, DISPATCH_TASK_BANNER_MARKER, GITHUB_DISPATCH_UI_BOUNDARY, WAKE_TIME_HEADER_TAIL, WAKE_TRAILERS, HUMAN_GAP_FLOOR_MS, HUMAN_GAP_NOTE_TAIL, WAKE_DELIVERY_TOKEN_TAIL, WAKE_DELIVERY_TOKEN_LINE, NOISE_PREFIXES, AGENT_MESSAGE_WRAPPER, GithubWakeItem, GithubWakeSteer, WAKE_SCOPE, WAKE_REVIEW_LEAD, WAKE_BACKLOG_TAIL, WAKE_REF, WAKE_SINGLE, WAKE_MULTI_HEAD, WAKE_ITEM, WAKE_MORE, PR_WATCH_FINISHED, PR_WATCH_CI_PASSED, PR_WATCH_CI_GATED, PR_WATCH_STATE, PR_WATCH_CI_FAILED, GithubStatus, GithubRefCard, GithubRefPreviewInput, GithubRefPreviewResult, GithubItem, GithubListInput, GithubListResult, GithubBatchInput, GithubBatchResult, BoardMeta, ServerEvent, TranscriptEdit, TranscriptTodo, TranscriptToolCall, TranscriptPart, TranscriptMessage, TranscriptPageCursor, EditedFile, TranscriptPage, TranscriptEarlierInput, SocketTranscriptSlug, SocketFilePath, SocketTranscriptClientMsg, SocketFileClientMsg, SocketClientMsg, ProjectCard, ProjectRailCounts, PROJECT_ICON_EXTENSIONS, PROJECT_ICON_MAX_BASE64_CHARS, DirectoryPickResult, ThreadLocation, FRIZZ_ROUTE_PREFIX, DEFAULT_PORT, threadIdentityName;
13816
13816
  var init_src = __esm({
13817
13817
  "packages/shared/src/index.ts"() {
13818
13818
  "use strict";
@@ -14602,6 +14602,17 @@ var init_src = __esm({
14602
14602
  dismissed: external_exports.array(external_exports.string()),
14603
14603
  open: external_exports.array(RegisteredQuestionView)
14604
14604
  }).strict();
14605
+ SettledQuestionView = external_exports.object({
14606
+ id: external_exports.string(),
14607
+ spec: AskedQuestionSchema,
14608
+ askedAt: external_exports.string(),
14609
+ /** When the human sent the answer — what decides which rest the card stood at when it was answered. */
14610
+ settledAt: external_exports.string(),
14611
+ answer: QuestionAnswerSchema
14612
+ }).strict();
14613
+ ThreadSettledQuestionsResult = external_exports.object({
14614
+ questions: external_exports.array(SettledQuestionView)
14615
+ }).strict();
14605
14616
  BURIED_ANSWERS_HEADER = "Answers to earlier questions:";
14606
14617
  ANSWER_FOLLOW_UP_MARKER = "\u2937";
14607
14618
  ANSWER_CONTINUATION_INDENT = " ";
@@ -15007,13 +15018,6 @@ ${ANSWER_CONTINUATION_INDENT}`);
15007
15018
  activeThreads: external_exports.number().int().positive().optional(),
15008
15019
  detail: external_exports.string().max(200).optional()
15009
15020
  });
15010
- AccountLoginStartInput = external_exports.object({ backend: AccountBackend }).strict();
15011
- AccountLoginStartResult = external_exports.object({ attemptId: ThreadSlug });
15012
- AccountLoginStatusInput = external_exports.object({ attemptId: ThreadSlug }).strict();
15013
- AccountLoginStatusResult = external_exports.object({
15014
- state: external_exports.enum(["running", "exited", "unknown"]),
15015
- auth: ProviderAuth
15016
- });
15017
15021
  PermissionMode = external_exports.enum(["auto", "default", "acceptEdits", "plan", "bypassPermissions"]);
15018
15022
  LocalFileOpener = external_exports.enum(["system", "cursor", "vscode", "finder", "copy"]);
15019
15023
  Settings = external_exports.object({
@@ -17841,7 +17845,7 @@ var init_sqlite_quiet = __esm({
17841
17845
  });
17842
17846
 
17843
17847
  // packages/server/src/sqlite.ts
17844
- import { createRequire as createRequire2 } from "node:module";
17848
+ import { createRequire } from "node:module";
17845
17849
  function namedParameters(sql) {
17846
17850
  const found = /* @__PURE__ */ new Set();
17847
17851
  for (let index = 0; index < sql.length; index++) {
@@ -17905,7 +17909,7 @@ var init_sqlite = __esm({
17905
17909
  "packages/server/src/sqlite.ts"() {
17906
17910
  "use strict";
17907
17911
  init_sqlite_quiet();
17908
- ({ DatabaseSync } = createRequire2(import.meta.url)("node:sqlite"));
17912
+ ({ DatabaseSync } = createRequire(import.meta.url)("node:sqlite"));
17909
17913
  PreparedStatement = class {
17910
17914
  #statement;
17911
17915
  #required;
@@ -20915,9 +20919,9 @@ var init_storage = __esm({
20915
20919
 
20916
20920
  // packages/server/src/machine-config.ts
20917
20921
  import { closeSync as closeSync5, fsyncSync as fsyncSync5, mkdirSync as mkdirSync7, openSync as openSync6, readFileSync as readFileSync6, renameSync as renameSync5, rmSync as rmSync6, writeFileSync as writeFileSync6 } from "node:fs";
20918
- import { dirname as dirname7, join as join10 } from "node:path";
20922
+ import { dirname as dirname6, join as join9 } from "node:path";
20919
20923
  function machineConfigPath(home) {
20920
- return join10(frizzPaths({ home }).data, "config.json");
20924
+ return join9(frizzPaths({ home }).data, "config.json");
20921
20925
  }
20922
20926
  function readAll(home) {
20923
20927
  let raw2;
@@ -20930,7 +20934,7 @@ function readAll(home) {
20930
20934
  }
20931
20935
  function writeAll(home, all) {
20932
20936
  const path3 = machineConfigPath(home);
20933
- mkdirSync7(dirname7(path3), { recursive: true });
20937
+ mkdirSync7(dirname6(path3), { recursive: true });
20934
20938
  const temp = `${path3}.${process.pid}.tmp`;
20935
20939
  let fd2;
20936
20940
  try {
@@ -20976,9 +20980,9 @@ var init_machine_config = __esm({
20976
20980
 
20977
20981
  // packages/server/src/settings.ts
20978
20982
  import { readFileSync as readFileSync7, rmSync as rmSync7 } from "node:fs";
20979
- import { join as join11 } from "node:path";
20983
+ import { join as join10 } from "node:path";
20980
20984
  function legacyMachineSettingsPath(home) {
20981
- return join11(frizzPaths({ home }).data, "settings.json");
20985
+ return join10(frizzPaths({ home }).data, "settings.json");
20982
20986
  }
20983
20987
  function pickMachine(settings) {
20984
20988
  return Object.fromEntries(MACHINE_KEYS.map((key) => [key, settings[key]]));
@@ -21312,8 +21316,8 @@ var init_codex_error = __esm({
21312
21316
  });
21313
21317
 
21314
21318
  // packages/server/src/discover.ts
21315
- import { readdirSync as readdirSync3, statSync as statSync5, openSync as openSync7, readSync, closeSync as closeSync6 } from "node:fs";
21316
- import { dirname as dirname8, join as join12 } from "node:path";
21319
+ import { readdirSync as readdirSync3, statSync as statSync4, openSync as openSync7, readSync, closeSync as closeSync6 } from "node:fs";
21320
+ import { dirname as dirname7, join as join11 } from "node:path";
21317
21321
  function sentinelFor(sessionId) {
21318
21322
  return `threads/${sessionId}/`;
21319
21323
  }
@@ -21350,10 +21354,10 @@ function discoverTranscriptId(logDir, sessionId, opts = {}) {
21350
21354
  if (name.startsWith(".") || !name.endsWith(".jsonl")) continue;
21351
21355
  const id2 = name.slice(0, -".jsonl".length);
21352
21356
  if (!id2 || id2 === sessionId || exclude?.has(id2)) continue;
21353
- const path3 = join12(logDir, name);
21357
+ const path3 = join11(logDir, name);
21354
21358
  let mtime;
21355
21359
  try {
21356
- mtime = statSync5(path3).mtimeMs;
21360
+ mtime = statSync4(path3).mtimeMs;
21357
21361
  } catch {
21358
21362
  continue;
21359
21363
  }
@@ -21368,7 +21372,7 @@ function discoverTranscriptId(logDir, sessionId, opts = {}) {
21368
21372
  }
21369
21373
  function mtimeOfNonEmpty(path3) {
21370
21374
  try {
21371
- const st2 = statSync5(path3, { throwIfNoEntry: false });
21375
+ const st2 = statSync4(path3, { throwIfNoEntry: false });
21372
21376
  return st2 && st2.size > 0 ? st2.mtimeMs : void 0;
21373
21377
  } catch {
21374
21378
  return void 0;
@@ -21378,7 +21382,7 @@ function discoverTranscriptDir(logDir, sessionId, memo3 = strandedLogDirs) {
21378
21382
  const name = `${sessionId}.jsonl`;
21379
21383
  const better = (best2, dir) => {
21380
21384
  if (dir === logDir) return best2;
21381
- const at2 = mtimeOfNonEmpty(join12(dir, name));
21385
+ const at2 = mtimeOfNonEmpty(join11(dir, name));
21382
21386
  if (at2 === void 0) return best2;
21383
21387
  return !best2 || at2 > best2.mtimeMs ? { dir, mtimeMs: at2 } : best2;
21384
21388
  };
@@ -21387,11 +21391,11 @@ function discoverTranscriptDir(logDir, sessionId, memo3 = strandedLogDirs) {
21387
21391
  if (best) return best.dir;
21388
21392
  let entries2;
21389
21393
  try {
21390
- entries2 = readdirSync3(dirname8(logDir), { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
21394
+ entries2 = readdirSync3(dirname7(logDir), { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
21391
21395
  } catch {
21392
21396
  return void 0;
21393
21397
  }
21394
- for (const entry of entries2) best = better(best, join12(dirname8(logDir), entry));
21398
+ for (const entry of entries2) best = better(best, join11(dirname7(logDir), entry));
21395
21399
  if (!best) return void 0;
21396
21400
  memo3.add(best.dir);
21397
21401
  return best.dir;
@@ -21410,10 +21414,10 @@ var init_discover = __esm({
21410
21414
 
21411
21415
  // packages/server/src/session-files.ts
21412
21416
  import { lstatSync, rmSync as rmSync8 } from "node:fs";
21413
- import { join as join13 } from "node:path";
21417
+ import { join as join12 } from "node:path";
21414
21418
  function systemPromptPath(sessionId) {
21415
21419
  if (!SESSION_ID_RE.test(sessionId)) throw new Error("invalid session id");
21416
- return join13(SYSTEM_PROMPT_DIR, `${sessionId}.md`);
21420
+ return join12(SYSTEM_PROMPT_DIR, `${sessionId}.md`);
21417
21421
  }
21418
21422
  function isDirectDirectory(path3) {
21419
21423
  try {
@@ -21433,7 +21437,7 @@ function pathAbsent(path3) {
21433
21437
  }
21434
21438
  function unlinkDirectChild(parent, filename) {
21435
21439
  if (!isDirectDirectory(parent)) return pathAbsent(parent);
21436
- const child = join13(parent, filename);
21440
+ const child = join12(parent, filename);
21437
21441
  try {
21438
21442
  rmSync8(child, { force: true });
21439
21443
  } catch {
@@ -21443,12 +21447,12 @@ function unlinkDirectChild(parent, filename) {
21443
21447
  }
21444
21448
  function cleanupAdoptionSessionFiles(projectDir, sessionId) {
21445
21449
  if (!SESSION_ID_RE.test(sessionId)) return false;
21446
- const frizzDir = join13(projectDir, ".frizz");
21450
+ const frizzDir = join12(projectDir, ".frizz");
21447
21451
  let clean = true;
21448
21452
  if (isDirectDirectory(frizzDir)) {
21449
- const threads = join13(frizzDir, "threads");
21453
+ const threads = join12(frizzDir, "threads");
21450
21454
  if (isDirectDirectory(threads)) {
21451
- const child = join13(threads, sessionId);
21455
+ const child = join12(threads, sessionId);
21452
21456
  try {
21453
21457
  rmSync8(child, { recursive: true, force: true });
21454
21458
  } catch {
@@ -21700,10 +21704,10 @@ var init_adoption_recovery = __esm({
21700
21704
  });
21701
21705
 
21702
21706
  // packages/server/src/backend/codex-models.ts
21703
- import { join as join14 } from "node:path";
21707
+ import { join as join13 } from "node:path";
21704
21708
  import { readFileSync as readFileSync8 } from "node:fs";
21705
21709
  function cachePath(codexHome) {
21706
- return join14(codexHome, "models_cache.json");
21710
+ return join13(codexHome, "models_cache.json");
21707
21711
  }
21708
21712
  function toCodexModel(raw2) {
21709
21713
  if (!raw2 || typeof raw2 !== "object") return void 0;
@@ -22422,10 +22426,10 @@ var init_claude_agent_sdk_protocol = __esm({
22422
22426
  });
22423
22427
 
22424
22428
  // packages/server/src/backend/claude-broker-diagnostics.ts
22425
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync8, readFileSync as readFileSync9, renameSync as renameSync6, statSync as statSync6 } from "node:fs";
22426
- import { join as join15 } from "node:path";
22429
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync8, readFileSync as readFileSync9, renameSync as renameSync6, statSync as statSync5 } from "node:fs";
22430
+ import { join as join14 } from "node:path";
22427
22431
  function claudeBrokerDiagnosticLogPath(stateDir, sessionId) {
22428
- return join15(stateDir, "claude-broker", `${sessionId}.diagnostics.log`);
22432
+ return join14(stateDir, "claude-broker", `${sessionId}.diagnostics.log`);
22429
22433
  }
22430
22434
  function readClaudeBrokerExit(stateDir, sessionId, generation) {
22431
22435
  if (!generation) return null;
@@ -22526,10 +22530,10 @@ var init_daemon_tree = __esm({
22526
22530
  });
22527
22531
 
22528
22532
  // packages/server/src/backend/ipc-path.ts
22529
- import { join as join16 } from "node:path";
22533
+ import { join as join15 } from "node:path";
22530
22534
  function frizzIpcPath(name) {
22531
22535
  if (process.platform === "win32") return `\\\\.\\pipe\\${name}`;
22532
- return join16(process.env.TMPDIR ?? "/tmp", `${name}.sock`);
22536
+ return join15(process.env.TMPDIR ?? "/tmp", `${name}.sock`);
22533
22537
  }
22534
22538
  var init_ipc_path = __esm({
22535
22539
  "packages/server/src/backend/ipc-path.ts"() {
@@ -22541,7 +22545,7 @@ var init_ipc_path = __esm({
22541
22545
  import { spawn } from "node:child_process";
22542
22546
  import { createHash as createHash5, randomUUID as randomUUID8 } from "node:crypto";
22543
22547
  import { accessSync, constants as fsConstants, mkdirSync as mkdirSync9, readFileSync as readFileSync10, readdirSync as readdirSync4, unlinkSync, writeFileSync as writeFileSync7 } from "node:fs";
22544
- import { delimiter, dirname as dirname9, isAbsolute as isAbsolute3, join as join17 } from "node:path";
22548
+ import { delimiter, dirname as dirname8, isAbsolute as isAbsolute3, join as join16 } from "node:path";
22545
22549
  function windowsShimTarget(shimPath) {
22546
22550
  let body;
22547
22551
  try {
@@ -22551,7 +22555,7 @@ function windowsShimTarget(shimPath) {
22551
22555
  }
22552
22556
  const target = WINDOWS_SHIM_TARGET.exec(body)?.[1];
22553
22557
  if (!target) return void 0;
22554
- const full = join17(dirname9(shimPath), target);
22558
+ const full = join16(dirname8(shimPath), target);
22555
22559
  try {
22556
22560
  accessSync(full, fsConstants.F_OK);
22557
22561
  return full;
@@ -22572,17 +22576,17 @@ function resolveClaudeExecutableAbsolute(bin, env = process.env) {
22572
22576
  for (const dir of searchPath(env).split(delimiter)) {
22573
22577
  if (!dir) continue;
22574
22578
  if (windows) {
22575
- const exe = join17(dir, `${candidate}.exe`);
22579
+ const exe = join16(dir, `${candidate}.exe`);
22576
22580
  try {
22577
22581
  accessSync(exe, fsConstants.F_OK);
22578
22582
  return exe;
22579
22583
  } catch {
22580
22584
  }
22581
- const viaShim = windowsShimTarget(join17(dir, `${candidate}.cmd`));
22585
+ const viaShim = windowsShimTarget(join16(dir, `${candidate}.cmd`));
22582
22586
  if (viaShim) return viaShim;
22583
22587
  continue;
22584
22588
  }
22585
- const full = join17(dir, candidate);
22589
+ const full = join16(dir, candidate);
22586
22590
  try {
22587
22591
  accessSync(full, fsConstants.X_OK);
22588
22592
  return full;
@@ -22597,17 +22601,17 @@ function claudeBrokerSocketPath(stateDir, sessionId) {
22597
22601
  }
22598
22602
  function claudeBrokerRecordPath(stateDir, sessionId) {
22599
22603
  const key = createHash5("sha256").update(sessionId).digest("hex").slice(0, 16);
22600
- return join17(stateDir, "claude-broker", `${key}.json`);
22604
+ return join16(stateDir, "claude-broker", `${key}.json`);
22601
22605
  }
22602
22606
  function claudeBrokerRetirementPath(stateDir, sessionId) {
22603
22607
  const key = createHash5("sha256").update(sessionId).digest("hex").slice(0, 16);
22604
- return join17(stateDir, "claude-broker", `${key}.retired`);
22608
+ return join16(stateDir, "claude-broker", `${key}.retired`);
22605
22609
  }
22606
22610
  function markBrokerRetired(stateDir, sessionId, reason, generation) {
22607
22611
  const mark = { at: (/* @__PURE__ */ new Date()).toISOString(), generation, reason };
22608
22612
  try {
22609
22613
  const path3 = claudeBrokerRetirementPath(stateDir, sessionId);
22610
- mkdirSync9(dirname9(path3), { recursive: true });
22614
+ mkdirSync9(dirname8(path3), { recursive: true });
22611
22615
  writeFileSync7(path3, JSON.stringify(mark));
22612
22616
  } catch {
22613
22617
  }
@@ -22668,7 +22672,7 @@ function liveBrokerRecord(recordPath2) {
22668
22672
  return null;
22669
22673
  }
22670
22674
  function liveBrokerRecords(stateDir) {
22671
- const dir = join17(stateDir, "claude-broker");
22675
+ const dir = join16(stateDir, "claude-broker");
22672
22676
  let names;
22673
22677
  try {
22674
22678
  names = readdirSync4(dir);
@@ -22678,7 +22682,7 @@ function liveBrokerRecords(stateDir) {
22678
22682
  const out = [];
22679
22683
  for (const name of names) {
22680
22684
  if (!name.endsWith(".json")) continue;
22681
- const record = liveBrokerRecord(join17(dir, name));
22685
+ const record = liveBrokerRecord(join16(dir, name));
22682
22686
  if (record) out.push(record);
22683
22687
  }
22684
22688
  return out;
@@ -22686,7 +22690,7 @@ function liveBrokerRecords(stateDir) {
22686
22690
  function forkBroker(options) {
22687
22691
  const socketPath = claudeBrokerSocketPath(options.stateDir, options.sessionId);
22688
22692
  const recordPath2 = claudeBrokerRecordPath(options.stateDir, options.sessionId);
22689
- mkdirSync9(dirname9(recordPath2), { recursive: true });
22693
+ mkdirSync9(dirname8(recordPath2), { recursive: true });
22690
22694
  const generation = randomUUID8();
22691
22695
  const config = {
22692
22696
  socketPath,
@@ -23198,7 +23202,7 @@ var init_delivery_ledger = __esm({
23198
23202
  });
23199
23203
 
23200
23204
  // packages/server/src/codex-subagents.ts
23201
- import { closeSync as closeSync7, openSync as openSync8, readSync as readSync2, statSync as statSync7 } from "node:fs";
23205
+ import { closeSync as closeSync7, openSync as openSync8, readSync as readSync2, statSync as statSync6 } from "node:fs";
23202
23206
  function createCodexSubAgentTracker(deps) {
23203
23207
  const findRollouts = deps.findRollouts ?? ((ids) => findRolloutsByIds(ids, deps.codexHome));
23204
23208
  const readAppended = deps.readAppended ?? defaultReadAppended;
@@ -23390,7 +23394,7 @@ function agentLabel(path3) {
23390
23394
  function defaultReadAppended(path3, offset) {
23391
23395
  let size;
23392
23396
  try {
23393
- size = statSync7(path3).size;
23397
+ size = statSync6(path3).size;
23394
23398
  } catch {
23395
23399
  return void 0;
23396
23400
  }
@@ -23532,15 +23536,15 @@ var init_completion_relay = __esm({
23532
23536
 
23533
23537
  // packages/server/src/tail-cache.ts
23534
23538
  import { createHash as createHash6 } from "node:crypto";
23535
- import { closeSync as closeSync8, openSync as openSync9, readFileSync as readFileSync11, readSync as readSync3, statSync as statSync8 } from "node:fs";
23536
- import { join as join18 } from "node:path";
23539
+ import { closeSync as closeSync8, openSync as openSync9, readFileSync as readFileSync11, readSync as readSync3, statSync as statSync7 } from "node:fs";
23540
+ import { join as join17 } from "node:path";
23537
23541
  function foldSchemaDigest(dir = import.meta.dirname) {
23538
23542
  if (foldSchemaMemo) return foldSchemaMemo;
23539
23543
  const hash = createHash6("sha256").update("frizz-tail-state-v1\0");
23540
23544
  let read = 0;
23541
23545
  for (const name of FOLD_SOURCES) {
23542
23546
  try {
23543
- hash.update(name).update("\0").update(readFileSync11(join18(dir, name)));
23547
+ hash.update(name).update("\0").update(readFileSync11(join17(dir, name)));
23544
23548
  read++;
23545
23549
  } catch {
23546
23550
  hash.update(name).update("\0missing\0");
@@ -23570,7 +23574,7 @@ function measureFence(path3, offset) {
23570
23574
  if (!Number.isSafeInteger(offset) || offset <= 0) return null;
23571
23575
  let fd2;
23572
23576
  try {
23573
- const stat2 = statSync8(path3);
23577
+ const stat2 = statSync7(path3);
23574
23578
  if (stat2.size < offset) return null;
23575
23579
  fd2 = openSync9(path3, "r");
23576
23580
  const window = Math.min(SAMPLE_BYTES, offset);
@@ -23743,10 +23747,10 @@ var init_tail_cache = __esm({
23743
23747
  });
23744
23748
 
23745
23749
  // packages/server/src/tailer.ts
23746
- import { statSync as statSync9, openSync as openSync10, readSync as readSync4, closeSync as closeSync9, readdirSync as readdirSync5, realpathSync as realpathSync5, mkdirSync as mkdirSync10, writeFileSync as writeFileSync8, readFileSync as readFileSync12, existsSync as existsSync5 } from "node:fs";
23750
+ import { statSync as statSync8, openSync as openSync10, readSync as readSync4, closeSync as closeSync9, readdirSync as readdirSync5, realpathSync as realpathSync5, mkdirSync as mkdirSync10, writeFileSync as writeFileSync8, readFileSync as readFileSync12, existsSync as existsSync5 } from "node:fs";
23747
23751
  import { execFile as execFile2 } from "node:child_process";
23748
23752
  import { promisify as promisify2 } from "node:util";
23749
- import { basename as basename4, join as join19, win32 } from "node:path";
23753
+ import { basename as basename4, join as join18, win32 } from "node:path";
23750
23754
  import { homedir as homedir7 } from "node:os";
23751
23755
  async function probeShellsAlive(outputFiles, opts = {}) {
23752
23756
  const platform3 = opts.platform ?? process.platform;
@@ -23922,6 +23926,9 @@ function isRealUserMessage(content) {
23922
23926
  if (!Array.isArray(content)) return false;
23923
23927
  return content.some((b) => !(b && typeof b === "object" && b.type === "tool_result"));
23924
23928
  }
23929
+ function isLocalCommandReceipt(content) {
23930
+ return LOCAL_COMMAND_RECEIPT.test(userMessageText(content).trim());
23931
+ }
23925
23932
  function isHumanSpeaking(rec, text2, system, compactSummary) {
23926
23933
  if (system || compactSummary) return false;
23927
23934
  if (!isRealUserMessage(rec.message?.content)) return false;
@@ -24067,7 +24074,7 @@ function launchTaskId(text2) {
24067
24074
  function readDescendantSidecars(sessionDir, mtimeMs) {
24068
24075
  let names;
24069
24076
  try {
24070
- names = readdirSync5(join19(sessionDir, "subagents"));
24077
+ names = readdirSync5(join18(sessionDir, "subagents"));
24071
24078
  } catch {
24072
24079
  return [];
24073
24080
  }
@@ -24078,7 +24085,7 @@ function readDescendantSidecars(sessionDir, mtimeMs) {
24078
24085
  if (!agentId) continue;
24079
24086
  let parsed;
24080
24087
  try {
24081
- parsed = JSON.parse(readFileSync12(join19(sessionDir, "subagents", name), "utf8"));
24088
+ parsed = JSON.parse(readFileSync12(join18(sessionDir, "subagents", name), "utf8"));
24082
24089
  } catch {
24083
24090
  continue;
24084
24091
  }
@@ -24092,7 +24099,7 @@ function readDescendantSidecars(sessionDir, mtimeMs) {
24092
24099
  agentType: text2(meta.agentType),
24093
24100
  parentAgentId: text2(meta.parentAgentId),
24094
24101
  spawnDepth: typeof meta.spawnDepth === "number" && Number.isFinite(meta.spawnDepth) ? meta.spawnDepth : void 0,
24095
- spawnedAtMs: mtimeMs(join19(sessionDir, "subagents", name))
24102
+ spawnedAtMs: mtimeMs(join18(sessionDir, "subagents", name))
24096
24103
  });
24097
24104
  }
24098
24105
  return out;
@@ -24356,6 +24363,7 @@ function applyRecord(state, rec) {
24356
24363
  state.sawRecords = true;
24357
24364
  state.lastKind = "assistant";
24358
24365
  state.interrupted = void 0;
24366
+ state.localCommandDone = void 0;
24359
24367
  if (typeof rec.timestamp === "string") state.lastAssistantAt = rec.timestamp;
24360
24368
  state.lastStopReason = typeof rec.message?.stop_reason === "string" ? rec.message.stop_reason : void 0;
24361
24369
  const observedModel = typeof rec.message?.model === "string" ? rec.message.model.trim() : "";
@@ -24411,6 +24419,7 @@ function applyRecord(state, rec) {
24411
24419
  state.lastStopReason = void 0;
24412
24420
  const userText2 = lastTextBlock(rec.message?.content) ?? "";
24413
24421
  state.interrupted = isInterruptMarker(userText2) || void 0;
24422
+ state.localCommandDone = isLocalCommandReceipt(rec.message?.content) || void 0;
24414
24423
  state.lastAssistantAllDone = false;
24415
24424
  state.lastFence = void 0;
24416
24425
  const humanSpoke = isHumanSpeaking(rec, userText2, systemUserRec, compactSummaryRec);
@@ -24540,7 +24549,7 @@ function computeTurn(state, nowMs) {
24540
24549
  return "in-flight";
24541
24550
  }
24542
24551
  if (state.lastKind === void 0) return state.turn;
24543
- if (state.interrupted) {
24552
+ if (state.interrupted || state.localCommandDone) {
24544
24553
  const at2 = state.lastActivityAt ? Date.parse(state.lastActivityAt) : NaN;
24545
24554
  if (Number.isFinite(at2) && nowMs - at2 > IDLE_BACKSTOP_MS) return "idle";
24546
24555
  }
@@ -24561,13 +24570,13 @@ function isPermMarker(v) {
24561
24570
  }
24562
24571
  function defaultMtimeMs(path3) {
24563
24572
  try {
24564
- return statSync9(path3).mtimeMs;
24573
+ return statSync8(path3).mtimeMs;
24565
24574
  } catch {
24566
24575
  return void 0;
24567
24576
  }
24568
24577
  }
24569
24578
  function defaultLogDir(project) {
24570
- return join19(homedir7(), ".claude", "projects", project.cwdSlug);
24579
+ return join18(homedir7(), ".claude", "projects", project.cwdSlug);
24571
24580
  }
24572
24581
  function defaultReadPermMarker(project) {
24573
24582
  if (!project.stateDir) return () => void 0;
@@ -24699,7 +24708,7 @@ function createTailer(deps) {
24699
24708
  return paneDead(row.slug);
24700
24709
  }
24701
24710
  const defaultBackend = {
24702
- transcriptPath: (sessionId) => join19(logDir, `${sessionId}.jsonl`),
24711
+ transcriptPath: (sessionId) => join18(logDir, `${sessionId}.jsonl`),
24703
24712
  foldLine: (state, line) => {
24704
24713
  const rec = parseLine(line);
24705
24714
  if (rec) applyRecord(state, rec);
@@ -24839,7 +24848,7 @@ ${ask}`;
24839
24848
  return state.path.replace(/\.jsonl$/, "");
24840
24849
  }
24841
24850
  function descendantSidecars(state) {
24842
- const at2 = mtimeMs(join19(sessionDirOf(state), "subagents"));
24851
+ const at2 = mtimeMs(join18(sessionDirOf(state), "subagents"));
24843
24852
  const cached2 = descendantIndex.get(state.slug);
24844
24853
  if (cached2 && cached2.at === at2) return cached2.all;
24845
24854
  const all = readDescendantSidecars(sessionDirOf(state), mtimeMs);
@@ -24853,7 +24862,7 @@ ${ask}`;
24853
24862
  return descendantIndex.get(state.slug)?.byToolUse.get(id2);
24854
24863
  }
24855
24864
  function descendantTranscript(state, meta) {
24856
- return join19(sessionDirOf(state), "subagents", `agent-${meta.agentId}.jsonl`);
24865
+ return join18(sessionDirOf(state), "subagents", `agent-${meta.agentId}.jsonl`);
24857
24866
  }
24858
24867
  function subAgentDescendantTasks(slug, id2) {
24859
24868
  const state = states.get(slug);
@@ -25199,10 +25208,10 @@ ${ask}`;
25199
25208
  if (name.startsWith(".") || !name.endsWith(".jsonl")) continue;
25200
25209
  const id2 = name.slice(0, -".jsonl".length);
25201
25210
  if (!id2 || registered.has(id2)) continue;
25202
- const path3 = join19(logDir, name);
25211
+ const path3 = join18(logDir, name);
25203
25212
  let mtime;
25204
25213
  try {
25205
- mtime = statSync9(path3).mtimeMs;
25214
+ mtime = statSync8(path3).mtimeMs;
25206
25215
  } catch {
25207
25216
  continue;
25208
25217
  }
@@ -25355,7 +25364,7 @@ ${ask}`;
25355
25364
  if (entry.path !== state.path) {
25356
25365
  let derivedSize = 0;
25357
25366
  try {
25358
- derivedSize = statSync9(state.path).size;
25367
+ derivedSize = statSync8(state.path).size;
25359
25368
  } catch {
25360
25369
  derivedSize = 0;
25361
25370
  }
@@ -25412,7 +25421,7 @@ ${ask}`;
25412
25421
  function consume(state, backend, onLine) {
25413
25422
  let size;
25414
25423
  try {
25415
- size = statSync9(state.path).size;
25424
+ size = statSync8(state.path).size;
25416
25425
  } catch {
25417
25426
  return;
25418
25427
  }
@@ -25471,7 +25480,7 @@ ${ask}`;
25471
25480
  );
25472
25481
  try {
25473
25482
  mkdirSync10(stallLogDir, { recursive: true });
25474
- writeFileSync8(join19(stallLogDir, `${row.slug}.stall.log`), `session_id: ${row.session_id}
25483
+ writeFileSync8(join18(stallLogDir, `${row.slug}.stall.log`), `session_id: ${row.session_id}
25475
25484
  captured_at: ${new Date(now()).toISOString()}
25476
25485
 
25477
25486
  ${detail2}
@@ -25481,10 +25490,10 @@ ${detail2}
25481
25490
  }
25482
25491
  function relocatedTranscript(state) {
25483
25492
  const name = `${state.nativeSessionId}.jsonl`;
25484
- const home = join19(logDir, name);
25493
+ const home = join18(logDir, name);
25485
25494
  const homeAt = home === state.path ? void 0 : mtimeOfNonEmpty(home);
25486
25495
  const dir = discoverTranscriptDir(logDir, state.nativeSessionId);
25487
- const sibling = dir ? join19(dir, name) : void 0;
25496
+ const sibling = dir ? join18(dir, name) : void 0;
25488
25497
  const siblingAt = sibling && sibling !== state.path ? mtimeOfNonEmpty(sibling) : void 0;
25489
25498
  if (homeAt === void 0) return siblingAt === void 0 ? void 0 : sibling;
25490
25499
  if (siblingAt === void 0) return home;
@@ -25519,7 +25528,7 @@ ${detail2}
25519
25528
  }
25520
25529
  let size = 0;
25521
25530
  try {
25522
- size = statSync9(state.path).size;
25531
+ size = statSync8(state.path).size;
25523
25532
  } catch {
25524
25533
  size = 0;
25525
25534
  }
@@ -25536,7 +25545,7 @@ ${detail2}
25536
25545
  state.nextDiscoverMs = nowMs + DISCOVER_RETRY_MS;
25537
25546
  const strandedDir = discoverTranscriptDir(logDir, row.session_id);
25538
25547
  if (strandedDir) {
25539
- state.path = join19(strandedDir, `${row.session_id}.jsonl`);
25548
+ state.path = join18(strandedDir, `${row.session_id}.jsonl`);
25540
25549
  state.offset = 0;
25541
25550
  state.partial = "";
25542
25551
  state.primed = false;
@@ -25560,7 +25569,7 @@ ${detail2}
25560
25569
  committed = false;
25561
25570
  }
25562
25571
  if (!committed) return false;
25563
- state.path = join19(logDir, `${found}.jsonl`);
25572
+ state.path = join18(logDir, `${found}.jsonl`);
25564
25573
  state.offset = 0;
25565
25574
  state.partial = "";
25566
25575
  state.primed = false;
@@ -25620,7 +25629,7 @@ ${detail2}
25620
25629
  continue;
25621
25630
  }
25622
25631
  if (!state) {
25623
- const path3 = backend.transcriptPath(nativeId) ?? join19(logDir, `${nativeId}.jsonl`);
25632
+ const path3 = backend.transcriptPath(nativeId) ?? join18(logDir, `${nativeId}.jsonl`);
25624
25633
  state = newTailState(row.slug, row.session_id, path3, false, nativeId, runtimeGeneration);
25625
25634
  state.dismissedOps = deps.storage.retiredOps(row.slug, row.session_id);
25626
25635
  hydrateFromCache(state, row, nativeId);
@@ -25976,7 +25985,7 @@ function landsAfterRead(eventAt, lastReadAt) {
25976
25985
  if (!Number.isFinite(e) || !Number.isFinite(r)) return true;
25977
25986
  return e > r;
25978
25987
  }
25979
- var IDLE_BACKSTOP_MS, RUNTIME_CHASE_MAX, POLL_MS2, MAX_PRIME_ROWS_PER_TICK, PRIME_BUDGET_MS, TRANSCRIPT_READ_WINDOW, EMPTY_BUFFER, MAX_POLL_MS, SUBAGENT_STALE_MS, SHELL_PROBE_TTL_MS, SHELL_PROBE_GRACE_MS, execFileAsync, FOREIGN_FRESH_MS, FOREIGN_MAX, FOREIGN_SCAN_EVERY, CACHE_FLUSH_MS, PRIME_PROGRESS_EVERY, DISCOVER_RETRY_MS, DISCOVER_RETRY_MAX_MS, RETAINED_SUBAGENTS_MAX, RETAINED_SHELLS_MAX, DESCENDANT_TERMINALS_MAX, PENDING_RESUMES_MAX, PENDING_SHELLS_MAX, RESUME_REPLAY_SLACK_MS, FIRST_USER_TEXT_MAX, QUESTION_BLOCK_RE, SIGNAL_FENCE_RE, FENCE_BODY_MAX, LAUNCH_ACK_RE, AUTO_BACKGROUND_ACK_RE, DESCENDANT_SIDECAR_MAX, DESCENDANT_NOTIFY_GRACE_MS, MAX_OWNED_TOOL_USE_IDS, BROKER_LIVENESS_TTL_MS, UNRESTORED_TAIL_FIELDS;
25988
+ var IDLE_BACKSTOP_MS, RUNTIME_CHASE_MAX, POLL_MS2, MAX_PRIME_ROWS_PER_TICK, PRIME_BUDGET_MS, TRANSCRIPT_READ_WINDOW, EMPTY_BUFFER, MAX_POLL_MS, SUBAGENT_STALE_MS, SHELL_PROBE_TTL_MS, SHELL_PROBE_GRACE_MS, execFileAsync, FOREIGN_FRESH_MS, FOREIGN_MAX, FOREIGN_SCAN_EVERY, CACHE_FLUSH_MS, PRIME_PROGRESS_EVERY, DISCOVER_RETRY_MS, DISCOVER_RETRY_MAX_MS, RETAINED_SUBAGENTS_MAX, RETAINED_SHELLS_MAX, DESCENDANT_TERMINALS_MAX, PENDING_RESUMES_MAX, PENDING_SHELLS_MAX, RESUME_REPLAY_SLACK_MS, FIRST_USER_TEXT_MAX, QUESTION_BLOCK_RE, SIGNAL_FENCE_RE, FENCE_BODY_MAX, LOCAL_COMMAND_RECEIPT, LAUNCH_ACK_RE, AUTO_BACKGROUND_ACK_RE, DESCENDANT_SIDECAR_MAX, DESCENDANT_NOTIFY_GRACE_MS, MAX_OWNED_TOOL_USE_IDS, BROKER_LIVENESS_TTL_MS, UNRESTORED_TAIL_FIELDS;
25980
25989
  var init_tailer = __esm({
25981
25990
  "packages/server/src/tailer.ts"() {
25982
25991
  "use strict";
@@ -26027,6 +26036,7 @@ var init_tailer = __esm({
26027
26036
  QUESTION_BLOCK_RE = /^```question(?:[ \t]+[A-Za-z][^\r\n]*?)?[ \t]*\r?\n[\s\S]*?\r?\n```[ \t]*$/gm;
26028
26037
  SIGNAL_FENCE_RE = /^```(done|awaiting)[ \t]*\n([\s\S]*?)\n```[ \t]*$/gm;
26029
26038
  FENCE_BODY_MAX = 500;
26039
+ LOCAL_COMMAND_RECEIPT = /^<local-command-(stdout|stderr)>[\s\S]*<\/local-command-\1>$/;
26030
26040
  LAUNCH_ACK_RE = /^\s*(Async agent launched successfully|Spawned successfully|Command running in background|Monitor started|Command did not complete within its)/;
26031
26041
  AUTO_BACKGROUND_ACK_RE = /^\s*Command did not complete within its .{0,40}?and was moved to the background/;
26032
26042
  DESCENDANT_SIDECAR_MAX = 512;
@@ -26078,14 +26088,14 @@ var init_tailer = __esm({
26078
26088
  });
26079
26089
 
26080
26090
  // packages/server/src/backend/codex.ts
26081
- import { join as join20 } from "node:path";
26091
+ import { join as join19 } from "node:path";
26082
26092
  import { homedir as homedir8 } from "node:os";
26083
- import { readdirSync as readdirSync6, statSync as statSync10, readFileSync as readFileSync13, openSync as openSync11, readSync as readSync5, closeSync as closeSync10 } from "node:fs";
26093
+ import { readdirSync as readdirSync6, statSync as statSync9, readFileSync as readFileSync13, openSync as openSync11, readSync as readSync5, closeSync as closeSync10 } from "node:fs";
26084
26094
  function defaultCodexHome() {
26085
- return process.env.CODEX_HOME && process.env.CODEX_HOME.trim() ? process.env.CODEX_HOME : join20(homedir8(), ".codex");
26095
+ return process.env.CODEX_HOME && process.env.CODEX_HOME.trim() ? process.env.CODEX_HOME : join19(homedir8(), ".codex");
26086
26096
  }
26087
26097
  function sessionsDir(codexHome) {
26088
- return join20(codexHome, "sessions");
26098
+ return join19(codexHome, "sessions");
26089
26099
  }
26090
26100
  function codexSandbox(mode) {
26091
26101
  switch (mode) {
@@ -26531,17 +26541,17 @@ function collectRollouts(dir, out, budget) {
26531
26541
  const files = entries2.filter((e) => e.isFile() && e.name.startsWith("rollout-") && e.name.endsWith(".jsonl")).sort(descByName);
26532
26542
  for (const d of dirs) {
26533
26543
  if (budget.n <= 0) return;
26534
- collectRollouts(join20(dir, d.name), out, budget);
26544
+ collectRollouts(join19(dir, d.name), out, budget);
26535
26545
  }
26536
26546
  for (const f of files) {
26537
26547
  if (budget.n <= 0) return;
26538
26548
  let mtimeMs;
26539
26549
  try {
26540
- mtimeMs = statSync10(join20(dir, f.name)).mtimeMs;
26550
+ mtimeMs = statSync9(join19(dir, f.name)).mtimeMs;
26541
26551
  } catch {
26542
26552
  continue;
26543
26553
  }
26544
- out.push({ path: join20(dir, f.name), mtimeMs });
26554
+ out.push({ path: join19(dir, f.name), mtimeMs });
26545
26555
  budget.n--;
26546
26556
  }
26547
26557
  }
@@ -26585,8 +26595,8 @@ function readCodexThreadNames(codexHome = defaultCodexHome()) {
26585
26595
  const out = /* @__PURE__ */ new Map();
26586
26596
  let raw2;
26587
26597
  try {
26588
- const path3 = join20(codexHome, "session_index.jsonl");
26589
- if (statSync10(path3).size > SESSION_INDEX_MAX_BYTES) return out;
26598
+ const path3 = join19(codexHome, "session_index.jsonl");
26599
+ if (statSync9(path3).size > SESSION_INDEX_MAX_BYTES) return out;
26590
26600
  raw2 = readFileSync13(path3, "utf8");
26591
26601
  } catch {
26592
26602
  return out;
@@ -26789,19 +26799,19 @@ function searchPath2(env) {
26789
26799
  function vendoredNativeBeside(launcherJs, arch, access) {
26790
26800
  const triple = WINDOWS_TRIPLE[arch];
26791
26801
  if (!triple) return void 0;
26792
- const { dirname: dirname28, join: join51 } = win322;
26793
- const pkgRoot = dirname28(dirname28(launcherJs));
26802
+ const { dirname: dirname27, join: join50 } = win322;
26803
+ const pkgRoot = dirname27(dirname27(launcherJs));
26794
26804
  const platformPkg = `codex-win32-${arch}`;
26795
26805
  const vendorRoots = [
26796
- join51(pkgRoot, "node_modules", "@openai", platformPkg, "vendor"),
26806
+ join50(pkgRoot, "node_modules", "@openai", platformPkg, "vendor"),
26797
26807
  // nested under the package
26798
- join51(dirname28(pkgRoot), platformPkg, "vendor"),
26808
+ join50(dirname27(pkgRoot), platformPkg, "vendor"),
26799
26809
  // hoisted beside it: <prefix>\node_modules\@openai\<pkg>
26800
- join51(pkgRoot, "vendor")
26810
+ join50(pkgRoot, "vendor")
26801
26811
  // the pre-platform-package layout, binaries inside @openai/codex itself
26802
26812
  ];
26803
26813
  for (const root of vendorRoots) {
26804
- const exe = join51(root, triple, "bin", "codex.exe");
26814
+ const exe = join50(root, triple, "bin", "codex.exe");
26805
26815
  if (access(exe, "exists")) return exe;
26806
26816
  }
26807
26817
  return void 0;
@@ -29125,7 +29135,7 @@ var require_websocket = __commonJS({
29125
29135
  var http = __require("http");
29126
29136
  var net2 = __require("net");
29127
29137
  var tls = __require("tls");
29128
- var { randomBytes: randomBytes2, createHash: createHash17 } = __require("crypto");
29138
+ var { randomBytes, createHash: createHash17 } = __require("crypto");
29129
29139
  var { Duplex, Readable: Readable2 } = __require("stream");
29130
29140
  var { URL: URL2 } = __require("url");
29131
29141
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -29663,7 +29673,7 @@ var require_websocket = __commonJS({
29663
29673
  }
29664
29674
  }
29665
29675
  const defaultPort = isSecure ? 443 : 80;
29666
- const key = randomBytes2(16).toString("base64");
29676
+ const key = randomBytes(16).toString("base64");
29667
29677
  const request = isSecure ? https.request : http.request;
29668
29678
  const protocolSet = /* @__PURE__ */ new Set();
29669
29679
  let perMessageDeflate;
@@ -30702,14 +30712,14 @@ import { connect } from "node:net";
30702
30712
  import { Agent as HttpAgent } from "node:http";
30703
30713
  import { createHash as createHash7, randomUUID as randomUUID9 } from "node:crypto";
30704
30714
  import { existsSync as existsSync6, mkdirSync as mkdirSync11, readFileSync as readFileSync15, unlinkSync as unlinkSync2, writeFileSync as writeFileSync9 } from "node:fs";
30705
- import { join as join21 } from "node:path";
30715
+ import { join as join20 } from "node:path";
30706
30716
  import { PassThrough, Writable } from "node:stream";
30707
30717
  import { StringDecoder } from "node:string_decoder";
30708
30718
  function nativeDir(stateDir) {
30709
- return join21(stateDir, "codex-app-server-native");
30719
+ return join20(stateDir, "codex-app-server-native");
30710
30720
  }
30711
30721
  function nativeRecordPath(stateDir, projectId) {
30712
- return join21(nativeDir(stateDir), `${projectId}.json`);
30722
+ return join20(nativeDir(stateDir), `${projectId}.json`);
30713
30723
  }
30714
30724
  function nativeListenSocketPath(stateDir, projectId) {
30715
30725
  const key = createHash7("sha256").update(stateDir).update("\0").update(projectId).digest("hex").slice(0, 16);
@@ -30982,14 +30992,14 @@ import { spawn as spawn3 } from "node:child_process";
30982
30992
  import { createConnection } from "node:net";
30983
30993
  import { createHash as createHash8, randomUUID as randomUUID10 } from "node:crypto";
30984
30994
  import { existsSync as existsSync7, mkdirSync as mkdirSync12, readFileSync as readFileSync16, unlinkSync as unlinkSync3 } from "node:fs";
30985
- import { join as join22 } from "node:path";
30995
+ import { join as join21 } from "node:path";
30986
30996
  import { PassThrough as PassThrough2, Writable as Writable2 } from "node:stream";
30987
30997
  import { StringDecoder as StringDecoder2 } from "node:string_decoder";
30988
30998
  function daemonDir(stateDir) {
30989
- return join22(stateDir, "codex-app-server");
30999
+ return join21(stateDir, "codex-app-server");
30990
31000
  }
30991
31001
  function recordPath(stateDir, projectId) {
30992
- return join22(daemonDir(stateDir), `${projectId}.json`);
31002
+ return join21(daemonDir(stateDir), `${projectId}.json`);
30993
31003
  }
30994
31004
  function codexAppServerSocketPath(stateDir, projectId) {
30995
31005
  const key = createHash8("sha256").update(stateDir).update("\0").update(projectId).digest("hex").slice(0, 16);
@@ -31287,7 +31297,7 @@ var init_codex_app_server_host = __esm({
31287
31297
  });
31288
31298
 
31289
31299
  // packages/server/src/backend/claude-quota.ts
31290
- import { join as join23 } from "node:path";
31300
+ import { join as join22 } from "node:path";
31291
31301
  import { homedir as homedir9, platform } from "node:os";
31292
31302
  import { createHash as createHash9 } from "node:crypto";
31293
31303
  import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
@@ -31295,7 +31305,7 @@ import { execFile as execFile3 } from "node:child_process";
31295
31305
  import { promisify as promisify3 } from "node:util";
31296
31306
  function claudeConfigDir() {
31297
31307
  const override = process.env.CLAUDE_CONFIG_DIR;
31298
- return override && override.trim() ? override : join23(homedir9(), ".claude");
31308
+ return override && override.trim() ? override : join22(homedir9(), ".claude");
31299
31309
  }
31300
31310
  function tokenFromCredentialsJson(raw2) {
31301
31311
  let doc;
@@ -31324,7 +31334,7 @@ async function readKeychainToken() {
31324
31334
  }
31325
31335
  async function readAccessToken(configDir) {
31326
31336
  try {
31327
- const fromFile = tokenFromCredentialsJson(await readFile(join23(configDir, ".credentials.json"), "utf8"));
31337
+ const fromFile = tokenFromCredentialsJson(await readFile(join22(configDir, ".credentials.json"), "utf8"));
31328
31338
  if (fromFile) return fromFile;
31329
31339
  } catch {
31330
31340
  }
@@ -31398,8 +31408,8 @@ function retryAtFrom(res, now) {
31398
31408
  function cachePaths(cacheDir, configDir) {
31399
31409
  const profile = createHash9("sha256").update(configDir).digest("hex").slice(0, 12);
31400
31410
  return {
31401
- data: join23(cacheDir, `claude-${profile}.json`),
31402
- lock: join23(cacheDir, `claude-${profile}.lock`)
31411
+ data: join22(cacheDir, `claude-${profile}.json`),
31412
+ lock: join22(cacheDir, `claude-${profile}.lock`)
31403
31413
  };
31404
31414
  }
31405
31415
  async function readShared(path3) {
@@ -31611,7 +31621,7 @@ function refreshSharedInBackground(paths, claudeBin, deps, now) {
31611
31621
  async function refreshClaudeQuotaInBackground(claudeBin = "claude", deps = {}) {
31612
31622
  const now = (deps.now ?? Date.now)();
31613
31623
  const configDir = claudeConfigDir();
31614
- const cacheDir = deps.cacheDir ?? join23(frizzRoots().cache, "quota-cache");
31624
+ const cacheDir = deps.cacheDir ?? join22(frizzRoots().cache, "quota-cache");
31615
31625
  try {
31616
31626
  await mkdir(cacheDir, { recursive: true, mode: 448 });
31617
31627
  } catch {
@@ -31625,7 +31635,7 @@ async function refreshClaudeQuotaInBackground(claudeBin = "claude", deps = {}) {
31625
31635
  async function readClaudeQuota(claudeBin = "claude", deps = {}, options = {}) {
31626
31636
  const now = (deps.now ?? Date.now)();
31627
31637
  const configDir = claudeConfigDir();
31628
- const cacheDir = deps.cacheDir ?? join23(frizzRoots().cache, "quota-cache");
31638
+ const cacheDir = deps.cacheDir ?? join22(frizzRoots().cache, "quota-cache");
31629
31639
  const paths = cachePaths(cacheDir, configDir);
31630
31640
  try {
31631
31641
  await mkdir(cacheDir, { recursive: true, mode: 448 });
@@ -31732,19 +31742,19 @@ var init_claude_quota = __esm({
31732
31742
  });
31733
31743
 
31734
31744
  // packages/server/src/backend/auth-status.ts
31735
- import { join as join24 } from "node:path";
31745
+ import { join as join23 } from "node:path";
31736
31746
  import { homedir as homedir10, platform as platform2 } from "node:os";
31737
- import { readFileSync as readFileSync17, statSync as statSync11 } from "node:fs";
31747
+ import { readFileSync as readFileSync17, statSync as statSync10 } from "node:fs";
31738
31748
  import { execFile as execFile4 } from "node:child_process";
31739
31749
  import { promisify as promisify4 } from "node:util";
31740
31750
  function claudeConfigDir2() {
31741
31751
  const override = process.env.CLAUDE_CONFIG_DIR;
31742
- return override && override.trim() ? override : join24(homedir10(), ".claude");
31752
+ return override && override.trim() ? override : join23(homedir10(), ".claude");
31743
31753
  }
31744
31754
  function claudeFileState(configDir) {
31745
31755
  let raw2;
31746
31756
  try {
31747
- raw2 = readFileSync17(join24(configDir, ".credentials.json"), "utf8");
31757
+ raw2 = readFileSync17(join23(configDir, ".credentials.json"), "utf8");
31748
31758
  } catch (err) {
31749
31759
  return err.code === "ENOENT" ? "absent" : "error";
31750
31760
  }
@@ -31777,7 +31787,7 @@ function readCodexAuthState(codexHome = defaultCodexHome()) {
31777
31787
  if (process.env.OPENAI_API_KEY || process.env.CODEX_API_KEY || process.env.CODEX_ACCESS_TOKEN) return "authed";
31778
31788
  let raw2;
31779
31789
  try {
31780
- raw2 = readFileSync17(join24(codexHome, "auth.json"), "utf8");
31790
+ raw2 = readFileSync17(join23(codexHome, "auth.json"), "utf8");
31781
31791
  } catch (err) {
31782
31792
  return err.code === "ENOENT" ? "signed-out" : "unknown";
31783
31793
  }
@@ -31797,7 +31807,7 @@ function readCodexAuthState(codexHome = defaultCodexHome()) {
31797
31807
  function readCodexAccountId(codexHome = defaultCodexHome()) {
31798
31808
  if (process.env.OPENAI_API_KEY || process.env.CODEX_API_KEY || process.env.CODEX_ACCESS_TOKEN) return void 0;
31799
31809
  try {
31800
- const doc = JSON.parse(readFileSync17(join24(codexHome, "auth.json"), "utf8"));
31810
+ const doc = JSON.parse(readFileSync17(join23(codexHome, "auth.json"), "utf8"));
31801
31811
  if (!doc || typeof doc !== "object") return void 0;
31802
31812
  const tokens = doc.tokens;
31803
31813
  if (!tokens || typeof tokens !== "object") return void 0;
@@ -31856,12 +31866,12 @@ function asEmail(value) {
31856
31866
  }
31857
31867
  function claudeAccountFile() {
31858
31868
  const override = process.env.CLAUDE_CONFIG_DIR;
31859
- return override && override.trim() ? join24(override, ".claude.json") : join24(homedir10(), ".claude.json");
31869
+ return override && override.trim() ? join23(override, ".claude.json") : join23(homedir10(), ".claude.json");
31860
31870
  }
31861
31871
  function readClaudeAccountEmail(path3 = claudeAccountFile()) {
31862
31872
  let stat2;
31863
31873
  try {
31864
- stat2 = statSync11(path3);
31874
+ stat2 = statSync10(path3);
31865
31875
  } catch {
31866
31876
  return void 0;
31867
31877
  }
@@ -31880,7 +31890,7 @@ function readClaudeAccountEmail(path3 = claudeAccountFile()) {
31880
31890
  function readCodexAccountEmail(codexHome = defaultCodexHome()) {
31881
31891
  let doc;
31882
31892
  try {
31883
- doc = JSON.parse(readFileSync17(join24(codexHome, "auth.json"), "utf8"));
31893
+ doc = JSON.parse(readFileSync17(join23(codexHome, "auth.json"), "utf8"));
31884
31894
  } catch {
31885
31895
  return void 0;
31886
31896
  }
@@ -32671,11 +32681,11 @@ var init_codex_app_server = __esm({
32671
32681
  init_logging();
32672
32682
  CODEX_APP_SERVER_PROVIDER = "codex-app-server";
32673
32683
  CODEX_NATIVE_LISTEN_FLAG = "FRIZZ_CODEX_NATIVE_LISTEN";
32674
- CODEX_APP_SERVER_SUPPORTED_VERSION = "0.156.1";
32684
+ CODEX_APP_SERVER_SUPPORTED_VERSION = "0.157.0";
32675
32685
  CODEX_APP_SERVER_PROTOCOL_REVISION = Object.freeze({
32676
32686
  packageVersion: CODEX_APP_SERVER_SUPPORTED_VERSION,
32677
- sourceTag: "rust-v0.156.1",
32678
- sourceCommit: "b412ff32c417f855c2b2d1581b77058eed87c84b"
32687
+ sourceTag: "rust-v0.157.0",
32688
+ sourceCommit: "00c972ed5d6ff6499317fd41b7f23605b8e6850d"
32679
32689
  });
32680
32690
  PROTOCOL_FINGERPRINT = [
32681
32691
  CODEX_APP_SERVER_PROTOCOL_REVISION.sourceTag,
@@ -35169,11 +35179,11 @@ var init_codex_app_server = __esm({
35169
35179
  });
35170
35180
 
35171
35181
  // packages/server/src/backend/codex-quota.ts
35172
- import { join as join25 } from "node:path";
35173
- import { readdirSync as readdirSync7, statSync as statSync12, openSync as openSync12, readSync as readSync6, fstatSync, closeSync as closeSync11 } from "node:fs";
35182
+ import { join as join24 } from "node:path";
35183
+ import { readdirSync as readdirSync7, statSync as statSync11, openSync as openSync12, readSync as readSync6, fstatSync, closeSync as closeSync11 } from "node:fs";
35174
35184
  import { spawn as spawn4 } from "node:child_process";
35175
35185
  function sessionsDir2(codexHome) {
35176
- return join25(codexHome, "sessions");
35186
+ return join24(codexHome, "sessions");
35177
35187
  }
35178
35188
  function newestRollouts(dir, out, budget) {
35179
35189
  if (budget.n <= 0) return;
@@ -35187,11 +35197,11 @@ function newestRollouts(dir, out, budget) {
35187
35197
  const files = entries2.filter((e) => e.isFile() && e.name.startsWith("rollout-") && e.name.endsWith(".jsonl")).map((e) => e.name).sort(descByName2);
35188
35198
  for (const d of dirs) {
35189
35199
  if (budget.n <= 0) return;
35190
- newestRollouts(join25(dir, d), out, budget);
35200
+ newestRollouts(join24(dir, d), out, budget);
35191
35201
  }
35192
35202
  for (const f of files) {
35193
35203
  if (budget.n <= 0) return;
35194
- out.push(join25(dir, f));
35204
+ out.push(join24(dir, f));
35195
35205
  budget.n--;
35196
35206
  }
35197
35207
  }
@@ -35263,7 +35273,7 @@ function readCodexQuotaFromRollouts(codexHome = defaultCodexHome()) {
35263
35273
  newestRollouts(sessionsDir2(codexHome), rollouts, { n: 8 });
35264
35274
  const byMtime = rollouts.map((path3) => {
35265
35275
  try {
35266
- return { path: path3, mtimeMs: statSync12(path3).mtimeMs };
35276
+ return { path: path3, mtimeMs: statSync11(path3).mtimeMs };
35267
35277
  } catch {
35268
35278
  return void 0;
35269
35279
  }
@@ -35474,9 +35484,9 @@ var init_local_path = __esm({
35474
35484
 
35475
35485
  // packages/server/src/local-file.ts
35476
35486
  import { spawn as spawn5 } from "node:child_process";
35477
- import { existsSync as existsSync9, readFileSync as readFileSync18, realpathSync as realpathSync6, statSync as statSync13 } from "node:fs";
35487
+ import { existsSync as existsSync9, readFileSync as readFileSync18, realpathSync as realpathSync6, statSync as statSync12 } from "node:fs";
35478
35488
  import { homedir as homedir11 } from "node:os";
35479
- import { dirname as dirname10, isAbsolute as isAbsolute4, join as join26, resolve as resolve5, sep as sep2 } from "node:path";
35489
+ import { dirname as dirname9, isAbsolute as isAbsolute4, join as join25, resolve as resolve5, sep as sep2 } from "node:path";
35480
35490
  function isUnder(real, root) {
35481
35491
  let rootReal;
35482
35492
  try {
@@ -35488,12 +35498,12 @@ function isUnder(real, root) {
35488
35498
  return real === rootReal || real.startsWith(rootReal.endsWith(sep2) ? rootReal : rootReal + sep2);
35489
35499
  }
35490
35500
  try {
35491
- const trusted = statSync13(rootReal, { bigint: true });
35501
+ const trusted = statSync12(rootReal, { bigint: true });
35492
35502
  if (!trusted.isDirectory() || trusted.ino === 0n) return false;
35493
35503
  for (let ancestor = real; ; ) {
35494
- const actual = statSync13(ancestor, { bigint: true });
35504
+ const actual = statSync12(ancestor, { bigint: true });
35495
35505
  if (actual.dev === trusted.dev && actual.ino === trusted.ino) return true;
35496
- const parent = dirname10(ancestor);
35506
+ const parent = dirname9(ancestor);
35497
35507
  if (parent === ancestor) return false;
35498
35508
  ancestor = parent;
35499
35509
  }
@@ -35512,7 +35522,7 @@ function resolveLocalFile(rawPath, roots) {
35512
35522
  }
35513
35523
  if (!roots.some((root) => isUnder(real, root))) throw new Error("Local file is outside Frizz's trusted roots");
35514
35524
  try {
35515
- if (!statSync13(real).isFile()) throw new Error("Local path is not a regular file");
35525
+ if (!statSync12(real).isFile()) throw new Error("Local path is not a regular file");
35516
35526
  } catch (error) {
35517
35527
  if (error instanceof Error && error.message === "Local path is not a regular file") throw error;
35518
35528
  throw new Error("Local file was not found");
@@ -35522,7 +35532,7 @@ function resolveLocalFile(rawPath, roots) {
35522
35532
  function resolveOpenableFile(raw2, projectDir, roots, home = homedir11()) {
35523
35533
  const trimmed = raw2.trim().replace(/:\d+(?::\d+)?$/, "");
35524
35534
  if (!trimmed) return null;
35525
- const abs = trimmed === "~" ? home : /^~[\/\\]/.test(trimmed) ? join26(home, trimmed.slice(2)) : isAbsolute4(trimmed) ? trimmed : resolve5(projectDir, trimmed);
35535
+ const abs = trimmed === "~" ? home : /^~[\/\\]/.test(trimmed) ? join25(home, trimmed.slice(2)) : isAbsolute4(trimmed) ? trimmed : resolve5(projectDir, trimmed);
35526
35536
  try {
35527
35537
  return resolveLocalFile(abs, roots);
35528
35538
  } catch {
@@ -35580,7 +35590,7 @@ function localFileOpenCommand(path3, selected, options = {}) {
35580
35590
  const exists = options.exists ?? existsSync9;
35581
35591
  const localAppData = env.LOCALAPPDATA;
35582
35592
  if (localAppData) {
35583
- const exe = join26(localAppData, ...editor.exe);
35593
+ const exe = join25(localAppData, ...editor.exe);
35584
35594
  if (exists(exe)) return { command: exe, args: [path3] };
35585
35595
  }
35586
35596
  if (/["%\r\n]/u.test(path3)) throw new Error(`cannot hand ${path3} to the ${editor.shim} shim through cmd.exe`);
@@ -35846,7 +35856,7 @@ var init_claude_model_upgrade = __esm({
35846
35856
  // packages/server/src/frizz.ts
35847
35857
  import { execFile as execFile6 } from "node:child_process";
35848
35858
  import { lstatSync as lstatSync2, realpathSync as realpathSync7 } from "node:fs";
35849
- import { basename as basename5, dirname as dirname11, join as join27, resolve as resolve6 } from "node:path";
35859
+ import { basename as basename5, dirname as dirname10, join as join26, resolve as resolve6 } from "node:path";
35850
35860
  import { promisify as promisify5 } from "node:util";
35851
35861
  function frizzScriptsDir() {
35852
35862
  if (process.env.FRIZZ_SCRIPTS_DIR) return process.env.FRIZZ_SCRIPTS_DIR;
@@ -35855,11 +35865,11 @@ function frizzScriptsDir() {
35855
35865
  function directFrizzRoot(projectDir) {
35856
35866
  try {
35857
35867
  const projectRoot = realpathSync7(projectDir);
35858
- const path3 = join27(projectRoot, ".frizz");
35868
+ const path3 = join26(projectRoot, ".frizz");
35859
35869
  const stat2 = lstatSync2(path3);
35860
35870
  if (!stat2.isDirectory() || stat2.isSymbolicLink()) return null;
35861
35871
  const real = realpathSync7(path3);
35862
- return dirname11(real) === projectRoot && basename5(real) === ".frizz" ? real : null;
35872
+ return dirname10(real) === projectRoot && basename5(real) === ".frizz" ? real : null;
35863
35873
  } catch {
35864
35874
  return null;
35865
35875
  }
@@ -35869,7 +35879,7 @@ function frizzDirExists(projectDir) {
35869
35879
  }
35870
35880
  async function readBoard(projectDir, scriptsDir = frizzScriptsDir()) {
35871
35881
  if (!directFrizzRoot(projectDir)) throw new Error("unsafe or missing .frizz directory");
35872
- const { stdout } = await execFileP("node", [join27(scriptsDir, "index.mjs"), "--json"], {
35882
+ const { stdout } = await execFileP("node", [join26(scriptsDir, "index.mjs"), "--json"], {
35873
35883
  cwd: projectDir,
35874
35884
  env: { ...process.env, CLAUDE_PROJECT_DIR: projectDir },
35875
35885
  maxBuffer: 32 * 1024 * 1024
@@ -35894,7 +35904,7 @@ async function readBoard(projectDir, scriptsDir = frizzScriptsDir()) {
35894
35904
  };
35895
35905
  }
35896
35906
  async function runThreadUpdate(projectDir, slug, args, scriptsDir = frizzScriptsDir()) {
35897
- await execFileP("node", [join27(scriptsDir, "thread-update.mjs"), slug, ...args], {
35907
+ await execFileP("node", [join26(scriptsDir, "thread-update.mjs"), slug, ...args], {
35898
35908
  cwd: projectDir,
35899
35909
  env: { ...process.env, CLAUDE_PROJECT_DIR: projectDir }
35900
35910
  });
@@ -36006,7 +36016,7 @@ var init_awaiting = __esm({
36006
36016
  // packages/server/src/backend/project-mcp-servers.ts
36007
36017
  import { readFileSync as readFileSync19 } from "node:fs";
36008
36018
  import { homedir as homedir12 } from "node:os";
36009
- import { join as join28 } from "node:path";
36019
+ import { join as join27 } from "node:path";
36010
36020
  function readJsonObject(path3) {
36011
36021
  try {
36012
36022
  const parsed = JSON.parse(readFileSync19(path3, "utf8"));
@@ -36102,15 +36112,15 @@ function projectMcpServers(cwd, options = {}) {
36102
36112
  const env = options.env ?? process.env;
36103
36113
  const home = options.home ?? homedir12();
36104
36114
  const configOverride = options.claudeConfigDir ?? (env.CLAUDE_CONFIG_DIR?.trim() ? env.CLAUDE_CONFIG_DIR.trim() : void 0);
36105
- const accountFile = configOverride ? join28(configOverride, ".claude.json") : join28(home, ".claude.json");
36106
- const userSettingsFile = join28(configOverride ?? join28(home, ".claude"), "settings.json");
36115
+ const accountFile = configOverride ? join27(configOverride, ".claude.json") : join27(home, ".claude.json");
36116
+ const userSettingsFile = join27(configOverride ?? join27(home, ".claude"), "settings.json");
36107
36117
  const account = readJsonObject(accountFile);
36108
36118
  const out = userScopeRemoteServers(account, cwd, env);
36109
- const declared = objectField(readJsonObject(join28(cwd, ".mcp.json")), "mcpServers");
36119
+ const declared = objectField(readJsonObject(join27(cwd, ".mcp.json")), "mcpServers");
36110
36120
  if (!declared) return out;
36111
36121
  const approval = collectApproval([
36112
- readJsonObject(join28(cwd, ".claude", "settings.json")),
36113
- readJsonObject(join28(cwd, ".claude", "settings.local.json")),
36122
+ readJsonObject(join27(cwd, ".claude", "settings.json")),
36123
+ readJsonObject(join27(cwd, ".claude", "settings.local.json")),
36114
36124
  readJsonObject(userSettingsFile),
36115
36125
  objectField(objectField(account, "projects"), cwd)
36116
36126
  ]);
@@ -36135,17 +36145,17 @@ var init_project_mcp_servers = __esm({
36135
36145
 
36136
36146
  // packages/server/src/worker-plugin-dir.ts
36137
36147
  import { existsSync as existsSync10 } from "node:fs";
36138
- import { dirname as dirname12, join as join29 } from "node:path";
36148
+ import { dirname as dirname11, join as join28 } from "node:path";
36139
36149
  import { fileURLToPath as fileURLToPath3 } from "node:url";
36140
36150
  function resolveWorkerPluginDir(moduleUrl = import.meta.url, env = process.env) {
36141
36151
  const override = env.FRIZZ_WORKER_PLUGIN_DIR;
36142
- if (override && existsSync10(join29(override, ".claude-plugin", "plugin.json")))
36152
+ if (override && existsSync10(join28(override, ".claude-plugin", "plugin.json")))
36143
36153
  return override;
36144
- let current = dirname12(fileURLToPath3(moduleUrl));
36154
+ let current = dirname11(fileURLToPath3(moduleUrl));
36145
36155
  for (; ; ) {
36146
- const candidate = join29(current, "cc-worker");
36147
- if (existsSync10(join29(candidate, ".claude-plugin", "plugin.json"))) return candidate;
36148
- const parent = dirname12(current);
36156
+ const candidate = join28(current, "cc-worker");
36157
+ if (existsSync10(join28(candidate, ".claude-plugin", "plugin.json"))) return candidate;
36158
+ const parent = dirname11(current);
36149
36159
  if (parent === current) return void 0;
36150
36160
  current = parent;
36151
36161
  }
@@ -37153,11 +37163,11 @@ checks. Depth scales with blast radius and yields to the project's conventions.`
37153
37163
  });
37154
37164
 
37155
37165
  // packages/server/src/backend/acp-agents.ts
37156
- import { accessSync as accessSync3, constants, statSync as statSync14 } from "node:fs";
37157
- import { delimiter as delimiter2, isAbsolute as isAbsolute6, join as join30 } from "node:path";
37166
+ import { accessSync as accessSync3, constants, statSync as statSync13 } from "node:fs";
37167
+ import { delimiter as delimiter2, isAbsolute as isAbsolute6, join as join29 } from "node:path";
37158
37168
  function isExecutableFile(path3) {
37159
37169
  try {
37160
- if (!statSync14(path3).isFile()) return false;
37170
+ if (!statSync13(path3).isFile()) return false;
37161
37171
  if (process.platform !== "win32") accessSync3(path3, constants.X_OK);
37162
37172
  return true;
37163
37173
  } catch {
@@ -37170,9 +37180,9 @@ function findOnPath(command, env = process.env) {
37170
37180
  const exts = process.platform === "win32" ? ["", ...(env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";")] : [""];
37171
37181
  for (const dir of dirs) {
37172
37182
  for (const ext of exts) {
37173
- const candidate = join30(dir, command + ext.toLowerCase());
37183
+ const candidate = join29(dir, command + ext.toLowerCase());
37174
37184
  if (isExecutableFile(candidate)) return candidate;
37175
- if (ext && isExecutableFile(join30(dir, command + ext))) return join30(dir, command + ext);
37185
+ if (ext && isExecutableFile(join29(dir, command + ext))) return join29(dir, command + ext);
37176
37186
  }
37177
37187
  }
37178
37188
  return void 0;
@@ -38120,8 +38130,8 @@ var init_claude_agent_broker_bridge = __esm({
38120
38130
  });
38121
38131
 
38122
38132
  // packages/server/src/dispatch.ts
38123
- import { closeSync as closeSync12, constants as constants2, existsSync as existsSync11, fstatSync as fstatSync2, lstatSync as lstatSync3, openSync as openSync13, readFileSync as readFileSync20, realpathSync as realpathSync8, statSync as statSync15, writeFileSync as writeFileSync10, mkdirSync as mkdirSync13, rmSync as rmSync9 } from "node:fs";
38124
- import { basename as basename6, join as join31, dirname as dirname13 } from "node:path";
38133
+ import { closeSync as closeSync12, constants as constants2, existsSync as existsSync11, fstatSync as fstatSync2, lstatSync as lstatSync3, openSync as openSync13, readFileSync as readFileSync20, realpathSync as realpathSync8, statSync as statSync14, writeFileSync as writeFileSync10, mkdirSync as mkdirSync13, rmSync as rmSync9 } from "node:fs";
38134
+ import { basename as basename6, join as join30, dirname as dirname12 } from "node:path";
38125
38135
  import { createHash as createHash11, randomUUID as randomUUID13 } from "node:crypto";
38126
38136
  function fallbackTitle(prompt) {
38127
38137
  const firstLine2 = prompt.trim().split("\n", 1)[0].trim();
@@ -38140,7 +38150,7 @@ function fallbackTitle(prompt) {
38140
38150
  }
38141
38151
  function resolveSlug(frizzDir, base, taken) {
38142
38152
  base = ThreadSlug.parse(base);
38143
- const isTaken = (slug) => existsSync11(join31(frizzDir, `${slug}.md`)) || (taken?.(slug) ?? false);
38153
+ const isTaken = (slug) => existsSync11(join30(frizzDir, `${slug}.md`)) || (taken?.(slug) ?? false);
38144
38154
  if (!isTaken(base)) return base;
38145
38155
  for (let n = 2; ; n++) {
38146
38156
  const suffix = `-${n}`;
@@ -38157,16 +38167,16 @@ function resolveLegacyThreadFile(projectDir, value) {
38157
38167
  if (!parsed.success) return null;
38158
38168
  try {
38159
38169
  const projectRoot = realpathSync8(projectDir);
38160
- const frizzPath = join31(projectRoot, ".frizz");
38170
+ const frizzPath = join30(projectRoot, ".frizz");
38161
38171
  const frizzStat = lstatSync3(frizzPath);
38162
38172
  if (!frizzStat.isDirectory() || frizzStat.isSymbolicLink()) return null;
38163
38173
  const realFrizz = realpathSync8(frizzPath);
38164
- if (dirname13(realFrizz) !== projectRoot || basename6(realFrizz) !== ".frizz") return null;
38165
- const path3 = join31(realFrizz, `${parsed.data}.md`);
38174
+ if (dirname12(realFrizz) !== projectRoot || basename6(realFrizz) !== ".frizz") return null;
38175
+ const path3 = join30(realFrizz, `${parsed.data}.md`);
38166
38176
  const before = lstatSync3(path3);
38167
38177
  if (!before.isFile() || before.isSymbolicLink()) return null;
38168
38178
  const realPath = realpathSync8(path3);
38169
- if (dirname13(realPath) !== realFrizz || basename6(realPath) !== `${parsed.data}.md`) return null;
38179
+ if (dirname12(realPath) !== realFrizz || basename6(realPath) !== `${parsed.data}.md`) return null;
38170
38180
  let contents;
38171
38181
  let openedBefore;
38172
38182
  let openedAfter;
@@ -38206,7 +38216,7 @@ function boardAuthorizesAdoption(board, slug) {
38206
38216
  return !board.errorItems.some((item) => item.file === `${slug}.md`);
38207
38217
  }
38208
38218
  function ensureSafeDirectDirectory(parent, name) {
38209
- const path3 = join31(parent, name);
38219
+ const path3 = join30(parent, name);
38210
38220
  try {
38211
38221
  mkdirSync13(path3);
38212
38222
  } catch (error) {
@@ -38216,7 +38226,7 @@ function ensureSafeDirectDirectory(parent, name) {
38216
38226
  const stat2 = lstatSync3(path3);
38217
38227
  if (!stat2.isDirectory() || stat2.isSymbolicLink()) throw new Error("unsafe project directory");
38218
38228
  const real = realpathSync8(path3);
38219
- if (dirname13(real) !== parent || basename6(real) !== name) throw new Error("unsafe project directory");
38229
+ if (dirname12(real) !== parent || basename6(real) !== name) throw new Error("unsafe project directory");
38220
38230
  return real;
38221
38231
  }
38222
38232
  function scratchDirRelPath(sessionId) {
@@ -38236,8 +38246,8 @@ function loadWorkerPrompt(kind = "claude") {
38236
38246
  function monitorScriptsDir() {
38237
38247
  const plugin = workerPluginDir();
38238
38248
  if (!plugin) return void 0;
38239
- const dir = join31(plugin, "skills", "gh", "scripts");
38240
- return existsSync11(join31(dir, "ci-watch.mjs")) ? dir : void 0;
38249
+ const dir = join30(plugin, "skills", "gh", "scripts");
38250
+ return existsSync11(join30(dir, "ci-watch.mjs")) ? dir : void 0;
38241
38251
  }
38242
38252
  function codexScratchpadHookConfig(hookScript, sessionId) {
38243
38253
  if (!hookScript || !sessionId) return {};
@@ -38249,7 +38259,7 @@ function codexScratchpadHookConfig(hookScript, sessionId) {
38249
38259
  }
38250
38260
  ]
38251
38261
  });
38252
- const bashBackgroundHook = join31(dirname13(hookScript), "bash-background.mjs");
38262
+ const bashBackgroundHook = join30(dirname12(hookScript), "bash-background.mjs");
38253
38263
  return {
38254
38264
  bypass_hook_trust: true,
38255
38265
  hooks: {
@@ -38275,7 +38285,7 @@ function codexScratchpadHookConfig(hookScript, sessionId) {
38275
38285
  }
38276
38286
  function scratchpadHookScript() {
38277
38287
  const plugin = workerPluginDir();
38278
- return plugin ? join31(plugin, "hooks", "scratchpad.mjs") : void 0;
38288
+ return plugin ? join30(plugin, "hooks", "scratchpad.mjs") : void 0;
38279
38289
  }
38280
38290
  function composePrompt(sessionId, prompt, kind = "claude") {
38281
38291
  const children2 = kind === "codex" ? "Native sub-agents share it \u2014 have each write its OWN file rather than all editing one." : "Name it in a sub-agent's prompt when you want its notes to land somewhere you can read; give each child its OWN file rather than having them all edit one.";
@@ -38291,10 +38301,10 @@ function scratchpadOrientation(sessionId, kind = "claude") {
38291
38301
  return `SCRATCH DIRECTORY: .frizz/threads/${sessionId}/ \u2014 yours, free-form, as many files as you like, and nothing is expected in it. A single direct task usually needs none; writing notes is never a substitute for doing the work (${children2}). Nothing in this directory is read automatically; if you want a note back after a compaction, mcp__frizz__goal with post_compaction: true re-sends a prompt of your choosing.`;
38292
38302
  }
38293
38303
  function frizzConfigBlock(projectDir) {
38294
- const path3 = join31(projectDir, "FRIZZ.md");
38304
+ const path3 = join30(projectDir, "FRIZZ.md");
38295
38305
  let body;
38296
38306
  try {
38297
- const st2 = statSync15(path3);
38307
+ const st2 = statSync14(path3);
38298
38308
  if (!st2.isFile() || st2.size > FRIZZ_MD_MAX_BYTES) return "";
38299
38309
  body = readFileSync20(path3, "utf8").trim();
38300
38310
  } catch {
@@ -38335,7 +38345,7 @@ function resolveFrizzMcp(target, moduleUrl = import.meta.url, env = process.env,
38335
38345
  const { stateDir, serverLock, projectId } = typeof target === "string" ? { stateDir: target } : target;
38336
38346
  const pluginDir = resolveWorkerPluginDir(moduleUrl, env);
38337
38347
  if (!pluginDir) return void 0;
38338
- const scriptPath = join31(pluginDir, "bin", FRIZZ_MCP.script);
38348
+ const scriptPath = join30(pluginDir, "bin", FRIZZ_MCP.script);
38339
38349
  if (!existsSync11(scriptPath)) return void 0;
38340
38350
  return {
38341
38351
  scriptPath,
@@ -38418,7 +38428,7 @@ function buildClaudeResumeCommand(opts) {
38418
38428
  }
38419
38429
  function createDispatcher(deps) {
38420
38430
  const readBoardSource = deps.readBoard ?? readBoard;
38421
- const frizzDir = join31(deps.project.dir, ".frizz");
38431
+ const frizzDir = join30(deps.project.dir, ".frizz");
38422
38432
  const adoptionRuntime = deps.adoptionRuntime ?? productionRuntime;
38423
38433
  function cleanupPrewrites(built) {
38424
38434
  for (const path3 of new Set(built.prewrite.map((file) => file.path))) {
@@ -38431,7 +38441,7 @@ function createDispatcher(deps) {
38431
38441
  function cleanupDispatchFiles(scratchRel, built, sessionId) {
38432
38442
  cleanupPrewrites(built);
38433
38443
  try {
38434
- rmSync9(join31(deps.project.dir, scratchRel), { force: true, recursive: true });
38444
+ rmSync9(join30(deps.project.dir, scratchRel), { force: true, recursive: true });
38435
38445
  } catch {
38436
38446
  }
38437
38447
  cleanupAdoptionSessionFiles(deps.project.dir, sessionId);
@@ -38924,7 +38934,7 @@ import {
38924
38934
  watch as fsWatch
38925
38935
  } from "node:fs";
38926
38936
  import { homedir as homedir14 } from "node:os";
38927
- import { dirname as dirname14, join as join32 } from "node:path";
38937
+ import { dirname as dirname13, join as join31 } from "node:path";
38928
38938
  import watcher from "@parcel/watcher";
38929
38939
  function appServerTurnStalled(liveness, lastActivityAt, nowMs) {
38930
38940
  if (!liveness) return false;
@@ -38973,7 +38983,7 @@ function registeredLegacyFileIsTerminal(projectDir, slug) {
38973
38983
  return status === "done" || status === "dismissed";
38974
38984
  }
38975
38985
  function isBoardRelevantFrizzPath(roots, path3) {
38976
- return path3.endsWith(".md") && roots.has(dirname14(path3));
38986
+ return path3.endsWith(".md") && roots.has(dirname13(path3));
38977
38987
  }
38978
38988
  function futureSnooze(row, nowMs) {
38979
38989
  const parsed = SnoozeUntil.safeParse(row.snoozed_until);
@@ -39075,6 +39085,12 @@ function answersInFlight(rows, lastUserAt, wakeOnDismissals = false) {
39075
39085
  if (answers.length > 0) return questionAnswerMessage(answers, dismissed);
39076
39086
  return wakeOnDismissals && dismissed.length > 0 ? questionsCancelledWakeMessage(dismissed.length) : void 0;
39077
39087
  }
39088
+ function answerAwaitingDelivery(rows, lastUserAt, nowMs = Date.now()) {
39089
+ const userAt = lastUserAt ? Date.parse(lastUserAt) : Number.NaN;
39090
+ return rows.some(
39091
+ (q10) => q10.state === "answered" && q10.settled_at != null && !(Number.isFinite(userAt) && userAt >= q10.settled_at) && nowMs - q10.settled_at < ANSWER_IN_FLIGHT_EXCUSAL_MS
39092
+ );
39093
+ }
39078
39094
  function hasRegisteredBackgroundPark(tele, armedWatches, nowMs) {
39079
39095
  return armedWatches.some((w10) => {
39080
39096
  const expiresAt = Date.parse(w10.expiresAt);
@@ -39183,7 +39199,7 @@ function hasFreshDelivery(row, processGone) {
39183
39199
  if (processGone) return false;
39184
39200
  return parseDeliveryLedger(row.delivery_ledger).some((d) => d.state === "pending" || d.state === "enqueued" || d.state === "delivered");
39185
39201
  }
39186
- function deriveNeedsYou(row, tele, runtime, hasActionableInteraction = false, nowMs = Date.now(), limitPause = void 0, excuseLiveOwnWork = true, deliveryProcessGone = false, github = {}, registeredPrWatches = /* @__PURE__ */ new Set(), armedTimerIds = /* @__PURE__ */ new Set(), armedWatches = [], openQuestions = 0) {
39202
+ function deriveNeedsYou(row, tele, runtime, hasActionableInteraction = false, nowMs = Date.now(), limitPause = void 0, excuseLiveOwnWork = true, deliveryProcessGone = false, github = {}, registeredPrWatches = /* @__PURE__ */ new Set(), armedTimerIds = /* @__PURE__ */ new Set(), armedWatches = [], openQuestions = 0, answerInFlight = false) {
39187
39203
  if (futureSnooze(row, nowMs)) return false;
39188
39204
  if (hasActionableInteraction) return true;
39189
39205
  if (runtime === "perm-prompt") return true;
@@ -39192,6 +39208,7 @@ function deriveNeedsYou(row, tele, runtime, hasActionableInteraction = false, no
39192
39208
  if (!atRest2) return false;
39193
39209
  if (runtime === "exited" && tele?.turn === "in-flight") return true;
39194
39210
  if (hasFreshDelivery(row, deliveryProcessGone)) return false;
39211
+ if (answerInFlight) return false;
39195
39212
  if (tele?.providerError && !tele.providerError.retrying) return true;
39196
39213
  if (tele?.pendingQuestion) return true;
39197
39214
  if (openQuestions > 0) return true;
@@ -39381,7 +39398,7 @@ function sessionThreadView(projectDir, storage, row, rawTele, registeredLegacyTe
39381
39398
  const state = effectiveSessionState(row, registeredLegacyTerminal);
39382
39399
  const archived = state === "archived";
39383
39400
  const limitPause = resolveLimitPause(row, tele, nowMs);
39384
- const needsYou = archived ? false : deriveNeedsYou(row, tele, runtime, interactionPresence.needsUser, nowMs, limitPause, true, deliveryProcessGone, github, registeredPrWatches, armedTimerIds, armedWatches, questions.length);
39401
+ const needsYou = archived ? false : deriveNeedsYou(row, tele, runtime, interactionPresence.needsUser, nowMs, limitPause, true, deliveryProcessGone, github, registeredPrWatches, armedTimerIds, armedWatches, questions.length, answerAwaitingDelivery(questionRows, rawTele?.lastUserAt, nowMs));
39385
39402
  const awaitingBackground = archived ? false : deriveAwaitingBackground(row, tele, runtime, interactionPresence.needsUser, nowMs, limitPause, deliveryProcessGone, github, registeredPrWatches, armedTimerIds, armedWatches, questions.length);
39386
39403
  const crashed = runtime === "exited" && (tele?.turn === "in-flight" || hasLiveBackgroundWork(tele) || headlessLostWork);
39387
39404
  const snoozedUntil = futureSnooze(row, nowMs);
@@ -39773,7 +39790,7 @@ function createBoard(project, storage, bus, tailer, bootId, deps = {}) {
39773
39790
  if (parcelSub || stopped) return Promise.resolve();
39774
39791
  if (watchSetup) return watchSetup;
39775
39792
  const setup = (async () => {
39776
- const dir = join32(project.dir, ".frizz");
39793
+ const dir = join31(project.dir, ".frizz");
39777
39794
  const roots = /* @__PURE__ */ new Set([dir]);
39778
39795
  try {
39779
39796
  roots.add(realpathSync9(dir));
@@ -39788,7 +39805,7 @@ function createBoard(project, storage, bus, tailer, bootId, deps = {}) {
39788
39805
  }
39789
39806
  if (events.some((event) => isBoardRelevantFrizzPath(roots, event.path))) scheduleRebuild();
39790
39807
  },
39791
- { ignore: FRIZZ_WATCH_IGNORED_DIRS.map((name) => join32(dir, name)) }
39808
+ { ignore: FRIZZ_WATCH_IGNORED_DIRS.map((name) => join31(dir, name)) }
39792
39809
  );
39793
39810
  if (stopped) {
39794
39811
  await next.unsubscribe();
@@ -39864,7 +39881,7 @@ function createBoard(project, storage, bus, tailer, bootId, deps = {}) {
39864
39881
  }
39865
39882
  };
39866
39883
  }
39867
- var DEBOUNCE_MS, RECONCILE_MS, STALL_GRACE_MS, LINE_CAP, FRIZZ_WATCH_IGNORED_DIRS, DECLARED_PARK_MAX_MS;
39884
+ var DEBOUNCE_MS, RECONCILE_MS, STALL_GRACE_MS, LINE_CAP, FRIZZ_WATCH_IGNORED_DIRS, DECLARED_PARK_MAX_MS, ANSWER_IN_FLIGHT_EXCUSAL_MS;
39868
39885
  var init_board = __esm({
39869
39886
  "packages/server/src/board.ts"() {
39870
39887
  "use strict";
@@ -39888,6 +39905,7 @@ var init_board = __esm({
39888
39905
  LINE_CAP = 240;
39889
39906
  FRIZZ_WATCH_IGNORED_DIRS = ["threads", ".session-state"];
39890
39907
  DECLARED_PARK_MAX_MS = 24 * 60 * 60 * 1e3;
39908
+ ANSWER_IN_FLIGHT_EXCUSAL_MS = 6e4;
39891
39909
  }
39892
39910
  });
39893
39911
 
@@ -42697,7 +42715,7 @@ var init_resume = __esm({
42697
42715
  });
42698
42716
 
42699
42717
  // packages/server/src/backend/claude.ts
42700
- import { join as join33 } from "node:path";
42718
+ import { join as join32 } from "node:path";
42701
42719
  function toolResultText2(content) {
42702
42720
  if (typeof content === "string") return content;
42703
42721
  if (!Array.isArray(content)) return "";
@@ -42788,7 +42806,7 @@ function createClaudeBackend(opts) {
42788
42806
  return { argv, env: claudeWorkerEnvironment(), prewrite: [] };
42789
42807
  },
42790
42808
  transcriptPath(sessionId) {
42791
- return join33(opts.logDir, `${sessionId}.jsonl`);
42809
+ return join32(opts.logDir, `${sessionId}.jsonl`);
42792
42810
  },
42793
42811
  parseLine(line) {
42794
42812
  return parseClaudeLine(line);
@@ -42814,9 +42832,9 @@ var init_claude = __esm({
42814
42832
 
42815
42833
  // packages/server/src/backend/acp-transcript.ts
42816
42834
  import { appendFileSync as appendFileSync3, existsSync as existsSync13, mkdirSync as mkdirSync14, readFileSync as readFileSync21 } from "node:fs";
42817
- import { dirname as dirname15, join as join34 } from "node:path";
42835
+ import { dirname as dirname14, join as join33 } from "node:path";
42818
42836
  function acpTranscriptPath(stateDir, sessionId) {
42819
- return join34(stateDir, ACP_TRANSCRIPT_DIR, `${sessionId}.jsonl`);
42837
+ return join33(stateDir, ACP_TRANSCRIPT_DIR, `${sessionId}.jsonl`);
42820
42838
  }
42821
42839
  function parseAcpRecord(line) {
42822
42840
  if (!line.trim()) return void 0;
@@ -43017,7 +43035,7 @@ var init_acp_transcript = __esm({
43017
43035
  AcpTranscriptWriter = class {
43018
43036
  constructor(path3) {
43019
43037
  this.path = path3;
43020
- mkdirSync14(dirname15(path3), { recursive: true });
43038
+ mkdirSync14(dirname14(path3), { recursive: true });
43021
43039
  if (!existsSync13(path3)) appendFileSync3(path3, "");
43022
43040
  }
43023
43041
  append(record) {
@@ -43405,14 +43423,14 @@ import { spawn as spawn7 } from "node:child_process";
43405
43423
  import { createConnection as createConnection2 } from "node:net";
43406
43424
  import { createHash as createHash13, randomUUID as randomUUID15 } from "node:crypto";
43407
43425
  import { existsSync as existsSync14, mkdirSync as mkdirSync15, readFileSync as readFileSync22, readdirSync as readdirSync8, unlinkSync as unlinkSync4 } from "node:fs";
43408
- import { join as join35 } from "node:path";
43426
+ import { join as join34 } from "node:path";
43409
43427
  import { PassThrough as PassThrough3, Writable as Writable3 } from "node:stream";
43410
43428
  import { StringDecoder as StringDecoder5 } from "node:string_decoder";
43411
43429
  function daemonDir2(stateDir) {
43412
- return join35(stateDir, "acp-daemon");
43430
+ return join34(stateDir, "acp-daemon");
43413
43431
  }
43414
43432
  function acpDaemonRecordPath(stateDir, sessionId) {
43415
- return join35(daemonDir2(stateDir), `${sessionId}.json`);
43433
+ return join34(daemonDir2(stateDir), `${sessionId}.json`);
43416
43434
  }
43417
43435
  function acpDaemonSocketPath(stateDir, sessionId) {
43418
43436
  const key = createHash13("sha256").update(stateDir).update("\0").update(sessionId).digest("hex").slice(0, 16);
@@ -44402,182 +44420,6 @@ var init_acp_bridge = __esm({
44402
44420
  }
44403
44421
  });
44404
44422
 
44405
- // packages/server/src/login-utility.ts
44406
- import { randomBytes } from "node:crypto";
44407
- import pty from "node-pty";
44408
- function createLoginUtility(deps) {
44409
- const spawnPty = deps.spawnPty ?? pty.spawn;
44410
- const env = deps.env ?? process.env;
44411
- const lifetimeMs = deps.lifetimeMs ?? ATTEMPT_LIFETIME_MS;
44412
- const attempts = /* @__PURE__ */ new Map();
44413
- function loginArgv(backend) {
44414
- if (backend === "codex") {
44415
- const codex = resolveCodexExecutable(deps.codexBin, { env });
44416
- return { file: codex.file, args: [...codex.args, "login"] };
44417
- }
44418
- return { file: resolveClaudeExecutableAbsolute(deps.claudeBin, env), args: ["auth", "login"] };
44419
- }
44420
- function failedAttempt(id2, backend, cause) {
44421
- const reason = cause instanceof Error ? cause.message : String(cause);
44422
- const error = `Could not start the ${backend === "codex" ? "Codex" : "Claude"} sign-in: ${reason}`;
44423
- return {
44424
- id: id2,
44425
- backend,
44426
- timer: setTimeout(() => teardown(id2), lifetimeMs),
44427
- buffer: `${error}\r
44428
- `,
44429
- bufferBytes: Buffer.byteLength(error) + 2,
44430
- exited: true,
44431
- error,
44432
- dataListeners: /* @__PURE__ */ new Set(),
44433
- exitListeners: /* @__PURE__ */ new Set()
44434
- };
44435
- }
44436
- function teardown(id2) {
44437
- const attempt = attempts.get(id2);
44438
- if (!attempt) return;
44439
- clearTimeout(attempt.timer);
44440
- attempts.delete(id2);
44441
- attempt.buffer = "";
44442
- attempt.bufferBytes = 0;
44443
- attempt.dataListeners.clear();
44444
- for (const listener of attempt.exitListeners) {
44445
- try {
44446
- listener();
44447
- } catch {
44448
- }
44449
- }
44450
- attempt.exitListeners.clear();
44451
- try {
44452
- attempt.term?.kill();
44453
- } catch {
44454
- }
44455
- }
44456
- return {
44457
- start(backend) {
44458
- for (const attempt2 of attempts.values()) {
44459
- if (attempt2.backend !== backend) continue;
44460
- if (!attempt2.exited) return { attemptId: attempt2.id };
44461
- teardown(attempt2.id);
44462
- }
44463
- const id2 = `login-${randomBytes(8).toString("hex")}`;
44464
- let term;
44465
- try {
44466
- const { file, args } = loginArgv(backend);
44467
- term = spawnPty(file, args, {
44468
- name: process.platform === "win32" ? "xterm-color" : "xterm-256color",
44469
- cwd: deps.cwd,
44470
- env,
44471
- cols: 120,
44472
- rows: 30
44473
- });
44474
- } catch (cause) {
44475
- const failed = failedAttempt(id2, backend, cause);
44476
- failed.timer.unref?.();
44477
- attempts.set(id2, failed);
44478
- return { attemptId: id2 };
44479
- }
44480
- const attempt = {
44481
- id: id2,
44482
- backend,
44483
- term,
44484
- timer: setTimeout(() => teardown(id2), lifetimeMs),
44485
- buffer: "",
44486
- bufferBytes: 0,
44487
- exited: false,
44488
- dataListeners: /* @__PURE__ */ new Set(),
44489
- exitListeners: /* @__PURE__ */ new Set()
44490
- };
44491
- attempt.timer.unref?.();
44492
- term.onData((chunk) => {
44493
- attempt.buffer += chunk;
44494
- attempt.bufferBytes += Buffer.byteLength(chunk);
44495
- while (attempt.bufferBytes > REPLAY_CAP_BYTES && attempt.buffer.length > 0) {
44496
- const drop = attempt.buffer.slice(0, Math.ceil(attempt.buffer.length / 4));
44497
- attempt.buffer = attempt.buffer.slice(drop.length);
44498
- attempt.bufferBytes -= Buffer.byteLength(drop);
44499
- }
44500
- for (const listener of attempt.dataListeners) {
44501
- try {
44502
- listener(chunk);
44503
- } catch {
44504
- }
44505
- }
44506
- });
44507
- term.onExit(() => {
44508
- attempt.exited = true;
44509
- for (const listener of attempt.exitListeners) {
44510
- try {
44511
- listener();
44512
- } catch {
44513
- }
44514
- }
44515
- });
44516
- attempts.set(id2, attempt);
44517
- return { attemptId: id2 };
44518
- },
44519
- attach(slug) {
44520
- const attempt = attempts.get(slug);
44521
- if (!attempt) return null;
44522
- return {
44523
- replay: () => attempt.buffer,
44524
- onData: (listener) => {
44525
- attempt.dataListeners.add(listener);
44526
- return () => attempt.dataListeners.delete(listener);
44527
- },
44528
- write: (data) => {
44529
- if (!attempt.exited) {
44530
- try {
44531
- attempt.term?.write(data);
44532
- } catch {
44533
- }
44534
- }
44535
- },
44536
- resize: (cols, rows) => {
44537
- if (!attempt.exited) {
44538
- try {
44539
- attempt.term?.resize(cols, rows);
44540
- } catch {
44541
- }
44542
- }
44543
- },
44544
- onExit: (listener) => {
44545
- if (attempt.exited) {
44546
- listener();
44547
- return () => {
44548
- };
44549
- }
44550
- attempt.exitListeners.add(listener);
44551
- return () => attempt.exitListeners.delete(listener);
44552
- },
44553
- close: () => {
44554
- }
44555
- };
44556
- },
44557
- status(attemptId) {
44558
- const attempt = attempts.get(attemptId);
44559
- if (!attempt) return { state: "exited" };
44560
- return { state: attempt.exited ? "exited" : "running", backend: attempt.backend, ...attempt.error ? { error: attempt.error } : {} };
44561
- },
44562
- cancel(attemptId) {
44563
- teardown(attemptId);
44564
- },
44565
- stop() {
44566
- for (const id2 of [...attempts.keys()]) teardown(id2);
44567
- }
44568
- };
44569
- }
44570
- var ATTEMPT_LIFETIME_MS, REPLAY_CAP_BYTES;
44571
- var init_login_utility = __esm({
44572
- "packages/server/src/login-utility.ts"() {
44573
- "use strict";
44574
- init_claude_broker_host();
44575
- init_codex_executable();
44576
- ATTEMPT_LIFETIME_MS = 10 * 60 * 1e3;
44577
- REPLAY_CAP_BYTES = 256 * 1024;
44578
- }
44579
- });
44580
-
44581
44423
  // node_modules/.pnpm/@anthropic-ai+claude-agent-sdk@0.3.282_@anthropic-ai+sdk@0.111.0_zod@4.4.3__@modelconte_2775e0bf363ceb1ee09ef372c727fb7d/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
44582
44424
  import { createRequire as IW } from "node:module";
44583
44425
  import { randomUUID as Ol } from "crypto";
@@ -68641,13 +68483,13 @@ var init_claude_models = __esm({
68641
68483
  });
68642
68484
 
68643
68485
  // packages/server/src/backend/codex-app-server-diagnostics.ts
68644
- import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync17, renameSync as renameSync9, statSync as statSync17 } from "node:fs";
68645
- import { join as join37 } from "node:path";
68486
+ import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync17, renameSync as renameSync9, statSync as statSync16 } from "node:fs";
68487
+ import { join as join36 } from "node:path";
68646
68488
  function codexDiagnosticLogPath(stateDir, projectId) {
68647
- return join37(stateDir, "codex-app-server", `${projectId}.diagnostics.log`);
68489
+ return join36(stateDir, "codex-app-server", `${projectId}.diagnostics.log`);
68648
68490
  }
68649
68491
  function createCodexDiagnosticSink(stateDir, projectId, now = () => /* @__PURE__ */ new Date()) {
68650
- const dir = join37(stateDir, "codex-app-server");
68492
+ const dir = join36(stateDir, "codex-app-server");
68651
68493
  const path3 = codexDiagnosticLogPath(stateDir, projectId);
68652
68494
  let ensured = false;
68653
68495
  return (event) => {
@@ -68658,7 +68500,7 @@ function createCodexDiagnosticSink(stateDir, projectId, now = () => /* @__PURE__
68658
68500
  ensured = true;
68659
68501
  }
68660
68502
  try {
68661
- if (statSync17(path3).size > MAX_BYTES2) renameSync9(path3, `${path3}.1`);
68503
+ if (statSync16(path3).size > MAX_BYTES2) renameSync9(path3, `${path3}.1`);
68662
68504
  } catch {
68663
68505
  }
68664
68506
  appendFileSync5(path3, `${JSON.stringify({ at: now().toISOString(), ...event })}
@@ -68679,7 +68521,7 @@ var init_codex_app_server_diagnostics = __esm({
68679
68521
  import { execFile as execFile9 } from "node:child_process";
68680
68522
  import { readdirSync as readdirSync10, unlinkSync as unlinkSync6 } from "node:fs";
68681
68523
  import { connect as connectSocket } from "node:net";
68682
- import { join as join38 } from "node:path";
68524
+ import { join as join37 } from "node:path";
68683
68525
  function parseLsofSocketNames(stdout) {
68684
68526
  const referenced = /* @__PURE__ */ new Set();
68685
68527
  for (const line of stdout.split("\n")) {
@@ -68696,7 +68538,7 @@ function sweepStaleSockets(options, deps = {}) {
68696
68538
  const keep = new Set(options.keep ?? []);
68697
68539
  let candidates;
68698
68540
  try {
68699
- candidates = (deps.readdir ?? readdirSync10)(options.dir).filter((name) => name.startsWith(options.prefix) && name.endsWith(".sock")).map((name) => join38(options.dir, name)).filter((path3) => !keep.has(path3));
68541
+ candidates = (deps.readdir ?? readdirSync10)(options.dir).filter((name) => name.startsWith(options.prefix) && name.endsWith(".sock")).map((name) => join37(options.dir, name)).filter((path3) => !keep.has(path3));
68700
68542
  } catch {
68701
68543
  return;
68702
68544
  }
@@ -68747,7 +68589,7 @@ var init_stale_socket_sweep = __esm({
68747
68589
  // packages/server/src/orphan-reaper.ts
68748
68590
  import { execFileSync as execFileSync4 } from "node:child_process";
68749
68591
  import { readFileSync as readFileSync24 } from "node:fs";
68750
- import { dirname as dirname17 } from "node:path";
68592
+ import { dirname as dirname16 } from "node:path";
68751
68593
  function firstTokenBasename(command) {
68752
68594
  const first = command.trimStart().split(/\s+/, 1)[0] ?? "";
68753
68595
  const slash = first.lastIndexOf("/");
@@ -68975,7 +68817,7 @@ function sweepOrphansOnce(deps = {}) {
68975
68817
  }
68976
68818
  function sweepStaleBrokerSockets() {
68977
68819
  try {
68978
- sweepStaleSockets({ dir: dirname17(claudeBrokerSocketPath("", "")), prefix: CLAUDE_BROKER_SOCKET_PREFIX });
68820
+ sweepStaleSockets({ dir: dirname16(claudeBrokerSocketPath("", "")), prefix: CLAUDE_BROKER_SOCKET_PREFIX });
68979
68821
  } catch {
68980
68822
  }
68981
68823
  }
@@ -69044,7 +68886,7 @@ var init_orphan_reaper = __esm({
69044
68886
  });
69045
68887
 
69046
68888
  // packages/server/src/context.ts
69047
- import { join as join39 } from "node:path";
68889
+ import { join as join38 } from "node:path";
69048
68890
  import { randomUUID as randomUUID16 } from "node:crypto";
69049
68891
  import { homedir as homedir15 } from "node:os";
69050
68892
  function reconcileSessions(storage) {
@@ -69139,7 +68981,6 @@ function deliverClaudeBrokerWake(deps) {
69139
68981
  function projectContextCleanups(get) {
69140
68982
  return {
69141
68983
  tailer: () => get()?.tailer.stop(),
69142
- loginUtility: () => get()?.loginUtility?.stop(),
69143
68984
  subscriptions: () => get()?.stopSubscriptions(),
69144
68985
  scheduler: async () => {
69145
68986
  await get()?.scheduler.stop();
@@ -69197,7 +69038,7 @@ async function createContext(opts = {}) {
69197
69038
  function createContextUnchecked(opts, resources) {
69198
69039
  const home = opts.home ?? homedir15();
69199
69040
  const project = opts.project ?? resolveProject();
69200
- const storage = createStorage(opts.database ?? join39(project.stateDir, "ui.db"), project.id);
69041
+ const storage = createStorage(opts.database ?? join38(project.stateDir, "ui.db"), project.id);
69201
69042
  resources.storage = storage;
69202
69043
  const bus = new Bus();
69203
69044
  const transcriptChange = new Emitter();
@@ -69599,8 +69440,7 @@ ${wakeDeliveryToken(deliveryId)}`;
69599
69440
  teardownProject: opts.teardownProject,
69600
69441
  launchProjectId: opts.launchProjectId,
69601
69442
  claudeBin: opts.claudeBin,
69602
- codexBin: opts.codexBin,
69603
- loginUtility: createLoginUtility({ claudeBin: opts.claudeBin, codexBin: opts.codexBin, cwd: project.dir })
69443
+ codexBin: opts.codexBin
69604
69444
  };
69605
69445
  }
69606
69446
  var CONTEXT_STARTUP_CLEANUP_TIMEOUT_MS, QUOTA_REFRESH_INTERVAL_MS, ContextStartupError;
@@ -69625,7 +69465,6 @@ var init_context = __esm({
69625
69465
  init_acp_transcript();
69626
69466
  init_acp_bridge();
69627
69467
  init_auth_status();
69628
- init_login_utility();
69629
69468
  init_usage_limit();
69630
69469
  init_claude_models();
69631
69470
  init_claude_model_upgrade();
@@ -72303,7 +72142,7 @@ var init_server = __esm({
72303
72142
 
72304
72143
  // packages/server/src/repair.ts
72305
72144
  import { existsSync as existsSync16, readFileSync as readFileSync25, writeFileSync as writeFileSync11 } from "node:fs";
72306
- import { basename as basename7, dirname as dirname18, resolve as resolve9 } from "node:path";
72145
+ import { basename as basename7, dirname as dirname17, resolve as resolve9 } from "node:path";
72307
72146
  function quoteValue(v) {
72308
72147
  if (/^[\w./#:+-]+$/.test(v)) return v;
72309
72148
  return `"${v.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
@@ -72315,7 +72154,7 @@ function deriveTitle(body, slug) {
72315
72154
  function repairThreadFile(frizzDir, file) {
72316
72155
  const root = resolve9(frizzDir);
72317
72156
  const abs = resolve9(root, file);
72318
- if (dirname18(abs) !== root) throw new RepairError(`refusing to repair "${file}": not directly under .frizz/`);
72157
+ if (dirname17(abs) !== root) throw new RepairError(`refusing to repair "${file}": not directly under .frizz/`);
72319
72158
  if (!abs.endsWith(".md")) throw new RepairError(`refusing to repair "${file}": not a .md thread file`);
72320
72159
  if (!existsSync16(abs)) throw new RepairError(`no thread file to repair: ${basename7(abs)}`);
72321
72160
  const content = readFileSync25(abs, "utf8");
@@ -72718,10 +72557,10 @@ var init_bash_background = __esm({
72718
72557
  });
72719
72558
 
72720
72559
  // packages/server/src/transcript.ts
72721
- import { closeSync as closeSync14, existsSync as existsSync17, fstatSync as fstatSync3, mkdirSync as mkdirSync18, openSync as openSync15, readdirSync as readdirSync11, readFileSync as readFileSync27, readSync as readSync8, renameSync as renameSync10, statSync as statSync18, unlinkSync as unlinkSync7, writeFileSync as writeFileSync12 } from "node:fs";
72560
+ import { closeSync as closeSync14, existsSync as existsSync17, fstatSync as fstatSync3, mkdirSync as mkdirSync18, openSync as openSync15, readdirSync as readdirSync11, readFileSync as readFileSync27, readSync as readSync8, renameSync as renameSync10, statSync as statSync17, unlinkSync as unlinkSync7, writeFileSync as writeFileSync12 } from "node:fs";
72722
72561
  import { createHash as createHash14 } from "node:crypto";
72723
72562
  import { StringDecoder as StringDecoder6 } from "node:string_decoder";
72724
- import { join as join40 } from "node:path";
72563
+ import { join as join39 } from "node:path";
72725
72564
  import { homedir as homedir16 } from "node:os";
72726
72565
  function formatTokens(n) {
72727
72566
  if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
@@ -73301,14 +73140,14 @@ function pruneScreenshotCache() {
73301
73140
  if (entries2.length <= SCREENSHOT_CACHE_MAX) return;
73302
73141
  const byMtime = entries2.map((n) => {
73303
73142
  try {
73304
- return { n, m: statSync18(join40(SCREENSHOT_CACHE_DIR, n)).mtimeMs };
73143
+ return { n, m: statSync17(join39(SCREENSHOT_CACHE_DIR, n)).mtimeMs };
73305
73144
  } catch {
73306
73145
  return { n, m: 0 };
73307
73146
  }
73308
73147
  }).sort((a, b) => b.m - a.m);
73309
73148
  for (const { n } of byMtime.slice(SCREENSHOT_CACHE_MAX)) {
73310
73149
  try {
73311
- unlinkSync7(join40(SCREENSHOT_CACHE_DIR, n));
73150
+ unlinkSync7(join39(SCREENSHOT_CACHE_DIR, n));
73312
73151
  } catch {
73313
73152
  }
73314
73153
  }
@@ -73338,14 +73177,14 @@ function persistBase64Image(mediaType, data, idKey) {
73338
73177
  const ext = IMAGE_MEDIA_EXT[typeof mediaType === "string" ? mediaType.toLowerCase() : ""];
73339
73178
  if (!ext || !data) return void 0;
73340
73179
  const name = createHash14("sha256").update(idKey).digest("hex").slice(0, 32);
73341
- const path3 = join40(SCREENSHOT_CACHE_DIR, `${name}.${ext}`);
73180
+ const path3 = join39(SCREENSHOT_CACHE_DIR, `${name}.${ext}`);
73342
73181
  try {
73343
73182
  if (existsSync17(path3)) return path3;
73344
73183
  if (data.length > SCREENSHOT_MAX_BASE64) return void 0;
73345
73184
  const buf = Buffer.from(data, "base64");
73346
73185
  if (buf.length === 0 || !looksLikeImage(buf, ext)) return void 0;
73347
73186
  mkdirSync18(SCREENSHOT_CACHE_DIR, { recursive: true });
73348
- const tmp = join40(SCREENSHOT_CACHE_DIR, `.${name}.${process.pid}.${screenshotTmpSeq++}.tmp`);
73187
+ const tmp = join39(SCREENSHOT_CACHE_DIR, `.${name}.${process.pid}.${screenshotTmpSeq++}.tmp`);
73349
73188
  writeFileSync12(tmp, buf);
73350
73189
  renameSync10(tmp, path3);
73351
73190
  pruneScreenshotCache();
@@ -73360,14 +73199,14 @@ function persistSentFile(srcPath, idKey) {
73360
73199
  const outExt = ext === "jpeg" ? "jpg" : ext;
73361
73200
  try {
73362
73201
  const name = createHash14("sha256").update(idKey).digest("hex").slice(0, 32);
73363
- const dest = join40(SCREENSHOT_CACHE_DIR, `${name}.${outExt}`);
73202
+ const dest = join39(SCREENSHOT_CACHE_DIR, `${name}.${outExt}`);
73364
73203
  if (existsSync17(dest)) return dest;
73365
- const size = statSync18(srcPath).size;
73204
+ const size = statSync17(srcPath).size;
73366
73205
  if (size === 0 || size > SENT_IMAGE_MAX_BYTES) return void 0;
73367
73206
  const buf = readFileSync27(srcPath);
73368
73207
  if (!looksLikeImage(buf, outExt)) return void 0;
73369
73208
  mkdirSync18(SCREENSHOT_CACHE_DIR, { recursive: true });
73370
- const tmp = join40(SCREENSHOT_CACHE_DIR, `.${name}.${process.pid}.${screenshotTmpSeq++}.tmp`);
73209
+ const tmp = join39(SCREENSHOT_CACHE_DIR, `.${name}.${process.pid}.${screenshotTmpSeq++}.tmp`);
73371
73210
  writeFileSync12(tmp, buf);
73372
73211
  renameSync10(tmp, dest);
73373
73212
  pruneScreenshotCache();
@@ -73825,16 +73664,16 @@ function verifyIncrementalParse(path3, identityPrefix, incremental) {
73825
73664
  }
73826
73665
  }
73827
73666
  function logDirOf(project) {
73828
- return join40(homedir16(), ".claude", "projects", project.cwdSlug);
73667
+ return join39(homedir16(), ".claude", "projects", project.cwdSlug);
73829
73668
  }
73830
73669
  function resolveTranscriptPath(project, sessionId) {
73831
- const path3 = join40(logDirOf(project), `${sessionId}.jsonl`);
73670
+ const path3 = join39(logDirOf(project), `${sessionId}.jsonl`);
73832
73671
  try {
73833
- if (statSync18(path3).size > 0) return path3;
73672
+ if (statSync17(path3).size > 0) return path3;
73834
73673
  } catch {
73835
73674
  }
73836
73675
  const stranded = discoverTranscriptDir(logDirOf(project), sessionId);
73837
- return stranded ? join40(stranded, `${sessionId}.jsonl`) : path3;
73676
+ return stranded ? join39(stranded, `${sessionId}.jsonl`) : path3;
73838
73677
  }
73839
73678
  function projectCodexTranscript(raw2, identityPrefix = "codex") {
73840
73679
  const out = [];
@@ -75805,12 +75644,12 @@ var init_background_shell_output = __esm({
75805
75644
  });
75806
75645
 
75807
75646
  // packages/server/src/image-header.ts
75808
- import { closeSync as closeSync16, openSync as openSync17, readSync as readSync10, statSync as statSync19 } from "node:fs";
75647
+ import { closeSync as closeSync16, openSync as openSync17, readSync as readSync10, statSync as statSync18 } from "node:fs";
75809
75648
  import { extname } from "node:path";
75810
75649
  function readHead3(path3, budget) {
75811
75650
  let fd2;
75812
75651
  try {
75813
- const size = statSync19(path3).size;
75652
+ const size = statSync18(path3).size;
75814
75653
  if (size === 0) return void 0;
75815
75654
  const buffer = Buffer.alloc(Math.min(size, budget));
75816
75655
  fd2 = openSync17(path3, "r");
@@ -76074,10 +75913,10 @@ var init_directory_picker = __esm({
76074
75913
  });
76075
75914
 
76076
75915
  // packages/server/src/router.ts
76077
- import { readFileSync as readFileSync28, statSync as statSync20 } from "node:fs";
76078
- import { join as join41, resolve as resolve10 } from "node:path";
75916
+ import { readFileSync as readFileSync28, statSync as statSync19 } from "node:fs";
75917
+ import { join as join40, resolve as resolve10 } from "node:path";
76079
75918
  import { randomUUID as randomUUID17 } from "node:crypto";
76080
- import { basename as basename9, dirname as dirname19 } from "node:path";
75919
+ import { basename as basename9, dirname as dirname18 } from "node:path";
76081
75920
  import { existsSync as existsSync18, mkdirSync as mkdirSync19, rmSync as rmSync11, writeFileSync as writeFileSync13 } from "node:fs";
76082
75921
  import { homedir as homedir17 } from "node:os";
76083
75922
  function validateGithubDispatchProfile(input) {
@@ -76252,11 +76091,11 @@ function projectCard(entry, stale) {
76252
76091
  function addProjectAtPath(input, home = homedir17()) {
76253
76092
  const typed = input.trim();
76254
76093
  if (!typed) throw new Error("Enter a folder path.");
76255
- const expanded = typed === "~" || typed.startsWith("~/") ? join41(home, typed.slice(1)) : typed;
76094
+ const expanded = typed === "~" || typed.startsWith("~/") ? join40(home, typed.slice(1)) : typed;
76256
76095
  const absolute = resolve10(expanded);
76257
76096
  let stats;
76258
76097
  try {
76259
- stats = statSync20(absolute);
76098
+ stats = statSync19(absolute);
76260
76099
  } catch {
76261
76100
  throw new Error(`No folder at ${absolute}`);
76262
76101
  }
@@ -76281,7 +76120,7 @@ function storeProjectIcon(id2, name, bytes) {
76281
76120
  if (!entry) throw new Error("No such project.");
76282
76121
  if (bytes.length === 0) throw new Error("That file is empty.");
76283
76122
  const path3 = customIconPath(id2, `.${extension2}`);
76284
- mkdirSync19(dirname19(path3), { recursive: true });
76123
+ mkdirSync19(dirname18(path3), { recursive: true });
76285
76124
  writeFileSync13(path3, bytes);
76286
76125
  if (!imageDimensions(path3)) {
76287
76126
  rmSync11(path3, { force: true });
@@ -76331,7 +76170,7 @@ function mergeSubAgentSteers(messages, steers) {
76331
76170
  return merged;
76332
76171
  }
76333
76172
  function createRouter(ctx) {
76334
- const frizzDir = join41(ctx.project.dir, ".frizz");
76173
+ const frizzDir = join40(ctx.project.dir, ".frizz");
76335
76174
  const openRoots = openableFileRoots(ctx.project);
76336
76175
  function isAutoTitledSession(slug) {
76337
76176
  return ctx.storage.getSession(slug)?.title_auto === 1;
@@ -76400,6 +76239,15 @@ function createRouter(ctx) {
76400
76239
  return void 0;
76401
76240
  }
76402
76241
  }
76242
+ function parseStoredAnswer(raw2) {
76243
+ if (!raw2) return void 0;
76244
+ try {
76245
+ const parsed = QuestionAnswerSchema.safeParse(JSON.parse(raw2));
76246
+ return parsed.success ? parsed.data : void 0;
76247
+ } catch {
76248
+ return void 0;
76249
+ }
76250
+ }
76403
76251
  function openQuestionViews(slug) {
76404
76252
  const out = [];
76405
76253
  for (const q10 of ctx.storage.listThreadQuestions(slug, { openOnly: true })) {
@@ -76643,6 +76491,25 @@ function createRouter(ctx) {
76643
76491
  return retireOpsInPage(input.slug, projectTranscriptPageAgentLifecycles(page, (id2) => ctx.tailer.subAgent(input.slug, id2), (taskId) => ctx.tailer.subAgentByTaskId?.(input.slug, taskId)));
76644
76492
  }
76645
76493
  }),
76494
+ // The thread's ANSWERED registered questions, each with its answer, so the transcript can keep the
76495
+ // card in the slot it stood in — greyed, showing only what was picked — instead of the ask vanishing
76496
+ // the instant it is sent. Per thread, not on the board: see SettledQuestionView. A row whose spec or
76497
+ // answer no longer parses is dropped, the same drop-don't-throw rule as the open list.
76498
+ threadSettledQuestions: query({
76499
+ input: SlugInput,
76500
+ output: ThreadSettledQuestionsResult,
76501
+ handler: async ({ input }) => {
76502
+ const questions = [];
76503
+ for (const q10 of ctx.storage.listThreadQuestions(input.slug)) {
76504
+ if (q10.state !== "answered" || q10.settled_at == null) continue;
76505
+ const spec = parseQuestionSpec(q10.spec);
76506
+ const answer = parseStoredAnswer(q10.answer);
76507
+ if (!spec || !answer) continue;
76508
+ questions.push({ id: q10.id, spec, askedAt: new Date(q10.asked_at).toISOString(), settledAt: new Date(q10.settled_at).toISOString(), answer });
76509
+ }
76510
+ return { questions };
76511
+ }
76512
+ }),
76646
76513
  // Runtime adapters create interactions internally. React gets only scoped reads and terminal
76647
76514
  // transitions; there is deliberately no public/provider-spoofable create RPC.
76648
76515
  pendingInteractions: query({
@@ -78244,33 +78111,6 @@ Say which way you went and why in your write-up, so the human can course-correct
78244
78111
  });
78245
78112
  }
78246
78113
  }),
78247
- // Slice B login utility: the sign-in modal's PRIMARY action. Starts (or re-attaches to) the one
78248
- // live `claude auth login` pty — login-utility.ts runs it on node-pty directly — addressed by a
78249
- // server-issued slug-shaped attempt id the browser then attaches to over the existing hardened
78250
- // /term transport.
78251
- accountLoginStart: mutation({
78252
- input: AccountLoginStartInput,
78253
- output: AccountLoginStartResult,
78254
- handler: async ({ input }) => ctx.loginUtility.start(input.backend)
78255
- }),
78256
- accountLoginStatus: query({
78257
- input: AccountLoginStatusInput,
78258
- output: AccountLoginStatusResult,
78259
- handler: async ({ input }) => {
78260
- const { state, backend } = ctx.loginUtility.status(input.attemptId);
78261
- const auth = await readAuthSnapshot({ claudeBin: ctx.claudeBin });
78262
- if (state === "exited") ctx.loginUtility.cancel(input.attemptId);
78263
- return { state, auth: backend === "acp" ? "unknown" : auth[backend ?? "claude"] };
78264
- }
78265
- }),
78266
- accountLoginCancel: mutation({
78267
- input: AccountLoginStatusInput,
78268
- output: external_exports.object({}),
78269
- handler: async ({ input }) => {
78270
- ctx.loginUtility.cancel(input.attemptId);
78271
- return {};
78272
- }
78273
- }),
78274
78114
  /**
78275
78115
  * Every project this machine knows about, most recently opened first.
78276
78116
  *
@@ -78889,7 +78729,7 @@ var init_compression = __esm({
78889
78729
  });
78890
78730
 
78891
78731
  // packages/server/src/local-image.ts
78892
- import { readFileSync as readFileSync29, realpathSync as realpathSync12, statSync as statSync21 } from "node:fs";
78732
+ import { readFileSync as readFileSync29, realpathSync as realpathSync12, statSync as statSync20 } from "node:fs";
78893
78733
  import { extname as extname2, isAbsolute as isAbsolute9 } from "node:path";
78894
78734
  function resolveLocalImage(rawPath) {
78895
78735
  if (rawPath) rawPath = normalizeLocalPath(rawPath);
@@ -78903,7 +78743,7 @@ function resolveLocalImage(rawPath) {
78903
78743
  return { status: 404 };
78904
78744
  }
78905
78745
  try {
78906
- if (!statSync21(real).isFile()) return { status: 404 };
78746
+ if (!statSync20(real).isFile()) return { status: 404 };
78907
78747
  return { status: 200, contentType, body: readFileSync29(real) };
78908
78748
  } catch {
78909
78749
  return { status: 404 };
@@ -78925,9 +78765,9 @@ var init_local_image = __esm({
78925
78765
  });
78926
78766
 
78927
78767
  // packages/server/src/project-icon.ts
78928
- import { readFileSync as readFileSync30, readdirSync as readdirSync12, realpathSync as realpathSync13, statSync as statSync22 } from "node:fs";
78768
+ import { readFileSync as readFileSync30, readdirSync as readdirSync12, realpathSync as realpathSync13, statSync as statSync21 } from "node:fs";
78929
78769
  import { homedir as homedir18 } from "node:os";
78930
- import { basename as basename10, dirname as dirname20, extname as extname3, join as join42, relative as relative2, sep as sep4 } from "node:path";
78770
+ import { basename as basename10, dirname as dirname19, extname as extname3, join as join41, relative as relative2, sep as sep4 } from "node:path";
78931
78771
  function normalizeStem(stem) {
78932
78772
  const sized = stem.toLowerCase().replace(/[@-]\d+(\.\d+)?x(\d+)?$/u, "").replace(/[-_]\d{2,4}$/u, "");
78933
78773
  const normalized = sized.replace(VARIANT_SUFFIX, "");
@@ -78945,7 +78785,7 @@ function sizeScore(dimensions) {
78945
78785
  return Math.max(0, Math.min(40, Math.round(Math.log2(edge / 24) * 8)));
78946
78786
  }
78947
78787
  function under(root, relativeDirectory) {
78948
- return relativeDirectory ? join42(root, relativeDirectory) : root;
78788
+ return relativeDirectory ? join41(root, relativeDirectory) : root;
78949
78789
  }
78950
78790
  function listFiles(directory) {
78951
78791
  try {
@@ -78967,19 +78807,19 @@ function iconDirectories(root) {
78967
78807
  for (const asset of ASSET_DIRECTORIES) directories.push(under(root, asset));
78968
78808
  for (const host of HOST_DIRECTORIES) {
78969
78809
  if (!children2.has(host)) continue;
78970
- for (const asset of ASSET_DIRECTORIES) directories.push(under(join42(root, host), asset));
78810
+ for (const asset of ASSET_DIRECTORIES) directories.push(under(join41(root, host), asset));
78971
78811
  }
78972
78812
  for (const extra of EXTRA_DIRECTORIES) directories.push(under(root, extra));
78973
78813
  for (const container of WORKSPACE_CONTAINERS) {
78974
78814
  if (!children2.has(container)) continue;
78975
78815
  let members;
78976
78816
  try {
78977
- members = readdirSync12(join42(root, container), { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name);
78817
+ members = readdirSync12(join41(root, container), { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name);
78978
78818
  } catch {
78979
78819
  continue;
78980
78820
  }
78981
78821
  for (const member of members) {
78982
- for (const asset of ASSET_DIRECTORIES) directories.push(under(join42(root, container, member), asset));
78822
+ for (const asset of ASSET_DIRECTORIES) directories.push(under(join41(root, container, member), asset));
78983
78823
  }
78984
78824
  }
78985
78825
  return [...new Set(directories)];
@@ -78992,8 +78832,8 @@ function manifestIcons(manifestPath) {
78992
78832
  return [];
78993
78833
  }
78994
78834
  if (!Array.isArray(parsed?.icons)) return [];
78995
- const directory = dirname20(manifestPath);
78996
- return parsed.icons.map((icon) => typeof icon?.src === "string" ? icon.src : void 0).filter((src) => !!src && !/^(https?:)?\/\//u.test(src) && !src.startsWith("data:")).map((src) => join42(directory, src.replace(/[?#].*$/u, "").replace(/^\//u, "")));
78835
+ const directory = dirname19(manifestPath);
78836
+ return parsed.icons.map((icon) => typeof icon?.src === "string" ? icon.src : void 0).filter((src) => !!src && !/^(https?:)?\/\//u.test(src) && !src.startsWith("data:")).map((src) => join41(directory, src.replace(/[?#].*$/u, "").replace(/^\//u, "")));
78997
78837
  }
78998
78838
  function projectIconCandidates(root) {
78999
78839
  const projectStem = normalizeStem(basename10(root)).normalized;
@@ -79012,10 +78852,10 @@ function projectIconCandidates(root) {
79012
78852
  for (const name of listFiles(directory)) {
79013
78853
  const extension2 = extname3(name).toLowerCase();
79014
78854
  if (MANIFEST_NAMES.includes(name.toLowerCase())) {
79015
- for (const icon of manifestIcons(join42(directory, name))) {
78855
+ for (const icon of manifestIcons(join41(directory, name))) {
79016
78856
  if (MEASURABLE_IMAGE_EXTENSIONS.has(extname3(icon).toLowerCase())) {
79017
78857
  fromManifest.add(icon);
79018
- files.push({ path: icon, directory: dirname20(icon) });
78858
+ files.push({ path: icon, directory: dirname19(icon) });
79019
78859
  }
79020
78860
  }
79021
78861
  continue;
@@ -79023,7 +78863,7 @@ function projectIconCandidates(root) {
79023
78863
  if (!MEASURABLE_IMAGE_EXTENSIONS.has(extension2)) continue;
79024
78864
  const stem = name.slice(0, name.length - extension2.length);
79025
78865
  if (normalizeStem(stem).normalized === "favicon") iconHomes.add(directory);
79026
- files.push({ path: join42(directory, name), directory });
78866
+ files.push({ path: join41(directory, name), directory });
79027
78867
  if (files.length >= MAX_CANDIDATES) break;
79028
78868
  }
79029
78869
  }
@@ -79075,7 +78915,7 @@ function resolveProjectIconResponse(id2, options = {}) {
79075
78915
  let real;
79076
78916
  try {
79077
78917
  real = realpathSync13(path3);
79078
- if (!statSync22(real).isFile()) return { status: 404 };
78918
+ if (!statSync21(real).isFile()) return { status: 404 };
79079
78919
  } catch {
79080
78920
  return { status: 404 };
79081
78921
  }
@@ -79200,8 +79040,8 @@ var init_project_icon = __esm({
79200
79040
  });
79201
79041
 
79202
79042
  // packages/server/src/local-visualization.ts
79203
- import { readdirSync as readdirSync13, readFileSync as readFileSync31, realpathSync as realpathSync14, statSync as statSync23 } from "node:fs";
79204
- import { join as join43, sep as sep5 } from "node:path";
79043
+ import { readdirSync as readdirSync13, readFileSync as readFileSync31, realpathSync as realpathSync14, statSync as statSync22 } from "node:fs";
79044
+ import { join as join42, sep as sep5 } from "node:path";
79205
79045
  function children(path3, pattern) {
79206
79046
  try {
79207
79047
  return readdirSync13(path3, { withFileTypes: true }).filter((entry) => entry.isDirectory() && pattern.test(entry.name)).map((entry) => entry.name).sort().reverse();
@@ -79213,7 +79053,7 @@ function isUnder2(path3, root) {
79213
79053
  return path3 === root || path3.startsWith(root.endsWith(sep5) ? root : root + sep5);
79214
79054
  }
79215
79055
  function resolveFragment(projectDir, sessionId, file) {
79216
- const base = join43(projectDir, ".codex", "visualizations");
79056
+ const base = join42(projectDir, ".codex", "visualizations");
79217
79057
  let projectReal;
79218
79058
  let baseReal;
79219
79059
  try {
@@ -79224,15 +79064,15 @@ function resolveFragment(projectDir, sessionId, file) {
79224
79064
  }
79225
79065
  if (!isUnder2(baseReal, projectReal)) return null;
79226
79066
  for (const year of children(base, YEAR_PART)) {
79227
- const yearDir = join43(base, year);
79067
+ const yearDir = join42(base, year);
79228
79068
  for (const month of children(yearDir, DATE_PART)) {
79229
- const monthDir = join43(yearDir, month);
79069
+ const monthDir = join42(yearDir, month);
79230
79070
  for (const day of children(monthDir, DATE_PART)) {
79231
- const sessionRoot = join43(baseReal, year, month, day, sessionId);
79232
- const candidate = join43(monthDir, day, sessionId, file);
79071
+ const sessionRoot = join42(baseReal, year, month, day, sessionId);
79072
+ const candidate = join42(monthDir, day, sessionId, file);
79233
79073
  try {
79234
79074
  const real = realpathSync14(candidate);
79235
- if (isUnder2(real, sessionRoot) && statSync23(real).isFile()) return real;
79075
+ if (isUnder2(real, sessionRoot) && statSync22(real).isFile()) return real;
79236
79076
  } catch {
79237
79077
  }
79238
79078
  }
@@ -79317,7 +79157,7 @@ function resolveLocalVisualization(projectDir, sessionId, file) {
79317
79157
  if (!path3) return { status: 404 };
79318
79158
  let fragment;
79319
79159
  try {
79320
- const size = statSync23(path3).size;
79160
+ const size = statSync22(path3).size;
79321
79161
  if (size > MAX_FRAGMENT_BYTES) return { status: 413 };
79322
79162
  fragment = readFileSync31(path3, "utf8");
79323
79163
  } catch {
@@ -79362,7 +79202,7 @@ var init_local_visualization = __esm({
79362
79202
 
79363
79203
  // packages/server/src/app.ts
79364
79204
  import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync14 } from "node:fs";
79365
- import { join as join44 } from "node:path";
79205
+ import { join as join43 } from "node:path";
79366
79206
  import { randomUUID as randomUUID18 } from "node:crypto";
79367
79207
  function createApp(ctx, options = {}) {
79368
79208
  const app = new Hono2();
@@ -79466,10 +79306,10 @@ function createApp(ctx, options = {}) {
79466
79306
  if (typeof body.data !== "string" || body.data.length > ATTACHMENT_MAX_BASE64_CHARS) return c.json({ error: "bad payload" }, 400);
79467
79307
  const ext = `.${attachmentExtension(name)}`;
79468
79308
  const buf = Buffer.from(body.data, "base64");
79469
- const dir = join44(ctx.project.stateDir, "attachments");
79309
+ const dir = join43(ctx.project.stateDir, "attachments");
79470
79310
  mkdirSync20(dir, { recursive: true });
79471
79311
  const base = name.replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9_-]+/g, "-").slice(0, 40) || "file";
79472
- const path3 = join44(dir, `${Date.now()}-${randomUUID18().slice(0, 8)}-${base}${ext}`);
79312
+ const path3 = join43(dir, `${Date.now()}-${randomUUID18().slice(0, 8)}-${base}${ext}`);
79473
79313
  writeFileSync14(path3, buf);
79474
79314
  return c.json({ path: path3 });
79475
79315
  });
@@ -79527,407 +79367,6 @@ var init_app = __esm({
79527
79367
  }
79528
79368
  });
79529
79369
 
79530
- // packages/server/src/terminal.ts
79531
- import "node-pty";
79532
- function parseTermClientMsg(raw2) {
79533
- let value;
79534
- try {
79535
- value = JSON.parse(raw2);
79536
- } catch {
79537
- return null;
79538
- }
79539
- if (!value || typeof value !== "object" || Array.isArray(value)) return null;
79540
- const msg = value;
79541
- if (msg.t === "input") {
79542
- if (Object.keys(msg).length !== 2 || !Object.prototype.hasOwnProperty.call(msg, "d") || typeof msg.d !== "string" || Buffer.byteLength(msg.d, "utf8") > TERMINAL_MAX_INPUT_BYTES) return null;
79543
- return { t: "input", d: msg.d };
79544
- }
79545
- if (msg.t === "resize") {
79546
- if (Object.keys(msg).length !== 3 || !Object.prototype.hasOwnProperty.call(msg, "cols") || !Object.prototype.hasOwnProperty.call(msg, "rows")) return null;
79547
- const cols = msg.cols;
79548
- const rows = msg.rows;
79549
- if (!Number.isFinite(cols) || !Number.isInteger(cols) || !Number.isFinite(rows) || !Number.isInteger(rows) || cols < 1 || rows < 1 || cols > TERMINAL_MAX_COLS || rows > TERMINAL_MAX_ROWS) {
79550
- return null;
79551
- }
79552
- return { t: "resize", cols, rows };
79553
- }
79554
- return null;
79555
- }
79556
- function parseTermSlug(url) {
79557
- const path3 = (url ?? "").split("?")[0];
79558
- const m = path3.match(TERM_PATH);
79559
- if (!m) return null;
79560
- const parsed = ThreadSlug.safeParse(m[1]);
79561
- return parsed.success ? parsed.data : null;
79562
- }
79563
- function adaptLoginSource(attachment) {
79564
- return {
79565
- onData(listener) {
79566
- const unsubscribe = attachment.onData(listener);
79567
- const replay = attachment.replay();
79568
- if (replay) queueMicrotask(() => listener(replay));
79569
- return { dispose: unsubscribe };
79570
- },
79571
- onExit(listener) {
79572
- const unsubscribe = attachment.onExit(() => listener({ exitCode: 0 }));
79573
- return { dispose: unsubscribe };
79574
- },
79575
- resize: (cols, rows) => attachment.resize(cols, rows),
79576
- write: (data) => attachment.write(data),
79577
- // Deliberately does NOT kill the login pty: closing one tab must not abandon an OAuth flow another
79578
- // tab is still driving, and the utility owns that lifecycle (cancel / success / timeout / stop).
79579
- kill: () => attachment.close()
79580
- };
79581
- }
79582
- function createTerminalServer(deps = {}) {
79583
- const wss = new import_websocket_server.default({ noServer: true, maxPayload: TERMINAL_MAX_MESSAGE_BYTES });
79584
- let closing = false;
79585
- let closePromise = null;
79586
- const configuredInteger = (value, fallback, minimum = 0) => value !== void 0 && Number.isSafeInteger(value) && value >= minimum ? value : fallback;
79587
- const maxOutputBufferBytes = configuredInteger(
79588
- deps.maxOutputBufferBytes,
79589
- TERMINAL_MAX_OUTPUT_BUFFER_BYTES
79590
- );
79591
- const maxViewers = configuredInteger(deps.maxViewers, TERMINAL_MAX_VIEWERS);
79592
- const maxViewersPerSlug = configuredInteger(
79593
- deps.maxViewersPerSlug,
79594
- TERMINAL_MAX_VIEWERS_PER_SLUG
79595
- );
79596
- const inputRateWindowMs = configuredInteger(
79597
- deps.inputRateWindowMs,
79598
- TERMINAL_INPUT_RATE_WINDOW_MS,
79599
- 1
79600
- );
79601
- const maxInputFramesPerWindow = configuredInteger(
79602
- deps.maxInputFramesPerWindow,
79603
- TERMINAL_MAX_INPUT_FRAMES_PER_WINDOW
79604
- );
79605
- const maxInputBytesPerWindow = configuredInteger(
79606
- deps.maxInputBytesPerWindow,
79607
- TERMINAL_MAX_INPUT_BYTES_PER_WINDOW
79608
- );
79609
- const closeGraceMs = configuredInteger(deps.closeGraceMs, TERMINAL_CLOSE_GRACE_MS);
79610
- const shutdownGraceMs = configuredInteger(
79611
- deps.shutdownGraceMs,
79612
- TERMINAL_SHUTDOWN_GRACE_MS
79613
- );
79614
- const now = deps.now ?? Date.now;
79615
- const terminateSocket = deps.terminateSocket ?? ((ws2) => ws2.terminate());
79616
- let viewerCount = 0;
79617
- const viewersPerSlug = /* @__PURE__ */ new Map();
79618
- const viewers = /* @__PURE__ */ new Set();
79619
- const pendingUpgrades = /* @__PURE__ */ new Set();
79620
- const reserveViewer = (slug) => {
79621
- const slugCount = viewersPerSlug.get(slug) ?? 0;
79622
- if (viewerCount >= maxViewers || slugCount >= maxViewersPerSlug) return null;
79623
- viewerCount += 1;
79624
- viewersPerSlug.set(slug, slugCount + 1);
79625
- let released = false;
79626
- return {
79627
- slug,
79628
- release() {
79629
- if (released) return;
79630
- released = true;
79631
- viewerCount -= 1;
79632
- const nextSlugCount = (viewersPerSlug.get(slug) ?? 1) - 1;
79633
- if (nextSlugCount <= 0) viewersPerSlug.delete(slug);
79634
- else viewersPerSlug.set(slug, nextSlugCount);
79635
- }
79636
- };
79637
- };
79638
- const rawDataBuffer = (raw2) => {
79639
- if (Buffer.isBuffer(raw2)) return raw2;
79640
- if (Array.isArray(raw2)) return Buffer.concat(raw2);
79641
- return Buffer.from(raw2);
79642
- };
79643
- wss.on("error", () => {
79644
- });
79645
- const acceptViewer = (ws2, slug, reservation) => {
79646
- let term;
79647
- let cleaned = false;
79648
- let closeStarted = false;
79649
- let terminated = false;
79650
- let forceCloseTimer;
79651
- let dataSubscription;
79652
- let exitSubscription;
79653
- const inputWindow = [];
79654
- let inputWindowBytes = 0;
79655
- const cleanup = () => {
79656
- if (cleaned) return;
79657
- cleaned = true;
79658
- reservation.release();
79659
- const ownedDataSubscription = dataSubscription;
79660
- dataSubscription = void 0;
79661
- const ownedExitSubscription = exitSubscription;
79662
- exitSubscription = void 0;
79663
- try {
79664
- ownedDataSubscription?.dispose();
79665
- } catch {
79666
- }
79667
- try {
79668
- ownedExitSubscription?.dispose();
79669
- } catch {
79670
- }
79671
- const ownedTerm = term;
79672
- term = void 0;
79673
- if (ownedTerm) {
79674
- try {
79675
- ownedTerm.kill();
79676
- } catch {
79677
- }
79678
- }
79679
- };
79680
- let viewer;
79681
- const forceTerminate = () => {
79682
- if (terminated) return;
79683
- terminated = true;
79684
- cleanup();
79685
- try {
79686
- terminateSocket(ws2);
79687
- } catch {
79688
- }
79689
- viewers.delete(viewer);
79690
- };
79691
- const beginClose = (code, reason) => {
79692
- if (closeStarted) return;
79693
- closeStarted = true;
79694
- cleanup();
79695
- if (ws2.readyState === import_websocket.default.CLOSED) {
79696
- viewers.delete(viewer);
79697
- return;
79698
- }
79699
- forceCloseTimer = setTimeout(forceTerminate, closeGraceMs);
79700
- forceCloseTimer.unref?.();
79701
- try {
79702
- if (ws2.readyState === import_websocket.default.OPEN || ws2.readyState === import_websocket.default.CONNECTING) {
79703
- ws2.close(code, reason);
79704
- }
79705
- } catch {
79706
- forceTerminate();
79707
- }
79708
- };
79709
- viewer = {
79710
- cleanup,
79711
- shutdown() {
79712
- closeStarted = true;
79713
- cleanup();
79714
- forceTerminate();
79715
- }
79716
- };
79717
- viewers.add(viewer);
79718
- ws2.once("close", () => {
79719
- clearTimeout(forceCloseTimer);
79720
- cleanup();
79721
- viewers.delete(viewer);
79722
- });
79723
- ws2.on("error", () => beginClose(1011, "terminal transport failed"));
79724
- if (closing) {
79725
- viewer.shutdown();
79726
- return;
79727
- }
79728
- let loginAttachment = null;
79729
- try {
79730
- loginAttachment = deps.resolveLogin?.(slug) ?? null;
79731
- } catch {
79732
- beginClose(1011, "terminal unavailable");
79733
- return;
79734
- }
79735
- if (!loginAttachment) {
79736
- beginClose(1008, "terminal attach denied");
79737
- return;
79738
- }
79739
- try {
79740
- term = adaptLoginSource(loginAttachment);
79741
- } catch {
79742
- beginClose(1011, "terminal unavailable");
79743
- return;
79744
- }
79745
- const acceptInputSample = (bytes) => {
79746
- const at2 = now();
79747
- const cutoff = at2 - inputRateWindowMs;
79748
- while (inputWindow.length > 0 && inputWindow[0].at <= cutoff) {
79749
- inputWindowBytes -= inputWindow.shift().bytes;
79750
- }
79751
- if (inputWindow.length + 1 > maxInputFramesPerWindow || inputWindowBytes + bytes > maxInputBytesPerWindow) {
79752
- return false;
79753
- }
79754
- inputWindow.push({ at: at2, bytes });
79755
- inputWindowBytes += bytes;
79756
- return true;
79757
- };
79758
- try {
79759
- dataSubscription = term.onData((d) => {
79760
- if (cleaned || ws2.readyState !== import_websocket.default.OPEN) return;
79761
- if (ws2.bufferedAmount + Buffer.byteLength(d, "utf8") > maxOutputBufferBytes) {
79762
- beginClose(1013, "terminal viewer overloaded");
79763
- return;
79764
- }
79765
- try {
79766
- ws2.send(d, (error) => {
79767
- if (error) beginClose(1011, "terminal transport failed");
79768
- });
79769
- } catch {
79770
- beginClose(1011, "terminal transport failed");
79771
- }
79772
- });
79773
- exitSubscription = term.onExit(({ exitCode }) => {
79774
- if (!cleaned) beginClose(1e3, `pty exit ${exitCode}`);
79775
- });
79776
- } catch {
79777
- beginClose(1011, "terminal unavailable");
79778
- return;
79779
- }
79780
- ws2.on("message", (raw2, isBinary) => {
79781
- if (cleaned) return;
79782
- if (isBinary) {
79783
- beginClose(1003, "terminal text frames required");
79784
- return;
79785
- }
79786
- const payload = rawDataBuffer(raw2);
79787
- if (!acceptInputSample(payload.byteLength)) {
79788
- beginClose(1013, "terminal input rate limited");
79789
- return;
79790
- }
79791
- const msg = parseTermClientMsg(payload.toString("utf8"));
79792
- if (!msg) {
79793
- beginClose(1008, "invalid terminal message");
79794
- return;
79795
- }
79796
- const activeTerm = term;
79797
- if (!activeTerm) return;
79798
- try {
79799
- if (msg.t === "input") activeTerm.write(msg.d);
79800
- else {
79801
- activeTerm.resize(msg.cols, msg.rows);
79802
- }
79803
- } catch {
79804
- beginClose(1011, "terminal unavailable");
79805
- }
79806
- });
79807
- };
79808
- return {
79809
- handleUpgrade(req, socket, head) {
79810
- const slug = parseTermSlug(req.url);
79811
- if (slug === null) return false;
79812
- if (closing) {
79813
- rejectWebSocketUpgrade(socket, 503, "Service Unavailable");
79814
- return true;
79815
- }
79816
- if (!isTrustedLocalWebSocketRequest(req)) {
79817
- rejectWebSocketUpgrade(socket);
79818
- return true;
79819
- }
79820
- const reservation = reserveViewer(slug);
79821
- if (!reservation) {
79822
- rejectWebSocketUpgrade(socket, 429, "Too Many Requests");
79823
- return true;
79824
- }
79825
- let finished = false;
79826
- const finishPending = () => {
79827
- if (finished) return false;
79828
- finished = true;
79829
- pendingUpgrades.delete(pending);
79830
- socket.removeListener("close", abandonPending);
79831
- socket.removeListener("error", abandonPending);
79832
- return true;
79833
- };
79834
- const abandonPending = () => {
79835
- if (finishPending()) reservation.release();
79836
- };
79837
- const pending = {
79838
- abort(status, reason) {
79839
- if (!finishPending()) return;
79840
- reservation.release();
79841
- if (status) rejectWebSocketUpgrade(socket, status, reason);
79842
- else {
79843
- try {
79844
- socket.destroy();
79845
- } catch {
79846
- }
79847
- }
79848
- }
79849
- };
79850
- pendingUpgrades.add(pending);
79851
- socket.once("close", abandonPending);
79852
- socket.once("error", abandonPending);
79853
- try {
79854
- wss.handleUpgrade(req, socket, head, (ws2) => {
79855
- if (!finishPending()) {
79856
- try {
79857
- ws2.terminate();
79858
- } catch {
79859
- }
79860
- return;
79861
- }
79862
- try {
79863
- acceptViewer(ws2, slug, reservation);
79864
- } catch {
79865
- reservation.release();
79866
- try {
79867
- ws2.terminate();
79868
- } catch {
79869
- }
79870
- }
79871
- });
79872
- } catch {
79873
- pending.abort(400, "Bad Request");
79874
- }
79875
- return true;
79876
- },
79877
- close() {
79878
- if (closePromise) return closePromise;
79879
- closing = true;
79880
- closePromise = (async () => {
79881
- for (const pending of [...pendingUpgrades]) {
79882
- pending.abort(503, "Service Unavailable");
79883
- }
79884
- for (const viewer of [...viewers]) viewer.shutdown();
79885
- let drainTimer;
79886
- const boundedServerDrain = new Promise((resolve13) => {
79887
- let resolved2 = false;
79888
- const finish = () => {
79889
- if (resolved2) return;
79890
- resolved2 = true;
79891
- clearTimeout(drainTimer);
79892
- resolve13();
79893
- };
79894
- drainTimer = setTimeout(finish, shutdownGraceMs);
79895
- try {
79896
- wss.close(finish);
79897
- } catch {
79898
- finish();
79899
- }
79900
- });
79901
- await boundedServerDrain;
79902
- viewers.clear();
79903
- })();
79904
- return closePromise;
79905
- }
79906
- };
79907
- }
79908
- var TERM_PATH, TERMINAL_MAX_INPUT_BYTES, TERMINAL_MAX_MESSAGE_BYTES, TERMINAL_MAX_COLS, TERMINAL_MAX_ROWS, TERMINAL_MAX_OUTPUT_BUFFER_BYTES, TERMINAL_MAX_VIEWERS, TERMINAL_MAX_VIEWERS_PER_SLUG, TERMINAL_INPUT_RATE_WINDOW_MS, TERMINAL_MAX_INPUT_FRAMES_PER_WINDOW, TERMINAL_MAX_INPUT_BYTES_PER_WINDOW, TERMINAL_CLOSE_GRACE_MS, TERMINAL_SHUTDOWN_GRACE_MS;
79909
- var init_terminal = __esm({
79910
- "packages/server/src/terminal.ts"() {
79911
- "use strict";
79912
- init_wrapper();
79913
- init_src();
79914
- init_local_origin();
79915
- TERM_PATH = new RegExp(`^${FRIZZ_ROUTE_PREFIX}/term/([^/?]+)$`);
79916
- TERMINAL_MAX_INPUT_BYTES = 1048576;
79917
- TERMINAL_MAX_MESSAGE_BYTES = TERMINAL_MAX_INPUT_BYTES + 1024;
79918
- TERMINAL_MAX_COLS = 1e3;
79919
- TERMINAL_MAX_ROWS = 1e3;
79920
- TERMINAL_MAX_OUTPUT_BUFFER_BYTES = 4 * 1024 * 1024;
79921
- TERMINAL_MAX_VIEWERS = 32;
79922
- TERMINAL_MAX_VIEWERS_PER_SLUG = 8;
79923
- TERMINAL_INPUT_RATE_WINDOW_MS = 1e3;
79924
- TERMINAL_MAX_INPUT_FRAMES_PER_WINDOW = 120;
79925
- TERMINAL_MAX_INPUT_BYTES_PER_WINDOW = 2 * TERMINAL_MAX_MESSAGE_BYTES;
79926
- TERMINAL_CLOSE_GRACE_MS = 250;
79927
- TERMINAL_SHUTDOWN_GRACE_MS = 500;
79928
- }
79929
- });
79930
-
79931
79370
  // packages/server/src/app-socket.ts
79932
79371
  import { createHash as createHash15 } from "node:crypto";
79933
79372
  function isWsPath(url) {
@@ -80790,11 +80229,11 @@ var init_app_socket = __esm({
80790
80229
  });
80791
80230
 
80792
80231
  // packages/server/src/local-file-watch.ts
80793
- import { statSync as statSync24, watch } from "node:fs";
80794
- import { basename as basename11, dirname as dirname21 } from "node:path";
80232
+ import { statSync as statSync23, watch } from "node:fs";
80233
+ import { basename as basename11, dirname as dirname20 } from "node:path";
80795
80234
  function stampOf(path3) {
80796
80235
  try {
80797
- const s = statSync24(path3, { bigint: true });
80236
+ const s = statSync23(path3, { bigint: true });
80798
80237
  return `${s.ino}:${s.size}:${s.mtimeNs}`;
80799
80238
  } catch {
80800
80239
  return "gone";
@@ -80814,7 +80253,7 @@ function watchLocalFile(path3, onChange) {
80814
80253
  let entry = entries.get(path3);
80815
80254
  if (!entry) {
80816
80255
  const name = basename11(path3);
80817
- const watcher2 = watch(dirname21(path3), { persistent: false }, (_event, changed) => {
80256
+ const watcher2 = watch(dirname20(path3), { persistent: false }, (_event, changed) => {
80818
80257
  if (changed !== null && changed !== void 0 && changed.toString() !== name) return;
80819
80258
  const current = entries.get(path3);
80820
80259
  if (!current) return;
@@ -80851,9 +80290,9 @@ var init_local_file_watch = __esm({
80851
80290
 
80852
80291
  // packages/server/src/boot-progress.ts
80853
80292
  import { mkdirSync as mkdirSync21, readFileSync as readFileSync32, renameSync as renameSync11, rmSync as rmSync12, writeFileSync as writeFileSync15 } from "node:fs";
80854
- import { basename as basename12, dirname as dirname22, join as join45 } from "node:path";
80293
+ import { basename as basename12, dirname as dirname21, join as join44 } from "node:path";
80855
80294
  function bootProgressPath(stateDir) {
80856
- return join45(stateDir, BOOT_PROGRESS_NAME);
80295
+ return join44(stateDir, BOOT_PROGRESS_NAME);
80857
80296
  }
80858
80297
  function createBootProgressPublisher(stateDir, minIntervalMs = 200) {
80859
80298
  if (!stateDir) {
@@ -80873,8 +80312,8 @@ function createBootProgressPublisher(stateDir, minIntervalMs = 200) {
80873
80312
  lastAt = now;
80874
80313
  step++;
80875
80314
  try {
80876
- mkdirSync21(dirname22(path3), { recursive: true, mode: 448 });
80877
- const temp = join45(dirname22(path3), `.${basename12(path3)}.${process.pid}.tmp`);
80315
+ mkdirSync21(dirname21(path3), { recursive: true, mode: 448 });
80316
+ const temp = join44(dirname21(path3), `.${basename12(path3)}.${process.pid}.tmp`);
80878
80317
  writeFileSync15(temp, `${JSON.stringify({ pid: process.pid, step, phase, at: new Date(now).toISOString() })}
80879
80318
  `, "utf8");
80880
80319
  renameSync11(temp, path3);
@@ -80901,12 +80340,12 @@ var init_boot_progress = __esm({
80901
80340
 
80902
80341
  // packages/server/src/runtime-lease.ts
80903
80342
  import { existsSync as existsSync19, mkdirSync as mkdirSync22, readdirSync as readdirSync14, readFileSync as readFileSync33, unlinkSync as unlinkSync8, writeFileSync as writeFileSync16 } from "node:fs";
80904
- import { dirname as dirname23, join as join46 } from "node:path";
80343
+ import { dirname as dirname22, join as join45 } from "node:path";
80905
80344
  function runtimeVersionDir(bin) {
80906
- let dir = dirname23(bin);
80345
+ let dir = dirname22(bin);
80907
80346
  for (let step = 0; step < MAX_ASCENT; step++) {
80908
- if (existsSync19(join46(dir, PROVISIONED_MARKER))) return dir;
80909
- const parent = dirname23(dir);
80347
+ if (existsSync19(join45(dir, PROVISIONED_MARKER))) return dir;
80348
+ const parent = dirname22(dir);
80910
80349
  if (parent === dir) return void 0;
80911
80350
  dir = parent;
80912
80351
  }
@@ -80924,9 +80363,9 @@ function leaseRuntime(bin, role) {
80924
80363
  const versionDir = runtimeVersionDir(bin);
80925
80364
  if (!versionDir) return () => {
80926
80365
  };
80927
- const path3 = join46(versionDir, LEASES_DIR, `${process.pid}.json`);
80366
+ const path3 = join45(versionDir, LEASES_DIR, `${process.pid}.json`);
80928
80367
  try {
80929
- mkdirSync22(dirname23(path3), { recursive: true });
80368
+ mkdirSync22(dirname22(path3), { recursive: true });
80930
80369
  const lease = { pid: process.pid, role, bin, at: (/* @__PURE__ */ new Date()).toISOString() };
80931
80370
  writeFileSync16(path3, JSON.stringify(lease));
80932
80371
  } catch {
@@ -80941,7 +80380,7 @@ function leaseRuntime(bin, role) {
80941
80380
  };
80942
80381
  }
80943
80382
  function liveRuntimeLeases(versionDir) {
80944
- const dir = join46(versionDir, LEASES_DIR);
80383
+ const dir = join45(versionDir, LEASES_DIR);
80945
80384
  let names;
80946
80385
  try {
80947
80386
  names = readdirSync14(dir);
@@ -80951,7 +80390,7 @@ function liveRuntimeLeases(versionDir) {
80951
80390
  const live = [];
80952
80391
  for (const name of names) {
80953
80392
  if (!name.endsWith(".json")) continue;
80954
- const path3 = join46(dir, name);
80393
+ const path3 = join45(dir, name);
80955
80394
  let lease;
80956
80395
  try {
80957
80396
  lease = JSON.parse(readFileSync33(path3, "utf8"));
@@ -80983,7 +80422,7 @@ var init_runtime_lease = __esm({
80983
80422
  // packages/server/src/runtimes.ts
80984
80423
  import { createHash as createHash16 } from "node:crypto";
80985
80424
  import {
80986
- chmodSync as chmodSync2,
80425
+ chmodSync,
80987
80426
  closeSync as closeSync17,
80988
80427
  existsSync as existsSync20,
80989
80428
  mkdirSync as mkdirSync23,
@@ -80992,18 +80431,18 @@ import {
80992
80431
  readdirSync as readdirSync15,
80993
80432
  renameSync as renameSync12,
80994
80433
  rmSync as rmSync13,
80995
- statSync as statSync25,
80434
+ statSync as statSync24,
80996
80435
  writeFileSync as writeFileSync17,
80997
80436
  writeSync as writeSync2
80998
80437
  } from "node:fs";
80999
- import { dirname as dirname24, isAbsolute as isAbsolute10, join as join47, normalize, relative as relative3, sep as sep6 } from "node:path";
80438
+ import { dirname as dirname23, isAbsolute as isAbsolute10, join as join46, normalize, relative as relative3, sep as sep6 } from "node:path";
81000
80439
  import { Readable, Transform, Writable as Writable4 } from "node:stream";
81001
80440
  import { pipeline } from "node:stream/promises";
81002
80441
  import { createGunzip } from "node:zlib";
81003
80442
  function runtimesRoot(env = process.env) {
81004
80443
  const override = env[RUNTIMES_DIR_ENV];
81005
80444
  if (override && isAbsolute10(override)) return override;
81006
- return join47(frizzRoots().cache, "runtimes");
80445
+ return join46(frizzRoots().cache, "runtimes");
81007
80446
  }
81008
80447
  function isMusl() {
81009
80448
  if (process.platform !== "linux") return false;
@@ -81020,15 +80459,15 @@ function runtimeCoordinates(backend, platform3 = process.platform, arch = proces
81020
80459
  return { pkg: "@openai/codex", packageVersion: `${CODEX_VERSION}-${platform3}-${arch}`, label: CODEX_VERSION, binary: `codex${exe}` };
81021
80460
  }
81022
80461
  function provisionedBinary(backend, root, label) {
81023
- const dir = join47(root, backend, label);
80462
+ const dir = join46(root, backend, label);
81024
80463
  let marker;
81025
80464
  try {
81026
- marker = JSON.parse(readFileSync34(join47(dir, MARKER), "utf8"));
80465
+ marker = JSON.parse(readFileSync34(join46(dir, MARKER), "utf8"));
81027
80466
  } catch {
81028
80467
  return void 0;
81029
80468
  }
81030
80469
  if (typeof marker.binary !== "string" || marker.label !== label) return void 0;
81031
- const bin = join47(dir, marker.binary);
80470
+ const bin = join46(dir, marker.binary);
81032
80471
  return existsSync20(bin) ? bin : void 0;
81033
80472
  }
81034
80473
  function octal(buffer, offset, length) {
@@ -81043,17 +80482,17 @@ function safeEntryPath(dest, name) {
81043
80482
  if (parts.length < 2) return void 0;
81044
80483
  const rel = normalize(parts.slice(1).join(sep6));
81045
80484
  if (isAbsolute10(rel) || rel === ".." || rel.startsWith(`..${sep6}`)) return void 0;
81046
- const full = join47(dest, rel);
80485
+ const full = join46(dest, rel);
81047
80486
  const back = relative3(dest, full);
81048
80487
  if (back.startsWith("..") || isAbsolute10(back)) return void 0;
81049
80488
  return full;
81050
80489
  }
81051
80490
  function locateBinary(dir, backend, binary) {
81052
80491
  if (backend === "claude") {
81053
- const direct = join47(dir, binary);
80492
+ const direct = join46(dir, binary);
81054
80493
  return existsSync20(direct) ? direct : void 0;
81055
80494
  }
81056
- const vendor = join47(dir, "vendor");
80495
+ const vendor = join46(dir, "vendor");
81057
80496
  let triples;
81058
80497
  try {
81059
80498
  triples = readdirSync15(vendor);
@@ -81061,7 +80500,7 @@ function locateBinary(dir, backend, binary) {
81061
80500
  return void 0;
81062
80501
  }
81063
80502
  for (const triple of triples) {
81064
- const candidate = join47(vendor, triple, "bin", binary);
80503
+ const candidate = join46(vendor, triple, "bin", binary);
81065
80504
  if (existsSync20(candidate)) return candidate;
81066
80505
  }
81067
80506
  return void 0;
@@ -81077,9 +80516,9 @@ async function provisionRuntime(backend, options) {
81077
80516
  const registry = options.registry ?? REGISTRY;
81078
80517
  const progress = options.onProgress ?? (() => {
81079
80518
  });
81080
- const backendDir = join47(root, backend);
81081
- const finalDir = join47(backendDir, coordinates.label);
81082
- const partial = join47(backendDir, `.partial-${coordinates.label}-${process.pid}`);
80519
+ const backendDir = join46(root, backend);
80520
+ const finalDir = join46(backendDir, coordinates.label);
80521
+ const partial = join46(backendDir, `.partial-${coordinates.label}-${process.pid}`);
81083
80522
  mkdirSync23(backendDir, { recursive: true });
81084
80523
  rmSync13(partial, { recursive: true, force: true });
81085
80524
  mkdirSync23(partial);
@@ -81116,7 +80555,7 @@ async function provisionRuntime(backend, options) {
81116
80555
  if (digest !== integrity) throw new Error(`integrity mismatch for ${tarball}: expected ${integrity}, got ${digest}`);
81117
80556
  const bin = locateBinary(partial, backend, coordinates.binary);
81118
80557
  if (!bin) throw new Error(`${coordinates.pkg}@${coordinates.packageVersion} unpacked without a ${coordinates.binary} binary`);
81119
- if (process.platform !== "win32") chmodSync2(bin, 493);
80558
+ if (process.platform !== "win32") chmodSync(bin, 493);
81120
80559
  const marker = {
81121
80560
  backend,
81122
80561
  label: coordinates.label,
@@ -81126,7 +80565,7 @@ async function provisionRuntime(backend, options) {
81126
80565
  binary: relative3(partial, bin),
81127
80566
  at: (/* @__PURE__ */ new Date()).toISOString()
81128
80567
  };
81129
- writeFileSync17(join47(partial, MARKER), `${JSON.stringify(marker, null, 2)}
80568
+ writeFileSync17(join46(partial, MARKER), `${JSON.stringify(marker, null, 2)}
81130
80569
  `, "utf8");
81131
80570
  const rename2 = options.rename ?? renameSync12;
81132
80571
  try {
@@ -81146,7 +80585,7 @@ async function provisionRuntime(backend, options) {
81146
80585
  return { bin: theirs, label: coordinates.label, fetched: false };
81147
80586
  }
81148
80587
  progress("ready");
81149
- return { bin: join47(finalDir, marker.binary), label: coordinates.label, fetched: true };
80588
+ return { bin: join46(finalDir, marker.binary), label: coordinates.label, fetched: true };
81150
80589
  } catch (err) {
81151
80590
  rmSync13(partial, { recursive: true, force: true });
81152
80591
  throw err;
@@ -81154,7 +80593,7 @@ async function provisionRuntime(backend, options) {
81154
80593
  }
81155
80594
  function sweepRuntimes(backend, root, keepLabel, now = Date.now(), deps = {}) {
81156
80595
  const rm3 = deps.rm ?? defaultSweepRm;
81157
- const backendDir = join47(root, backend);
80596
+ const backendDir = join46(root, backend);
81158
80597
  let entries2;
81159
80598
  try {
81160
80599
  entries2 = readdirSync15(backendDir);
@@ -81164,10 +80603,10 @@ function sweepRuntimes(backend, root, keepLabel, now = Date.now(), deps = {}) {
81164
80603
  const sweep = { removed: [], kept: [] };
81165
80604
  for (const entry of entries2) {
81166
80605
  if (entry === keepLabel) continue;
81167
- const full = join47(backendDir, entry);
80606
+ const full = join46(backendDir, entry);
81168
80607
  if (entry.startsWith(".partial-")) {
81169
80608
  try {
81170
- if (now - statSync25(full).mtimeMs < 24 * 60 * 60 * 1e3) continue;
80609
+ if (now - statSync24(full).mtimeMs < 24 * 60 * 60 * 1e3) continue;
81171
80610
  } catch {
81172
80611
  continue;
81173
80612
  }
@@ -81355,7 +80794,7 @@ var init_runtimes = __esm({
81355
80794
  case "7": {
81356
80795
  const file = safeEntryPath(this.dest, name);
81357
80796
  if (!file) return;
81358
- mkdirSync23(dirname24(file), { recursive: true });
80797
+ mkdirSync23(dirname23(file), { recursive: true });
81359
80798
  this.fd = openSync18(file, "w", octal(header, 100, 8) & 511 || 420);
81360
80799
  this.written.push(file);
81361
80800
  return;
@@ -81447,7 +80886,6 @@ function createTenantMap(options) {
81447
80886
  if (entry.app !== void 0) await options.closeApp?.(entry.app);
81448
80887
  }],
81449
80888
  ["tailer", cleanups.tailer],
81450
- ["login utility", cleanups.loginUtility],
81451
80889
  ["subscriptions", cleanups.subscriptions],
81452
80890
  ["scheduler", cleanups.scheduler],
81453
80891
  ["board", cleanups.board],
@@ -81936,18 +81374,18 @@ var init_legacy_project_db = __esm({
81936
81374
  });
81937
81375
 
81938
81376
  // packages/server/src/frizz-db.ts
81939
- import { existsSync as existsSync21, mkdirSync as mkdirSync24, readdirSync as readdirSync16, renameSync as renameSync13, statSync as statSync26 } from "node:fs";
81940
- import { basename as basename13, dirname as dirname25, join as join48 } from "node:path";
81377
+ import { existsSync as existsSync21, mkdirSync as mkdirSync24, readdirSync as readdirSync16, renameSync as renameSync13, statSync as statSync25 } from "node:fs";
81378
+ import { basename as basename13, dirname as dirname24, join as join47 } from "node:path";
81941
81379
  function frizzDatabaseLocation(options) {
81942
81380
  if (options.stateDir !== void 0) {
81943
- const projectsDir = dirname25(options.stateDir);
81381
+ const projectsDir = dirname24(options.stateDir);
81944
81382
  if (basename13(projectsDir) === "projects") {
81945
- return { path: options.path ?? join48(dirname25(projectsDir), "ui.db"), projectsDir };
81383
+ return { path: options.path ?? join47(dirname24(projectsDir), "ui.db"), projectsDir };
81946
81384
  }
81947
- return { path: options.path ?? join48(options.stateDir, "ui.db"), projectsDir: void 0 };
81385
+ return { path: options.path ?? join47(options.stateDir, "ui.db"), projectsDir: void 0 };
81948
81386
  }
81949
81387
  const data = options.home ? frizzPaths({ home: options.home }).data : frizzRoots().data;
81950
- return { path: options.path ?? join48(data, "ui.db"), projectsDir: join48(data, "projects") };
81388
+ return { path: options.path ?? join47(data, "ui.db"), projectsDir: join47(data, "projects") };
81951
81389
  }
81952
81390
  function ensureFrizzSchema(db) {
81953
81391
  db.exec(`
@@ -81966,7 +81404,7 @@ function ensureFrizzSchema(db) {
81966
81404
  }
81967
81405
  function openFrizzDatabase(options = {}) {
81968
81406
  const { path: path3, projectsDir } = frizzDatabaseLocation(options);
81969
- mkdirSync24(dirname25(path3), { recursive: true });
81407
+ mkdirSync24(dirname24(path3), { recursive: true });
81970
81408
  const db = new sqlite_default(path3);
81971
81409
  db.pragma("busy_timeout = 5000");
81972
81410
  db.pragma("journal_mode = WAL");
@@ -81978,10 +81416,10 @@ function openFrizzDatabase(options = {}) {
81978
81416
  );
81979
81417
  for (const projectId of retiredLegacyProjectIds(projectsDir)) {
81980
81418
  if (alreadyImported.has(projectId)) continue;
81981
- const dir = join48(projectsDir, projectId);
81419
+ const dir = join47(projectsDir, projectId);
81982
81420
  try {
81983
- renameSync13(join48(dir, "ui.db.imported"), join48(dir, "ui.db"));
81984
- db.prepare("INSERT INTO imported_project (project_id, source, rows, imported_at) VALUES (?, ?, 0, ?)").run(projectId, join48(dir, "ui.db"), (/* @__PURE__ */ new Date()).toISOString());
81421
+ renameSync13(join47(dir, "ui.db.imported"), join47(dir, "ui.db"));
81422
+ db.prepare("INSERT INTO imported_project (project_id, source, rows, imported_at) VALUES (?, ?, 0, ?)").run(projectId, join47(dir, "ui.db"), (/* @__PURE__ */ new Date()).toISOString());
81985
81423
  alreadyImported.add(projectId);
81986
81424
  log.info("frizz-db", `${projectId}: restored ui.db.imported to ui.db and recorded it as imported`);
81987
81425
  } catch (error) {
@@ -81991,7 +81429,7 @@ function openFrizzDatabase(options = {}) {
81991
81429
  }
81992
81430
  for (const projectId of legacyProjectIds(projectsDir)) {
81993
81431
  if (alreadyImported.has(projectId)) continue;
81994
- const legacyPath = join48(projectsDir, projectId, "ui.db");
81432
+ const legacyPath = join47(projectsDir, projectId, "ui.db");
81995
81433
  try {
81996
81434
  const rows = importLegacyProject(db, projectId, legacyPath);
81997
81435
  imported.push({ projectId, rows });
@@ -82024,7 +81462,7 @@ function projectIdsWithFile(projectsDir, file) {
82024
81462
  if (!existsSync21(projectsDir)) return [];
82025
81463
  return readdirSync16(projectsDir).filter((name) => {
82026
81464
  try {
82027
- return statSync26(join48(projectsDir, name, file)).isFile();
81465
+ return statSync25(join47(projectsDir, name, file)).isFile();
82028
81466
  } catch {
82029
81467
  return false;
82030
81468
  }
@@ -82034,7 +81472,7 @@ function legacyProjectIds(projectsDir) {
82034
81472
  return projectIdsWithFile(projectsDir, "ui.db");
82035
81473
  }
82036
81474
  function retiredLegacyProjectIds(projectsDir) {
82037
- return projectIdsWithFile(projectsDir, "ui.db.imported").filter((id2) => !existsSync21(join48(projectsDir, id2, "ui.db")));
81475
+ return projectIdsWithFile(projectsDir, "ui.db.imported").filter((id2) => !existsSync21(join47(projectsDir, id2, "ui.db")));
82038
81476
  }
82039
81477
  function tableColumns(db, schema, table) {
82040
81478
  return db.prepare(`PRAGMA ${schema}.table_info(${table})`).all().map((c) => c.name);
@@ -82190,7 +81628,7 @@ var init_tenant_prime = __esm({
82190
81628
  // packages/server/src/project-teardown.ts
82191
81629
  import { rmSync as rmSync14 } from "node:fs";
82192
81630
  import { homedir as homedir19 } from "node:os";
82193
- import { dirname as dirname26, resolve as resolve11 } from "node:path";
81631
+ import { dirname as dirname25, resolve as resolve11 } from "node:path";
82194
81632
  async function stopProjectWorkers(ctx) {
82195
81633
  let stopped = 0;
82196
81634
  for (const row of ctx.storage.allSessions()) {
@@ -82210,7 +81648,7 @@ function deleteProjectState(projectId, home = homedir19()) {
82210
81648
  if (!/^[\w.-]+$/u.test(projectId) || projectId === "." || projectId === "..") {
82211
81649
  throw new Error(`Refusing to delete state for a malformed project id: ${projectId}`);
82212
81650
  }
82213
- if (dirname26(resolve11(target)) !== resolve11(dirname26(projectStateDir("x", home)))) {
81651
+ if (dirname25(resolve11(target)) !== resolve11(dirname25(projectStateDir("x", home)))) {
82214
81652
  throw new Error(`Refusing to delete ${target} \u2014 it is not a project state directory`);
82215
81653
  }
82216
81654
  rmSync14(target, { recursive: true, force: true });
@@ -82239,8 +81677,8 @@ __export(index_exports, {
82239
81677
  unknownProjectPage: () => unknownProjectPage
82240
81678
  });
82241
81679
  import { createServer } from "node:http";
82242
- import { readFileSync as readFileSync35, existsSync as existsSync22, statSync as statSync27 } from "node:fs";
82243
- import { dirname as dirname27, join as join49, resolve as resolve12, extname as extname4, posix as posix2, sep as sep7 } from "node:path";
81680
+ import { readFileSync as readFileSync35, existsSync as existsSync22, statSync as statSync26 } from "node:fs";
81681
+ import { dirname as dirname26, join as join48, resolve as resolve12, extname as extname4, posix as posix2, sep as sep7 } from "node:path";
82244
81682
  function readServerAddressHolder(path3) {
82245
81683
  try {
82246
81684
  const value = JSON.parse(readFileSync35(path3, "utf8"));
@@ -82368,12 +81806,12 @@ function staticIsFresh(req, etag, mtimeMs) {
82368
81806
  }
82369
81807
  function serveStatic(distDir, req, res) {
82370
81808
  const rel = posix2.normalize((req.url ?? "/").split("?")[0].replace(/\\/g, "/")).replace(/^(\.\.[/\\])+/, "");
82371
- let file = join49(distDir, rel === "/" ? "index.html" : rel);
82372
- if (!file.startsWith(distDir + sep7)) file = join49(distDir, "index.html");
82373
- if (!existsSync22(file)) file = join49(distDir, "index.html");
81809
+ let file = join48(distDir, rel === "/" ? "index.html" : rel);
81810
+ if (!file.startsWith(distDir + sep7)) file = join48(distDir, "index.html");
81811
+ if (!existsSync22(file)) file = join48(distDir, "index.html");
82374
81812
  try {
82375
- const stats = statSync27(file);
82376
- const cacheControl = file.startsWith(join49(distDir, "assets") + sep7) ? STATIC_CACHE_IMMUTABLE : STATIC_CACHE_REVALIDATE;
81813
+ const stats = statSync26(file);
81814
+ const cacheControl = file.startsWith(join48(distDir, "assets") + sep7) ? STATIC_CACHE_IMMUTABLE : STATIC_CACHE_REVALIDATE;
82377
81815
  const etag = `"${stats.size.toString(16)}-${Math.trunc(stats.mtimeMs).toString(16)}"`;
82378
81816
  const headers = {
82379
81817
  "content-type": MIME[extname4(file)] ?? "application/octet-stream",
@@ -82455,17 +81893,15 @@ async function startServer(opts = {}) {
82455
81893
  return frizzDb?.db;
82456
81894
  } },
82457
81895
  // Each project's app carries ITS OWN owner proof, so /health stays honest per project rather than
82458
- // answering for whichever one happened to launch the server. The transports are per project for a
82459
- // blunter reason: a socket is a live feed of ONE board, so sharing the launcher's would push its
81896
+ // answering for whichever one happened to launch the server. The socket is per project for a
81897
+ // blunter reason: it is a live feed of ONE board, so sharing the launcher's would push its
82460
81898
  // threads into every other project's UI.
82461
81899
  createApp: (tenantCtx) => ({
82462
81900
  app: runtime.createApp(tenantCtx, appOptionsFor(tenantCtx)),
82463
- terminal: runtime.createTerminal(terminalOptionsFor(tenantCtx)),
82464
81901
  appSocket: runtime.createAppSocket(appSocketOptionsFor(tenantCtx))
82465
81902
  }),
82466
81903
  closeApp: async (surfaces) => {
82467
81904
  await surfaces.appSocket.close();
82468
- await surfaces.terminal.close();
82469
81905
  },
82470
81906
  // The same producers boot starts for the launching project, in the same order. The tailer's cold
82471
81907
  // prime is what makes this affordable to do lazily — it is bounded per tick, so activating a
@@ -82483,9 +81919,6 @@ async function startServer(opts = {}) {
82483
81919
  controlToken: effectiveOwnerToken,
82484
81920
  requestOwnerStop
82485
81921
  });
82486
- const terminalOptionsFor = (c) => ({
82487
- resolveLogin: (slug) => c.loginUtility.attach(slug)
82488
- });
82489
81922
  const appSocketOptionsFor = (c) => ({
82490
81923
  bus: c.bus,
82491
81924
  bootId: c.bootId,
@@ -82510,7 +81943,6 @@ async function startServer(opts = {}) {
82510
81943
  watchFile: (path3, onChange) => watchLocalFile(resolveWatchableLocalFile(path3, openableFileRoots(c.project)), onChange)
82511
81944
  });
82512
81945
  let githubInit;
82513
- let terminal;
82514
81946
  let appSocket;
82515
81947
  let vite;
82516
81948
  let httpServer;
@@ -82565,9 +81997,6 @@ async function startServer(opts = {}) {
82565
81997
  const closingHttp = stopHttp();
82566
81998
  await Promise.all([closingHttp, Promise.allSettled([...requestTasks]).then(() => void 0)]);
82567
81999
  });
82568
- const cleanupTerminal = createRetryableCleanup(async () => {
82569
- await terminal?.close();
82570
- });
82571
82000
  const cleanupAppSocket = createRetryableCleanup(async () => {
82572
82001
  await appSocket?.close();
82573
82002
  });
@@ -82580,7 +82009,6 @@ async function startServer(opts = {}) {
82580
82009
  }
82581
82010
  });
82582
82011
  const cleanupTailer = createRetryableCleanup(tenant.tailer);
82583
- const cleanupLoginUtility = createRetryableCleanup(tenant.loginUtility);
82584
82012
  const cleanupSubscriptions = createRetryableCleanup(tenant.subscriptions);
82585
82013
  const cleanupScheduler = createRetryableCleanup(tenant.scheduler);
82586
82014
  const cleanupBoard = createRetryableCleanup(tenant.board);
@@ -82608,18 +82036,12 @@ async function startServer(opts = {}) {
82608
82036
  name: "http requests",
82609
82037
  run: cleanupHttp
82610
82038
  },
82611
- {
82612
- name: "terminal transport",
82613
- run: cleanupTerminal
82614
- },
82615
82039
  {
82616
82040
  name: "application socket",
82617
82041
  run: cleanupAppSocket
82618
82042
  },
82619
82043
  { name: "other projects", run: cleanupExtraTenants },
82620
82044
  { name: "tailer producer", run: cleanupTailer },
82621
- // Kill any live login-attempt pane so OAuth bytes never outlive the server.
82622
- { name: "login utility", run: cleanupLoginUtility },
82623
82045
  { name: "context subscriptions", run: cleanupSubscriptions },
82624
82046
  { name: "wake scheduler", run: cleanupScheduler },
82625
82047
  { name: "board producer and watcher", run: cleanupBoard },
@@ -82651,7 +82073,7 @@ async function startServer(opts = {}) {
82651
82073
  if (statusPath && statusIdentity) runtime.removeStatus(statusPath, statusIdentity);
82652
82074
  if (statusPath && statusIdentity) {
82653
82075
  try {
82654
- runtime.removeStatus(serverAddressPathForStateDir(dirname27(statusPath)), statusIdentity);
82076
+ runtime.removeStatus(serverAddressPathForStateDir(dirname26(statusPath)), statusIdentity);
82655
82077
  } catch {
82656
82078
  }
82657
82079
  }
@@ -82763,13 +82185,6 @@ async function startServer(opts = {}) {
82763
82185
  void githubInit.catch(() => void 0);
82764
82186
  await runtime.afterPhase?.("GitHub initialization");
82765
82187
  const app = await phase("application", () => runtime.createApp(ctx, appOptionsFor(ctx)));
82766
- terminal = await phase(
82767
- "terminal transport",
82768
- () => runtime.createTerminal(terminalOptionsFor(ctx)),
82769
- (value) => {
82770
- terminal = value;
82771
- }
82772
- );
82773
82188
  appSocket = await phase(
82774
82189
  "application socket",
82775
82190
  () => runtime.createAppSocket(appSocketOptionsFor(ctx)),
@@ -82777,7 +82192,7 @@ async function startServer(opts = {}) {
82777
82192
  appSocket = value;
82778
82193
  }
82779
82194
  );
82780
- tenants.adopt(project, ctx, { app, terminal, appSocket });
82195
+ tenants.adopt(project, ctx, { app, appSocket });
82781
82196
  await phase("board producer", () => ctx.board.start());
82782
82197
  await phase("tailer producer", () => ctx.tailer.start((done, total) => {
82783
82198
  bootProgress(`tailer producer ${done}/${total}`);
@@ -82789,7 +82204,7 @@ async function startServer(opts = {}) {
82789
82204
  }
82790
82205
  statusPath = serverLockPathFor(ctx.project);
82791
82206
  const webRoot = resolve12(import.meta.dirname, "..", "..", "web");
82792
- const distDir = opts.webDistDir ? resolve12(opts.webDistDir) : join49(webRoot, "dist");
82207
+ const distDir = opts.webDistDir ? resolve12(opts.webDistDir) : join48(webRoot, "dist");
82793
82208
  startupPhase = "Vite";
82794
82209
  if (opts.dev) {
82795
82210
  try {
@@ -82867,7 +82282,7 @@ async function startServer(opts = {}) {
82867
82282
  if (vite) {
82868
82283
  vite.middlewares(req, res, () => {
82869
82284
  try {
82870
- const html = readFileSync35(join49(webRoot, "index.html"), "utf8");
82285
+ const html = readFileSync35(join48(webRoot, "index.html"), "utf8");
82871
82286
  void vite.transformIndexHtml(url, html).then((out) => {
82872
82287
  res.writeHead(200, { "content-type": "text/html" });
82873
82288
  res.end(out);
@@ -82898,9 +82313,7 @@ async function startServer(opts = {}) {
82898
82313
  void routeToTenant(req.url ?? "/").then((routed) => {
82899
82314
  const surfaces = routed?.surfaces;
82900
82315
  if (routed) req.url = routed.url;
82901
- const term = surfaces?.terminal ?? terminal;
82902
82316
  const ws2 = surfaces?.appSocket ?? appSocket;
82903
- if (term.handleUpgrade(req, socket, head)) return;
82904
82317
  if (ws2.handleUpgrade(req, socket, head)) return;
82905
82318
  socket.destroy();
82906
82319
  }).catch(() => socket.destroy());
@@ -83018,7 +82431,6 @@ var init_index = __esm({
83018
82431
  init_context();
83019
82432
  init_app();
83020
82433
  init_compression();
83021
- init_terminal();
83022
82434
  init_app_socket();
83023
82435
  init_shutdown();
83024
82436
  init_project();
@@ -83045,7 +82457,6 @@ var init_index = __esm({
83045
82457
  createContext,
83046
82458
  initGithub,
83047
82459
  createApp,
83048
- createTerminal: createTerminalServer,
83049
82460
  createAppSocket: createAppSocketServer,
83050
82461
  createVite: async (options) => {
83051
82462
  const { createServer: createVite } = await import("vite");
@@ -83077,7 +82488,7 @@ var init_index = __esm({
83077
82488
  }
83078
82489
  };
83079
82490
  isApiUrl = (url) => url === FRIZZ_ROUTE_PREFIX || url.startsWith(`${FRIZZ_ROUTE_PREFIX}/`);
83080
- serverLockPathFor = (project) => join49(project.stateDir, "server.lock");
82491
+ serverLockPathFor = (project) => join48(project.stateDir, "server.lock");
83081
82492
  MIME = {
83082
82493
  ".html": "text/html",
83083
82494
  ".js": "text/javascript",
@@ -83101,28 +82512,7 @@ init_project_launch();
83101
82512
  init_shutdown();
83102
82513
  init_logging();
83103
82514
  import { existsSync as existsSync23 } from "node:fs";
83104
- import { join as join50 } from "node:path";
83105
-
83106
- // packages/server/src/native-helper.ts
83107
- import { chmodSync, statSync as statSync4 } from "node:fs";
83108
- import { createRequire } from "node:module";
83109
- import { dirname as dirname6, join as join9 } from "node:path";
83110
- function ensureNativeHelperPermissions(options = {}) {
83111
- const platform3 = options.platform ?? process.platform;
83112
- if (platform3 === "win32") return;
83113
- const stat2 = options.stat ?? ((path3) => statSync4(path3));
83114
- const chmod = options.chmod ?? ((path3, mode) => chmodSync(path3, mode));
83115
- const resolvePty = options.resolvePty ?? (() => createRequire(import.meta.url).resolve("node-pty/package.json"));
83116
- try {
83117
- const helper = join9(dirname6(resolvePty()), "prebuilds", `${platform3}-${options.arch ?? process.arch}`, "spawn-helper");
83118
- const mode = stat2(helper).mode;
83119
- if ((mode & 73) === 73) return;
83120
- chmod(helper, mode | 493);
83121
- } catch {
83122
- }
83123
- }
83124
-
83125
- // packages/server/src/dev-child.ts
82515
+ import { join as join49 } from "node:path";
83126
82516
  process.on("uncaughtException", (error) => {
83127
82517
  log.error("dev-child", `uncaught exception: ${error instanceof Error ? error.stack ?? error.message : error}`);
83128
82518
  process.exit(1);
@@ -83166,7 +82556,6 @@ try {
83166
82556
  if (!serverTarget || !serverToken) throw new Error("stable server is missing global launch ownership");
83167
82557
  registerProjectLaunchDelegate(serverTarget, serverToken);
83168
82558
  }
83169
- ensureNativeHelperPermissions();
83170
82559
  const { startServer: startServer2 } = await Promise.resolve().then(() => (init_index(), index_exports));
83171
82560
  const project = projectFromLaunchTarget(target);
83172
82561
  const stableWebDist = process.env.FRIZZ_STABLE_WEB_DIST;
@@ -83180,7 +82569,7 @@ try {
83180
82569
  ];
83181
82570
  if (!existsSync23(stableWebDist)) throw new Error("stable artifact launch is missing its verified web directory");
83182
82571
  for (const [name, directory, requiredFile] of required) {
83183
- if (!directory || !existsSync23(join50(directory, requiredFile)))
82572
+ if (!directory || !existsSync23(join49(directory, requiredFile)))
83184
82573
  throw new Error(`stable artifact launch is missing verified ${name}`);
83185
82574
  }
83186
82575
  }