pybao-cli 1.4.81 → 1.4.82

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 (163) hide show
  1. package/dist/REPL-VOJCD6X6.js +49 -0
  2. package/dist/{acp-YXMNP56B.js → acp-ASRH57AF.js} +79 -32
  3. package/dist/acp-ASRH57AF.js.map +7 -0
  4. package/dist/{agentsValidate-LQFWOCPZ.js → agentsValidate-35AHZXNB.js} +7 -7
  5. package/dist/ask-TI3ITWN7.js +143 -0
  6. package/dist/ask-TI3ITWN7.js.map +7 -0
  7. package/dist/{autoUpdater-DEH233RT.js → autoUpdater-MRK5BD2L.js} +3 -3
  8. package/dist/{chunk-JVF6KNE3.js → chunk-2AG4BTRV.js} +1 -1
  9. package/dist/{chunk-PRRYL2E2.js → chunk-2S2V2ZI7.js} +16 -16
  10. package/dist/{chunk-ZE75JZFY.js → chunk-2WIUQUTU.js} +3 -3
  11. package/dist/{chunk-5KAIY3II.js → chunk-2YM35XWE.js} +3 -3
  12. package/dist/{chunk-H44O47XJ.js → chunk-AUGXOUTX.js} +11 -1
  13. package/dist/chunk-AUGXOUTX.js.map +7 -0
  14. package/dist/{chunk-FDGIVQNE.js → chunk-AYVB6VUF.js} +1 -1
  15. package/dist/{chunk-6XINCIUI.js → chunk-DYJD66YF.js} +1 -1
  16. package/dist/{chunk-EYY3QDKX.js → chunk-DZTZPEPA.js} +2 -2
  17. package/dist/chunk-F4AXICO7.js +28 -0
  18. package/dist/chunk-F4AXICO7.js.map +7 -0
  19. package/dist/{chunk-HNHWG52B.js → chunk-GSAG6WNQ.js} +1 -1
  20. package/dist/{chunk-CLGB56HY.js → chunk-GUTLXPN6.js} +36 -2
  21. package/dist/{chunk-CLGB56HY.js.map → chunk-GUTLXPN6.js.map} +2 -2
  22. package/dist/{chunk-VW3NZKCP.js → chunk-GZT2DWED.js} +1 -1
  23. package/dist/{chunk-BJMVIICS.js → chunk-HJWUPFGF.js} +4 -4
  24. package/dist/{chunk-KH3U5BR5.js → chunk-IIVG2SHE.js} +3 -3
  25. package/dist/{chunk-GS4PRJHV.js → chunk-JQVZNIKI.js} +4 -4
  26. package/dist/{chunk-MKNRYFQR.js → chunk-JT3RE7UH.js} +6 -22
  27. package/dist/{chunk-MKNRYFQR.js.map → chunk-JT3RE7UH.js.map} +3 -3
  28. package/dist/{chunk-4SWM6FWR.js → chunk-KNWW4HGV.js} +2 -2
  29. package/dist/chunk-LM665HND.js +262 -0
  30. package/dist/chunk-LM665HND.js.map +7 -0
  31. package/dist/{chunk-Z73SPR4B.js → chunk-NTL5PKCX.js} +3 -3
  32. package/dist/{chunk-2NFKKANF.js → chunk-PXPTGNYH.js} +2 -2
  33. package/dist/{chunk-HIZXCXUG.js → chunk-QUWUFGZF.js} +4 -4
  34. package/dist/{chunk-BX6HNPWQ.js → chunk-SZEYDC6A.js} +3 -3
  35. package/dist/{chunk-AB3F7T5N.js → chunk-TWWQYBVK.js} +3 -3
  36. package/dist/{chunk-UUS77RPP.js → chunk-U265OPSO.js} +1 -1
  37. package/dist/{chunk-4NNDWUSZ.js → chunk-UBX7JQR2.js} +2 -2
  38. package/dist/{chunk-4VUECEM6.js → chunk-UXVOYFKL.js} +2 -2
  39. package/dist/{chunk-37ZXN5M4.js → chunk-VMWEFYQB.js} +1 -1
  40. package/dist/{chunk-CCF52HVZ.js → chunk-WBBMOYXK.js} +1 -1
  41. package/dist/{chunk-CCF52HVZ.js.map → chunk-WBBMOYXK.js.map} +1 -1
  42. package/dist/{chunk-B3NR3UMC.js → chunk-WVYIFMLG.js} +4 -4
  43. package/dist/chunk-XKYHFZEC.js +68 -0
  44. package/dist/chunk-XKYHFZEC.js.map +7 -0
  45. package/dist/{chunk-TVUG5GLX.js → chunk-XOOHCC63.js} +356 -161
  46. package/dist/chunk-XOOHCC63.js.map +7 -0
  47. package/dist/{chunk-GMKASRN7.js → chunk-Y5JPSTQ4.js} +1 -1
  48. package/dist/{chunk-7ANXEZRS.js → chunk-ZW25QNXS.js} +3 -3
  49. package/dist/{cli-VNT2RTPP.js → cli-ECB4WYUZ.js} +399 -379
  50. package/dist/cli-ECB4WYUZ.js.map +7 -0
  51. package/dist/commands-3B77L2SI.js +53 -0
  52. package/dist/{config-VK55G2IB.js → config-KZHPV37P.js} +4 -4
  53. package/dist/{context-QHTEENJ6.js → context-ZZI53BPM.js} +6 -6
  54. package/dist/conversationTracker-SC6NCQHL.js +17 -0
  55. package/dist/{customCommands-HRHE7ZIM.js → customCommands-MX6OENKO.js} +4 -4
  56. package/dist/{env-GGYUE5V7.js → env-76WAAGI6.js} +2 -2
  57. package/dist/{file-KHYC624L.js → file-LCS77XWE.js} +4 -4
  58. package/dist/index.js +3 -3
  59. package/dist/{llm-A3S75CLF.js → llm-AR66BS2U.js} +32 -29
  60. package/dist/{llm-A3S75CLF.js.map → llm-AR66BS2U.js.map} +1 -1
  61. package/dist/{llmLazy-USVVGSVL.js → llmLazy-5W6E5BCB.js} +1 -1
  62. package/dist/{loader-JPKYTFFC.js → loader-OWZ3WD2X.js} +4 -4
  63. package/dist/{lsp-B7QJVI2U.js → lsp-NLPSJYH4.js} +6 -6
  64. package/dist/{lspAnchor-JJJ2WKI7.js → lspAnchor-MWASWGQD.js} +6 -6
  65. package/dist/{mcp-YOR7UMEZ.js → mcp-T2UB74Y2.js} +7 -7
  66. package/dist/{mentionProcessor-5CYA4NR4.js → mentionProcessor-KIBWOHEC.js} +5 -5
  67. package/dist/{messages-ICKAWGUW.js → messages-6BHCXDWR.js} +5 -1
  68. package/dist/{model-P33QONA2.js → model-5NDSZPIL.js} +5 -5
  69. package/dist/{openai-POLCH476.js → openai-7XPWH2G7.js} +6 -5
  70. package/dist/{outputStyles-EZGCOEE2.js → outputStyles-QUE4ALJQ.js} +4 -4
  71. package/dist/{pluginRuntime-KJ3YFO2O.js → pluginRuntime-PQ3VZRX7.js} +6 -6
  72. package/dist/{pluginValidation-MR5GV7PL.js → pluginValidation-RQ34XQY3.js} +6 -6
  73. package/dist/prompts-5576MRUX.js +55 -0
  74. package/dist/{pybAgentSessionLoad-TRSWA62U.js → pybAgentSessionLoad-5MWAY2A4.js} +4 -4
  75. package/dist/{pybAgentSessionResume-3IRNTCVI.js → pybAgentSessionResume-NZGSUGGS.js} +4 -4
  76. package/dist/{pybAgentStreamJsonSession-5IBYEXS5.js → pybAgentStreamJsonSession-UP4WOINX.js} +3 -3
  77. package/dist/pybAgentStreamJsonSession-UP4WOINX.js.map +7 -0
  78. package/dist/{pybHooks-HFAKEYDS.js → pybHooks-HILU7ZB4.js} +4 -4
  79. package/dist/query-LMPE4HBF.js +57 -0
  80. package/dist/{registry-LOKL3JBE.js → registry-4MWYBUFA.js} +5 -5
  81. package/dist/replSessionBridge-EBXNFUAD.js +10 -0
  82. package/dist/{ripgrep-X4LOQHA7.js → ripgrep-J74GL455.js} +3 -3
  83. package/dist/{skillMarketplace-UITGQNZD.js → skillMarketplace-ATLDIEEX.js} +3 -3
  84. package/dist/{state-I7LIGIFJ.js → state-Y2Q4MPY5.js} +2 -2
  85. package/dist/{theme-RVIXXPSQ.js → theme-3L66ZU5Z.js} +5 -5
  86. package/dist/{toolPermissionSettings-TALALPH3.js → toolPermissionSettings-PDGMFGN2.js} +6 -6
  87. package/dist/toolPermissionSettings-PDGMFGN2.js.map +7 -0
  88. package/dist/tools-45UHHM5S.js +54 -0
  89. package/dist/tools-45UHHM5S.js.map +7 -0
  90. package/dist/{userInput-WFPUGJ4L.js → userInput-GBXOUS4W.js} +40 -36
  91. package/dist/userInput-GBXOUS4W.js.map +7 -0
  92. package/package.json +1 -1
  93. package/dist/REPL-WXPYXBW2.js +0 -46
  94. package/dist/acp-YXMNP56B.js.map +0 -7
  95. package/dist/ask-CUR6IJ2W.js +0 -129
  96. package/dist/ask-CUR6IJ2W.js.map +0 -7
  97. package/dist/chunk-H44O47XJ.js.map +0 -7
  98. package/dist/chunk-TVUG5GLX.js.map +0 -7
  99. package/dist/cli-VNT2RTPP.js.map +0 -7
  100. package/dist/commands-LAZD5O4M.js +0 -50
  101. package/dist/prompts-P4JU57HZ.js +0 -52
  102. package/dist/pybAgentStreamJsonSession-5IBYEXS5.js.map +0 -7
  103. package/dist/query-NHQFKSCC.js +0 -54
  104. package/dist/tools-HVGZBEHZ.js +0 -51
  105. package/dist/userInput-WFPUGJ4L.js.map +0 -7
  106. /package/dist/{REPL-WXPYXBW2.js.map → REPL-VOJCD6X6.js.map} +0 -0
  107. /package/dist/{agentsValidate-LQFWOCPZ.js.map → agentsValidate-35AHZXNB.js.map} +0 -0
  108. /package/dist/{autoUpdater-DEH233RT.js.map → autoUpdater-MRK5BD2L.js.map} +0 -0
  109. /package/dist/{chunk-JVF6KNE3.js.map → chunk-2AG4BTRV.js.map} +0 -0
  110. /package/dist/{chunk-PRRYL2E2.js.map → chunk-2S2V2ZI7.js.map} +0 -0
  111. /package/dist/{chunk-ZE75JZFY.js.map → chunk-2WIUQUTU.js.map} +0 -0
  112. /package/dist/{chunk-5KAIY3II.js.map → chunk-2YM35XWE.js.map} +0 -0
  113. /package/dist/{chunk-FDGIVQNE.js.map → chunk-AYVB6VUF.js.map} +0 -0
  114. /package/dist/{chunk-6XINCIUI.js.map → chunk-DYJD66YF.js.map} +0 -0
  115. /package/dist/{chunk-EYY3QDKX.js.map → chunk-DZTZPEPA.js.map} +0 -0
  116. /package/dist/{chunk-HNHWG52B.js.map → chunk-GSAG6WNQ.js.map} +0 -0
  117. /package/dist/{chunk-VW3NZKCP.js.map → chunk-GZT2DWED.js.map} +0 -0
  118. /package/dist/{chunk-BJMVIICS.js.map → chunk-HJWUPFGF.js.map} +0 -0
  119. /package/dist/{chunk-KH3U5BR5.js.map → chunk-IIVG2SHE.js.map} +0 -0
  120. /package/dist/{chunk-GS4PRJHV.js.map → chunk-JQVZNIKI.js.map} +0 -0
  121. /package/dist/{chunk-4SWM6FWR.js.map → chunk-KNWW4HGV.js.map} +0 -0
  122. /package/dist/{chunk-Z73SPR4B.js.map → chunk-NTL5PKCX.js.map} +0 -0
  123. /package/dist/{chunk-2NFKKANF.js.map → chunk-PXPTGNYH.js.map} +0 -0
  124. /package/dist/{chunk-HIZXCXUG.js.map → chunk-QUWUFGZF.js.map} +0 -0
  125. /package/dist/{chunk-BX6HNPWQ.js.map → chunk-SZEYDC6A.js.map} +0 -0
  126. /package/dist/{chunk-AB3F7T5N.js.map → chunk-TWWQYBVK.js.map} +0 -0
  127. /package/dist/{chunk-UUS77RPP.js.map → chunk-U265OPSO.js.map} +0 -0
  128. /package/dist/{chunk-4NNDWUSZ.js.map → chunk-UBX7JQR2.js.map} +0 -0
  129. /package/dist/{chunk-4VUECEM6.js.map → chunk-UXVOYFKL.js.map} +0 -0
  130. /package/dist/{chunk-37ZXN5M4.js.map → chunk-VMWEFYQB.js.map} +0 -0
  131. /package/dist/{chunk-B3NR3UMC.js.map → chunk-WVYIFMLG.js.map} +0 -0
  132. /package/dist/{chunk-GMKASRN7.js.map → chunk-Y5JPSTQ4.js.map} +0 -0
  133. /package/dist/{chunk-7ANXEZRS.js.map → chunk-ZW25QNXS.js.map} +0 -0
  134. /package/dist/{commands-LAZD5O4M.js.map → commands-3B77L2SI.js.map} +0 -0
  135. /package/dist/{config-VK55G2IB.js.map → config-KZHPV37P.js.map} +0 -0
  136. /package/dist/{context-QHTEENJ6.js.map → context-ZZI53BPM.js.map} +0 -0
  137. /package/dist/{customCommands-HRHE7ZIM.js.map → conversationTracker-SC6NCQHL.js.map} +0 -0
  138. /package/dist/{env-GGYUE5V7.js.map → customCommands-MX6OENKO.js.map} +0 -0
  139. /package/dist/{file-KHYC624L.js.map → env-76WAAGI6.js.map} +0 -0
  140. /package/dist/{llmLazy-USVVGSVL.js.map → file-LCS77XWE.js.map} +0 -0
  141. /package/dist/{loader-JPKYTFFC.js.map → llmLazy-5W6E5BCB.js.map} +0 -0
  142. /package/dist/{lsp-B7QJVI2U.js.map → loader-OWZ3WD2X.js.map} +0 -0
  143. /package/dist/{mcp-YOR7UMEZ.js.map → lsp-NLPSJYH4.js.map} +0 -0
  144. /package/dist/{lspAnchor-JJJ2WKI7.js.map → lspAnchor-MWASWGQD.js.map} +0 -0
  145. /package/dist/{messages-ICKAWGUW.js.map → mcp-T2UB74Y2.js.map} +0 -0
  146. /package/dist/{mentionProcessor-5CYA4NR4.js.map → mentionProcessor-KIBWOHEC.js.map} +0 -0
  147. /package/dist/{model-P33QONA2.js.map → messages-6BHCXDWR.js.map} +0 -0
  148. /package/dist/{openai-POLCH476.js.map → model-5NDSZPIL.js.map} +0 -0
  149. /package/dist/{outputStyles-EZGCOEE2.js.map → openai-7XPWH2G7.js.map} +0 -0
  150. /package/dist/{pluginValidation-MR5GV7PL.js.map → outputStyles-QUE4ALJQ.js.map} +0 -0
  151. /package/dist/{pluginRuntime-KJ3YFO2O.js.map → pluginRuntime-PQ3VZRX7.js.map} +0 -0
  152. /package/dist/{prompts-P4JU57HZ.js.map → pluginValidation-RQ34XQY3.js.map} +0 -0
  153. /package/dist/{pybAgentSessionLoad-TRSWA62U.js.map → prompts-5576MRUX.js.map} +0 -0
  154. /package/dist/{pybAgentSessionResume-3IRNTCVI.js.map → pybAgentSessionLoad-5MWAY2A4.js.map} +0 -0
  155. /package/dist/{pybHooks-HFAKEYDS.js.map → pybAgentSessionResume-NZGSUGGS.js.map} +0 -0
  156. /package/dist/{query-NHQFKSCC.js.map → pybHooks-HILU7ZB4.js.map} +0 -0
  157. /package/dist/{registry-LOKL3JBE.js.map → query-LMPE4HBF.js.map} +0 -0
  158. /package/dist/{ripgrep-X4LOQHA7.js.map → registry-4MWYBUFA.js.map} +0 -0
  159. /package/dist/{skillMarketplace-UITGQNZD.js.map → replSessionBridge-EBXNFUAD.js.map} +0 -0
  160. /package/dist/{state-I7LIGIFJ.js.map → ripgrep-J74GL455.js.map} +0 -0
  161. /package/dist/{theme-RVIXXPSQ.js.map → skillMarketplace-ATLDIEEX.js.map} +0 -0
  162. /package/dist/{toolPermissionSettings-TALALPH3.js.map → state-Y2Q4MPY5.js.map} +0 -0
  163. /package/dist/{tools-HVGZBEHZ.js.map → theme-3L66ZU5Z.js.map} +0 -0
@@ -9,13 +9,13 @@ import {
9
9
  getAllTools,
10
10
  toTaskDetail,
11
11
  toTaskListItem
12
- } from "./chunk-PRRYL2E2.js";
12
+ } from "./chunk-2S2V2ZI7.js";
13
13
  import {
14
14
  PybAgentStructuredStdio
15
15
  } from "./chunk-5AGDLQAW.js";
16
16
  import {
17
17
  assertMinVersion
18
- } from "./chunk-AB3F7T5N.js";
18
+ } from "./chunk-TWWQYBVK.js";
19
19
  import {
20
20
  getToolDescription
21
21
  } from "./chunk-XI4LTVYT.js";
@@ -39,18 +39,23 @@ import {
39
39
  review_default,
40
40
  useExitOnCtrlCD,
41
41
  useTerminalSize
42
- } from "./chunk-TVUG5GLX.js";
43
- import "./chunk-7ANXEZRS.js";
44
- import "./chunk-FDGIVQNE.js";
45
- import "./chunk-VW3NZKCP.js";
46
- import "./chunk-4NNDWUSZ.js";
42
+ } from "./chunk-XOOHCC63.js";
43
+ import "./chunk-GZT2DWED.js";
44
+ import "./chunk-ZW25QNXS.js";
45
+ import "./chunk-LM665HND.js";
46
+ import {
47
+ beginReplSessionScope
48
+ } from "./chunk-F4AXICO7.js";
49
+ import "./chunk-AYVB6VUF.js";
50
+ import "./chunk-UBX7JQR2.js";
47
51
  import "./chunk-5P7HBXTD.js";
48
- import "./chunk-KH3U5BR5.js";
52
+ import "./chunk-IIVG2SHE.js";
49
53
  import {
50
54
  clearOutputStyleCache
51
- } from "./chunk-4VUECEM6.js";
52
- import "./chunk-MKNRYFQR.js";
53
- import "./chunk-BJMVIICS.js";
55
+ } from "./chunk-UXVOYFKL.js";
56
+ import "./chunk-JT3RE7UH.js";
57
+ import "./chunk-XKYHFZEC.js";
58
+ import "./chunk-HJWUPFGF.js";
54
59
  import {
55
60
  addMcpServer,
56
61
  ensureConfigScope,
@@ -65,43 +70,43 @@ import {
65
70
  parseEnvVars,
66
71
  parseMcpHeaders,
67
72
  removeMcpServer
68
- } from "./chunk-HIZXCXUG.js";
69
- import "./chunk-HNHWG52B.js";
70
- import "./chunk-BX6HNPWQ.js";
73
+ } from "./chunk-QUWUFGZF.js";
74
+ import "./chunk-GSAG6WNQ.js";
75
+ import "./chunk-SZEYDC6A.js";
71
76
  import "./chunk-UNNVICVU.js";
72
- import "./chunk-2NFKKANF.js";
77
+ import "./chunk-PXPTGNYH.js";
73
78
  import {
74
79
  clearAgentCache,
75
80
  setFlagAgentsFromCliJson
76
- } from "./chunk-CLGB56HY.js";
81
+ } from "./chunk-GUTLXPN6.js";
77
82
  import {
78
83
  setEnabledSettingSourcesFromCli
79
84
  } from "./chunk-A3BVXXA3.js";
80
- import "./chunk-H44O47XJ.js";
85
+ import "./chunk-AUGXOUTX.js";
81
86
  import "./chunk-3DFBSQIT.js";
82
87
  import "./chunk-B6IMQJZM.js";
83
88
  import "./chunk-OUXHGDLH.js";
84
- import "./chunk-EYY3QDKX.js";
89
+ import "./chunk-DZTZPEPA.js";
85
90
  import "./chunk-QWIBSCDN.js";
86
- import "./chunk-GS4PRJHV.js";
87
- import "./chunk-5KAIY3II.js";
88
- import "./chunk-JVF6KNE3.js";
91
+ import "./chunk-JQVZNIKI.js";
92
+ import "./chunk-2YM35XWE.js";
93
+ import "./chunk-2AG4BTRV.js";
89
94
  import "./chunk-UZ34JEUK.js";
90
- import "./chunk-4SWM6FWR.js";
95
+ import "./chunk-KNWW4HGV.js";
91
96
  import "./chunk-BJSWTHRM.js";
92
97
  import {
93
98
  getModelManager,
94
99
  isDefaultSlowAndCapableModel
95
- } from "./chunk-Z73SPR4B.js";
100
+ } from "./chunk-NTL5PKCX.js";
96
101
  import {
97
102
  getContext,
98
103
  removeContext,
99
104
  setContext
100
- } from "./chunk-B3NR3UMC.js";
101
- import "./chunk-37ZXN5M4.js";
105
+ } from "./chunk-WVYIFMLG.js";
106
+ import "./chunk-VMWEFYQB.js";
102
107
  import {
103
108
  getTheme
104
- } from "./chunk-GMKASRN7.js";
109
+ } from "./chunk-Y5JPSTQ4.js";
105
110
  import {
106
111
  checkHasTrustDialogAccepted,
107
112
  deleteConfigForCLI,
@@ -115,14 +120,14 @@ import {
115
120
  saveGlobalConfig,
116
121
  setConfigForCLI,
117
122
  validateAndRepairAllGPT5Profiles
118
- } from "./chunk-ZE75JZFY.js";
123
+ } from "./chunk-2WIUQUTU.js";
119
124
  import {
120
125
  ConfigParseError
121
126
  } from "./chunk-RQVLBMP7.js";
122
127
  import {
123
128
  debug,
124
129
  initDebugLogger
125
- } from "./chunk-6XINCIUI.js";
130
+ } from "./chunk-DYJD66YF.js";
126
131
  import {
127
132
  BunShell,
128
133
  CACHE_PATHS,
@@ -138,10 +143,10 @@ import {
138
143
  parseLogFilename,
139
144
  setCwd,
140
145
  setOriginalCwd
141
- } from "./chunk-UUS77RPP.js";
146
+ } from "./chunk-U265OPSO.js";
142
147
  import {
143
148
  MACRO
144
- } from "./chunk-CCF52HVZ.js";
149
+ } from "./chunk-WBBMOYXK.js";
145
150
  import "./chunk-I3J4JYES.js";
146
151
 
147
152
  // src/entrypoints/cli/runCli.tsx
@@ -301,8 +306,14 @@ function createPrintModeControlRequestHandler(args) {
301
306
 
302
307
  // src/entrypoints/cli/stdio/streamJsonSession.ts
303
308
  async function runPrintModeStreamJsonSession(args) {
304
- const { runPybAgentStreamJsonSession } = await import("./pybAgentStreamJsonSession-5IBYEXS5.js");
305
- await runPybAgentStreamJsonSession(args);
309
+ const { beginReplSessionScope: beginReplSessionScope2 } = await import("./replSessionBridge-EBXNFUAD.js");
310
+ const { runPybAgentStreamJsonSession } = await import("./pybAgentStreamJsonSession-UP4WOINX.js");
311
+ const restoreSessionScope = beginReplSessionScope2(args.sessionId);
312
+ try {
313
+ await runPybAgentStreamJsonSession(args);
314
+ } finally {
315
+ restoreSessionScope();
316
+ }
306
317
  }
307
318
 
308
319
  // src/entrypoints/cli/stdio/structuredStdio.ts
@@ -455,338 +466,347 @@ async function runPrintMode({
455
466
  `);
456
467
  process.exit(0);
457
468
  }
458
- const { createUserMessage } = await import("./messages-ICKAWGUW.js");
459
- const { getSystemPrompt } = await import("./prompts-P4JU57HZ.js");
460
- const { getContext: getContext2 } = await import("./context-QHTEENJ6.js");
469
+ const { createUserMessage } = await import("./messages-6BHCXDWR.js");
470
+ const { ConversationTracker } = await import("./conversationTracker-SC6NCQHL.js");
471
+ const { getSystemPrompt } = await import("./prompts-5576MRUX.js");
472
+ const { getContext: getContext2 } = await import("./context-ZZI53BPM.js");
461
473
  const { getTotalCost } = await import("./costTracker-DJVFVAVZ.js");
462
- const { query } = await import("./query-NHQFKSCC.js");
474
+ const { query } = await import("./query-LMPE4HBF.js");
463
475
  const { getPybAgentSessionId } = await import("./pybAgentSessionId-EPCAMQ25.js");
464
476
  const { pybMessageToSdkMessage, makeSdkInitMessage, makeSdkResultMessage } = await import("./pybAgentStreamJson-EQPO52B6.js");
465
477
  const { PybAgentStructuredStdio: PybAgentStructuredStdio2 } = await import("./pybAgentStructuredStdio-ROCSOGNT.js");
466
478
  const {
467
479
  loadToolPermissionContextFromDisk,
468
480
  persistToolPermissionUpdateToDisk
469
- } = await import("./toolPermissionSettings-TALALPH3.js");
481
+ } = await import("./toolPermissionSettings-PDGMFGN2.js");
470
482
  const { applyToolPermissionContextUpdates } = await import("./toolPermissionContext-BSFV23IL.js");
471
483
  const sessionIdForSdk = getPybAgentSessionId();
484
+ const restoreSessionScope = beginReplSessionScope(sessionIdForSdk);
485
+ const conversationTracker = new ConversationTracker();
472
486
  const startedAt = Date.now();
473
487
  const sdkMessages = [];
474
- const baseSystemPrompt = typeof systemPromptOverride === "string" && systemPromptOverride.trim() ? [systemPromptOverride] : await getSystemPrompt({ disableSlashCommands });
475
- const systemPrompt = typeof appendSystemPrompt === "string" && appendSystemPrompt.trim() ? [...baseSystemPrompt, appendSystemPrompt] : baseSystemPrompt;
476
- const normalizedJsonSchema = typeof jsonSchema === "string" ? jsonSchema.trim() : "";
477
- const parsedJsonSchema = (() => {
478
- if (!normalizedJsonSchema) return null;
479
- try {
480
- const parsed = JSON.parse(normalizedJsonSchema);
481
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
482
- throw new Error("Schema must be a JSON object");
488
+ try {
489
+ const baseSystemPrompt = typeof systemPromptOverride === "string" && systemPromptOverride.trim() ? [systemPromptOverride] : await getSystemPrompt({ disableSlashCommands });
490
+ const systemPrompt = typeof appendSystemPrompt === "string" && appendSystemPrompt.trim() ? [...baseSystemPrompt, appendSystemPrompt] : baseSystemPrompt;
491
+ const normalizedJsonSchema = typeof jsonSchema === "string" ? jsonSchema.trim() : "";
492
+ const parsedJsonSchema = (() => {
493
+ if (!normalizedJsonSchema) return null;
494
+ try {
495
+ const parsed = JSON.parse(normalizedJsonSchema);
496
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
497
+ throw new Error("Schema must be a JSON object");
498
+ }
499
+ return parsed;
500
+ } catch (error) {
501
+ const msg = error instanceof Error ? error.message : String(error);
502
+ console.error(`Error: Invalid --json-schema: ${msg}`);
503
+ process.exit(1);
483
504
  }
484
- return parsed;
485
- } catch (error) {
486
- const msg = error instanceof Error ? error.message : String(error);
487
- console.error(`Error: Invalid --json-schema: ${msg}`);
488
- process.exit(1);
489
- }
490
- })();
491
- if (parsedJsonSchema) {
492
- systemPrompt.push(
493
- [
494
- "You MUST respond with ONLY valid JSON.",
495
- "The JSON MUST validate against the following JSON Schema.",
496
- "Do not wrap the JSON in markdown code fences and do not add extra commentary.",
497
- "",
498
- `<json_schema>${JSON.stringify(parsedJsonSchema)}</json_schema>`
499
- ].join("\n")
500
- );
501
- }
502
- const ctx = await getContext2();
503
- const isBypassAvailable = !safe || Boolean(allowDangerouslySkipPermissions) || Boolean(dangerouslySkipPermissions);
504
- let toolPermissionContext = loadToolPermissionContextFromDisk({
505
- projectDir: cwd2,
506
- includePybProjectConfig: true,
507
- isBypassPermissionsModeAvailable: isBypassAvailable
508
- });
509
- const cliRuleList = (value) => {
510
- if (!value) return [];
511
- const raw = Array.isArray(value) ? value : [value];
512
- return raw.flatMap((v) => String(v ?? "").split(",")).map((v) => v.trim()).filter(Boolean);
513
- };
514
- const allowedRules = cliRuleList(allowedTools);
515
- const deniedRules = cliRuleList(disallowedTools);
516
- const additionalDirs = cliRuleList(addDir);
517
- const updates = [];
518
- if (allowedRules.length > 0) {
519
- updates.push({
520
- type: "addRules",
521
- destination: "cliArg",
522
- behavior: "allow",
523
- rules: allowedRules
524
- });
525
- }
526
- if (deniedRules.length > 0) {
527
- updates.push({
528
- type: "addRules",
529
- destination: "cliArg",
530
- behavior: "deny",
531
- rules: deniedRules
532
- });
533
- }
534
- if (additionalDirs.length > 0) {
535
- updates.push({
536
- type: "addDirectories",
537
- destination: "cliArg",
538
- directories: additionalDirs
539
- });
540
- }
541
- const normalizedPermissionMode = typeof permissionMode === "string" ? permissionMode.trim() : "";
542
- if (normalizedPermissionMode) {
543
- const normalized = normalizedPermissionMode === "delegate" ? "default" : normalizedPermissionMode;
544
- const allowed = /* @__PURE__ */ new Set([
545
- "acceptEdits",
546
- "bypassPermissions",
547
- "default",
548
- "dontAsk",
549
- "plan"
550
- ]);
551
- if (!allowed.has(normalized)) {
552
- console.error(
553
- `Error: Invalid --permission-mode "${normalizedPermissionMode}". Expected one of: acceptEdits, bypassPermissions, default, delegate, dontAsk, plan`
505
+ })();
506
+ if (parsedJsonSchema) {
507
+ systemPrompt.push(
508
+ [
509
+ "You MUST respond with ONLY valid JSON.",
510
+ "The JSON MUST validate against the following JSON Schema.",
511
+ "Do not wrap the JSON in markdown code fences and do not add extra commentary.",
512
+ "",
513
+ `<json_schema>${JSON.stringify(parsedJsonSchema)}</json_schema>`
514
+ ].join("\n")
554
515
  );
555
- process.exit(1);
556
516
  }
557
- updates.push({
558
- type: "setMode",
559
- destination: "cliArg",
560
- mode: normalized
561
- });
562
- }
563
- if (dangerouslySkipPermissions) {
564
- updates.push({
565
- type: "setMode",
566
- destination: "cliArg",
567
- mode: "bypassPermissions"
517
+ const ctx = await getContext2();
518
+ const isBypassAvailable = !safe || Boolean(allowDangerouslySkipPermissions) || Boolean(dangerouslySkipPermissions);
519
+ let toolPermissionContext = loadToolPermissionContextFromDisk({
520
+ projectDir: cwd2,
521
+ includePybProjectConfig: true,
522
+ isBypassPermissionsModeAvailable: isBypassAvailable
568
523
  });
569
- }
570
- if (updates.length > 0) {
571
- toolPermissionContext = applyToolPermissionContextUpdates(
572
- toolPermissionContext,
573
- updates
574
- );
575
- }
576
- const printOptions = {
577
- commands,
578
- tools: toolsForPrint,
579
- verbose: true,
580
- safeMode: safe,
581
- forkNumber: 0,
582
- messageLogName: "unused",
583
- maxThinkingTokens: 0,
584
- persistSession: sessionPersistence !== false,
585
- toolPermissionContext,
586
- mcpClients,
587
- shouldAvoidPermissionPrompts: normalizedInputFormat !== "stream-json",
588
- model: typeof model === "string" && model.trim() ? model.trim() : void 0
589
- };
590
- const availableTools = toolsForPrint.map((t) => t.name);
591
- const slashCommands = disableSlashCommands === true ? void 0 : commands.filter((c) => !c.isHidden).map((c) => `/${c.userFacingName()}`);
592
- const initMsg = makeSdkInitMessage({
593
- sessionId: sessionIdForSdk,
594
- cwd: cwd2,
595
- tools: availableTools,
596
- slashCommands
597
- });
598
- const writeSdkLine = (obj) => {
599
- process.stdout.write(JSON.stringify(obj) + "\n");
600
- };
601
- if (normalizedOutputFormat === "stream-json") {
602
- writeSdkLine(initMsg);
603
- } else {
604
- sdkMessages.push(initMsg);
605
- }
606
- let activeTurnAbortController = null;
607
- const structured = createPrintModeStructuredStdio({
608
- enabled: normalizedInputFormat === "stream-json",
609
- stdin: process.stdin,
610
- stdout: process.stdout,
611
- onInterrupt: () => {
612
- activeTurnAbortController?.abort();
613
- },
614
- onControlRequest: createPrintModeControlRequestHandler({
615
- printOptions,
616
- mcpClients
617
- })
618
- });
619
- if (structured) structured.start();
620
- const permissionTimeoutMs = (() => {
621
- const raw = process.env.PYB_STDIO_PERMISSION_TIMEOUT_MS;
622
- const n = raw ? Number(raw) : NaN;
623
- return Number.isFinite(n) && n > 0 ? n : 3e4;
624
- })();
625
- const canUseTool = createStdioCanUseTool({
626
- normalizedPermissionPromptTool,
627
- structured,
628
- permissionTimeoutMs,
629
- cwd: cwd2,
630
- printOptions,
631
- hasPermissionsToUseTool,
632
- applyToolPermissionContextUpdates,
633
- persistToolPermissionUpdateToDisk
634
- });
635
- if (normalizedInputFormat === "stream-json") {
636
- if (!structured) {
637
- console.error("Error: Structured stdin is not available");
638
- process.exit(1);
524
+ const cliRuleList = (value) => {
525
+ if (!value) return [];
526
+ const raw = Array.isArray(value) ? value : [value];
527
+ return raw.flatMap((v) => String(v ?? "").split(",")).map((v) => v.trim()).filter(Boolean);
528
+ };
529
+ const allowedRules = cliRuleList(allowedTools);
530
+ const deniedRules = cliRuleList(disallowedTools);
531
+ const additionalDirs = cliRuleList(addDir);
532
+ const updates = [];
533
+ if (allowedRules.length > 0) {
534
+ updates.push({
535
+ type: "addRules",
536
+ destination: "cliArg",
537
+ behavior: "allow",
538
+ rules: allowedRules
539
+ });
639
540
  }
640
- await runPrintModeStreamJsonSession({
641
- structured,
642
- query,
643
- writeSdkLine,
644
- sessionId: sessionIdForSdk,
645
- systemPrompt,
646
- jsonSchema: parsedJsonSchema,
647
- context: ctx,
648
- canUseTool,
649
- toolUseContextBase: {
650
- options: printOptions,
651
- messageId: void 0,
652
- readFileTimestamps: {},
653
- setToolJSX: () => {
654
- }
655
- },
656
- replayUserMessages: Boolean(replayUserMessages),
657
- getTotalCostUsd: () => getTotalCost(),
658
- onActiveTurnAbortControllerChanged: (controller) => {
659
- activeTurnAbortController = controller;
660
- },
661
- initialMessages
662
- });
663
- process.exit(0);
664
- }
665
- const abortController = new AbortController();
666
- const userMsg = await (async () => {
667
- if (normalizedInputFormat !== "stream-json") {
668
- addToHistory(inputPrompt);
669
- return createUserMessage(inputPrompt);
541
+ if (deniedRules.length > 0) {
542
+ updates.push({
543
+ type: "addRules",
544
+ destination: "cliArg",
545
+ behavior: "deny",
546
+ rules: deniedRules
547
+ });
670
548
  }
671
- if (!structured) {
672
- console.error("Error: Structured stdin is not available");
673
- process.exit(1);
549
+ if (additionalDirs.length > 0) {
550
+ updates.push({
551
+ type: "addDirectories",
552
+ destination: "cliArg",
553
+ directories: additionalDirs
554
+ });
674
555
  }
675
- const sdkUser2 = await structured.nextUserMessage({
676
- signal: abortController.signal,
677
- timeoutMs: 3e4
678
- });
679
- if (!sdkUser2 || typeof sdkUser2 !== "object") {
680
- console.error("Error: Invalid stream-json input (missing user message)");
681
- process.exit(1);
556
+ const normalizedPermissionMode = typeof permissionMode === "string" ? permissionMode.trim() : "";
557
+ if (normalizedPermissionMode) {
558
+ const normalized = normalizedPermissionMode === "delegate" ? "default" : normalizedPermissionMode;
559
+ const allowed = /* @__PURE__ */ new Set([
560
+ "acceptEdits",
561
+ "bypassPermissions",
562
+ "default",
563
+ "dontAsk",
564
+ "plan"
565
+ ]);
566
+ if (!allowed.has(normalized)) {
567
+ console.error(
568
+ `Error: Invalid --permission-mode "${normalizedPermissionMode}". Expected one of: acceptEdits, bypassPermissions, default, delegate, dontAsk, plan`
569
+ );
570
+ process.exit(1);
571
+ }
572
+ updates.push({
573
+ type: "setMode",
574
+ destination: "cliArg",
575
+ mode: normalized
576
+ });
682
577
  }
683
- const sdkMessage = sdkUser2.message;
684
- const sdkContent = sdkMessage?.content;
685
- if (typeof sdkContent !== "string" && !Array.isArray(sdkContent)) {
686
- console.error("Error: Invalid stream-json user message content");
687
- process.exit(1);
578
+ if (dangerouslySkipPermissions) {
579
+ updates.push({
580
+ type: "setMode",
581
+ destination: "cliArg",
582
+ mode: "bypassPermissions"
583
+ });
688
584
  }
689
- const m = createUserMessage(sdkContent);
690
- if (typeof sdkUser2.uuid === "string" && sdkUser2.uuid) {
691
- ;
692
- m.uuid = String(sdkUser2.uuid);
585
+ if (updates.length > 0) {
586
+ toolPermissionContext = applyToolPermissionContextUpdates(
587
+ toolPermissionContext,
588
+ updates
589
+ );
693
590
  }
694
- return m;
695
- })();
696
- const baseMessages = [...initialMessages ?? [], userMsg];
697
- const sdkUser = pybMessageToSdkMessage(userMsg, sessionIdForSdk);
698
- if (sdkUser) {
591
+ const printOptions = {
592
+ commands,
593
+ tools: toolsForPrint,
594
+ verbose: true,
595
+ safeMode: safe,
596
+ forkNumber: 0,
597
+ messageLogName: "unused",
598
+ maxThinkingTokens: 0,
599
+ persistSession: sessionPersistence !== false,
600
+ toolPermissionContext,
601
+ mcpClients,
602
+ shouldAvoidPermissionPrompts: normalizedInputFormat !== "stream-json",
603
+ model: typeof model === "string" && model.trim() ? model.trim() : void 0
604
+ };
605
+ const availableTools = toolsForPrint.map((t) => t.name);
606
+ const slashCommands = disableSlashCommands === true ? void 0 : commands.filter((c) => !c.isHidden).map((c) => `/${c.userFacingName()}`);
607
+ const initMsg = makeSdkInitMessage({
608
+ sessionId: sessionIdForSdk,
609
+ cwd: cwd2,
610
+ tools: availableTools,
611
+ slashCommands
612
+ });
613
+ const writeSdkLine = (obj) => {
614
+ process.stdout.write(JSON.stringify(obj) + "\n");
615
+ };
699
616
  if (normalizedOutputFormat === "stream-json") {
700
- writeSdkLine(sdkUser);
617
+ writeSdkLine(initMsg);
701
618
  } else {
702
- sdkMessages.push(sdkUser);
619
+ sdkMessages.push(initMsg);
703
620
  }
704
- }
705
- let lastAssistant = null;
706
- let queryError = null;
707
- try {
708
- for await (const m of query(baseMessages, systemPrompt, ctx, canUseTool, {
709
- options: printOptions,
710
- abortController,
711
- messageId: void 0,
712
- readFileTimestamps: {},
713
- setToolJSX: () => {
621
+ let activeTurnAbortController = null;
622
+ const structured = createPrintModeStructuredStdio({
623
+ enabled: normalizedInputFormat === "stream-json",
624
+ stdin: process.stdin,
625
+ stdout: process.stdout,
626
+ onInterrupt: () => {
627
+ activeTurnAbortController?.abort();
628
+ },
629
+ onControlRequest: createPrintModeControlRequestHandler({
630
+ printOptions,
631
+ mcpClients
632
+ })
633
+ });
634
+ if (structured) structured.start();
635
+ const permissionTimeoutMs = (() => {
636
+ const raw = process.env.PYB_STDIO_PERMISSION_TIMEOUT_MS;
637
+ const n = raw ? Number(raw) : NaN;
638
+ return Number.isFinite(n) && n > 0 ? n : 3e4;
639
+ })();
640
+ const canUseTool = createStdioCanUseTool({
641
+ normalizedPermissionPromptTool,
642
+ structured,
643
+ permissionTimeoutMs,
644
+ cwd: cwd2,
645
+ printOptions,
646
+ hasPermissionsToUseTool,
647
+ applyToolPermissionContextUpdates,
648
+ persistToolPermissionUpdateToDisk
649
+ });
650
+ if (normalizedInputFormat === "stream-json") {
651
+ if (!structured) {
652
+ console.error("Error: Structured stdin is not available");
653
+ process.exit(1);
654
+ }
655
+ await runPrintModeStreamJsonSession({
656
+ structured,
657
+ query,
658
+ writeSdkLine,
659
+ sessionId: sessionIdForSdk,
660
+ systemPrompt,
661
+ jsonSchema: parsedJsonSchema,
662
+ context: ctx,
663
+ canUseTool,
664
+ toolUseContextBase: {
665
+ options: printOptions,
666
+ messageId: void 0,
667
+ readFileTimestamps: {},
668
+ setToolJSX: () => {
669
+ },
670
+ conversationTracker
671
+ },
672
+ replayUserMessages: Boolean(replayUserMessages),
673
+ getTotalCostUsd: () => getTotalCost(),
674
+ onActiveTurnAbortControllerChanged: (controller) => {
675
+ activeTurnAbortController = controller;
676
+ },
677
+ initialMessages
678
+ });
679
+ process.exit(0);
680
+ }
681
+ const abortController = new AbortController();
682
+ const userMsg = await (async () => {
683
+ if (normalizedInputFormat !== "stream-json") {
684
+ addToHistory(inputPrompt);
685
+ return createUserMessage(inputPrompt);
686
+ }
687
+ if (!structured) {
688
+ console.error("Error: Structured stdin is not available");
689
+ process.exit(1);
690
+ }
691
+ const sdkUser2 = await structured.nextUserMessage({
692
+ signal: abortController.signal,
693
+ timeoutMs: 3e4
694
+ });
695
+ if (!sdkUser2 || typeof sdkUser2 !== "object") {
696
+ console.error("Error: Invalid stream-json input (missing user message)");
697
+ process.exit(1);
698
+ }
699
+ const sdkMessage = sdkUser2.message;
700
+ const sdkContent = sdkMessage?.content;
701
+ if (typeof sdkContent !== "string" && !Array.isArray(sdkContent)) {
702
+ console.error("Error: Invalid stream-json user message content");
703
+ process.exit(1);
714
704
  }
715
- })) {
716
- if (m.type === "assistant") lastAssistant = m;
717
- const sdk = pybMessageToSdkMessage(m, sessionIdForSdk);
718
- if (!sdk) continue;
705
+ const m = createUserMessage(sdkContent);
706
+ if (typeof sdkUser2.uuid === "string" && sdkUser2.uuid) {
707
+ ;
708
+ m.uuid = String(sdkUser2.uuid);
709
+ }
710
+ return m;
711
+ })();
712
+ const baseMessages = [...initialMessages ?? [], userMsg];
713
+ const sdkUser = pybMessageToSdkMessage(userMsg, sessionIdForSdk);
714
+ if (sdkUser) {
719
715
  if (normalizedOutputFormat === "stream-json") {
720
- writeSdkLine(sdk);
716
+ writeSdkLine(sdkUser);
721
717
  } else {
722
- sdkMessages.push(sdk);
718
+ sdkMessages.push(sdkUser);
723
719
  }
724
720
  }
725
- } catch (e) {
726
- abortController.abort();
727
- queryError = e;
728
- }
729
- const textFromAssistant = lastAssistant?.message?.content?.find(
730
- (c) => c.type === "text"
731
- )?.text;
732
- let text = typeof textFromAssistant === "string" ? textFromAssistant : queryError instanceof Error ? queryError.message : queryError ? String(queryError) : "";
733
- let structuredOutput;
734
- if (parsedJsonSchema && !queryError) {
721
+ let lastAssistant = null;
722
+ let queryError = null;
735
723
  try {
736
- const raw = typeof textFromAssistant === "string" ? textFromAssistant : "";
737
- const fenced = raw.trim();
738
- const unfenced = (() => {
739
- const m = fenced.match(/^```(?:json)?\\s*([\\s\\S]*?)\\s*```$/i);
740
- return m ? m[1].trim() : fenced;
741
- })();
742
- const parsed = JSON.parse(unfenced);
743
- const Ajv = (await import("ajv")).default;
744
- const ajv = new Ajv({ allErrors: true, strict: false });
745
- const validate = ajv.compile(parsedJsonSchema);
746
- const ok = validate(parsed);
747
- if (!ok) {
748
- const errorText = typeof ajv.errorsText === "function" ? ajv.errorsText(validate.errors, { separator: "; " }) : JSON.stringify(validate.errors ?? []);
749
- throw new Error(
750
- `Structured output failed JSON schema validation: ${errorText}`
751
- );
752
- }
753
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
754
- throw new Error("Structured output must be a JSON object");
724
+ for await (const m of query(baseMessages, systemPrompt, ctx, canUseTool, {
725
+ options: printOptions,
726
+ abortController,
727
+ messageId: void 0,
728
+ readFileTimestamps: {},
729
+ setToolJSX: () => {
730
+ },
731
+ conversationTracker
732
+ })) {
733
+ if (m.type === "assistant") lastAssistant = m;
734
+ const sdk = pybMessageToSdkMessage(m, sessionIdForSdk);
735
+ if (!sdk) continue;
736
+ if (normalizedOutputFormat === "stream-json") {
737
+ writeSdkLine(sdk);
738
+ } else {
739
+ sdkMessages.push(sdk);
740
+ }
755
741
  }
756
- structuredOutput = parsed;
757
742
  } catch (e) {
758
- const msg = e instanceof Error ? e.message : String(e);
759
- queryError = new Error(msg);
760
- text = msg;
743
+ abortController.abort();
744
+ queryError = e;
761
745
  }
762
- }
763
- const usage = lastAssistant?.message?.usage;
764
- const totalCostUsd = getTotalCost();
765
- const durationMs = Date.now() - startedAt;
766
- const resultMsg = makeSdkResultMessage({
767
- sessionId: sessionIdForSdk,
768
- result: String(text),
769
- structuredOutput,
770
- numTurns: 1,
771
- usage,
772
- totalCostUsd,
773
- durationMs,
774
- durationApiMs: 0,
775
- isError: Boolean(queryError)
776
- });
777
- if (normalizedOutputFormat === "stream-json") {
778
- writeSdkLine(resultMsg);
779
- process.exit(0);
780
- }
781
- sdkMessages.push(resultMsg);
782
- if (verbose) {
783
- process.stdout.write(`${JSON.stringify(sdkMessages, null, 2)}
746
+ const textFromAssistant = lastAssistant?.message?.content?.find(
747
+ (c) => c.type === "text"
748
+ )?.text;
749
+ let text = typeof textFromAssistant === "string" ? textFromAssistant : queryError instanceof Error ? queryError.message : queryError ? String(queryError) : "";
750
+ let structuredOutput;
751
+ if (parsedJsonSchema && !queryError) {
752
+ try {
753
+ const raw = typeof textFromAssistant === "string" ? textFromAssistant : "";
754
+ const fenced = raw.trim();
755
+ const unfenced = (() => {
756
+ const m = fenced.match(/^```(?:json)?\\s*([\\s\\S]*?)\\s*```$/i);
757
+ return m ? m[1].trim() : fenced;
758
+ })();
759
+ const parsed = JSON.parse(unfenced);
760
+ const Ajv = (await import("ajv")).default;
761
+ const ajv = new Ajv({ allErrors: true, strict: false });
762
+ const validate = ajv.compile(parsedJsonSchema);
763
+ const ok = validate(parsed);
764
+ if (!ok) {
765
+ const errorText = typeof ajv.errorsText === "function" ? ajv.errorsText(validate.errors, { separator: "; " }) : JSON.stringify(validate.errors ?? []);
766
+ throw new Error(
767
+ `Structured output failed JSON schema validation: ${errorText}`
768
+ );
769
+ }
770
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
771
+ throw new Error("Structured output must be a JSON object");
772
+ }
773
+ structuredOutput = parsed;
774
+ } catch (e) {
775
+ const msg = e instanceof Error ? e.message : String(e);
776
+ queryError = new Error(msg);
777
+ text = msg;
778
+ }
779
+ }
780
+ const usage = lastAssistant?.message?.usage;
781
+ const totalCostUsd = getTotalCost();
782
+ const durationMs = Date.now() - startedAt;
783
+ const resultMsg = makeSdkResultMessage({
784
+ sessionId: sessionIdForSdk,
785
+ result: String(text),
786
+ structuredOutput,
787
+ numTurns: 1,
788
+ usage,
789
+ totalCostUsd,
790
+ durationMs,
791
+ durationApiMs: 0,
792
+ isError: Boolean(queryError)
793
+ });
794
+ if (normalizedOutputFormat === "stream-json") {
795
+ writeSdkLine(resultMsg);
796
+ process.exit(0);
797
+ }
798
+ sdkMessages.push(resultMsg);
799
+ if (verbose) {
800
+ process.stdout.write(`${JSON.stringify(sdkMessages, null, 2)}
784
801
  `);
785
- } else {
786
- process.stdout.write(`${JSON.stringify(resultMsg, null, 2)}
802
+ } else {
803
+ process.stdout.write(`${JSON.stringify(resultMsg, null, 2)}
787
804
  `);
805
+ }
806
+ process.exit(0);
807
+ } finally {
808
+ restoreSessionScope();
788
809
  }
789
- process.exit(0);
790
810
  }
791
811
 
792
812
  // src/utils/session/cleanup.ts
@@ -846,9 +866,9 @@ async function setup(cwd2, safeMode) {
846
866
  grantReadPermissionForOriginalDir();
847
867
  let agentLoader;
848
868
  try {
849
- agentLoader = await import("./loader-JPKYTFFC.js");
869
+ agentLoader = await import("./loader-OWZ3WD2X.js");
850
870
  } catch {
851
- agentLoader = await import("./loader-JPKYTFFC.js");
871
+ agentLoader = await import("./loader-OWZ3WD2X.js");
852
872
  }
853
873
  const { startAgentWatcher } = agentLoader;
854
874
  await startAgentWatcher(() => {
@@ -2068,12 +2088,12 @@ async function parseArgs(stdinContent, renderContext) {
2068
2088
  assertMinVersion();
2069
2089
  {
2070
2090
  const requested = Array.isArray(pluginDir) && pluginDir.length > 0 ? pluginDir : [];
2071
- const { listEnabledInstalledPluginPackRoots } = await import("./skillMarketplace-UITGQNZD.js");
2091
+ const { listEnabledInstalledPluginPackRoots } = await import("./skillMarketplace-ATLDIEEX.js");
2072
2092
  const installed = listEnabledInstalledPluginPackRoots();
2073
2093
  const all = [...installed, ...requested].filter(Boolean);
2074
2094
  const deduped = Array.from(new Set(all));
2075
2095
  if (deduped.length > 0) {
2076
- const { configureSessionPlugins } = await import("./pluginRuntime-KJ3YFO2O.js");
2096
+ const { configureSessionPlugins } = await import("./pluginRuntime-PQ3VZRX7.js");
2077
2097
  const { errors } = await configureSessionPlugins({
2078
2098
  pluginDirs: deduped
2079
2099
  });
@@ -2083,9 +2103,9 @@ async function parseArgs(stdinContent, renderContext) {
2083
2103
  }
2084
2104
  }
2085
2105
  const [{ ask }, { getTools }, { getCommands }] = await Promise.all([
2086
- import("./ask-CUR6IJ2W.js"),
2087
- import("./tools-HVGZBEHZ.js"),
2088
- import("./commands-LAZD5O4M.js")
2106
+ import("./ask-TI3ITWN7.js"),
2107
+ import("./tools-45UHHM5S.js"),
2108
+ import("./commands-3B77L2SI.js")
2089
2109
  ]);
2090
2110
  const commands = await getCommands();
2091
2111
  const mcpClientsPromise = Array.isArray(mcpConfig) && mcpConfig.length > 0 || strictMcpConfig === true ? getClientsForCliMcpConfig({
@@ -2104,8 +2124,8 @@ async function parseArgs(stdinContent, renderContext) {
2104
2124
  const {
2105
2125
  loadPybAgentSessionMessages,
2106
2126
  findMostRecentPybAgentSessionId
2107
- } = await import("./pybAgentSessionLoad-TRSWA62U.js");
2108
- const { listPybAgentSessions, resolvePybResumeSessionIdentifier } = await import("./pybAgentSessionResume-3IRNTCVI.js");
2127
+ } = await import("./pybAgentSessionLoad-5MWAY2A4.js");
2128
+ const { listPybAgentSessions, resolvePybResumeSessionIdentifier } = await import("./pybAgentSessionResume-NZGSUGGS.js");
2109
2129
  const { isUuid } = await import("./uuid-CVHEFGW4.js");
2110
2130
  const { setPybAgentSessionId, getPybAgentSessionId } = await import("./pybAgentSessionId-EPCAMQ25.js");
2111
2131
  const { randomUUID } = await import("crypto");
@@ -2230,7 +2250,7 @@ async function parseArgs(stdinContent, renderContext) {
2230
2250
  { getLatestVersion, getUpdateCommandSuggestions },
2231
2251
  semverMod
2232
2252
  ] = await Promise.all([
2233
- import("./autoUpdater-DEH233RT.js"),
2253
+ import("./autoUpdater-MRK5BD2L.js"),
2234
2254
  import("semver")
2235
2255
  ]);
2236
2256
  const semver = semverMod?.default ?? semverMod;
@@ -2291,7 +2311,7 @@ async function parseArgs(stdinContent, renderContext) {
2291
2311
  const isDefaultModel = await isDefaultSlowAndCapableModel();
2292
2312
  {
2293
2313
  const { render: render3 } = await import("ink");
2294
- const { REPL } = await import("./REPL-WXPYXBW2.js");
2314
+ const { REPL } = await import("./REPL-VOJCD6X6.js");
2295
2315
  render3(
2296
2316
  /* @__PURE__ */ React10.createElement(
2297
2317
  REPL,
@@ -2459,7 +2479,7 @@ async function parseArgs(stdinContent, renderContext) {
2459
2479
  { replace: !!replace }
2460
2480
  );
2461
2481
  saveGlobalConfig(nextConfig);
2462
- await import("./model-P33QONA2.js").then(({ reloadModelManager }) => {
2482
+ await import("./model-5NDSZPIL.js").then(({ reloadModelManager }) => {
2463
2483
  reloadModelManager();
2464
2484
  });
2465
2485
  if (warnings.length > 0) {
@@ -2478,7 +2498,7 @@ async function parseArgs(stdinContent, renderContext) {
2478
2498
  const workingDir = typeof options?.cwd === "string" ? options.cwd : typeof programCwd === "string" ? programCwd : cwd();
2479
2499
  const asJson = options?.json === true;
2480
2500
  await setup(workingDir, false);
2481
- const { reloadModelManager, getModelManager: getModelManager2 } = await import("./model-P33QONA2.js");
2501
+ const { reloadModelManager, getModelManager: getModelManager2 } = await import("./model-5NDSZPIL.js");
2482
2502
  reloadModelManager();
2483
2503
  const manager = getModelManager2();
2484
2504
  const config2 = getGlobalConfig();
@@ -2552,7 +2572,7 @@ Model profiles (${active.length}/${profiles.length} active):
2552
2572
  try {
2553
2573
  const workingDir = typeof options?.cwd === "string" ? options.cwd : cwd();
2554
2574
  await setup(workingDir, false);
2555
- const { validateAgentTemplates } = await import("./agentsValidate-LQFWOCPZ.js");
2575
+ const { validateAgentTemplates } = await import("./agentsValidate-35AHZXNB.js");
2556
2576
  const report = await validateAgentTemplates({
2557
2577
  cwd: workingDir,
2558
2578
  paths: Array.isArray(paths) ? paths : [],
@@ -2596,7 +2616,7 @@ Model profiles (${active.length}/${profiles.length} active):
2596
2616
  const registerMarketplaceCommands = (marketplaceCmd2) => {
2597
2617
  marketplaceCmd2.command("add <source>").description("Add a marketplace from a URL, path, or GitHub repo").action(async (source) => {
2598
2618
  try {
2599
- const { addMarketplace } = await import("./skillMarketplace-UITGQNZD.js");
2619
+ const { addMarketplace } = await import("./skillMarketplace-ATLDIEEX.js");
2600
2620
  console.log("Adding marketplace...");
2601
2621
  const { name } = await addMarketplace(source);
2602
2622
  console.log(`Successfully added marketplace: ${name}`);
@@ -2608,7 +2628,7 @@ Model profiles (${active.length}/${profiles.length} active):
2608
2628
  });
2609
2629
  marketplaceCmd2.command("list").description("List all configured marketplaces").option("--json", "Output as JSON").action(async (options) => {
2610
2630
  try {
2611
- const { listMarketplaces } = await import("./skillMarketplace-UITGQNZD.js");
2631
+ const { listMarketplaces } = await import("./skillMarketplace-ATLDIEEX.js");
2612
2632
  const marketplaces = listMarketplaces();
2613
2633
  if (options.json) {
2614
2634
  console.log(JSON.stringify(marketplaces, null, 2));
@@ -2647,7 +2667,7 @@ Model profiles (${active.length}/${profiles.length} active):
2647
2667
  });
2648
2668
  marketplaceCmd2.command("remove <name>").alias("rm").description("Remove a configured marketplace").action(async (name) => {
2649
2669
  try {
2650
- const { removeMarketplace } = await import("./skillMarketplace-UITGQNZD.js");
2670
+ const { removeMarketplace } = await import("./skillMarketplace-ATLDIEEX.js");
2651
2671
  removeMarketplace(name);
2652
2672
  console.log(`Successfully removed marketplace: ${name}`);
2653
2673
  process.exit(0);
@@ -2664,7 +2684,7 @@ Model profiles (${active.length}/${profiles.length} active):
2664
2684
  listMarketplaces,
2665
2685
  refreshAllMarketplacesAsync,
2666
2686
  refreshMarketplaceAsync
2667
- } = await import("./skillMarketplace-UITGQNZD.js");
2687
+ } = await import("./skillMarketplace-ATLDIEEX.js");
2668
2688
  const trimmed = typeof name === "string" ? name.trim() : "";
2669
2689
  if (trimmed) {
2670
2690
  console.log(`Updating marketplace: ${trimmed}...`);
@@ -2715,9 +2735,9 @@ Model profiles (${active.length}/${profiles.length} active):
2715
2735
  );
2716
2736
  process.exit(1);
2717
2737
  }
2718
- const { setCwd: setCwd2 } = await import("./state-I7LIGIFJ.js");
2738
+ const { setCwd: setCwd2 } = await import("./state-Y2Q4MPY5.js");
2719
2739
  await setCwd2(options.cwd ?? cwd());
2720
- const { installSkillPlugin } = await import("./skillMarketplace-UITGQNZD.js");
2740
+ const { installSkillPlugin } = await import("./skillMarketplace-ATLDIEEX.js");
2721
2741
  const result = installSkillPlugin(plugin, {
2722
2742
  scope,
2723
2743
  force: options.force === true
@@ -2744,9 +2764,9 @@ ${skillList}`);
2744
2764
  );
2745
2765
  process.exit(1);
2746
2766
  }
2747
- const { setCwd: setCwd2 } = await import("./state-I7LIGIFJ.js");
2767
+ const { setCwd: setCwd2 } = await import("./state-Y2Q4MPY5.js");
2748
2768
  await setCwd2(options.cwd ?? cwd());
2749
- const { uninstallSkillPlugin } = await import("./skillMarketplace-UITGQNZD.js");
2769
+ const { uninstallSkillPlugin } = await import("./skillMarketplace-ATLDIEEX.js");
2750
2770
  const result = uninstallSkillPlugin(plugin, { scope });
2751
2771
  const skillList = result.removedSkills.length > 0 ? `Skills: ${result.removedSkills.join(", ")}` : "Skills: (none)";
2752
2772
  console.log(`Uninstalled ${result.pluginSpec}
@@ -2770,9 +2790,9 @@ ${skillList}`);
2770
2790
  );
2771
2791
  process.exit(1);
2772
2792
  }
2773
- const { setCwd: setCwd2, getCwd: getCwd2 } = await import("./state-I7LIGIFJ.js");
2793
+ const { setCwd: setCwd2, getCwd: getCwd2 } = await import("./state-Y2Q4MPY5.js");
2774
2794
  await setCwd2(options.cwd ?? cwd());
2775
- const { listInstalledSkillPlugins } = await import("./skillMarketplace-UITGQNZD.js");
2795
+ const { listInstalledSkillPlugins } = await import("./skillMarketplace-ATLDIEEX.js");
2776
2796
  const all = listInstalledSkillPlugins();
2777
2797
  const filtered = Object.fromEntries(
2778
2798
  Object.entries(all).filter(([, record]) => {
@@ -2816,9 +2836,9 @@ ${skillList}`);
2816
2836
  );
2817
2837
  process.exit(1);
2818
2838
  }
2819
- const { setCwd: setCwd2 } = await import("./state-I7LIGIFJ.js");
2839
+ const { setCwd: setCwd2 } = await import("./state-Y2Q4MPY5.js");
2820
2840
  await setCwd2(options.cwd ?? cwd());
2821
- const { enableSkillPlugin } = await import("./skillMarketplace-UITGQNZD.js");
2841
+ const { enableSkillPlugin } = await import("./skillMarketplace-ATLDIEEX.js");
2822
2842
  const result = enableSkillPlugin(plugin, { scope });
2823
2843
  console.log(`Enabled ${result.pluginSpec}`);
2824
2844
  process.exit(0);
@@ -2840,9 +2860,9 @@ ${skillList}`);
2840
2860
  );
2841
2861
  process.exit(1);
2842
2862
  }
2843
- const { setCwd: setCwd2 } = await import("./state-I7LIGIFJ.js");
2863
+ const { setCwd: setCwd2 } = await import("./state-Y2Q4MPY5.js");
2844
2864
  await setCwd2(options.cwd ?? cwd());
2845
- const { disableSkillPlugin } = await import("./skillMarketplace-UITGQNZD.js");
2865
+ const { disableSkillPlugin } = await import("./skillMarketplace-ATLDIEEX.js");
2846
2866
  const result = disableSkillPlugin(plugin, { scope });
2847
2867
  console.log(`Disabled ${result.pluginSpec}`);
2848
2868
  process.exit(0);
@@ -2853,9 +2873,9 @@ ${skillList}`);
2853
2873
  });
2854
2874
  pluginCmd.command("validate <path>").description("Validate a plugin or marketplace manifest").option("--cwd <cwd>", "The current working directory", String, cwd()).action(async (path, options) => {
2855
2875
  try {
2856
- const { setCwd: setCwd2 } = await import("./state-I7LIGIFJ.js");
2876
+ const { setCwd: setCwd2 } = await import("./state-Y2Q4MPY5.js");
2857
2877
  await setCwd2(options.cwd ?? cwd());
2858
- const { formatValidationResult, validatePluginOrMarketplacePath } = await import("./pluginValidation-MR5GV7PL.js");
2878
+ const { formatValidationResult, validatePluginOrMarketplacePath } = await import("./pluginValidation-RQ34XQY3.js");
2859
2879
  const result = validatePluginOrMarketplacePath(path);
2860
2880
  console.log(
2861
2881
  `Validating ${result.fileType} manifest: ${result.filePath}
@@ -2877,9 +2897,9 @@ ${skillList}`);
2877
2897
  registerMarketplaceCommands(marketplaceCmd);
2878
2898
  skillsCmd.command("install <plugin>").description("Install a skill plugin pack (<plugin>@<marketplace>)").option("--cwd <cwd>", "The current working directory", String, cwd()).option("--project", "Install into this project (.pyb/...)", () => true).option("--force", "Overwrite existing installed files", () => true).action(async (plugin, options) => {
2879
2899
  try {
2880
- const { setCwd: setCwd2 } = await import("./state-I7LIGIFJ.js");
2900
+ const { setCwd: setCwd2 } = await import("./state-Y2Q4MPY5.js");
2881
2901
  await setCwd2(options.cwd ?? cwd());
2882
- const { installSkillPlugin } = await import("./skillMarketplace-UITGQNZD.js");
2902
+ const { installSkillPlugin } = await import("./skillMarketplace-ATLDIEEX.js");
2883
2903
  const result = installSkillPlugin(plugin, {
2884
2904
  project: options.project === true,
2885
2905
  force: options.force === true
@@ -2895,9 +2915,9 @@ ${skillList}`);
2895
2915
  });
2896
2916
  skillsCmd.command("uninstall <plugin>").description("Uninstall a skill plugin pack (<plugin>@<marketplace>)").option("--cwd <cwd>", "The current working directory", String, cwd()).option("--project", "Uninstall from this project (.pyb/...)", () => true).action(async (plugin, options) => {
2897
2917
  try {
2898
- const { setCwd: setCwd2 } = await import("./state-I7LIGIFJ.js");
2918
+ const { setCwd: setCwd2 } = await import("./state-Y2Q4MPY5.js");
2899
2919
  await setCwd2(options.cwd ?? cwd());
2900
- const { uninstallSkillPlugin } = await import("./skillMarketplace-UITGQNZD.js");
2920
+ const { uninstallSkillPlugin } = await import("./skillMarketplace-ATLDIEEX.js");
2901
2921
  const result = uninstallSkillPlugin(plugin, {
2902
2922
  project: options.project === true
2903
2923
  });
@@ -2912,7 +2932,7 @@ ${skillList}`);
2912
2932
  });
2913
2933
  skillsCmd.command("list-installed").description("List installed skill plugins").action(async () => {
2914
2934
  try {
2915
- const { listInstalledSkillPlugins } = await import("./skillMarketplace-UITGQNZD.js");
2935
+ const { listInstalledSkillPlugins } = await import("./skillMarketplace-ATLDIEEX.js");
2916
2936
  console.log(JSON.stringify(listInstalledSkillPlugins(), null, 2));
2917
2937
  process.exit(0);
2918
2938
  } catch (error) {
@@ -3558,7 +3578,7 @@ ${skillList}`);
3558
3578
  const ink = await import("ink");
3559
3579
  const reactModule = await import("react");
3560
3580
  const inkjsui = await import("@inkjs/ui");
3561
- const utilsTheme = await import("./theme-RVIXXPSQ.js");
3581
+ const utilsTheme = await import("./theme-3L66ZU5Z.js");
3562
3582
  const { render: render3 } = ink;
3563
3583
  const React11 = reactModule;
3564
3584
  const { MultiSelect: MultiSelect2 } = inkjsui;
@@ -3701,8 +3721,8 @@ ${skillList}`);
3701
3721
  const commandOptions = getCommandOptions(options);
3702
3722
  const workingDir = resolveWorkingDir(commandOptions, program);
3703
3723
  await setup(workingDir, false);
3704
- const { getAbsolutePath } = await import("./file-KHYC624L.js");
3705
- const { LspFacade } = await import("./lsp-B7QJVI2U.js");
3724
+ const { getAbsolutePath } = await import("./file-LCS77XWE.js");
3725
+ const { LspFacade } = await import("./lsp-NLPSJYH4.js");
3706
3726
  const { existsSync: existsSync2 } = await import("fs");
3707
3727
  const absPath = getAbsolutePath(file) ?? file;
3708
3728
  if (!existsSync2(absPath)) {
@@ -3733,7 +3753,7 @@ ${skillList}`);
3733
3753
  try {
3734
3754
  const workingDir = resolveWorkingDir(options, program);
3735
3755
  await setup(workingDir, false);
3736
- const { LspFacade } = await import("./lsp-B7QJVI2U.js");
3756
+ const { LspFacade } = await import("./lsp-NLPSJYH4.js");
3737
3757
  const result = await LspFacade.run({
3738
3758
  operation: "workspaceSymbol",
3739
3759
  filePath: query,
@@ -3750,8 +3770,8 @@ ${skillList}`);
3750
3770
  try {
3751
3771
  const workingDir = resolveWorkingDir(options, program);
3752
3772
  await setup(workingDir, false);
3753
- const { getAbsolutePath } = await import("./file-KHYC624L.js");
3754
- const { LspFacade } = await import("./lsp-B7QJVI2U.js");
3773
+ const { getAbsolutePath } = await import("./file-LCS77XWE.js");
3774
+ const { LspFacade } = await import("./lsp-NLPSJYH4.js");
3755
3775
  const { existsSync: existsSync2 } = await import("fs");
3756
3776
  const absPath = getAbsolutePath(file) ?? file;
3757
3777
  if (!existsSync2(absPath)) {
@@ -3774,7 +3794,7 @@ ${skillList}`);
3774
3794
  try {
3775
3795
  const workingDir = resolveWorkingDir(options, program);
3776
3796
  await setup(workingDir, false);
3777
- const { LspFacade } = await import("./lsp-B7QJVI2U.js");
3797
+ const { LspFacade } = await import("./lsp-NLPSJYH4.js");
3778
3798
  const status = LspFacade.status();
3779
3799
  console.log(JSON.stringify(status, null, 2));
3780
3800
  process.exit(0);
@@ -3788,7 +3808,7 @@ ${skillList}`);
3788
3808
  const commandOptions = getCommandOptions(options);
3789
3809
  const workingDir = resolveWorkingDir(commandOptions, program);
3790
3810
  await setup(workingDir, false);
3791
- const { LspFacade } = await import("./lsp-B7QJVI2U.js");
3811
+ const { LspFacade } = await import("./lsp-NLPSJYH4.js");
3792
3812
  const host = typeof commandOptions?.host === "string" && commandOptions.host.length > 0 ? commandOptions.host : "127.0.0.1";
3793
3813
  const port = typeof commandOptions?.port === "number" && !Number.isNaN(commandOptions.port) ? commandOptions.port : 7337;
3794
3814
  const server = LspFacade.serveStatus({ host, port });
@@ -3814,7 +3834,7 @@ ${skillList}`);
3814
3834
  program.command("update").description("Show manual upgrade commands (no auto-install)").action(async () => {
3815
3835
  console.log(`Current version: ${MACRO.VERSION}`);
3816
3836
  console.log("Checking for updates...");
3817
- const { getLatestVersion, getUpdateCommandSuggestions } = await import("./autoUpdater-DEH233RT.js");
3837
+ const { getLatestVersion, getUpdateCommandSuggestions } = await import("./autoUpdater-MRK5BD2L.js");
3818
3838
  const latestVersion = await getLatestVersion();
3819
3839
  if (!latestVersion) {
3820
3840
  console.error("Failed to check for updates");
@@ -3869,8 +3889,8 @@ ${skillList}`);
3869
3889
  await setup(cwd2, safe);
3870
3890
  assertMinVersion();
3871
3891
  const [{ getTools }, { getCommands }] = await Promise.all([
3872
- import("./tools-HVGZBEHZ.js"),
3873
- import("./commands-LAZD5O4M.js")
3892
+ import("./tools-45UHHM5S.js"),
3893
+ import("./commands-3B77L2SI.js")
3874
3894
  ]);
3875
3895
  const [allTools, commands, mcpClients] = await Promise.all([
3876
3896
  getTools(
@@ -3881,8 +3901,8 @@ ${skillList}`);
3881
3901
  ]);
3882
3902
  const tools = disableSlashCommands === true ? allTools.filter((t) => t.name !== "SlashCommand") : allTools;
3883
3903
  if (identifier !== void 0) {
3884
- const { loadPybAgentSessionMessages } = await import("./pybAgentSessionLoad-TRSWA62U.js");
3885
- const { listPybAgentSessions, resolvePybResumeSessionIdentifier } = await import("./pybAgentSessionResume-3IRNTCVI.js");
3904
+ const { loadPybAgentSessionMessages } = await import("./pybAgentSessionLoad-5MWAY2A4.js");
3905
+ const { listPybAgentSessions, resolvePybResumeSessionIdentifier } = await import("./pybAgentSessionResume-NZGSUGGS.js");
3886
3906
  const { setPybAgentSessionId } = await import("./pybAgentSessionId-EPCAMQ25.js");
3887
3907
  const rawIdentifier = String(identifier).trim();
3888
3908
  const isLegacyNumber = /^-?\\d+$/.test(rawIdentifier);
@@ -3952,7 +3972,7 @@ ${skillList}`);
3952
3972
  const isDefaultModel = await isDefaultSlowAndCapableModel();
3953
3973
  {
3954
3974
  const { render: render3 } = await import("ink");
3955
- const { REPL } = await import("./REPL-WXPYXBW2.js");
3975
+ const { REPL } = await import("./REPL-VOJCD6X6.js");
3956
3976
  render3(
3957
3977
  /* @__PURE__ */ React10.createElement(
3958
3978
  REPL,
@@ -3979,7 +3999,7 @@ ${skillList}`);
3979
3999
  process.exit(1);
3980
4000
  }
3981
4001
  } else {
3982
- const { listPybAgentSessions } = await import("./pybAgentSessionResume-3IRNTCVI.js");
4002
+ const { listPybAgentSessions } = await import("./pybAgentSessionResume-NZGSUGGS.js");
3983
4003
  const sessions = listPybAgentSessions({ cwd: cwd2 });
3984
4004
  if (sessions.length === 0) {
3985
4005
  console.error("No conversation found to resume");
@@ -4084,7 +4104,7 @@ async function gracefulExit(code = 0) {
4084
4104
  }
4085
4105
  isGracefulExitInProgress = true;
4086
4106
  try {
4087
- const { runSessionEndHooks } = await import("./pybHooks-HFAKEYDS.js");
4107
+ const { runSessionEndHooks } = await import("./pybHooks-HILU7ZB4.js");
4088
4108
  const { getPybAgentSessionId } = await import("./pybAgentSessionId-EPCAMQ25.js");
4089
4109
  const { tmpdir } = await import("os");
4090
4110
  const { join: join2 } = await import("path");