@band-app/server 0.35.0 → 0.36.0
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.
- package/dist/client/assets/{TerminalPanel-CX4dQ8jR.js → TerminalPanel-6-rt7Tzp.js} +1 -1
- package/dist/client/assets/{_basePickBy-Dx35lEgW.js → _basePickBy-D1cW8RfA.js} +1 -1
- package/dist/client/assets/{_baseUniq-CMkXBei9.js → _baseUniq-DCImWVn2.js} +1 -1
- package/dist/client/assets/{arc-DK3KeNW-.js → arc-Jv1JrzDM.js} +1 -1
- package/dist/client/assets/{architectureDiagram-VXUJARFQ-_hgteJO2.js → architectureDiagram-VXUJARFQ-DJTHV1y7.js} +1 -1
- package/dist/client/assets/{blockDiagram-VD42YOAC-D4nK8NF5.js → blockDiagram-VD42YOAC-Cj_bRlht.js} +1 -1
- package/dist/client/assets/{c4Diagram-YG6GDRKO-D8ZrZiTI.js → c4Diagram-YG6GDRKO-xPUaEy7L.js} +1 -1
- package/dist/client/assets/channel-BObJvFJf.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-EqwJIY-C.js → chunk-4BX2VUAB-DWHXL8Ea.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-CHNR-VN7.js → chunk-55IACEB6-Bd7QCFS0.js} +1 -1
- package/dist/client/assets/{chunk-B4BG7PRW-CVzCDJlc.js → chunk-B4BG7PRW-By14k0HA.js} +1 -1
- package/dist/client/assets/{chunk-DI55MBZ5-oTBFM9ze.js → chunk-DI55MBZ5-D6pCQEj8.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-Bo-2Dikp.js → chunk-FMBD7UC4-DYeXE4xT.js} +1 -1
- package/dist/client/assets/{chunk-QN33PNHL-FqjvjGa_.js → chunk-QN33PNHL-DcLmw7kN.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-CKO815gH.js → chunk-QZHKN3VN-CRzbN_tm.js} +1 -1
- package/dist/client/assets/{chunk-TZMSLE5B-3zjd2CiU.js → chunk-TZMSLE5B-B75f53t3.js} +1 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-B4j3Xs8O.js +1 -0
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-B4j3Xs8O.js +1 -0
- package/dist/client/assets/clone-D1oJjm-k.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-4x0aq1rT.js → cose-bilkent-S5V4N54A-BkAK4OL7.js} +1 -1
- package/dist/client/assets/{dagre-6UL2VRFP-C685K4i3.js → dagre-6UL2VRFP-DncmS6YY.js} +1 -1
- package/dist/client/assets/{diagram-PSM6KHXK-B6qGMKr7.js → diagram-PSM6KHXK-Cn4L1emn.js} +1 -1
- package/dist/client/assets/{diagram-QEK2KX5R-Bfd-BbBX.js → diagram-QEK2KX5R-PfH1MBS7.js} +1 -1
- package/dist/client/assets/{diagram-S2PKOQOG-BwLaDVQ4.js → diagram-S2PKOQOG-DIyYe2yo.js} +1 -1
- package/dist/client/assets/{erDiagram-Q2GNP2WA-DoQMRnGW.js → erDiagram-Q2GNP2WA-DWSS5ilU.js} +1 -1
- package/dist/client/assets/{flowDiagram-NV44I4VS-2yTNMz0q.js → flowDiagram-NV44I4VS-D8sgfoe8.js} +1 -1
- package/dist/client/assets/{ganttDiagram-JELNMOA3-DXqi-DbY.js → ganttDiagram-JELNMOA3-CY0uwMQo.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-V2S2FVAM-C7CSi-Aw.js → gitGraphDiagram-V2S2FVAM-C5HEaqeu.js} +1 -1
- package/dist/client/assets/{graph-DZMgyc4x.js → graph-CHdAVft2.js} +1 -1
- package/dist/client/assets/{highlighted-body-B3W2YXNL-CrQyrK8r.js → highlighted-body-B3W2YXNL-fz7u7Bcv.js} +1 -1
- package/dist/client/assets/{index-au-xsyz1.js → index-8d72uArR.js} +1 -1
- package/dist/client/assets/{index-CLyGoryJ.js → index-BooiqIu5.js} +1 -1
- package/dist/client/assets/{index-C3LMxvTf.js → index-Clbffg3I.js} +1 -1
- package/dist/client/assets/{index-CIWfGOhs.js → index-CrBImo8f.js} +1 -1
- package/dist/client/assets/{index-CHYUiFs8.js → index-D-HgfXJR.js} +1 -1
- package/dist/client/assets/{index-DAIY6Xmz.js → index-D6YofG76.js} +1 -1
- package/dist/client/assets/{index-BqO-wiLH.js → index-DMwXny-D.js} +1 -1
- package/dist/client/assets/{index-1zFJtuaW.js → index-DQOFyUau.js} +1 -1
- package/dist/client/assets/{index-C0k4s5Ib.js → index-DWJFPU_5.js} +1 -1
- package/dist/client/assets/{index-CKwJD7xz.js → index-DZYkmDwN.js} +1 -1
- package/dist/client/assets/{index-CW98CyWe.js → index-Dz2ryCk3.js} +1 -1
- package/dist/client/assets/{index-DilFeEck.js → index-Ru2Dc5A_.js} +1 -1
- package/dist/client/assets/{index-BLIt4sly.js → index-xQGEDauU.js} +1 -1
- package/dist/client/assets/{infoDiagram-HS3SLOUP-D_T5UsZX.js → infoDiagram-HS3SLOUP-D0hp75aO.js} +1 -1
- package/dist/client/assets/{journeyDiagram-XKPGCS4Q-DVkCPjcS.js → journeyDiagram-XKPGCS4Q-91HWCjRU.js} +1 -1
- package/dist/client/assets/{kanban-definition-3W4ZIXB7-DXhSxzi6.js → kanban-definition-3W4ZIXB7-BzioXfF6.js} +1 -1
- package/dist/client/assets/{layout-Cf3mHsPQ.js → layout-DfQbFp33.js} +1 -1
- package/dist/client/assets/{main-KoITWpfm.js → main-Dqe_6Q3-.js} +220 -220
- package/dist/client/assets/{mindmap-definition-VGOIOE7T-C2IQK3iT.js → mindmap-definition-VGOIOE7T-C_jxHaxD.js} +1 -1
- package/dist/client/assets/{pieDiagram-ADFJNKIX-BGQzh0tv.js → pieDiagram-ADFJNKIX-Kn_LfuP0.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-AYHSOK5B-LdhEGcnL.js → quadrantDiagram-AYHSOK5B-CbeGV886.js} +1 -1
- package/dist/client/assets/{requirementDiagram-UZGBJVZJ-cnV0P1YE.js → requirementDiagram-UZGBJVZJ-COoa_fat.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-TZEHDZUN-BoAgFD3l.js → sankeyDiagram-TZEHDZUN-TXccJBqI.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-WL72ISMW-CxF4TFvD.js → sequenceDiagram-WL72ISMW-Llnk43Jx.js} +1 -1
- package/dist/client/assets/{stateDiagram-FKZM4ZOC-wf-3-MA5.js → stateDiagram-FKZM4ZOC-DsQWz-Kg.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-BZgMRt9_.js +1 -0
- package/dist/client/assets/{timeline-definition-IT6M3QCI-W-q-JEwZ.js → timeline-definition-IT6M3QCI-B16mbiqF.js} +1 -1
- package/dist/client/assets/{treemap-GDKQZRPO-Ct5obnww.js → treemap-GDKQZRPO-CN_Il1TD.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId-CeUz5yMg.js → workspace._workspaceId-CXgdRFSq.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId-BUh7S3Ta.js → workspace._workspaceId-DJz9r6Bk.js} +1 -1
- package/dist/client/assets/{xychartDiagram-PRI3JC2R-sXsIzR4l.js → xychartDiagram-PRI3JC2R-RSssrHeJ.js} +1 -1
- package/dist/openapi.json +17 -0
- package/dist/server/assets/{TerminalPanel-DlJiSPdF.js → TerminalPanel-BE1IBqp5.js} +1 -1
- package/dist/server/assets/{_basePickBy-DTbj2hwA.js → _basePickBy-CHo3_xmm.js} +2 -2
- package/dist/server/assets/{_baseUniq-pix9fqoH.js → _baseUniq-CSupPFs6.js} +1 -1
- package/dist/server/assets/{_tanstack-start-manifest_v-B5eaoRZw.js → _tanstack-start-manifest_v-Cnfw-Mtl.js} +1 -1
- package/dist/server/assets/{arc-BMzVEd8n.js → arc-D44kAr9U.js} +1 -1
- package/dist/server/assets/{architecture-7HQA4BMR-DUwedg7M.js → architecture-7HQA4BMR-vXckakYr.js} +6 -6
- package/dist/server/assets/{architectureDiagram-VXUJARFQ-BVdUCEQJ.js → architectureDiagram-VXUJARFQ-CR2ITyvh.js} +6 -6
- package/dist/server/assets/{blockDiagram-VD42YOAC-7f6jQaSI.js → blockDiagram-VD42YOAC-DEeR9cDU.js} +6 -6
- package/dist/server/assets/{c4Diagram-YG6GDRKO-Dyit97Cn.js → c4Diagram-YG6GDRKO-DBRRCTXb.js} +2 -2
- package/dist/server/assets/{channel-JMSLQrct.js → channel-C5tRsfJG.js} +1 -1
- package/dist/server/assets/{chunk-4BX2VUAB-DqntIakH.js → chunk-4BX2VUAB-bf7NCd3y.js} +1 -1
- package/dist/server/assets/{chunk-55IACEB6-CzZbYD81.js → chunk-55IACEB6-DWdn6VWI.js} +1 -1
- package/dist/server/assets/{chunk-B4BG7PRW-Cxs7LhtB.js → chunk-B4BG7PRW-Dkh6IKnk.js} +4 -4
- package/dist/server/assets/{chunk-DI55MBZ5-D82pXnd6.js → chunk-DI55MBZ5-DBWVZkkA.js} +3 -3
- package/dist/server/assets/{chunk-FMBD7UC4-GTnnxNFW.js → chunk-FMBD7UC4-BdS42WOu.js} +1 -1
- package/dist/server/assets/{chunk-QN33PNHL-B5OJJkcK.js → chunk-QN33PNHL-B8Ct7vG8.js} +1 -1
- package/dist/server/assets/{chunk-QZHKN3VN-BWZGgInb.js → chunk-QZHKN3VN-B9nHGxsX.js} +1 -1
- package/dist/server/assets/{chunk-TZMSLE5B-9TD1Q4Kc.js → chunk-TZMSLE5B-BlzccDyU.js} +1 -1
- package/dist/server/assets/{classDiagram-v2-WZHVMYZB-CaG6UQL6.js → classDiagram-2ON5EDUG-Chmrw_oF.js} +5 -5
- package/dist/server/assets/{classDiagram-2ON5EDUG-CaG6UQL6.js → classDiagram-v2-WZHVMYZB-Chmrw_oF.js} +5 -5
- package/dist/server/assets/{clone-DgeV5mya.js → clone-aEnx_Sae.js} +1 -1
- package/dist/server/assets/{cose-bilkent-S5V4N54A-DLdWU-b5.js → cose-bilkent-S5V4N54A-Bc5NoQXq.js} +1 -1
- package/dist/server/assets/{dagre-6UL2VRFP-B0nEEYz6.js → dagre-6UL2VRFP-H_kNmEPM.js} +6 -6
- package/dist/server/assets/{diagram-PSM6KHXK-CheGKVJh.js → diagram-PSM6KHXK-BcsANBT1.js} +7 -7
- package/dist/server/assets/{diagram-QEK2KX5R-CthFJNjb.js → diagram-QEK2KX5R-k-zPaYMJ.js} +6 -6
- package/dist/server/assets/{diagram-S2PKOQOG-D07bUeWi.js → diagram-S2PKOQOG-DjbSY-6m.js} +6 -6
- package/dist/server/assets/{erDiagram-Q2GNP2WA-Ci87z6gp.js → erDiagram-Q2GNP2WA-CydybEEO.js} +4 -4
- package/dist/server/assets/{flowDiagram-NV44I4VS-DivTbEjK.js → flowDiagram-NV44I4VS-tA99onXp.js} +5 -5
- package/dist/server/assets/{ganttDiagram-JELNMOA3-Bfi_i44A.js → ganttDiagram-JELNMOA3-DsJKSbMm.js} +1 -1
- package/dist/server/assets/{gitGraph-G5XIXVHT-DHmMmJEG.js → gitGraph-G5XIXVHT-BNHu-oQ-.js} +6 -6
- package/dist/server/assets/{gitGraphDiagram-V2S2FVAM-Czb_wB7o.js → gitGraphDiagram-V2S2FVAM-CzPNHl73.js} +7 -7
- package/dist/server/assets/{graph-GE1fpS3M.js → graph-BnMaPr50.js} +2 -2
- package/dist/server/assets/{highlighted-body-B3W2YXNL-B9E1TIHZ.js → highlighted-body-B3W2YXNL-BdiOjvlf.js} +1 -1
- package/dist/server/assets/{index-CJ4gZHux.js → index-B5Ou6PeY.js} +1 -1
- package/dist/server/assets/{index-D6JW20YV.js → index-BDjoQgaj.js} +1 -1
- package/dist/server/assets/{index-wHjghntc.js → index-BbZG02I3.js} +1 -1
- package/dist/server/assets/{index-CA0ijKgN.js → index-BcHVcca2.js} +1 -1
- package/dist/server/assets/{index-BAImbDDY.js → index-BdUQ01QB.js} +1 -1
- package/dist/server/assets/{index-C3C8EWaf.js → index-BuEcvcgH.js} +1 -1
- package/dist/server/assets/{index-BnjbnlDe.js → index-C1sJw8Wd.js} +1 -1
- package/dist/server/assets/{index-7UcRPUFC.js → index-CGb2LUtT.js} +1 -1
- package/dist/server/assets/{index-wDH-Tiw_.js → index-CPWcRp4N.js} +1 -1
- package/dist/server/assets/{index-CdUUMlBr.js → index-CvQ9Ebcc.js} +1 -1
- package/dist/server/assets/{index-mKjVv-iY.js → index-DKZU081P.js} +1 -1
- package/dist/server/assets/{index-DaNksnON.js → index-DYrcmtj8.js} +1 -1
- package/dist/server/assets/{index-DkEya4LL.js → index-Z2HsI7K-.js} +1 -1
- package/dist/server/assets/{info-VBDWY6EO-DojEXGtR.js → info-VBDWY6EO-C24hC3ph.js} +6 -6
- package/dist/server/assets/{infoDiagram-HS3SLOUP-CMrDcNjJ.js → infoDiagram-HS3SLOUP-CSvzttKw.js} +5 -5
- package/dist/server/assets/{journeyDiagram-XKPGCS4Q-arif2oC4.js → journeyDiagram-XKPGCS4Q-Bb7ADiou.js} +4 -4
- package/dist/server/assets/{kanban-definition-3W4ZIXB7-Ue-uEk6t.js → kanban-definition-3W4ZIXB7-BCi9DXfZ.js} +2 -2
- package/dist/server/assets/{layout-Jl8vkWvB.js → layout-CBoh_yzS.js} +4 -4
- package/dist/server/assets/{mermaid-3ZIDBTTL-BwTrF7xS.js → mermaid-3ZIDBTTL-DrE5sAWk.js} +1 -1
- package/dist/server/assets/{mermaid-parser.core-43ahKWIm.js → mermaid-parser.core-C6_1Cugd.js} +11 -11
- package/dist/server/assets/{mindmap-definition-VGOIOE7T-DrtL2GtX.js → mindmap-definition-VGOIOE7T-yqPdoOIb.js} +3 -3
- package/dist/server/assets/{packet-DYOGHKS2-qaKqUqmU.js → packet-DYOGHKS2-DJmc50nE.js} +6 -6
- package/dist/server/assets/{pie-VRWISCQL-sZSNfuEg.js → pie-VRWISCQL-CvrR2-yk.js} +6 -6
- package/dist/server/assets/{pieDiagram-ADFJNKIX-J90TL7dM.js → pieDiagram-ADFJNKIX-CFOW6PnN.js} +7 -7
- package/dist/server/assets/{quadrantDiagram-AYHSOK5B-Ciqcx945.js → quadrantDiagram-AYHSOK5B-3A-aZNyC.js} +1 -1
- package/dist/server/assets/{radar-ZZBFDIW7-Wmt4lMQq.js → radar-ZZBFDIW7-Cfbkh5bz.js} +6 -6
- package/dist/server/assets/{requirementDiagram-UZGBJVZJ-BKq7A1k7.js → requirementDiagram-UZGBJVZJ-Dlll26uf.js} +3 -3
- package/dist/server/assets/{router-Cj_mF2JU.js → router-B261twKF.js} +297 -115
- package/dist/server/assets/{sankeyDiagram-TZEHDZUN-B5D47iqQ.js → sankeyDiagram-TZEHDZUN-BQaOXs3v.js} +1 -1
- package/dist/server/assets/{sequenceDiagram-WL72ISMW-YT-X3Mpm.js → sequenceDiagram-WL72ISMW-BCAnfOwu.js} +3 -3
- package/dist/server/assets/{stateDiagram-FKZM4ZOC-D8X_Rq8R.js → stateDiagram-FKZM4ZOC-BqJZtxdF.js} +8 -8
- package/dist/server/assets/{stateDiagram-v2-4FDKWEC3-CHk9LeUj.js → stateDiagram-v2-4FDKWEC3-1ifEjgYq.js} +4 -4
- package/dist/server/assets/{timeline-definition-IT6M3QCI-Cq-NLIUZ.js → timeline-definition-IT6M3QCI-CAWbczQG.js} +2 -2
- package/dist/server/assets/{treemap-GDKQZRPO-f0Rq9dJ9.js → treemap-GDKQZRPO-BK5fWRQl.js} +6 -6
- package/dist/server/assets/{workspace._workspaceId-CHDrJbrs.js → workspace._workspaceId-C895SrvA.js} +1 -1
- package/dist/server/assets/{workspace._workspaceId-CzpW_AIO.js → workspace._workspaceId-DJjGZFKN.js} +1 -1
- package/dist/server/assets/{xychartDiagram-PRI3JC2R-zZQ-PeCr.js → xychartDiagram-PRI3JC2R-DfSubvZj.js} +1 -1
- package/dist/server/server.js +2 -2
- package/dist/start-server.mjs +605 -262
- package/package.json +4 -4
- package/dist/client/assets/channel-DgStcXMV.js +0 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-DqJ8lUPo.js +0 -1
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-DqJ8lUPo.js +0 -1
- package/dist/client/assets/clone-BXDlHTU2.js +0 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-BZZ4iqpR.js +0 -1
package/dist/start-server.mjs
CHANGED
|
@@ -8520,7 +8520,7 @@ var require_thread_stream = __commonJS({
|
|
|
8520
8520
|
var { version: version2 } = require_package();
|
|
8521
8521
|
var { EventEmitter } = __require("events");
|
|
8522
8522
|
var { Worker: Worker2 } = __require("worker_threads");
|
|
8523
|
-
var { join:
|
|
8523
|
+
var { join: join40 } = __require("path");
|
|
8524
8524
|
var { pathToFileURL } = __require("url");
|
|
8525
8525
|
var { wait } = require_wait();
|
|
8526
8526
|
var {
|
|
@@ -8556,7 +8556,7 @@ var require_thread_stream = __commonJS({
|
|
|
8556
8556
|
function createWorker(stream, opts) {
|
|
8557
8557
|
const { filename, workerData } = opts;
|
|
8558
8558
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
8559
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
8559
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join40(__dirname, "lib", "worker.js");
|
|
8560
8560
|
const worker2 = new Worker2(toExecute, {
|
|
8561
8561
|
...opts.workerOpts,
|
|
8562
8562
|
trackUnmanagedFds: false,
|
|
@@ -8942,7 +8942,7 @@ var require_transport = __commonJS({
|
|
|
8942
8942
|
"use strict";
|
|
8943
8943
|
var { createRequire: createRequire2 } = __require("module");
|
|
8944
8944
|
var getCallers = require_caller();
|
|
8945
|
-
var { join:
|
|
8945
|
+
var { join: join40, isAbsolute: isAbsolute5, sep: sep9 } = __require("node:path");
|
|
8946
8946
|
var sleep3 = require_atomic_sleep();
|
|
8947
8947
|
var onExit = require_on_exit_leak_free();
|
|
8948
8948
|
var ThreadStream = require_thread_stream();
|
|
@@ -9005,7 +9005,7 @@ var require_transport = __commonJS({
|
|
|
9005
9005
|
throw new Error("only one of target or targets can be specified");
|
|
9006
9006
|
}
|
|
9007
9007
|
if (targets) {
|
|
9008
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
9008
|
+
target = bundlerOverrides["pino-worker"] || join40(__dirname, "worker.js");
|
|
9009
9009
|
options2.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
9010
9010
|
return {
|
|
9011
9011
|
...dest,
|
|
@@ -9023,7 +9023,7 @@ var require_transport = __commonJS({
|
|
|
9023
9023
|
});
|
|
9024
9024
|
});
|
|
9025
9025
|
} else if (pipeline) {
|
|
9026
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
9026
|
+
target = bundlerOverrides["pino-worker"] || join40(__dirname, "worker.js");
|
|
9027
9027
|
options2.pipelines = [pipeline.map((dest) => {
|
|
9028
9028
|
return {
|
|
9029
9029
|
...dest,
|
|
@@ -9045,7 +9045,7 @@ var require_transport = __commonJS({
|
|
|
9045
9045
|
return origin;
|
|
9046
9046
|
}
|
|
9047
9047
|
if (origin === "pino/file") {
|
|
9048
|
-
return
|
|
9048
|
+
return join40(__dirname, "..", "file.js");
|
|
9049
9049
|
}
|
|
9050
9050
|
let fixTarget2;
|
|
9051
9051
|
for (const filePath of callers) {
|
|
@@ -10034,7 +10034,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
10034
10034
|
return circularValue;
|
|
10035
10035
|
}
|
|
10036
10036
|
let res = "";
|
|
10037
|
-
let
|
|
10037
|
+
let join40 = ",";
|
|
10038
10038
|
const originalIndentation = indentation4;
|
|
10039
10039
|
if (Array.isArray(value)) {
|
|
10040
10040
|
if (value.length === 0) {
|
|
@@ -10048,7 +10048,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
10048
10048
|
indentation4 += spacer;
|
|
10049
10049
|
res += `
|
|
10050
10050
|
${indentation4}`;
|
|
10051
|
-
|
|
10051
|
+
join40 = `,
|
|
10052
10052
|
${indentation4}`;
|
|
10053
10053
|
}
|
|
10054
10054
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -10056,13 +10056,13 @@ ${indentation4}`;
|
|
|
10056
10056
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
10057
10057
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation4);
|
|
10058
10058
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
10059
|
-
res +=
|
|
10059
|
+
res += join40;
|
|
10060
10060
|
}
|
|
10061
10061
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation4);
|
|
10062
10062
|
res += tmp !== void 0 ? tmp : "null";
|
|
10063
10063
|
if (value.length - 1 > maximumBreadth) {
|
|
10064
10064
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
10065
|
-
res += `${
|
|
10065
|
+
res += `${join40}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
10066
10066
|
}
|
|
10067
10067
|
if (spacer !== "") {
|
|
10068
10068
|
res += `
|
|
@@ -10083,7 +10083,7 @@ ${originalIndentation}`;
|
|
|
10083
10083
|
let separator = "";
|
|
10084
10084
|
if (spacer !== "") {
|
|
10085
10085
|
indentation4 += spacer;
|
|
10086
|
-
|
|
10086
|
+
join40 = `,
|
|
10087
10087
|
${indentation4}`;
|
|
10088
10088
|
whitespace3 = " ";
|
|
10089
10089
|
}
|
|
@@ -10097,13 +10097,13 @@ ${indentation4}`;
|
|
|
10097
10097
|
const tmp = stringifyFnReplacer(key3, value, stack, replacer, spacer, indentation4);
|
|
10098
10098
|
if (tmp !== void 0) {
|
|
10099
10099
|
res += `${separator}${strEscape(key3)}:${whitespace3}${tmp}`;
|
|
10100
|
-
separator =
|
|
10100
|
+
separator = join40;
|
|
10101
10101
|
}
|
|
10102
10102
|
}
|
|
10103
10103
|
if (keyLength > maximumBreadth) {
|
|
10104
10104
|
const removedKeys = keyLength - maximumBreadth;
|
|
10105
10105
|
res += `${separator}"...":${whitespace3}"${getItemCount(removedKeys)} not stringified"`;
|
|
10106
|
-
separator =
|
|
10106
|
+
separator = join40;
|
|
10107
10107
|
}
|
|
10108
10108
|
if (spacer !== "" && separator.length > 1) {
|
|
10109
10109
|
res = `
|
|
@@ -10144,7 +10144,7 @@ ${originalIndentation}`;
|
|
|
10144
10144
|
}
|
|
10145
10145
|
const originalIndentation = indentation4;
|
|
10146
10146
|
let res = "";
|
|
10147
|
-
let
|
|
10147
|
+
let join40 = ",";
|
|
10148
10148
|
if (Array.isArray(value)) {
|
|
10149
10149
|
if (value.length === 0) {
|
|
10150
10150
|
return "[]";
|
|
@@ -10157,7 +10157,7 @@ ${originalIndentation}`;
|
|
|
10157
10157
|
indentation4 += spacer;
|
|
10158
10158
|
res += `
|
|
10159
10159
|
${indentation4}`;
|
|
10160
|
-
|
|
10160
|
+
join40 = `,
|
|
10161
10161
|
${indentation4}`;
|
|
10162
10162
|
}
|
|
10163
10163
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -10165,13 +10165,13 @@ ${indentation4}`;
|
|
|
10165
10165
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
10166
10166
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation4);
|
|
10167
10167
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
10168
|
-
res +=
|
|
10168
|
+
res += join40;
|
|
10169
10169
|
}
|
|
10170
10170
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation4);
|
|
10171
10171
|
res += tmp !== void 0 ? tmp : "null";
|
|
10172
10172
|
if (value.length - 1 > maximumBreadth) {
|
|
10173
10173
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
10174
|
-
res += `${
|
|
10174
|
+
res += `${join40}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
10175
10175
|
}
|
|
10176
10176
|
if (spacer !== "") {
|
|
10177
10177
|
res += `
|
|
@@ -10184,7 +10184,7 @@ ${originalIndentation}`;
|
|
|
10184
10184
|
let whitespace3 = "";
|
|
10185
10185
|
if (spacer !== "") {
|
|
10186
10186
|
indentation4 += spacer;
|
|
10187
|
-
|
|
10187
|
+
join40 = `,
|
|
10188
10188
|
${indentation4}`;
|
|
10189
10189
|
whitespace3 = " ";
|
|
10190
10190
|
}
|
|
@@ -10193,7 +10193,7 @@ ${indentation4}`;
|
|
|
10193
10193
|
const tmp = stringifyArrayReplacer(key3, value[key3], stack, replacer, spacer, indentation4);
|
|
10194
10194
|
if (tmp !== void 0) {
|
|
10195
10195
|
res += `${separator}${strEscape(key3)}:${whitespace3}${tmp}`;
|
|
10196
|
-
separator =
|
|
10196
|
+
separator = join40;
|
|
10197
10197
|
}
|
|
10198
10198
|
}
|
|
10199
10199
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -10251,20 +10251,20 @@ ${originalIndentation}`;
|
|
|
10251
10251
|
indentation4 += spacer;
|
|
10252
10252
|
let res2 = `
|
|
10253
10253
|
${indentation4}`;
|
|
10254
|
-
const
|
|
10254
|
+
const join41 = `,
|
|
10255
10255
|
${indentation4}`;
|
|
10256
10256
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
10257
10257
|
let i = 0;
|
|
10258
10258
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
10259
10259
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation4);
|
|
10260
10260
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
10261
|
-
res2 +=
|
|
10261
|
+
res2 += join41;
|
|
10262
10262
|
}
|
|
10263
10263
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation4);
|
|
10264
10264
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
10265
10265
|
if (value.length - 1 > maximumBreadth) {
|
|
10266
10266
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
10267
|
-
res2 += `${
|
|
10267
|
+
res2 += `${join41}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
10268
10268
|
}
|
|
10269
10269
|
res2 += `
|
|
10270
10270
|
${originalIndentation}`;
|
|
@@ -10280,16 +10280,16 @@ ${originalIndentation}`;
|
|
|
10280
10280
|
return '"[Object]"';
|
|
10281
10281
|
}
|
|
10282
10282
|
indentation4 += spacer;
|
|
10283
|
-
const
|
|
10283
|
+
const join40 = `,
|
|
10284
10284
|
${indentation4}`;
|
|
10285
10285
|
let res = "";
|
|
10286
10286
|
let separator = "";
|
|
10287
10287
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
10288
10288
|
if (isTypedArrayWithEntries(value)) {
|
|
10289
|
-
res += stringifyTypedArray(value,
|
|
10289
|
+
res += stringifyTypedArray(value, join40, maximumBreadth);
|
|
10290
10290
|
keys = keys.slice(value.length);
|
|
10291
10291
|
maximumPropertiesToStringify -= value.length;
|
|
10292
|
-
separator =
|
|
10292
|
+
separator = join40;
|
|
10293
10293
|
}
|
|
10294
10294
|
if (deterministic) {
|
|
10295
10295
|
keys = sort(keys, comparator);
|
|
@@ -10300,13 +10300,13 @@ ${indentation4}`;
|
|
|
10300
10300
|
const tmp = stringifyIndent(key3, value[key3], stack, spacer, indentation4);
|
|
10301
10301
|
if (tmp !== void 0) {
|
|
10302
10302
|
res += `${separator}${strEscape(key3)}: ${tmp}`;
|
|
10303
|
-
separator =
|
|
10303
|
+
separator = join40;
|
|
10304
10304
|
}
|
|
10305
10305
|
}
|
|
10306
10306
|
if (keyLength > maximumBreadth) {
|
|
10307
10307
|
const removedKeys = keyLength - maximumBreadth;
|
|
10308
10308
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
10309
|
-
separator =
|
|
10309
|
+
separator = join40;
|
|
10310
10310
|
}
|
|
10311
10311
|
if (separator !== "") {
|
|
10312
10312
|
res = `
|
|
@@ -91037,9 +91037,9 @@ var require_dist5 = __commonJS({
|
|
|
91037
91037
|
});
|
|
91038
91038
|
|
|
91039
91039
|
// start-server.ts
|
|
91040
|
-
import { appendFileSync, createReadStream as createReadStream3, mkdirSync as mkdirSync8, readFileSync as
|
|
91040
|
+
import { appendFileSync, createReadStream as createReadStream3, mkdirSync as mkdirSync8, readFileSync as readFileSync10, statSync as statSync12 } from "node:fs";
|
|
91041
91041
|
import { createServer } from "node:http";
|
|
91042
|
-
import { basename as basename5, join as
|
|
91042
|
+
import { basename as basename5, join as join39, resolve as resolve11, sep as sep8 } from "node:path";
|
|
91043
91043
|
|
|
91044
91044
|
// ../../node_modules/.pnpm/@trpc+server@11.12.0_typescript@5.9.3/node_modules/@trpc/server/dist/adapters/fetch/index.mjs
|
|
91045
91045
|
init_getErrorShape_vC8mUXJD();
|
|
@@ -92456,7 +92456,7 @@ function openSseStream(res) {
|
|
|
92456
92456
|
|
|
92457
92457
|
// src/server/services/agent-session-service.ts
|
|
92458
92458
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
92459
|
-
import { join as
|
|
92459
|
+
import { join as join25 } from "node:path";
|
|
92460
92460
|
|
|
92461
92461
|
// src/server/infra/agents/acp-agent-process.ts
|
|
92462
92462
|
import { spawn } from "node:child_process";
|
|
@@ -107342,6 +107342,8 @@ var legacyClientNotificationMethods = /* @__PURE__ */ new Set([
|
|
|
107342
107342
|
var log = createLogger("acp-agent");
|
|
107343
107343
|
var STARTUP_TIMEOUT_MS = 6e4;
|
|
107344
107344
|
var LOAD_TIMEOUT_MS = 18e4;
|
|
107345
|
+
var STOP_TIMEOUT_MS = 3e3;
|
|
107346
|
+
var liveChildren = /* @__PURE__ */ new Set();
|
|
107345
107347
|
var CLIENT_CAPABILITIES = {
|
|
107346
107348
|
fs: { readTextFile: false, writeTextFile: false },
|
|
107347
107349
|
terminal: false,
|
|
@@ -107402,6 +107404,11 @@ var AcpAgentProcess = class _AcpAgentProcess {
|
|
|
107402
107404
|
detached: process.platform !== "win32"
|
|
107403
107405
|
});
|
|
107404
107406
|
child.stderr?.on("data", stderr.push);
|
|
107407
|
+
liveChildren.add(child);
|
|
107408
|
+
child.once("exit", () => liveChildren.delete(child));
|
|
107409
|
+
child.once("error", () => {
|
|
107410
|
+
if (child.pid === void 0) liveChildren.delete(child);
|
|
107411
|
+
});
|
|
107405
107412
|
try {
|
|
107406
107413
|
await new Promise((resolve12, reject) => {
|
|
107407
107414
|
child.once("spawn", resolve12);
|
|
@@ -107445,6 +107452,10 @@ var AcpAgentProcess = class _AcpAgentProcess {
|
|
|
107445
107452
|
throw withStderr(label, err, stderr.text());
|
|
107446
107453
|
}
|
|
107447
107454
|
}
|
|
107455
|
+
/** The agent process id, while it runs. */
|
|
107456
|
+
get pid() {
|
|
107457
|
+
return this.child.pid;
|
|
107458
|
+
}
|
|
107448
107459
|
get alive() {
|
|
107449
107460
|
return !this.closed && this.child.exitCode === null && this.child.signalCode === null;
|
|
107450
107461
|
}
|
|
@@ -107565,10 +107576,10 @@ var AcpAgentProcess = class _AcpAgentProcess {
|
|
|
107565
107576
|
}
|
|
107566
107577
|
/** Unstable `session/set_model`, for agents that expose models without a
|
|
107567
107578
|
* `model` config option (Gemini CLI). */
|
|
107568
|
-
async setModel(sessionId,
|
|
107579
|
+
async setModel(sessionId, modelId2) {
|
|
107569
107580
|
await this.guard(
|
|
107570
107581
|
withTimeout(
|
|
107571
|
-
this.connection.agent.request("session/set_model", { sessionId, modelId }),
|
|
107582
|
+
this.connection.agent.request("session/set_model", { sessionId, modelId: modelId2 }),
|
|
107572
107583
|
this.label
|
|
107573
107584
|
)
|
|
107574
107585
|
);
|
|
@@ -107604,6 +107615,47 @@ function describe(err) {
|
|
|
107604
107615
|
}
|
|
107605
107616
|
return String(err);
|
|
107606
107617
|
}
|
|
107618
|
+
async function stopAllAgentProcesses() {
|
|
107619
|
+
await Promise.all([...liveChildren].map(stopAgentProcess));
|
|
107620
|
+
}
|
|
107621
|
+
async function stopAgentProcess(child) {
|
|
107622
|
+
if (child.pid === void 0) {
|
|
107623
|
+
await new Promise((resolve12) => {
|
|
107624
|
+
child.once("spawn", () => resolve12());
|
|
107625
|
+
child.once("error", () => resolve12());
|
|
107626
|
+
});
|
|
107627
|
+
}
|
|
107628
|
+
const pid = child.pid;
|
|
107629
|
+
if (pid === void 0) return;
|
|
107630
|
+
const exited = new Promise((resolve12) => {
|
|
107631
|
+
if (child.exitCode !== null || child.signalCode !== null) resolve12();
|
|
107632
|
+
else child.once("exit", () => resolve12());
|
|
107633
|
+
});
|
|
107634
|
+
const running = () => {
|
|
107635
|
+
if (process.platform === "win32") return child.exitCode === null && child.signalCode === null;
|
|
107636
|
+
try {
|
|
107637
|
+
process.kill(-pid, 0);
|
|
107638
|
+
return true;
|
|
107639
|
+
} catch {
|
|
107640
|
+
return false;
|
|
107641
|
+
}
|
|
107642
|
+
};
|
|
107643
|
+
killTree(child);
|
|
107644
|
+
const deadline = Date.now() + STOP_TIMEOUT_MS;
|
|
107645
|
+
while (running() && Date.now() < deadline) await delay(20);
|
|
107646
|
+
if (running()) signalGroup(child, pid, "SIGKILL");
|
|
107647
|
+
await Promise.race([exited, delay(1e3)]);
|
|
107648
|
+
}
|
|
107649
|
+
function delay(ms) {
|
|
107650
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
107651
|
+
}
|
|
107652
|
+
function signalGroup(child, pid, signal) {
|
|
107653
|
+
try {
|
|
107654
|
+
if (process.platform === "win32") child.kill(signal);
|
|
107655
|
+
else process.kill(-pid, signal);
|
|
107656
|
+
} catch {
|
|
107657
|
+
}
|
|
107658
|
+
}
|
|
107607
107659
|
function killTree(child) {
|
|
107608
107660
|
if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) return;
|
|
107609
107661
|
try {
|
|
@@ -108497,6 +108549,204 @@ async function resolveAcpLaunch(def2) {
|
|
|
108497
108549
|
}
|
|
108498
108550
|
}
|
|
108499
108551
|
|
|
108552
|
+
// src/server/infra/agents/claude-defaults.ts
|
|
108553
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
108554
|
+
import { closeSync, openSync, readFileSync, readSync, realpathSync, statSync as statSync4 } from "node:fs";
|
|
108555
|
+
import { homedir as homedir5 } from "node:os";
|
|
108556
|
+
import { join as join7, resolve as resolvePath2 } from "node:path";
|
|
108557
|
+
var EFFORT_LEVELS = /* @__PURE__ */ new Set(["low", "medium", "high", "xhigh", "max"]);
|
|
108558
|
+
var TRANSCRIPT_TAIL_BYTES = 256 * 1024;
|
|
108559
|
+
var SESSION_ID_PATTERN = /^[\w-]+$/;
|
|
108560
|
+
function claudeConfigDir2(env) {
|
|
108561
|
+
return env.CLAUDE_CONFIG_DIR || join7(homedir5(), ".claude");
|
|
108562
|
+
}
|
|
108563
|
+
function managedSettingsPath() {
|
|
108564
|
+
if (process.platform === "darwin") {
|
|
108565
|
+
return "/Library/Application Support/ClaudeCode/managed-settings.json";
|
|
108566
|
+
}
|
|
108567
|
+
if (process.platform === "linux") return "/etc/claude-code/managed-settings.json";
|
|
108568
|
+
return null;
|
|
108569
|
+
}
|
|
108570
|
+
function readSettings(source, cwd) {
|
|
108571
|
+
try {
|
|
108572
|
+
const text3 = source.trimStart().startsWith("{") ? source : readFileSync(resolvePath2(cwd ?? homedir5(), source.replace(/^~(?=\/)/, homedir5())), "utf8");
|
|
108573
|
+
const parsed = JSON.parse(text3);
|
|
108574
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
108575
|
+
} catch {
|
|
108576
|
+
return null;
|
|
108577
|
+
}
|
|
108578
|
+
}
|
|
108579
|
+
function mergedSettings(cwd, env, extra) {
|
|
108580
|
+
const sources = [
|
|
108581
|
+
join7(claudeConfigDir2(env), "settings.json"),
|
|
108582
|
+
cwd && join7(cwd, ".claude", "settings.json"),
|
|
108583
|
+
cwd && join7(cwd, ".claude", "settings.local.json"),
|
|
108584
|
+
...extra,
|
|
108585
|
+
managedSettingsPath()
|
|
108586
|
+
];
|
|
108587
|
+
const merged = {};
|
|
108588
|
+
for (const source of sources) {
|
|
108589
|
+
if (!source) continue;
|
|
108590
|
+
const s2 = readSettings(source, cwd);
|
|
108591
|
+
if (!s2) continue;
|
|
108592
|
+
if (s2.model !== void 0) merged.model = s2.model;
|
|
108593
|
+
if (s2.effortLevel !== void 0) merged.effortLevel = s2.effortLevel;
|
|
108594
|
+
if (s2.modelSettings && typeof s2.modelSettings === "object") {
|
|
108595
|
+
merged.modelSettings = { ...merged.modelSettings, ...s2.modelSettings };
|
|
108596
|
+
}
|
|
108597
|
+
if (s2.env && typeof s2.env === "object") merged.env = { ...merged.env, ...s2.env };
|
|
108598
|
+
}
|
|
108599
|
+
return merged;
|
|
108600
|
+
}
|
|
108601
|
+
function effortLevel(value) {
|
|
108602
|
+
if (typeof value !== "string") return void 0;
|
|
108603
|
+
const level = value.trim().toLowerCase();
|
|
108604
|
+
if (level === "med") return "medium";
|
|
108605
|
+
return EFFORT_LEVELS.has(level) ? level : void 0;
|
|
108606
|
+
}
|
|
108607
|
+
function modelId(value) {
|
|
108608
|
+
if (typeof value !== "string") return void 0;
|
|
108609
|
+
const model = value.trim();
|
|
108610
|
+
return model && model.toLowerCase() !== "default" ? model : void 0;
|
|
108611
|
+
}
|
|
108612
|
+
function modelKey(model) {
|
|
108613
|
+
return model.trim().toLowerCase().replace(/\[\d+m\]$|-\d+m$/, "").replace(/-\d{8}$/, "").replace(/^claude-/, "");
|
|
108614
|
+
}
|
|
108615
|
+
function perModelEffort(settings2, model) {
|
|
108616
|
+
if (!model || !settings2.modelSettings) return void 0;
|
|
108617
|
+
const key2 = modelKey(model);
|
|
108618
|
+
const entries = Object.entries(settings2.modelSettings);
|
|
108619
|
+
const exact2 = entries.find(([k4]) => modelKey(k4) === key2);
|
|
108620
|
+
if (exact2) return effortLevel(exact2[1]?.effortLevel);
|
|
108621
|
+
const family = entries.filter(([k4]) => modelKey(k4).startsWith(`${key2}-`));
|
|
108622
|
+
return family.length === 1 ? effortLevel(family[0]?.[1]?.effortLevel) : void 0;
|
|
108623
|
+
}
|
|
108624
|
+
function configuredClaudeDefaults(opts) {
|
|
108625
|
+
const settings2 = mergedSettings(opts.cwd, opts.env, opts.cli?.settings ?? []);
|
|
108626
|
+
const envVar = (name3) => {
|
|
108627
|
+
const fromSettings = settings2.env?.[name3];
|
|
108628
|
+
return typeof fromSettings === "string" ? fromSettings : opts.env[name3];
|
|
108629
|
+
};
|
|
108630
|
+
const model = modelId(opts.cli?.model) ?? modelId(envVar("ANTHROPIC_MODEL")) ?? modelId(settings2.model);
|
|
108631
|
+
const effort = effortLevel(envVar("CLAUDE_CODE_EFFORT_LEVEL")) ?? effortLevel(opts.cli?.effort) ?? perModelEffort(settings2, model) ?? effortLevel(settings2.effortLevel);
|
|
108632
|
+
return { model, effort };
|
|
108633
|
+
}
|
|
108634
|
+
function transcriptPath(env, cwd, sessionId) {
|
|
108635
|
+
let real3 = cwd;
|
|
108636
|
+
try {
|
|
108637
|
+
real3 = realpathSync(cwd);
|
|
108638
|
+
} catch {
|
|
108639
|
+
}
|
|
108640
|
+
return join7(
|
|
108641
|
+
claudeConfigDir2(env),
|
|
108642
|
+
"projects",
|
|
108643
|
+
real3.replace(/[^a-zA-Z0-9]/g, "-"),
|
|
108644
|
+
`${sessionId}.jsonl`
|
|
108645
|
+
);
|
|
108646
|
+
}
|
|
108647
|
+
function readTail(path, bytes) {
|
|
108648
|
+
let fd;
|
|
108649
|
+
try {
|
|
108650
|
+
const size4 = statSync4(path).size;
|
|
108651
|
+
const length = Math.min(size4, bytes);
|
|
108652
|
+
const buf = Buffer.alloc(length);
|
|
108653
|
+
fd = openSync(path, "r");
|
|
108654
|
+
readSync(fd, buf, 0, length, size4 - length);
|
|
108655
|
+
return buf.toString("utf8");
|
|
108656
|
+
} catch {
|
|
108657
|
+
return null;
|
|
108658
|
+
} finally {
|
|
108659
|
+
if (fd !== void 0) closeSync(fd);
|
|
108660
|
+
}
|
|
108661
|
+
}
|
|
108662
|
+
function reportedClaudeDefaults(opts) {
|
|
108663
|
+
if (!SESSION_ID_PATTERN.test(opts.sessionId)) return {};
|
|
108664
|
+
const tail = readTail(transcriptPath(opts.env, opts.cwd, opts.sessionId), TRANSCRIPT_TAIL_BYTES);
|
|
108665
|
+
if (!tail) return {};
|
|
108666
|
+
const lines = tail.split("\n");
|
|
108667
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
108668
|
+
const line2 = lines[i];
|
|
108669
|
+
if (!line2?.includes('"assistant"')) continue;
|
|
108670
|
+
let record3;
|
|
108671
|
+
try {
|
|
108672
|
+
record3 = JSON.parse(line2);
|
|
108673
|
+
} catch {
|
|
108674
|
+
continue;
|
|
108675
|
+
}
|
|
108676
|
+
const model = record3.message?.model;
|
|
108677
|
+
if (record3.type !== "assistant" || record3.isSidechain === true) continue;
|
|
108678
|
+
if (typeof model !== "string" || model.startsWith("<")) continue;
|
|
108679
|
+
const at = typeof record3.timestamp === "string" ? Date.parse(record3.timestamp) : Number.NaN;
|
|
108680
|
+
if (opts.since !== void 0 && !(at >= opts.since)) return {};
|
|
108681
|
+
return { model, effort: effortLevel(record3.effort) };
|
|
108682
|
+
}
|
|
108683
|
+
return {};
|
|
108684
|
+
}
|
|
108685
|
+
function flagValue(args, i, flag) {
|
|
108686
|
+
const arg = args[i];
|
|
108687
|
+
if (arg === flag) return args[i + 1];
|
|
108688
|
+
if (arg?.startsWith(`${flag}=`)) return arg.slice(flag.length + 1);
|
|
108689
|
+
return void 0;
|
|
108690
|
+
}
|
|
108691
|
+
function parseClaudeCliArgs(commandLine) {
|
|
108692
|
+
const args = commandLine.split(/\s+/).filter(Boolean);
|
|
108693
|
+
const out = { settings: [] };
|
|
108694
|
+
for (let i = 0; i < args.length; i++) {
|
|
108695
|
+
const settings2 = flagValue(args, i, "--settings");
|
|
108696
|
+
if (settings2) out.settings.push(settings2);
|
|
108697
|
+
out.model = flagValue(args, i, "--model") ?? out.model;
|
|
108698
|
+
out.effort = flagValue(args, i, "--effort") ?? out.effort;
|
|
108699
|
+
}
|
|
108700
|
+
return out;
|
|
108701
|
+
}
|
|
108702
|
+
function listProcesses() {
|
|
108703
|
+
return new Promise((resolve12) => {
|
|
108704
|
+
execFile3(
|
|
108705
|
+
"ps",
|
|
108706
|
+
["-A", "-o", "pid=,ppid=,args="],
|
|
108707
|
+
{ maxBuffer: 16 * 1024 * 1024 },
|
|
108708
|
+
(err, out) => {
|
|
108709
|
+
if (err) return resolve12([]);
|
|
108710
|
+
const rows = [];
|
|
108711
|
+
for (const line2 of out.split("\n")) {
|
|
108712
|
+
const m3 = /^\s*(\d+)\s+(\d+)\s+(.*)$/.exec(line2);
|
|
108713
|
+
if (m3) rows.push({ pid: Number(m3[1]), ppid: Number(m3[2]), args: m3[3] ?? "" });
|
|
108714
|
+
}
|
|
108715
|
+
resolve12(rows);
|
|
108716
|
+
}
|
|
108717
|
+
);
|
|
108718
|
+
});
|
|
108719
|
+
}
|
|
108720
|
+
async function findClaudeCliArgs(rootPid, sessionId) {
|
|
108721
|
+
if (process.platform === "win32") return null;
|
|
108722
|
+
const rows = await listProcesses();
|
|
108723
|
+
const children = /* @__PURE__ */ new Map();
|
|
108724
|
+
for (const row of rows) {
|
|
108725
|
+
const list3 = children.get(row.ppid) ?? [];
|
|
108726
|
+
list3.push(row);
|
|
108727
|
+
children.set(row.ppid, list3);
|
|
108728
|
+
}
|
|
108729
|
+
const queue = [...children.get(rootPid) ?? []];
|
|
108730
|
+
let found = null;
|
|
108731
|
+
while (queue.length > 0) {
|
|
108732
|
+
const row = queue.shift();
|
|
108733
|
+
if (!row) break;
|
|
108734
|
+
if (row.args.includes(sessionId)) {
|
|
108735
|
+
const args = parseClaudeCliArgs(row.args);
|
|
108736
|
+
found = found ? {
|
|
108737
|
+
settings: [
|
|
108738
|
+
...found.settings,
|
|
108739
|
+
...args.settings.filter((s2) => !found?.settings.includes(s2))
|
|
108740
|
+
],
|
|
108741
|
+
model: args.model ?? found.model,
|
|
108742
|
+
effort: args.effort ?? found.effort
|
|
108743
|
+
} : args;
|
|
108744
|
+
}
|
|
108745
|
+
queue.push(...children.get(row.pid) ?? []);
|
|
108746
|
+
}
|
|
108747
|
+
return found;
|
|
108748
|
+
}
|
|
108749
|
+
|
|
108500
108750
|
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.1_@opentelemetry+api@1.9.0_@types+better-sqlite3@7.6.13_better-sql_95478898f63cc8c3fbbd0c5f8c1e464f/node_modules/drizzle-orm/entity.js
|
|
108501
108751
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
108502
108752
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
@@ -109053,7 +109303,7 @@ function sql(strings2, ...params) {
|
|
|
109053
109303
|
return new SQL([new StringChunk(str)]);
|
|
109054
109304
|
}
|
|
109055
109305
|
_sql.raw = raw;
|
|
109056
|
-
function
|
|
109306
|
+
function join40(chunks, separator) {
|
|
109057
109307
|
const result = [];
|
|
109058
109308
|
for (const [i, chunk] of chunks.entries()) {
|
|
109059
109309
|
if (i > 0 && separator !== void 0) result.push(separator);
|
|
@@ -109061,7 +109311,7 @@ function sql(strings2, ...params) {
|
|
|
109061
109311
|
}
|
|
109062
109312
|
return new SQL(result);
|
|
109063
109313
|
}
|
|
109064
|
-
_sql.join =
|
|
109314
|
+
_sql.join = join40;
|
|
109065
109315
|
function identifier7(value) {
|
|
109066
109316
|
return new Name(value);
|
|
109067
109317
|
}
|
|
@@ -110339,7 +110589,7 @@ function max(expression2) {
|
|
|
110339
110589
|
|
|
110340
110590
|
// src/server/infra/db/connection.ts
|
|
110341
110591
|
import { mkdirSync as mkdirSync2 } from "node:fs";
|
|
110342
|
-
import { join as
|
|
110592
|
+
import { join as join10 } from "node:path";
|
|
110343
110593
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
110344
110594
|
|
|
110345
110595
|
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.1_@opentelemetry+api@1.9.0_@types+better-sqlite3@7.6.13_better-sql_95478898f63cc8c3fbbd0c5f8c1e464f/node_modules/drizzle-orm/pg-core/foreign-keys.js
|
|
@@ -113604,7 +113854,7 @@ var SQLiteSelectQueryBuilderBase = class extends TypedQueryBuilder {
|
|
|
113604
113854
|
const baseTableName = this.tableName;
|
|
113605
113855
|
const tableName = getTableLikeName(table);
|
|
113606
113856
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
113607
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
113857
|
+
if (typeof tableName === "string" && this.config.joins?.some((join40) => join40.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
113608
113858
|
if (!this.isPartialSelect) {
|
|
113609
113859
|
if (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === "string") this.config.fields = { [baseTableName]: this.config.fields };
|
|
113610
113860
|
if (typeof tableName === "string" && !is(table, SQL)) {
|
|
@@ -114812,7 +115062,7 @@ var SQLiteDialect = class {
|
|
|
114812
115062
|
if (!joins2) return;
|
|
114813
115063
|
const withEntries = Object.entries(joins2).filter(([_2, v2]) => v2);
|
|
114814
115064
|
if (!withEntries.length) return;
|
|
114815
|
-
return sql.join(withEntries.map(([k4,
|
|
115065
|
+
return sql.join(withEntries.map(([k4, join40]) => {
|
|
114816
115066
|
const relation = tableConfig.relations[k4];
|
|
114817
115067
|
const isSingle2 = is(relation, One);
|
|
114818
115068
|
const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
|
|
@@ -114823,7 +115073,7 @@ var SQLiteDialect = class {
|
|
|
114823
115073
|
table: targetTable,
|
|
114824
115074
|
mode: isSingle2 ? "first" : "many",
|
|
114825
115075
|
schema,
|
|
114826
|
-
queryConfig:
|
|
115076
|
+
queryConfig: join40,
|
|
114827
115077
|
tableConfig: schema[relation.targetTableName],
|
|
114828
115078
|
relationWhere: filter,
|
|
114829
115079
|
isNested: true,
|
|
@@ -114837,7 +115087,7 @@ var SQLiteDialect = class {
|
|
|
114837
115087
|
key: k4,
|
|
114838
115088
|
selection: innerQuery.selection,
|
|
114839
115089
|
isArray: !isSingle2,
|
|
114840
|
-
isOptional: (relation.optional ?? false) ||
|
|
115090
|
+
isOptional: (relation.optional ?? false) || join40 !== true && !!join40.where
|
|
114841
115091
|
});
|
|
114842
115092
|
const jsonColumns = sql.join(innerQuery.selection.map((s2) => {
|
|
114843
115093
|
return sql`${sql.raw(this.escapeString(s2.key))}, ${s2.selection ? sql`${jsonb2}(${sql.identifier(s2.key)})` : sql.identifier(s2.key)}`;
|
|
@@ -115306,7 +115556,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
|
|
|
115306
115556
|
createJoin(joinType) {
|
|
115307
115557
|
return ((table, on) => {
|
|
115308
115558
|
const tableName = getTableLikeName(table);
|
|
115309
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
115559
|
+
if (typeof tableName === "string" && this.config.joins.some((join40) => join40.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
115310
115560
|
if (typeof on === "function") {
|
|
115311
115561
|
const from3 = this.config.from ? is(table, SQLiteTable) ? table[Table.Symbol.Columns] : is(table, Subquery) ? table._.selectedFields : is(table, SQLiteViewBase) ? table[ViewBaseConfig].selectedFields : void 0 : void 0;
|
|
115312
115562
|
on = on(new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
|
|
@@ -116049,13 +116299,13 @@ function drizzle(...params) {
|
|
|
116049
116299
|
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.1_@opentelemetry+api@1.9.0_@types+better-sqlite3@7.6.13_better-sql_95478898f63cc8c3fbbd0c5f8c1e464f/node_modules/drizzle-orm/migrator.js
|
|
116050
116300
|
import crypto2 from "node:crypto";
|
|
116051
116301
|
import fs2, { existsSync as existsSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
116052
|
-
import { join as
|
|
116302
|
+
import { join as join8 } from "node:path";
|
|
116053
116303
|
function readMigrationFiles(config2) {
|
|
116054
116304
|
if (fs2.existsSync(`${config2.migrationsFolder}/meta/_journal.json`)) throw Error('We detected that you have old drizzle-kit migration folders. You must upgrade drizzle-kit and run "drizzle-kit up"');
|
|
116055
116305
|
const migrationFolderTo = config2.migrationsFolder;
|
|
116056
116306
|
const migrationQueries = [];
|
|
116057
116307
|
const migrations = readdirSync2(migrationFolderTo).map((subdir) => ({
|
|
116058
|
-
path:
|
|
116308
|
+
path: join8(migrationFolderTo, subdir, "migration.sql"),
|
|
116059
116309
|
name: subdir
|
|
116060
116310
|
})).filter((it) => existsSync4(it.path));
|
|
116061
116311
|
migrations.sort((a2, b2) => a2.name.localeCompare(b2.name));
|
|
@@ -116086,15 +116336,15 @@ function migrate(db, config2) {
|
|
|
116086
116336
|
|
|
116087
116337
|
// src/server/infra/db/queries/settings.ts
|
|
116088
116338
|
import { randomBytes } from "node:crypto";
|
|
116089
|
-
import { mkdirSync, readFileSync, renameSync, statSync as
|
|
116090
|
-
import { homedir as
|
|
116091
|
-
import { dirname as dirname2, join as
|
|
116339
|
+
import { mkdirSync, readFileSync as readFileSync2, renameSync, statSync as statSync5, writeFileSync } from "node:fs";
|
|
116340
|
+
import { homedir as homedir6 } from "node:os";
|
|
116341
|
+
import { dirname as dirname2, join as join9 } from "node:path";
|
|
116092
116342
|
function bandHome() {
|
|
116093
116343
|
if (process.env.BAND_HOME) return process.env.BAND_HOME;
|
|
116094
|
-
return
|
|
116344
|
+
return join9(homedir6(), ".band");
|
|
116095
116345
|
}
|
|
116096
116346
|
function settingsFile() {
|
|
116097
|
-
return
|
|
116347
|
+
return join9(bandHome(), "settings.json");
|
|
116098
116348
|
}
|
|
116099
116349
|
function resolveAgentDefinition(settings2, agentId) {
|
|
116100
116350
|
const agents = settings2.codingAgents ?? [];
|
|
@@ -116123,7 +116373,7 @@ var SettingsQueries = class {
|
|
|
116123
116373
|
const filePath = settingsFile();
|
|
116124
116374
|
let mtimeMs;
|
|
116125
116375
|
try {
|
|
116126
|
-
mtimeMs =
|
|
116376
|
+
mtimeMs = statSync5(filePath).mtimeMs;
|
|
116127
116377
|
} catch {
|
|
116128
116378
|
settingsCache.delete(filePath);
|
|
116129
116379
|
return {};
|
|
@@ -116133,7 +116383,7 @@ var SettingsQueries = class {
|
|
|
116133
116383
|
return cached2.value;
|
|
116134
116384
|
}
|
|
116135
116385
|
try {
|
|
116136
|
-
const value = JSON.parse(
|
|
116386
|
+
const value = JSON.parse(readFileSync2(filePath, "utf-8"));
|
|
116137
116387
|
settingsCache.set(filePath, { mtimeMs, value });
|
|
116138
116388
|
return value;
|
|
116139
116389
|
} catch {
|
|
@@ -116160,7 +116410,7 @@ var SettingsQueries = class {
|
|
|
116160
116410
|
const filePath = settingsFile();
|
|
116161
116411
|
let existing = {};
|
|
116162
116412
|
try {
|
|
116163
|
-
existing = JSON.parse(
|
|
116413
|
+
existing = JSON.parse(readFileSync2(filePath, "utf-8"));
|
|
116164
116414
|
} catch {
|
|
116165
116415
|
}
|
|
116166
116416
|
const merged = { ...existing, ...patch };
|
|
@@ -116495,14 +116745,14 @@ var clientState = sqliteTable(
|
|
|
116495
116745
|
|
|
116496
116746
|
// src/server/infra/db/connection.ts
|
|
116497
116747
|
var log4 = createLogger("db");
|
|
116498
|
-
var migrationsFolder =
|
|
116748
|
+
var migrationsFolder = join10(import.meta.dirname, "migrations");
|
|
116499
116749
|
var _db = null;
|
|
116500
116750
|
var _sqlite = null;
|
|
116501
116751
|
function getDb() {
|
|
116502
116752
|
if (_db) return _db;
|
|
116503
116753
|
const home = bandHome();
|
|
116504
116754
|
mkdirSync2(home, { recursive: true });
|
|
116505
|
-
const dbPath =
|
|
116755
|
+
const dbPath = join10(home, "band.db");
|
|
116506
116756
|
_sqlite = new DatabaseSync2(dbPath);
|
|
116507
116757
|
_sqlite.exec("PRAGMA journal_mode = WAL");
|
|
116508
116758
|
_sqlite.exec("PRAGMA synchronous = NORMAL");
|
|
@@ -117140,6 +117390,9 @@ function listenerCount() {
|
|
|
117140
117390
|
return listeners.size;
|
|
117141
117391
|
}
|
|
117142
117392
|
|
|
117393
|
+
// src/server/services/branch-status-poller.ts
|
|
117394
|
+
import { setImmediate as yieldToEventLoop } from "node:timers/promises";
|
|
117395
|
+
|
|
117143
117396
|
// ../../node_modules/.pnpm/@radix-ui+react-visually-hidden@1.2.3_@types+react-dom@19.2.3_@types+react@19.2.14__@ty_fa89646d7248b32d1762bf88948f6339/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
|
|
117144
117397
|
var React4 = __toESM(require_react(), 1);
|
|
117145
117398
|
|
|
@@ -127054,9 +127307,9 @@ var defaultTimeoutProvider = {
|
|
|
127054
127307
|
// replace the global setTimeout (like tests) won't work since we'll already
|
|
127055
127308
|
// have a hard reference to the original implementation at the time when this
|
|
127056
127309
|
// file was imported.
|
|
127057
|
-
setTimeout: (callback,
|
|
127310
|
+
setTimeout: (callback, delay2) => setTimeout(callback, delay2),
|
|
127058
127311
|
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
127059
|
-
setInterval: (callback,
|
|
127312
|
+
setInterval: (callback, delay2) => setInterval(callback, delay2),
|
|
127060
127313
|
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
127061
127314
|
};
|
|
127062
127315
|
var TimeoutManager = class {
|
|
@@ -127082,20 +127335,20 @@ var TimeoutManager = class {
|
|
|
127082
127335
|
this.#providerCalled = false;
|
|
127083
127336
|
}
|
|
127084
127337
|
}
|
|
127085
|
-
setTimeout(callback,
|
|
127338
|
+
setTimeout(callback, delay2) {
|
|
127086
127339
|
if (process.env.NODE_ENV !== "production") {
|
|
127087
127340
|
this.#providerCalled = true;
|
|
127088
127341
|
}
|
|
127089
|
-
return this.#provider.setTimeout(callback,
|
|
127342
|
+
return this.#provider.setTimeout(callback, delay2);
|
|
127090
127343
|
}
|
|
127091
127344
|
clearTimeout(timeoutId) {
|
|
127092
127345
|
this.#provider.clearTimeout(timeoutId);
|
|
127093
127346
|
}
|
|
127094
|
-
setInterval(callback,
|
|
127347
|
+
setInterval(callback, delay2) {
|
|
127095
127348
|
if (process.env.NODE_ENV !== "production") {
|
|
127096
127349
|
this.#providerCalled = true;
|
|
127097
127350
|
}
|
|
127098
|
-
return this.#provider.setInterval(callback,
|
|
127351
|
+
return this.#provider.setInterval(callback, delay2);
|
|
127099
127352
|
}
|
|
127100
127353
|
clearInterval(intervalId) {
|
|
127101
127354
|
this.#provider.clearInterval(intervalId);
|
|
@@ -127662,7 +127915,7 @@ function createRetryer(config2) {
|
|
|
127662
127915
|
}
|
|
127663
127916
|
const retry = config2.retry ?? (isServer ? 0 : 3);
|
|
127664
127917
|
const retryDelay = config2.retryDelay ?? defaultRetryDelay;
|
|
127665
|
-
const
|
|
127918
|
+
const delay2 = typeof retryDelay === "function" ? retryDelay(failureCount, error40) : retryDelay;
|
|
127666
127919
|
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error40);
|
|
127667
127920
|
if (isRetryCancelled || !shouldRetry) {
|
|
127668
127921
|
reject(error40);
|
|
@@ -127670,7 +127923,7 @@ function createRetryer(config2) {
|
|
|
127670
127923
|
}
|
|
127671
127924
|
failureCount++;
|
|
127672
127925
|
config2.onFail?.(failureCount, error40);
|
|
127673
|
-
sleep2(
|
|
127926
|
+
sleep2(delay2).then(() => {
|
|
127674
127927
|
return canContinue() ? void 0 : pause();
|
|
127675
127928
|
}).then(() => {
|
|
127676
127929
|
if (isRetryCancelled) {
|
|
@@ -131011,7 +131264,7 @@ var ClientStateStore = class {
|
|
|
131011
131264
|
if (this.hydrated.has(groupOf(matched.workspaceId))) this.schedule(id2);
|
|
131012
131265
|
}
|
|
131013
131266
|
}
|
|
131014
|
-
schedule(id2,
|
|
131267
|
+
schedule(id2, delay2 = PUSH_DELAY_MS) {
|
|
131015
131268
|
const existing = this.timers.get(id2);
|
|
131016
131269
|
if (existing) clearTimeout(existing);
|
|
131017
131270
|
this.timers.set(
|
|
@@ -131019,7 +131272,7 @@ var ClientStateStore = class {
|
|
|
131019
131272
|
setTimeout(() => {
|
|
131020
131273
|
this.timers.delete(id2);
|
|
131021
131274
|
void this.push(id2);
|
|
131022
|
-
},
|
|
131275
|
+
}, delay2)
|
|
131023
131276
|
);
|
|
131024
131277
|
}
|
|
131025
131278
|
async push(id2) {
|
|
@@ -131400,9 +131653,9 @@ function PullRequestBadge({ pr, ciState, onOpenChecks }) {
|
|
|
131400
131653
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
131401
131654
|
timerRef.current = null;
|
|
131402
131655
|
};
|
|
131403
|
-
const setOpenAfter = (next,
|
|
131656
|
+
const setOpenAfter = (next, delay2) => {
|
|
131404
131657
|
cancelTimer();
|
|
131405
|
-
timerRef.current = setTimeout(() => setOpen(next),
|
|
131658
|
+
timerRef.current = setTimeout(() => setOpen(next), delay2);
|
|
131406
131659
|
};
|
|
131407
131660
|
(0, import_react28.useEffect)(
|
|
131408
131661
|
() => () => {
|
|
@@ -135661,10 +135914,10 @@ var cmdClickLinkTheme = EditorView.baseTheme({
|
|
|
135661
135914
|
|
|
135662
135915
|
// src/server/infra/git/git-client.ts
|
|
135663
135916
|
import { readFile, stat as stat3 } from "node:fs/promises";
|
|
135664
|
-
import { join as
|
|
135917
|
+
import { join as join11 } from "node:path";
|
|
135665
135918
|
|
|
135666
135919
|
// src/server/infra/process/exec-file-worker.ts
|
|
135667
|
-
import { execFile as
|
|
135920
|
+
import { execFile as execFile4 } from "node:child_process";
|
|
135668
135921
|
import { Worker } from "node:worker_threads";
|
|
135669
135922
|
var log6 = createLogger("exec-file-worker");
|
|
135670
135923
|
var WORKER_SOURCE = `
|
|
@@ -135689,7 +135942,7 @@ var pending = /* @__PURE__ */ new Map();
|
|
|
135689
135942
|
function execOnThisThread({ command, args, options: options2 }) {
|
|
135690
135943
|
return new Promise((resolve12) => {
|
|
135691
135944
|
try {
|
|
135692
|
-
|
|
135945
|
+
execFile4(command, args, { ...options2, encoding: "utf8" }, (err, stdout, stderr) => {
|
|
135693
135946
|
resolve12({ stdout, stderr, error: err ? err.message : null });
|
|
135694
135947
|
});
|
|
135695
135948
|
} catch (err) {
|
|
@@ -135787,7 +136040,7 @@ function detachedShaLabel(head) {
|
|
|
135787
136040
|
return sha ? `${DETACHED_BRANCH_PREFIX}${sha}` : "detached";
|
|
135788
136041
|
}
|
|
135789
136042
|
async function resolveDetachedBranch(worktreePath) {
|
|
135790
|
-
const dotGit =
|
|
136043
|
+
const dotGit = join11(worktreePath, ".git");
|
|
135791
136044
|
let gitdir;
|
|
135792
136045
|
try {
|
|
135793
136046
|
const st = await stat3(dotGit);
|
|
@@ -135804,7 +136057,7 @@ async function resolveDetachedBranch(worktreePath) {
|
|
|
135804
136057
|
}
|
|
135805
136058
|
for (const rebaseDir of ["rebase-merge", "rebase-apply"]) {
|
|
135806
136059
|
try {
|
|
135807
|
-
const headName = await readFile(
|
|
136060
|
+
const headName = await readFile(join11(gitdir, rebaseDir, "head-name"), "utf-8");
|
|
135808
136061
|
const name3 = headName.trim();
|
|
135809
136062
|
return name3.startsWith("refs/heads/") ? name3.slice("refs/heads/".length) : name3;
|
|
135810
136063
|
} catch {
|
|
@@ -136088,7 +136341,7 @@ async function mapLimited(items, limit, fn2) {
|
|
|
136088
136341
|
}
|
|
136089
136342
|
|
|
136090
136343
|
// src/server/services/plugin-host-service.ts
|
|
136091
|
-
import { execFile as
|
|
136344
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
136092
136345
|
|
|
136093
136346
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
136094
136347
|
var external_exports2 = {};
|
|
@@ -140512,10 +140765,10 @@ var BUNDLED_PLUGINS = [
|
|
|
140512
140765
|
|
|
140513
140766
|
// src/server/infra/db/queries/projects.ts
|
|
140514
140767
|
import { existsSync as existsSync5 } from "node:fs";
|
|
140515
|
-
import { join as
|
|
140768
|
+
import { join as join12 } from "node:path";
|
|
140516
140769
|
function reconcileKindForProject(project) {
|
|
140517
140770
|
if (!existsSync5(project.path)) return false;
|
|
140518
|
-
const detectedKind = existsSync5(
|
|
140771
|
+
const detectedKind = existsSync5(join12(project.path, ".git")) ? "git" : "plain";
|
|
140519
140772
|
if (detectedKind === project.kind) return false;
|
|
140520
140773
|
project.kind = detectedKind;
|
|
140521
140774
|
if (detectedKind === "plain") {
|
|
@@ -140830,7 +141083,7 @@ var WorkspaceQueries = class {
|
|
|
140830
141083
|
};
|
|
140831
141084
|
|
|
140832
141085
|
// src/server/services/settings-service.ts
|
|
140833
|
-
import { join as
|
|
141086
|
+
import { join as join13 } from "node:path";
|
|
140834
141087
|
var settingsUpdateInput = external_exports2.object({
|
|
140835
141088
|
// `null` is allowed because the dashboard sends `worktreesDir.trim() || null`
|
|
140836
141089
|
// when the field is cleared — the legacy behavior preserved across the
|
|
@@ -140998,7 +141251,7 @@ var SettingsService = class _SettingsService {
|
|
|
140998
141251
|
*/
|
|
140999
141252
|
worktreesDir() {
|
|
141000
141253
|
const raw = this.rawWorktreesDir();
|
|
141001
|
-
return raw ??
|
|
141254
|
+
return raw ?? join13(bandHome(), "worktrees");
|
|
141002
141255
|
}
|
|
141003
141256
|
/**
|
|
141004
141257
|
* Return the raw `worktreesDir` value from settings without applying the
|
|
@@ -141351,7 +141604,7 @@ var PluginHost = class {
|
|
|
141351
141604
|
exec: (bin, args, options2) => new Promise((resolve12, reject) => {
|
|
141352
141605
|
const env = { ...process.env, ...options2.env };
|
|
141353
141606
|
env.PATH = prependBinDirs(process.env.PATH);
|
|
141354
|
-
|
|
141607
|
+
execFile5(
|
|
141355
141608
|
bin,
|
|
141356
141609
|
args,
|
|
141357
141610
|
{ cwd: options2.cwd, env, maxBuffer: EXEC_MAX_BUFFER, timeout: options2.timeoutMs },
|
|
@@ -141721,25 +141974,27 @@ async function getBatchedCIStatuses(workspaces) {
|
|
|
141721
141974
|
var pollCount = 0;
|
|
141722
141975
|
var latestPollByWorkspace = /* @__PURE__ */ new Map();
|
|
141723
141976
|
var pendingCIByWorkspace = /* @__PURE__ */ new Map();
|
|
141977
|
+
function isSameStatus(row, git, ci) {
|
|
141978
|
+
return row.gitDirty === git.dirty && row.gitConflict === git.conflict && row.gitAhead === git.ahead && row.gitBehind === git.behind && row.gitSyncState === git.sync_state && row.ciState === ci.state && row.ciUrl === (ci.url ?? null) && JSON.stringify(row.ciPr ?? null) === JSON.stringify(ci.pr ?? null);
|
|
141979
|
+
}
|
|
141724
141980
|
async function pollWorkspace(ws, newCI) {
|
|
141725
141981
|
const poll = ++pollCount;
|
|
141726
141982
|
latestPollByWorkspace.set(ws.workspaceId, poll);
|
|
141727
141983
|
if (newCI) pendingCIByWorkspace.set(ws.workspaceId, newCI);
|
|
141728
141984
|
const git = await getGitStatus(ws.worktreePath);
|
|
141985
|
+
await yieldToEventLoop();
|
|
141729
141986
|
if (latestPollByWorkspace.get(ws.workspaceId) !== poll) return;
|
|
141730
141987
|
const db = getDb();
|
|
141988
|
+
const existing = db.select().from(branchStatuses).where(eq(branchStatuses.workspaceId, ws.workspaceId)).get();
|
|
141731
141989
|
const pendingCI = pendingCIByWorkspace.get(ws.workspaceId);
|
|
141732
141990
|
let ci = newCI ?? pendingCI ?? { state: "none" };
|
|
141733
|
-
if (!newCI && !pendingCI) {
|
|
141734
|
-
|
|
141735
|
-
|
|
141736
|
-
|
|
141737
|
-
|
|
141738
|
-
}).from(branchStatuses).where(eq(branchStatuses.workspaceId, ws.workspaceId)).get();
|
|
141739
|
-
if (existing) {
|
|
141740
|
-
ci = { state: existing.ciState, url: existing.ciUrl, pr: existing.ciPr };
|
|
141741
|
-
}
|
|
141991
|
+
if (!newCI && !pendingCI && existing) {
|
|
141992
|
+
ci = { state: existing.ciState, url: existing.ciUrl, pr: existing.ciPr };
|
|
141993
|
+
}
|
|
141994
|
+
if (pendingCIByWorkspace.get(ws.workspaceId) === ci) {
|
|
141995
|
+
pendingCIByWorkspace.delete(ws.workspaceId);
|
|
141742
141996
|
}
|
|
141997
|
+
if (existing && isSameStatus(existing, git, ci)) return;
|
|
141743
141998
|
const now = Date.now();
|
|
141744
141999
|
db.insert(branchStatuses).values({
|
|
141745
142000
|
workspaceId: ws.workspaceId,
|
|
@@ -141766,14 +142021,11 @@ async function pollWorkspace(ws, newCI) {
|
|
|
141766
142021
|
updatedAt: now
|
|
141767
142022
|
}
|
|
141768
142023
|
}).run();
|
|
141769
|
-
if (pendingCIByWorkspace.get(ws.workspaceId) === ci) {
|
|
141770
|
-
pendingCIByWorkspace.delete(ws.workspaceId);
|
|
141771
|
-
}
|
|
141772
142024
|
emit({
|
|
141773
142025
|
kind: "branch-status",
|
|
141774
142026
|
workspaceId: ws.workspaceId,
|
|
141775
142027
|
git,
|
|
141776
|
-
ci
|
|
142028
|
+
ci: { state: ci.state, url: ci.url ?? null, pr: ci.pr ?? null }
|
|
141777
142029
|
});
|
|
141778
142030
|
}
|
|
141779
142031
|
var refreshesInFlight = /* @__PURE__ */ new Map();
|
|
@@ -141872,15 +142124,15 @@ var branchStatusPoller = new BranchStatusPoller();
|
|
|
141872
142124
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
141873
142125
|
|
|
141874
142126
|
// src/server/infra/setup/project-config.ts
|
|
141875
|
-
import { existsSync as existsSync6, readFileSync as
|
|
141876
|
-
import { join as
|
|
142127
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
142128
|
+
import { join as join14 } from "node:path";
|
|
141877
142129
|
var log10 = createLogger("project-config");
|
|
141878
142130
|
function loadProjectConfig(worktreePath, projectPath) {
|
|
141879
142131
|
for (const base3 of [worktreePath, projectPath]) {
|
|
141880
|
-
const configPath =
|
|
142132
|
+
const configPath = join14(base3, ".band", "config.json");
|
|
141881
142133
|
if (existsSync6(configPath)) {
|
|
141882
142134
|
try {
|
|
141883
|
-
return JSON.parse(
|
|
142135
|
+
return JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
141884
142136
|
} catch {
|
|
141885
142137
|
}
|
|
141886
142138
|
}
|
|
@@ -141889,11 +142141,11 @@ function loadProjectConfig(worktreePath, projectPath) {
|
|
|
141889
142141
|
}
|
|
141890
142142
|
var CopyFilesSchema = external_exports2.array(external_exports2.string()).optional();
|
|
141891
142143
|
function getCopyFiles(projectPath) {
|
|
141892
|
-
const configPath =
|
|
142144
|
+
const configPath = join14(projectPath, ".band", "config.json");
|
|
141893
142145
|
if (!existsSync6(configPath)) return null;
|
|
141894
142146
|
let raw;
|
|
141895
142147
|
try {
|
|
141896
|
-
raw = JSON.parse(
|
|
142148
|
+
raw = JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
141897
142149
|
} catch (err) {
|
|
141898
142150
|
log10.warn({ err, configPath }, "failed to parse .band/config.json");
|
|
141899
142151
|
return null;
|
|
@@ -141916,16 +142168,16 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
141916
142168
|
import { watch } from "node:fs";
|
|
141917
142169
|
import { mkdtemp, readFile as readFile2, rm, writeFile } from "node:fs/promises";
|
|
141918
142170
|
import { tmpdir } from "node:os";
|
|
141919
|
-
import { join as
|
|
142171
|
+
import { join as join15 } from "node:path";
|
|
141920
142172
|
var log11 = createLogger("script-run");
|
|
141921
142173
|
var POLL_MS = 1e3;
|
|
141922
142174
|
function quote2(value) {
|
|
141923
142175
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
141924
142176
|
}
|
|
141925
142177
|
async function prepareScriptRun(script, label) {
|
|
141926
|
-
const dir = await mkdtemp(
|
|
141927
|
-
const scriptFile =
|
|
141928
|
-
const exitFile =
|
|
142178
|
+
const dir = await mkdtemp(join15(tmpdir(), "band-script-"));
|
|
142179
|
+
const scriptFile = join15(dir, `${label}.sh`);
|
|
142180
|
+
const exitFile = join15(dir, "exit-code");
|
|
141929
142181
|
const partialFile = `${exitFile}.partial`;
|
|
141930
142182
|
const onExit = [
|
|
141931
142183
|
"rc=$?",
|
|
@@ -142008,7 +142260,7 @@ function runScriptHidden(script, cwd, timeoutMs) {
|
|
|
142008
142260
|
}
|
|
142009
142261
|
|
|
142010
142262
|
// src/server/infra/terminals/daemon/daemon-backend.ts
|
|
142011
|
-
import { existsSync as existsSync7, lstatSync as lstatSync2, readFileSync as
|
|
142263
|
+
import { existsSync as existsSync7, lstatSync as lstatSync2, readFileSync as readFileSync5 } from "node:fs";
|
|
142012
142264
|
|
|
142013
142265
|
// src/server/infra/terminals/terminal-backend.ts
|
|
142014
142266
|
var AttachGate = class {
|
|
@@ -142071,10 +142323,10 @@ import {
|
|
|
142071
142323
|
lstatSync,
|
|
142072
142324
|
mkdirSync as mkdirSync3,
|
|
142073
142325
|
renameSync as renameSync2,
|
|
142074
|
-
statSync as
|
|
142326
|
+
statSync as statSync6,
|
|
142075
142327
|
unlinkSync
|
|
142076
142328
|
} from "node:fs";
|
|
142077
|
-
import { dirname as dirname3, join as
|
|
142329
|
+
import { dirname as dirname3, join as join16 } from "node:path";
|
|
142078
142330
|
function ensurePrivateDir(dir) {
|
|
142079
142331
|
mkdirSync3(dir, { recursive: true, mode: 448 });
|
|
142080
142332
|
const stats = lstatSync(dir);
|
|
@@ -142128,30 +142380,30 @@ function errorCode(err) {
|
|
|
142128
142380
|
// src/server/infra/terminals/daemon/protocol.ts
|
|
142129
142381
|
import { createHash } from "node:crypto";
|
|
142130
142382
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
142131
|
-
import { basename, dirname as dirname4, join as
|
|
142383
|
+
import { basename, dirname as dirname4, join as join17 } from "node:path";
|
|
142132
142384
|
var PROTOCOL_VERSION2 = 1;
|
|
142133
142385
|
var EXIT_ENDPOINT_OCCUPIED = 20;
|
|
142134
142386
|
var EXIT_NODE_PTY_UNAVAILABLE = 22;
|
|
142135
142387
|
var ENDPOINT_LOST_ERROR = "Terminal daemon no longer owns its endpoint";
|
|
142136
142388
|
var MAX_SOCKET_PATH_BYTES = 103;
|
|
142137
142389
|
function daemonPaths(runDir, version2 = PROTOCOL_VERSION2) {
|
|
142138
|
-
const inRunDir =
|
|
142139
|
-
const socket = Buffer.byteLength(inRunDir) <= MAX_SOCKET_PATH_BYTES ? inRunDir :
|
|
142390
|
+
const inRunDir = join17(runDir, `terminal-daemon-v${version2}.sock`);
|
|
142391
|
+
const socket = Buffer.byteLength(inRunDir) <= MAX_SOCKET_PATH_BYTES ? inRunDir : join17(
|
|
142140
142392
|
shortSocketDir(),
|
|
142141
142393
|
`td-${createHash("sha256").update(runDir).digest("hex").slice(0, 16)}-v${version2}.sock`
|
|
142142
142394
|
);
|
|
142143
142395
|
return {
|
|
142144
142396
|
runDir,
|
|
142145
142397
|
socket,
|
|
142146
|
-
token:
|
|
142147
|
-
pid:
|
|
142148
|
-
log:
|
|
142398
|
+
token: join17(runDir, `terminal-daemon-v${version2}.token`),
|
|
142399
|
+
pid: join17(runDir, `terminal-daemon-v${version2}.pid`),
|
|
142400
|
+
log: join17(runDir, "terminal-daemon.log")
|
|
142149
142401
|
};
|
|
142150
142402
|
}
|
|
142151
142403
|
function retiredDaemonPaths(paths, tag2) {
|
|
142152
142404
|
return {
|
|
142153
142405
|
...paths,
|
|
142154
|
-
socket:
|
|
142406
|
+
socket: join17(dirname4(paths.socket), `.r${tag2}`),
|
|
142155
142407
|
token: paths.token.replace(/\.token$/, `.retired-${tag2}.token`),
|
|
142156
142408
|
pid: paths.pid.replace(/\.pid$/, `.retired-${tag2}.pid`)
|
|
142157
142409
|
};
|
|
@@ -142167,7 +142419,7 @@ function listRetiredDaemons(paths) {
|
|
|
142167
142419
|
return names.filter((name3) => name3.startsWith(prefix) && name3.endsWith(".token")).map((name3) => name3.slice(prefix.length, -".token".length)).filter((tag2) => /^[0-9a-f]{8}$/.test(tag2)).map((tag2) => retiredDaemonPaths(paths, tag2));
|
|
142168
142420
|
}
|
|
142169
142421
|
function shortSocketDir() {
|
|
142170
|
-
return
|
|
142422
|
+
return join17("/tmp", `band-${process.getuid?.() ?? "user"}`);
|
|
142171
142423
|
}
|
|
142172
142424
|
function writeFrame(socket, message) {
|
|
142173
142425
|
socket.write(`${JSON.stringify(message)}
|
|
@@ -142462,7 +142714,7 @@ async function readToken3(path) {
|
|
|
142462
142714
|
|
|
142463
142715
|
// src/server/infra/terminals/daemon/launch.ts
|
|
142464
142716
|
import { fork } from "node:child_process";
|
|
142465
|
-
import { closeSync, openSync, readFileSync as
|
|
142717
|
+
import { closeSync as closeSync2, openSync as openSync2, readFileSync as readFileSync4, renameSync as renameSync3, statSync as statSync7 } from "node:fs";
|
|
142466
142718
|
var READY_TIMEOUT_MS = 1e4;
|
|
142467
142719
|
var LOG_ROTATE_BYTES = 5 * 1024 * 1024;
|
|
142468
142720
|
var LOG_TAIL_BYTES = 4096;
|
|
@@ -142470,10 +142722,10 @@ async function launchDaemon(options2) {
|
|
|
142470
142722
|
const { entry, paths, cwd, buildId, supersede } = options2;
|
|
142471
142723
|
ensurePrivateDir(paths.runDir);
|
|
142472
142724
|
rotateLog(paths.log);
|
|
142473
|
-
const logFd =
|
|
142725
|
+
const logFd = openSync2(paths.log, "a", 384);
|
|
142474
142726
|
let logSize = 0;
|
|
142475
142727
|
try {
|
|
142476
|
-
logSize =
|
|
142728
|
+
logSize = statSync7(paths.log).size;
|
|
142477
142729
|
} catch {
|
|
142478
142730
|
}
|
|
142479
142731
|
const child = (() => {
|
|
@@ -142487,7 +142739,7 @@ async function launchDaemon(options2) {
|
|
|
142487
142739
|
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" }
|
|
142488
142740
|
});
|
|
142489
142741
|
} finally {
|
|
142490
|
-
|
|
142742
|
+
closeSync2(logFd);
|
|
142491
142743
|
}
|
|
142492
142744
|
})();
|
|
142493
142745
|
child.on("error", () => {
|
|
@@ -142543,13 +142795,13 @@ async function retireOlderDaemons(runDir, buildId) {
|
|
|
142543
142795
|
}
|
|
142544
142796
|
function rotateLog(path) {
|
|
142545
142797
|
try {
|
|
142546
|
-
if (
|
|
142798
|
+
if (statSync7(path).size > LOG_ROTATE_BYTES) renameSync3(path, `${path}.1`);
|
|
142547
142799
|
} catch {
|
|
142548
142800
|
}
|
|
142549
142801
|
}
|
|
142550
142802
|
function readLogTail(path, from3) {
|
|
142551
142803
|
try {
|
|
142552
|
-
const content2 =
|
|
142804
|
+
const content2 = readFileSync4(path, "utf8").slice(from3);
|
|
142553
142805
|
return content2.slice(-LOG_TAIL_BYTES).trim();
|
|
142554
142806
|
} catch {
|
|
142555
142807
|
return "";
|
|
@@ -143050,7 +143302,7 @@ function sameEntry(a2, b2) {
|
|
|
143050
143302
|
}
|
|
143051
143303
|
function readPidRecord(path) {
|
|
143052
143304
|
try {
|
|
143053
|
-
return JSON.parse(
|
|
143305
|
+
return JSON.parse(readFileSync5(path, "utf8"));
|
|
143054
143306
|
} catch {
|
|
143055
143307
|
return null;
|
|
143056
143308
|
}
|
|
@@ -143092,22 +143344,22 @@ function stringEnv(env) {
|
|
|
143092
143344
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
143093
143345
|
import { existsSync as existsSync8, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
143094
143346
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
143095
|
-
import { join as
|
|
143347
|
+
import { join as join20, sep as sep2 } from "node:path";
|
|
143096
143348
|
|
|
143097
143349
|
// src/server/infra/terminals/claude-resume.ts
|
|
143098
|
-
import { readdirSync as readdirSync4, statSync as
|
|
143099
|
-
import { homedir as
|
|
143100
|
-
import { join as
|
|
143350
|
+
import { readdirSync as readdirSync4, statSync as statSync8 } from "node:fs";
|
|
143351
|
+
import { homedir as homedir7 } from "node:os";
|
|
143352
|
+
import { join as join18 } from "node:path";
|
|
143101
143353
|
var CLAUDE_COMMAND_PATTERN = /^claude(\s|$)/;
|
|
143102
143354
|
var CLAUDE_RESUME_FLAG_PATTERN = /(^|\s)(--resume|-r)(\s|$)/;
|
|
143103
|
-
var
|
|
143355
|
+
var SESSION_ID_PATTERN2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
143104
143356
|
function isResumableClaudeCommand(command) {
|
|
143105
143357
|
if (!command) return false;
|
|
143106
143358
|
const trimmed = command.trim();
|
|
143107
143359
|
return CLAUDE_COMMAND_PATTERN.test(trimmed) && !CLAUDE_RESUME_FLAG_PATTERN.test(trimmed);
|
|
143108
143360
|
}
|
|
143109
143361
|
function claudeProjectDir(cwd) {
|
|
143110
|
-
return
|
|
143362
|
+
return join18(homedir7(), ".claude", "projects", cwd.replaceAll("/", "-"));
|
|
143111
143363
|
}
|
|
143112
143364
|
function findLatestClaudeSessionId(cwd) {
|
|
143113
143365
|
const dir = claudeProjectDir(cwd);
|
|
@@ -143121,7 +143373,7 @@ function findLatestClaudeSessionId(cwd) {
|
|
|
143121
143373
|
for (const name3 of names) {
|
|
143122
143374
|
let mtimeMs;
|
|
143123
143375
|
try {
|
|
143124
|
-
mtimeMs =
|
|
143376
|
+
mtimeMs = statSync8(join18(dir, name3)).mtimeMs;
|
|
143125
143377
|
} catch {
|
|
143126
143378
|
continue;
|
|
143127
143379
|
}
|
|
@@ -143129,7 +143381,7 @@ function findLatestClaudeSessionId(cwd) {
|
|
|
143129
143381
|
newest = { id: name3.slice(0, -".jsonl".length), mtimeMs };
|
|
143130
143382
|
}
|
|
143131
143383
|
}
|
|
143132
|
-
if (!newest || !
|
|
143384
|
+
if (!newest || !SESSION_ID_PATTERN2.test(newest.id)) return null;
|
|
143133
143385
|
return newest.id;
|
|
143134
143386
|
}
|
|
143135
143387
|
function buildClaudeResumeCommand(originalCommand, sessionId) {
|
|
@@ -143158,9 +143410,9 @@ function hintForPtySpawnError(err) {
|
|
|
143158
143410
|
}
|
|
143159
143411
|
|
|
143160
143412
|
// src/server/infra/terminals/terminal-history.ts
|
|
143161
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
143413
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync6, rmSync } from "node:fs";
|
|
143162
143414
|
import { mkdir, rename, writeFile as writeFile2 } from "node:fs/promises";
|
|
143163
|
-
import { join as
|
|
143415
|
+
import { join as join19 } from "node:path";
|
|
143164
143416
|
var log13 = createLogger("terminal-history");
|
|
143165
143417
|
var CHECKPOINT_MAX_BYTES = 5 * 1024 * 1024;
|
|
143166
143418
|
var TerminalHistoryManager = class {
|
|
@@ -143168,14 +143420,14 @@ var TerminalHistoryManager = class {
|
|
|
143168
143420
|
this.historyDir = historyDir;
|
|
143169
143421
|
}
|
|
143170
143422
|
sessionDir(terminalId) {
|
|
143171
|
-
return
|
|
143423
|
+
return join19(this.historyDir, encodeURIComponent(terminalId));
|
|
143172
143424
|
}
|
|
143173
143425
|
readMeta(terminalId) {
|
|
143174
|
-
return readJson(
|
|
143426
|
+
return readJson(join19(this.sessionDir(terminalId), "meta.json"));
|
|
143175
143427
|
}
|
|
143176
143428
|
readCheckpoint(terminalId) {
|
|
143177
143429
|
return readJson(
|
|
143178
|
-
|
|
143430
|
+
join19(this.sessionDir(terminalId), "checkpoint.json")
|
|
143179
143431
|
);
|
|
143180
143432
|
}
|
|
143181
143433
|
/**
|
|
@@ -143221,8 +143473,8 @@ var TerminalHistoryManager = class {
|
|
|
143221
143473
|
return;
|
|
143222
143474
|
}
|
|
143223
143475
|
for (const name3 of names) {
|
|
143224
|
-
const dir =
|
|
143225
|
-
const meta2 = readJson(
|
|
143476
|
+
const dir = join19(this.historyDir, name3);
|
|
143477
|
+
const meta2 = readJson(join19(dir, "meta.json"));
|
|
143226
143478
|
if (meta2?.workspaceId !== workspaceId2) continue;
|
|
143227
143479
|
try {
|
|
143228
143480
|
rmSync(dir, { recursive: true, force: true });
|
|
@@ -143234,7 +143486,7 @@ var TerminalHistoryManager = class {
|
|
|
143234
143486
|
};
|
|
143235
143487
|
function readJson(path) {
|
|
143236
143488
|
try {
|
|
143237
|
-
return JSON.parse(
|
|
143489
|
+
return JSON.parse(readFileSync6(path, "utf8"));
|
|
143238
143490
|
} catch {
|
|
143239
143491
|
return null;
|
|
143240
143492
|
}
|
|
@@ -143242,7 +143494,7 @@ function readJson(path) {
|
|
|
143242
143494
|
async function writeJson(dir, name3, value, serialized) {
|
|
143243
143495
|
try {
|
|
143244
143496
|
await mkdir(dir, { recursive: true, mode: 448 });
|
|
143245
|
-
const path =
|
|
143497
|
+
const path = join19(dir, name3);
|
|
143246
143498
|
const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
143247
143499
|
await writeFile2(tmp, serialized ?? JSON.stringify(value), { mode: 384 });
|
|
143248
143500
|
await rename(tmp, path);
|
|
@@ -143383,7 +143635,7 @@ var TerminalPool = class {
|
|
|
143383
143635
|
env.BAND_TERMINAL_ID = terminalId;
|
|
143384
143636
|
let cwd = workspaceRoot;
|
|
143385
143637
|
if (options2?.cwd) {
|
|
143386
|
-
cwd = resolveSafeCwd(
|
|
143638
|
+
cwd = resolveSafeCwd(join20(workspaceRoot, options2.cwd), workspaceRoot, "cwd", options2.cwd) ?? cwd;
|
|
143387
143639
|
} else if (checkpoint?.cwd) {
|
|
143388
143640
|
cwd = resolveSafeCwd(
|
|
143389
143641
|
checkpoint.cwd,
|
|
@@ -143645,7 +143897,7 @@ var TerminalPool = class {
|
|
|
143645
143897
|
const pty = session.pty;
|
|
143646
143898
|
let cmdFile;
|
|
143647
143899
|
try {
|
|
143648
|
-
cmdFile =
|
|
143900
|
+
cmdFile = join20(tmpdir2(), `band-autorun-${randomUUID3()}.sh`);
|
|
143649
143901
|
writeFileSync2(cmdFile, `${command}
|
|
143650
143902
|
`, { encoding: "utf-8", mode: 384, flag: "wx" });
|
|
143651
143903
|
session.autoRunFile = cmdFile;
|
|
@@ -144166,11 +144418,11 @@ function removeTerminalFromLayout(workspaceId2, terminalId) {
|
|
|
144166
144418
|
}
|
|
144167
144419
|
|
|
144168
144420
|
// src/server/services/workspace-service.ts
|
|
144169
|
-
import { execFile as
|
|
144421
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
144170
144422
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
144171
144423
|
import { existsSync as existsSync10, mkdirSync as mkdirSync5, unlinkSync as unlinkSync3 } from "node:fs";
|
|
144172
144424
|
import { rm as rm2 } from "node:fs/promises";
|
|
144173
|
-
import { join as
|
|
144425
|
+
import { join as join24 } from "node:path";
|
|
144174
144426
|
import { promisify as promisify2 } from "node:util";
|
|
144175
144427
|
|
|
144176
144428
|
// src/server/errors.ts
|
|
@@ -144744,7 +144996,7 @@ function formatFileList(files) {
|
|
|
144744
144996
|
|
|
144745
144997
|
// src/server/infra/lsp/lsp-manager.ts
|
|
144746
144998
|
import { spawn as spawn3 } from "node:child_process";
|
|
144747
|
-
import { dirname as dirname5, join as
|
|
144999
|
+
import { dirname as dirname5, join as join21, resolve as resolve3 } from "node:path";
|
|
144748
145000
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
144749
145001
|
var workspaceQueries = new WorkspaceQueries();
|
|
144750
145002
|
var __dirname2 = dirname5(fileURLToPath2(import.meta.url));
|
|
@@ -144773,7 +145025,7 @@ async function getOrSpawnServer(workspaceId2, lang) {
|
|
|
144773
145025
|
const cwd = workspace.worktreePath;
|
|
144774
145026
|
const appBin = resolve3(__dirname2, "../../../../node_modules/.bin");
|
|
144775
145027
|
const bundledBin = resolve3(__dirname2, "node_modules/.bin");
|
|
144776
|
-
const workspaceBin =
|
|
145028
|
+
const workspaceBin = join21(cwd, "node_modules/.bin");
|
|
144777
145029
|
const pathSep = process.platform === "win32" ? ";" : ":";
|
|
144778
145030
|
const combinedPath = [bundledBin, appBin, workspaceBin, resolvedPath].join(pathSep);
|
|
144779
145031
|
log17.debug("Spawning %s language server in %s for workspace %s", lang, cwd, workspaceId2);
|
|
@@ -144846,20 +145098,20 @@ function killAllServers() {
|
|
|
144846
145098
|
}
|
|
144847
145099
|
|
|
144848
145100
|
// src/server/infra/setup/workspace-files.ts
|
|
144849
|
-
import { execFile as
|
|
145101
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
144850
145102
|
import {
|
|
144851
145103
|
copyFileSync,
|
|
144852
145104
|
existsSync as existsSync9,
|
|
144853
145105
|
globSync,
|
|
144854
145106
|
mkdirSync as mkdirSync4,
|
|
144855
|
-
readFileSync as
|
|
144856
|
-
realpathSync,
|
|
144857
|
-
statSync as
|
|
145107
|
+
readFileSync as readFileSync7,
|
|
145108
|
+
realpathSync as realpathSync2,
|
|
145109
|
+
statSync as statSync9
|
|
144858
145110
|
} from "node:fs";
|
|
144859
|
-
import { dirname as dirname6, isAbsolute, join as
|
|
145111
|
+
import { dirname as dirname6, isAbsolute, join as join22, relative, resolve as resolve4, sep as sep3 } from "node:path";
|
|
144860
145112
|
import { promisify } from "node:util";
|
|
144861
145113
|
var log18 = createLogger("workspace-files");
|
|
144862
|
-
var execFileAsync = promisify(
|
|
145114
|
+
var execFileAsync = promisify(execFile6);
|
|
144863
145115
|
var MAX_COPY_FILES_ENTRIES = 100;
|
|
144864
145116
|
var MAX_COPY_FILES_MATCHES = 500;
|
|
144865
145117
|
async function copyWorkspaceFiles(projectPath, worktreePath) {
|
|
@@ -144882,14 +145134,14 @@ async function copyWorkspaceFiles(projectPath, worktreePath) {
|
|
|
144882
145134
|
const copied = [];
|
|
144883
145135
|
let canonicalProjectRoot;
|
|
144884
145136
|
try {
|
|
144885
|
-
canonicalProjectRoot =
|
|
145137
|
+
canonicalProjectRoot = realpathSync2(projectPath);
|
|
144886
145138
|
} catch (err) {
|
|
144887
145139
|
log18.warn({ err, projectPath }, "failed to resolve project root \u2014 skipping workspace file copy");
|
|
144888
145140
|
return copied;
|
|
144889
145141
|
}
|
|
144890
145142
|
for (const [absSource, source] of byAbs) {
|
|
144891
145143
|
const rel = relative(projectPath, absSource);
|
|
144892
|
-
const dest =
|
|
145144
|
+
const dest = join22(worktreePath, rel);
|
|
144893
145145
|
if (rel.startsWith("..") || isAbsolute(rel)) {
|
|
144894
145146
|
log18.warn(
|
|
144895
145147
|
{ source, entry: absSource },
|
|
@@ -144898,7 +145150,7 @@ async function copyWorkspaceFiles(projectPath, worktreePath) {
|
|
|
144898
145150
|
continue;
|
|
144899
145151
|
}
|
|
144900
145152
|
try {
|
|
144901
|
-
const canonicalSource =
|
|
145153
|
+
const canonicalSource = realpathSync2(absSource);
|
|
144902
145154
|
const insideRoot = canonicalSource === canonicalProjectRoot || canonicalSource.startsWith(canonicalProjectRoot + sep3);
|
|
144903
145155
|
if (!insideRoot) {
|
|
144904
145156
|
log18.warn(
|
|
@@ -144961,7 +145213,7 @@ function resolveFromConfig(projectPath, missing) {
|
|
|
144961
145213
|
}
|
|
144962
145214
|
const abs = resolve4(projectPath, m3);
|
|
144963
145215
|
try {
|
|
144964
|
-
if (
|
|
145216
|
+
if (statSync9(abs).isFile()) {
|
|
144965
145217
|
out.push(abs);
|
|
144966
145218
|
}
|
|
144967
145219
|
} catch {
|
|
@@ -144970,7 +145222,7 @@ function resolveFromConfig(projectPath, missing) {
|
|
|
144970
145222
|
} else {
|
|
144971
145223
|
const abs = resolve4(projectPath, entry);
|
|
144972
145224
|
try {
|
|
144973
|
-
if (
|
|
145225
|
+
if (statSync9(abs).isFile()) {
|
|
144974
145226
|
out.push(abs);
|
|
144975
145227
|
}
|
|
144976
145228
|
} catch {
|
|
@@ -144981,9 +145233,9 @@ function resolveFromConfig(projectPath, missing) {
|
|
|
144981
145233
|
return out;
|
|
144982
145234
|
}
|
|
144983
145235
|
async function resolveFromWorktreeInclude(projectPath) {
|
|
144984
|
-
const includePath =
|
|
145236
|
+
const includePath = join22(projectPath, ".worktreeinclude");
|
|
144985
145237
|
if (!existsSync9(includePath)) return [];
|
|
144986
|
-
const includeContent =
|
|
145238
|
+
const includeContent = readFileSync7(includePath, "utf-8");
|
|
144987
145239
|
const hasPatterns = includeContent.split(/\r?\n/).some((line2) => {
|
|
144988
145240
|
const trimmed = line2.trim();
|
|
144989
145241
|
return trimmed.length > 0 && !trimmed.startsWith("#");
|
|
@@ -145037,7 +145289,7 @@ import { randomUUID as randomUUID4 } from "node:crypto";
|
|
|
145037
145289
|
// src/server/services/task-service.ts
|
|
145038
145290
|
import { readdirSync as readdirSync6 } from "node:fs";
|
|
145039
145291
|
import { mkdir as mkdir2, readFile as readFile4 } from "node:fs/promises";
|
|
145040
|
-
import { join as
|
|
145292
|
+
import { join as join23 } from "node:path";
|
|
145041
145293
|
|
|
145042
145294
|
// src/server/services/_utils/mime-types.ts
|
|
145043
145295
|
import { extname } from "node:path";
|
|
@@ -145275,7 +145527,7 @@ async function runTask(task) {
|
|
|
145275
145527
|
}
|
|
145276
145528
|
if (task.model) await applyTurnChoice(chatId, "model", task.model);
|
|
145277
145529
|
if (task.mode) await applyTurnChoice(chatId, "mode", task.mode);
|
|
145278
|
-
const sharedDir =
|
|
145530
|
+
const sharedDir = join23(bandHome(), "shared", task.workspaceId);
|
|
145279
145531
|
await mkdir2(sharedDir, { recursive: true });
|
|
145280
145532
|
const seenShared = listFiles(sharedDir);
|
|
145281
145533
|
const unsubscribe = agentSessionService.subscribe(chatId, (event) => {
|
|
@@ -145293,7 +145545,9 @@ async function runTask(task) {
|
|
|
145293
145545
|
});
|
|
145294
145546
|
}
|
|
145295
145547
|
});
|
|
145296
|
-
const previousCost = agentSessionService.getSessionState(chatId
|
|
145548
|
+
const previousCost = agentSessionService.getSessionState(chatId, {
|
|
145549
|
+
resolveDefaults: false
|
|
145550
|
+
}).costUsd;
|
|
145297
145551
|
agentSessionService.record(
|
|
145298
145552
|
chatId,
|
|
145299
145553
|
{
|
|
@@ -145337,7 +145591,7 @@ async function runTask(task) {
|
|
|
145337
145591
|
}
|
|
145338
145592
|
async function applyTurnChoice(chatId, category, value) {
|
|
145339
145593
|
try {
|
|
145340
|
-
const state = agentSessionService.getSessionState(chatId);
|
|
145594
|
+
const state = agentSessionService.getSessionState(chatId, { resolveDefaults: false });
|
|
145341
145595
|
const option = findOption(state.configOptions, category);
|
|
145342
145596
|
const configId = option?.id ?? (category === "model" ? "__legacy_model" : "__legacy_mode");
|
|
145343
145597
|
await agentSessionService.setConfigOption(chatId, configId, value);
|
|
@@ -147464,7 +147718,7 @@ var PanelFocusService = class {
|
|
|
147464
147718
|
var panelFocusService = new PanelFocusService();
|
|
147465
147719
|
|
|
147466
147720
|
// src/server/services/workspace-service.ts
|
|
147467
|
-
var execFileAsync2 = promisify2(
|
|
147721
|
+
var execFileAsync2 = promisify2(execFile7);
|
|
147468
147722
|
var TEARDOWN_TIMEOUT_MS = 6e4;
|
|
147469
147723
|
var log26 = createLogger("workspace-service");
|
|
147470
147724
|
var workspaceVia = external_exports2.enum(["chat", "terminal"]);
|
|
@@ -147656,8 +147910,8 @@ var WorkspaceService = class {
|
|
|
147656
147910
|
return { ok: true, path: existing.path };
|
|
147657
147911
|
}
|
|
147658
147912
|
const wtDir = worktreesDir();
|
|
147659
|
-
const worktreePath =
|
|
147660
|
-
mkdirSync5(
|
|
147913
|
+
const worktreePath = join24(wtDir, input.project, input.branch);
|
|
147914
|
+
mkdirSync5(join24(wtDir, input.project), { recursive: true });
|
|
147661
147915
|
const { command, env } = gitCmd();
|
|
147662
147916
|
const args = ["worktree", "add"];
|
|
147663
147917
|
if (input.base) {
|
|
@@ -147867,7 +148121,7 @@ var WorkspaceService = class {
|
|
|
147867
148121
|
saveState(state);
|
|
147868
148122
|
removal.commit();
|
|
147869
148123
|
try {
|
|
147870
|
-
unlinkSync3(
|
|
148124
|
+
unlinkSync3(join24(bandHome(), "workspace-prompts", `${workspaceId2}.json`));
|
|
147871
148125
|
} catch {
|
|
147872
148126
|
}
|
|
147873
148127
|
deleteWorkspaceStatus(workspaceId2);
|
|
@@ -148216,7 +148470,7 @@ var WorkspaceService = class {
|
|
|
148216
148470
|
if (!/^[a-zA-Z0-9._-]+$/.test(input.scriptType) || input.scriptType.includes("..")) {
|
|
148217
148471
|
throw new Error(`Invalid script type "${input.scriptType}"`);
|
|
148218
148472
|
}
|
|
148219
|
-
const scriptPath =
|
|
148473
|
+
const scriptPath = join24(input.path, ".band", input.scriptType);
|
|
148220
148474
|
if (!existsSync10(scriptPath)) {
|
|
148221
148475
|
throw new Error(`Script "${input.scriptType}" not found`);
|
|
148222
148476
|
}
|
|
@@ -149310,13 +149564,16 @@ var settings = new SettingsQueries();
|
|
|
149310
149564
|
var RUNTIMES_KEY = Symbol.for("band.acp.runtimes");
|
|
149311
149565
|
var LISTENERS_KEY2 = Symbol.for("band.acp.listeners");
|
|
149312
149566
|
var CATALOG_KEY = Symbol.for("band.acp.catalog");
|
|
149567
|
+
var DEFAULTS_CHANGED_KEY = Symbol.for("band.acp.defaultsChangedAt");
|
|
149313
149568
|
var g5 = globalThis;
|
|
149314
149569
|
g5[RUNTIMES_KEY] ??= /* @__PURE__ */ new Map();
|
|
149315
149570
|
g5[LISTENERS_KEY2] ??= /* @__PURE__ */ new Map();
|
|
149316
149571
|
g5[CATALOG_KEY] ??= /* @__PURE__ */ new Map();
|
|
149572
|
+
g5[DEFAULTS_CHANGED_KEY] ??= /* @__PURE__ */ new Map();
|
|
149317
149573
|
var runtimes = g5[RUNTIMES_KEY];
|
|
149318
149574
|
var listeners2 = g5[LISTENERS_KEY2];
|
|
149319
149575
|
var catalog = g5[CATALOG_KEY];
|
|
149576
|
+
var defaultsChangedAt = g5[DEFAULTS_CHANGED_KEY];
|
|
149320
149577
|
var transientId = -1e9;
|
|
149321
149578
|
var pendingObserver = null;
|
|
149322
149579
|
function emptyLive() {
|
|
@@ -149379,7 +149636,8 @@ function runtimeFor(chat, def2) {
|
|
|
149379
149636
|
turnSeq: 0,
|
|
149380
149637
|
live: emptyLive(),
|
|
149381
149638
|
pending: /* @__PURE__ */ new Map(),
|
|
149382
|
-
idleTimer: null
|
|
149639
|
+
idleTimer: null,
|
|
149640
|
+
claudeCli: null
|
|
149383
149641
|
};
|
|
149384
149642
|
runtimes.set(chat.id, rt);
|
|
149385
149643
|
}
|
|
@@ -149432,10 +149690,49 @@ function remember(def2, patch) {
|
|
|
149432
149690
|
models: prev?.models ?? null,
|
|
149433
149691
|
commands: prev?.commands ?? [],
|
|
149434
149692
|
canList: prev?.canList ?? false,
|
|
149693
|
+
learnedDefaults: prev?.learnedDefaults,
|
|
149435
149694
|
...patch,
|
|
149436
149695
|
updatedAt: Date.now()
|
|
149437
149696
|
});
|
|
149438
149697
|
}
|
|
149698
|
+
function findEffortOption(options2) {
|
|
149699
|
+
return options2.find(
|
|
149700
|
+
(o) => o.type === "select" && (o.category === "thought_level" || o.id === "effort")
|
|
149701
|
+
);
|
|
149702
|
+
}
|
|
149703
|
+
function claudeDefaults(chatId, chat, def2, configOptions, learn = false) {
|
|
149704
|
+
if (def2.type !== "claude-code") return void 0;
|
|
149705
|
+
const cwd = chat ? workspaceService.resolve(chat.workspaceId)?.worktree.path : void 0;
|
|
149706
|
+
const configured = configuredClaudeDefaults({
|
|
149707
|
+
cwd,
|
|
149708
|
+
env: process.env,
|
|
149709
|
+
cli: runtimes.get(chatId)?.claudeCli ?? void 0
|
|
149710
|
+
});
|
|
149711
|
+
const reported = cwd && chat?.activeSessionId ? reportedClaudeDefaults({
|
|
149712
|
+
cwd,
|
|
149713
|
+
env: process.env,
|
|
149714
|
+
sessionId: chat.activeSessionId,
|
|
149715
|
+
since: defaultsChangedAt.get(chatId)
|
|
149716
|
+
}) : {};
|
|
149717
|
+
const modelOption = findOption(configOptions, "model");
|
|
149718
|
+
const modelChoice = modelOption?.type === "select" ? String(modelOption.currentValue) : void 0;
|
|
149719
|
+
const effortOption = findEffortOption(configOptions);
|
|
149720
|
+
const model = modelChoice === "default" ? reported.model : void 0;
|
|
149721
|
+
const effort = effortOption?.type === "select" && effortOption.currentValue === "default" ? reported.effort : void 0;
|
|
149722
|
+
const entry = catalog.get(def2.id);
|
|
149723
|
+
if (learn && entry && (model && !configured.model || effort && !configured.effort)) {
|
|
149724
|
+
const learned2 = entry.learnedDefaults ?? { effort: {} };
|
|
149725
|
+
entry.learnedDefaults = {
|
|
149726
|
+
model: !configured.model && model || learned2.model,
|
|
149727
|
+
effort: effort && !configured.effort && modelChoice ? { ...learned2.effort, [modelChoice]: effort } : learned2.effort
|
|
149728
|
+
};
|
|
149729
|
+
}
|
|
149730
|
+
const learned = entry?.learnedDefaults;
|
|
149731
|
+
return {
|
|
149732
|
+
model: model ?? configured.model ?? learned?.model,
|
|
149733
|
+
effort: effort ?? configured.effort ?? (modelChoice ? learned?.effort[modelChoice] : void 0)
|
|
149734
|
+
};
|
|
149735
|
+
}
|
|
149439
149736
|
function applyLive(rt, update) {
|
|
149440
149737
|
const def2 = { id: rt.agentDefId };
|
|
149441
149738
|
switch (update.sessionUpdate) {
|
|
@@ -149651,8 +149948,8 @@ async function attachNew(rt, proc, chat, def2, cwd) {
|
|
|
149651
149948
|
let attached;
|
|
149652
149949
|
try {
|
|
149653
149950
|
attached = await proc.newSession(cwd, [
|
|
149654
|
-
|
|
149655
|
-
|
|
149951
|
+
join25(bandHome(), "uploads"),
|
|
149952
|
+
join25(bandHome(), "shared")
|
|
149656
149953
|
]);
|
|
149657
149954
|
} catch (err) {
|
|
149658
149955
|
rt.routing = "log";
|
|
@@ -149782,12 +150079,17 @@ var AgentSessionService = class {
|
|
|
149782
150079
|
const rt = runtimeFor(chat, def2);
|
|
149783
150080
|
while (rt.attaching) await rt.attaching.catch(() => void 0);
|
|
149784
150081
|
const fresh = chatService.get(chatId) ?? chat;
|
|
150082
|
+
const attachedBefore = rt.sessionId;
|
|
149785
150083
|
rt.attaching = attach(rt, fresh, def2, workspace.worktree.path, purpose);
|
|
149786
150084
|
try {
|
|
149787
150085
|
await rt.attaching;
|
|
149788
150086
|
} finally {
|
|
149789
150087
|
rt.attaching = null;
|
|
149790
150088
|
}
|
|
150089
|
+
if (def2.type === "claude-code" && rt.sessionId && rt.sessionId !== attachedBefore) {
|
|
150090
|
+
rt.claudeCli = null;
|
|
150091
|
+
void this.readClaudeCli(rt).catch((err) => log31.debug({ chatId, err }, "no CLI flags"));
|
|
150092
|
+
}
|
|
149791
150093
|
if (!rt.inTurn && rt.process) scheduleIdle(rt);
|
|
149792
150094
|
return rt.sessionId;
|
|
149793
150095
|
}
|
|
@@ -149823,8 +150125,35 @@ var AgentSessionService = class {
|
|
|
149823
150125
|
} finally {
|
|
149824
150126
|
rt.inTurn = false;
|
|
149825
150127
|
if (rt.process) scheduleIdle(rt);
|
|
150128
|
+
try {
|
|
150129
|
+
this.pushClaudeDefaults(chatId, true);
|
|
150130
|
+
} catch (err) {
|
|
150131
|
+
log31.debug({ chatId, err }, "could not push Claude defaults");
|
|
150132
|
+
}
|
|
149826
150133
|
}
|
|
149827
150134
|
}
|
|
150135
|
+
/** Sends a Claude Code chat's session state again once the turn wrote what
|
|
150136
|
+
* its `default` choices ran with, or the CLI's flags are known. */
|
|
150137
|
+
pushClaudeDefaults(chatId, learn) {
|
|
150138
|
+
const chat = chatService.get(chatId);
|
|
150139
|
+
if (!chat) return;
|
|
150140
|
+
const def2 = definitionFor(chat);
|
|
150141
|
+
if (def2.type !== "claude-code") return;
|
|
150142
|
+
const state = this.getSessionState(chatId, { resolveDefaults: false });
|
|
150143
|
+
const resolvedDefaults = claudeDefaults(chatId, chat, def2, state.configOptions, learn);
|
|
150144
|
+
broadcastTransient(chatId, { type: "session-state", state: { ...state, resolvedDefaults } });
|
|
150145
|
+
}
|
|
150146
|
+
/** Reads the Claude Code CLI's command line once per attached session, for
|
|
150147
|
+
* a `--settings` file or flags a wrapper script added. */
|
|
150148
|
+
async readClaudeCli(rt) {
|
|
150149
|
+
const pid = rt.process?.pid;
|
|
150150
|
+
const sessionId = rt.sessionId;
|
|
150151
|
+
if (!pid || !sessionId) return;
|
|
150152
|
+
const args = await findClaudeCliArgs(pid, sessionId);
|
|
150153
|
+
if (!args || rt.sessionId !== sessionId) return;
|
|
150154
|
+
rt.claudeCli = args;
|
|
150155
|
+
this.pushClaudeDefaults(rt.chatId, false);
|
|
150156
|
+
}
|
|
149828
150157
|
/**
|
|
149829
150158
|
* Stops the chat's current turn. ACP requires open permission requests to
|
|
149830
150159
|
* be answered `cancelled` first. If the agent doesn't stop in time, its
|
|
@@ -149907,10 +150236,14 @@ var AgentSessionService = class {
|
|
|
149907
150236
|
async setConfigOption(chatId, configId, value, workspaceId2) {
|
|
149908
150237
|
const chat = chatService.get(chatId) ?? (workspaceId2 ? chatService.create(workspaceId2, { id: chatId, name: "Chat" }) : void 0);
|
|
149909
150238
|
if (!chat) throw new ChatNotFoundError(chatId);
|
|
149910
|
-
const option = this.getSessionState(chatId).configOptions.find(
|
|
150239
|
+
const option = this.getSessionState(chatId, { resolveDefaults: false }).configOptions.find(
|
|
150240
|
+
(o) => o.id === configId
|
|
150241
|
+
);
|
|
149911
150242
|
const category = option?.category === "model" || configId === "model" ? "model" : option?.category === "mode" || configId === "mode" ? "mode" : configId === "__legacy_model" ? "model" : configId === "__legacy_mode" ? "mode" : void 0;
|
|
149912
150243
|
if (category === "model") chatService.update(chatId, { model: value });
|
|
149913
150244
|
if (category === "mode") chatService.update(chatId, { mode: value });
|
|
150245
|
+
const isEffort = option?.category === "thought_level" || configId === "effort";
|
|
150246
|
+
if (category === "model" || isEffort) defaultsChangedAt.set(chatId, Date.now());
|
|
149914
150247
|
const live = runtimes.get(chatId);
|
|
149915
150248
|
const attached = live?.process?.alive && live.sessionId && live.sessionId === chat.activeSessionId;
|
|
149916
150249
|
if (!attached && category !== "mode") {
|
|
@@ -149953,18 +150286,26 @@ var AgentSessionService = class {
|
|
|
149953
150286
|
* chat's session, else rebuilt from the log, else the agent catalog with
|
|
149954
150287
|
* the chat's saved choices applied. A chat the server has no row for yet
|
|
149955
150288
|
* (a new pane, created lazily on its first message) gets the default
|
|
149956
|
-
* agent's catalog entry.
|
|
149957
|
-
|
|
149958
|
-
|
|
149959
|
-
|
|
149960
|
-
|
|
149961
|
-
|
|
150289
|
+
* agent's catalog entry. Claude Code chats also get what their `default`
|
|
150290
|
+
* choices resolve to, which reads Claude's settings files and transcript;
|
|
150291
|
+
* callers that only need the options or the cost pass
|
|
150292
|
+
* `resolveDefaults: false`.
|
|
150293
|
+
*/
|
|
150294
|
+
getSessionState(chatId, opts = {}) {
|
|
150295
|
+
const saved = chatService.get(chatId);
|
|
150296
|
+
const chat = saved ?? {
|
|
149962
150297
|
agent: void 0,
|
|
149963
150298
|
activeSessionId: void 0,
|
|
149964
150299
|
model: void 0,
|
|
149965
150300
|
mode: void 0
|
|
149966
150301
|
};
|
|
149967
150302
|
const def2 = definitionFor(chat);
|
|
150303
|
+
const state = this.baseSessionState(chatId, chat, def2);
|
|
150304
|
+
if (opts.resolveDefaults === false) return state;
|
|
150305
|
+
const resolvedDefaults = claudeDefaults(chatId, saved, def2, state.configOptions);
|
|
150306
|
+
return resolvedDefaults ? { ...state, resolvedDefaults } : state;
|
|
150307
|
+
}
|
|
150308
|
+
baseSessionState(chatId, chat, def2) {
|
|
149968
150309
|
const rt = runtimes.get(chatId);
|
|
149969
150310
|
const sessionId = chat.activeSessionId;
|
|
149970
150311
|
if (rt?.process?.alive && rt.sessionId && rt.sessionId === sessionId) {
|
|
@@ -150081,6 +150422,7 @@ var AgentSessionService = class {
|
|
|
150081
150422
|
}
|
|
150082
150423
|
/** Stops the chat's agent. Used when the chat is removed or switches agent. */
|
|
150083
150424
|
stop(chatId) {
|
|
150425
|
+
defaultsChangedAt.delete(chatId);
|
|
150084
150426
|
const rt = runtimes.get(chatId);
|
|
150085
150427
|
if (rt) stopRuntime(rt);
|
|
150086
150428
|
}
|
|
@@ -150385,14 +150727,14 @@ async function handleChatHistory(req, res, chatId) {
|
|
|
150385
150727
|
}
|
|
150386
150728
|
|
|
150387
150729
|
// src/server/services/_utils/session-id.ts
|
|
150388
|
-
var
|
|
150389
|
-
var sessionIdSchema = external_exports2.string().regex(
|
|
150730
|
+
var SESSION_ID_PATTERN3 = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,511}$/;
|
|
150731
|
+
var sessionIdSchema = external_exports2.string().regex(SESSION_ID_PATTERN3, "invalid session id");
|
|
150390
150732
|
|
|
150391
150733
|
// src/server/services/_utils/upload-utils.ts
|
|
150392
150734
|
import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
150393
|
-
import { join as
|
|
150735
|
+
import { join as join26 } from "node:path";
|
|
150394
150736
|
async function saveUploadedFilesDetailed(fileParts) {
|
|
150395
|
-
const uploadDir =
|
|
150737
|
+
const uploadDir = join26(bandHome(), "uploads");
|
|
150396
150738
|
await mkdir3(uploadDir, { recursive: true });
|
|
150397
150739
|
const baseTimestamp = Date.now();
|
|
150398
150740
|
const saved = [];
|
|
@@ -150404,7 +150746,7 @@ async function saveUploadedFilesDetailed(fileParts) {
|
|
|
150404
150746
|
const filename = part.filename || `file-${baseTimestamp}`;
|
|
150405
150747
|
const safeOriginal = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
150406
150748
|
const storedName = `${baseTimestamp}-${i}-${safeOriginal}`;
|
|
150407
|
-
const filePath =
|
|
150749
|
+
const filePath = join26(uploadDir, storedName);
|
|
150408
150750
|
await writeFile3(filePath, buffer);
|
|
150409
150751
|
saved.push({
|
|
150410
150752
|
path: filePath,
|
|
@@ -150443,7 +150785,7 @@ async function handleChatSubmit(req, res, chatId) {
|
|
|
150443
150785
|
sendJson2(res, 400, { error: "workspaceId and text are required" });
|
|
150444
150786
|
return;
|
|
150445
150787
|
}
|
|
150446
|
-
if (sessionId !== void 0 && !
|
|
150788
|
+
if (sessionId !== void 0 && !SESSION_ID_PATTERN3.test(sessionId)) {
|
|
150447
150789
|
sendJson2(res, 400, { error: "invalid sessionId" });
|
|
150448
150790
|
return;
|
|
150449
150791
|
}
|
|
@@ -158307,26 +158649,26 @@ var chatsRouter = t3.router({
|
|
|
158307
158649
|
});
|
|
158308
158650
|
|
|
158309
158651
|
// src/server/services/cli-service.ts
|
|
158310
|
-
import { execFile as
|
|
158652
|
+
import { execFile as execFile8 } from "node:child_process";
|
|
158311
158653
|
import {
|
|
158312
158654
|
accessSync as accessSync2,
|
|
158313
158655
|
constants as constants2,
|
|
158314
158656
|
existsSync as existsSync11,
|
|
158315
158657
|
lstatSync as lstatSync3,
|
|
158316
158658
|
mkdirSync as mkdirSync6,
|
|
158317
|
-
readFileSync as
|
|
158318
|
-
realpathSync as
|
|
158659
|
+
readFileSync as readFileSync8,
|
|
158660
|
+
realpathSync as realpathSync3,
|
|
158319
158661
|
symlinkSync,
|
|
158320
158662
|
unlinkSync as unlinkSync4,
|
|
158321
158663
|
writeFileSync as writeFileSync3
|
|
158322
158664
|
} from "node:fs";
|
|
158323
|
-
import { homedir as
|
|
158324
|
-
import { basename as basename2, dirname as dirname7, join as
|
|
158665
|
+
import { homedir as homedir8, platform as platform2 } from "node:os";
|
|
158666
|
+
import { basename as basename2, dirname as dirname7, join as join27, resolve as resolve5 } from "node:path";
|
|
158325
158667
|
function windowsBinDir() {
|
|
158326
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
158327
|
-
return
|
|
158668
|
+
const localAppData = process.env.LOCALAPPDATA || join27(homedir8(), "AppData", "Local");
|
|
158669
|
+
return join27(localAppData, "band", "bin");
|
|
158328
158670
|
}
|
|
158329
|
-
var SYMLINK_PATH = platform2() === "win32" ?
|
|
158671
|
+
var SYMLINK_PATH = platform2() === "win32" ? join27(windowsBinDir(), "band.cmd") : "/usr/local/bin/band";
|
|
158330
158672
|
function findCliBinaryAt(opts) {
|
|
158331
158673
|
const { cwd, dirname: dirname11 } = opts;
|
|
158332
158674
|
const exe = platform2() === "win32" ? "band.exe" : "band";
|
|
@@ -158348,7 +158690,7 @@ function findCliBinaryAt(opts) {
|
|
|
158348
158690
|
];
|
|
158349
158691
|
for (const appsDir of appsStrategies) {
|
|
158350
158692
|
for (const profile of ["release", "debug"]) {
|
|
158351
|
-
const p3 =
|
|
158693
|
+
const p3 = join27(appsDir, "cli", "target", profile, exe);
|
|
158352
158694
|
try {
|
|
158353
158695
|
lstatSync3(p3);
|
|
158354
158696
|
return p3;
|
|
@@ -158378,7 +158720,7 @@ function findCliBinary() {
|
|
|
158378
158720
|
function checkCliWindows() {
|
|
158379
158721
|
let contents;
|
|
158380
158722
|
try {
|
|
158381
|
-
contents =
|
|
158723
|
+
contents = readFileSync8(SYMLINK_PATH, "utf-8");
|
|
158382
158724
|
} catch (err) {
|
|
158383
158725
|
const code = err.code;
|
|
158384
158726
|
if (code === "EACCES") return "NotWritable";
|
|
@@ -158401,12 +158743,12 @@ async function checkCli() {
|
|
|
158401
158743
|
}
|
|
158402
158744
|
let target;
|
|
158403
158745
|
try {
|
|
158404
|
-
target =
|
|
158746
|
+
target = realpathSync3(SYMLINK_PATH);
|
|
158405
158747
|
} catch {
|
|
158406
158748
|
return "NotInstalled";
|
|
158407
158749
|
}
|
|
158408
|
-
const isCargoBuild = target.includes(
|
|
158409
|
-
const isElectronSidecar = target.endsWith(
|
|
158750
|
+
const isCargoBuild = target.includes(join27("apps", "cli", "target"));
|
|
158751
|
+
const isElectronSidecar = target.endsWith(join27("binaries", "band"));
|
|
158410
158752
|
if (isCargoBuild || isElectronSidecar) {
|
|
158411
158753
|
return "Installed";
|
|
158412
158754
|
}
|
|
@@ -158449,7 +158791,7 @@ function noBinaryError(env = process.env) {
|
|
|
158449
158791
|
}
|
|
158450
158792
|
function runReg(args) {
|
|
158451
158793
|
return new Promise((resolve12) => {
|
|
158452
|
-
|
|
158794
|
+
execFile8("reg", args, { windowsHide: true }, (err, stdout) => {
|
|
158453
158795
|
resolve12(err ? "" : stdout ?? "");
|
|
158454
158796
|
});
|
|
158455
158797
|
});
|
|
@@ -158642,7 +158984,7 @@ init_dist38();
|
|
|
158642
158984
|
|
|
158643
158985
|
// src/server/services/editor-service.ts
|
|
158644
158986
|
import { realpath as realpath2, stat as stat4 } from "node:fs/promises";
|
|
158645
|
-
import { isAbsolute as isAbsolute4, join as
|
|
158987
|
+
import { isAbsolute as isAbsolute4, join as join29, resolve as resolve6, sep as sep4 } from "node:path";
|
|
158646
158988
|
|
|
158647
158989
|
// src/server/services/file-watcher.ts
|
|
158648
158990
|
import { watch as fsWatch } from "node:fs";
|
|
@@ -158737,8 +159079,8 @@ function subscribeToFileChanges(workspaceId2, listener) {
|
|
|
158737
159079
|
}
|
|
158738
159080
|
|
|
158739
159081
|
// src/server/services/formatter.ts
|
|
158740
|
-
import { existsSync as existsSync12, realpathSync as
|
|
158741
|
-
import { basename as basename3, dirname as dirname8, isAbsolute as isAbsolute3, join as
|
|
159082
|
+
import { existsSync as existsSync12, realpathSync as realpathSync4 } from "node:fs";
|
|
159083
|
+
import { basename as basename3, dirname as dirname8, isAbsolute as isAbsolute3, join as join28, resolve as resolvePath3 } from "node:path";
|
|
158742
159084
|
import prettier from "prettier";
|
|
158743
159085
|
var log37 = createLogger("formatter");
|
|
158744
159086
|
var FormatterError = class extends Error {
|
|
@@ -158752,7 +159094,7 @@ var FormatterError = class extends Error {
|
|
|
158752
159094
|
}
|
|
158753
159095
|
};
|
|
158754
159096
|
async function formatFile(worktreePath, filePath, content2, options2 = {}) {
|
|
158755
|
-
const absFile = isAbsolute3(filePath) ? filePath :
|
|
159097
|
+
const absFile = isAbsolute3(filePath) ? filePath : resolvePath3(worktreePath, filePath);
|
|
158756
159098
|
if (!isInsideWorktree(absFile, worktreePath)) {
|
|
158757
159099
|
throw new FormatterError(
|
|
158758
159100
|
"FILE_NOT_IN_WORKTREE",
|
|
@@ -158761,7 +159103,7 @@ async function formatFile(worktreePath, filePath, content2, options2 = {}) {
|
|
|
158761
159103
|
}
|
|
158762
159104
|
const start = Date.now();
|
|
158763
159105
|
prettier.clearConfigCache();
|
|
158764
|
-
const ignorePath =
|
|
159106
|
+
const ignorePath = resolvePath3(worktreePath, ".prettierignore");
|
|
158765
159107
|
const info = await prettier.getFileInfo(absFile, {
|
|
158766
159108
|
resolveConfig: true,
|
|
158767
159109
|
ignorePath: existsSync12(ignorePath) ? ignorePath : void 0
|
|
@@ -158814,17 +159156,17 @@ async function formatFile(worktreePath, filePath, content2, options2 = {}) {
|
|
|
158814
159156
|
function isInsideWorktree(absFile, worktreePath) {
|
|
158815
159157
|
let realFile;
|
|
158816
159158
|
try {
|
|
158817
|
-
realFile =
|
|
159159
|
+
realFile = realpathSync4(absFile);
|
|
158818
159160
|
} catch {
|
|
158819
159161
|
try {
|
|
158820
|
-
realFile =
|
|
159162
|
+
realFile = join28(realpathSync4(dirname8(absFile)), basename3(absFile));
|
|
158821
159163
|
} catch {
|
|
158822
159164
|
realFile = absFile;
|
|
158823
159165
|
}
|
|
158824
159166
|
}
|
|
158825
159167
|
let realWorktree;
|
|
158826
159168
|
try {
|
|
158827
|
-
realWorktree =
|
|
159169
|
+
realWorktree = realpathSync4(worktreePath);
|
|
158828
159170
|
} catch {
|
|
158829
159171
|
realWorktree = worktreePath;
|
|
158830
159172
|
}
|
|
@@ -158993,7 +159335,7 @@ async function canonicalizeMaybeMissing(p3) {
|
|
|
158993
159335
|
const prefix = parts.slice(0, i).join(sep4) || sep4;
|
|
158994
159336
|
try {
|
|
158995
159337
|
const canonicalPrefix = await realpath2(prefix);
|
|
158996
|
-
return
|
|
159338
|
+
return join29(canonicalPrefix, ...parts.slice(i));
|
|
158997
159339
|
} catch {
|
|
158998
159340
|
}
|
|
158999
159341
|
}
|
|
@@ -159358,14 +159700,14 @@ var historyRouter = t3.router({
|
|
|
159358
159700
|
});
|
|
159359
159701
|
|
|
159360
159702
|
// src/server/services/hooks-service.ts
|
|
159361
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
159362
|
-
import { homedir as
|
|
159363
|
-
import { dirname as dirname9, join as
|
|
159703
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
|
|
159704
|
+
import { homedir as homedir9 } from "node:os";
|
|
159705
|
+
import { dirname as dirname9, join as join31 } from "node:path";
|
|
159364
159706
|
|
|
159365
159707
|
// src/server/infra/process/du.ts
|
|
159366
|
-
import { execFile as
|
|
159708
|
+
import { execFile as execFile9 } from "node:child_process";
|
|
159367
159709
|
import { readdir as readdir3, stat as stat5 } from "node:fs/promises";
|
|
159368
|
-
import { join as
|
|
159710
|
+
import { join as join30 } from "node:path";
|
|
159369
159711
|
var MAX_DU_BUFFER = 10 * 1024 * 1024;
|
|
159370
159712
|
var DU_TIMEOUT_MS = 3e4;
|
|
159371
159713
|
var STAT_CHUNK = 256;
|
|
@@ -159381,9 +159723,9 @@ async function duBytesNodeWalk(path) {
|
|
|
159381
159723
|
const filePaths = [];
|
|
159382
159724
|
for (const entry of entries) {
|
|
159383
159725
|
if (entry.isDirectory()) {
|
|
159384
|
-
stack.push(
|
|
159726
|
+
stack.push(join30(dir, entry.name));
|
|
159385
159727
|
} else if (entry.isFile()) {
|
|
159386
|
-
filePaths.push(
|
|
159728
|
+
filePaths.push(join30(dir, entry.name));
|
|
159387
159729
|
}
|
|
159388
159730
|
}
|
|
159389
159731
|
for (let i = 0; i < filePaths.length; i += STAT_CHUNK) {
|
|
@@ -159409,7 +159751,7 @@ async function duBytes(path) {
|
|
|
159409
159751
|
return duBytesNodeWalk(path);
|
|
159410
159752
|
}
|
|
159411
159753
|
const stdout = await new Promise((resolve12, reject) => {
|
|
159412
|
-
|
|
159754
|
+
execFile9(
|
|
159413
159755
|
"du",
|
|
159414
159756
|
["-sk", path],
|
|
159415
159757
|
{ maxBuffer: MAX_DU_BUFFER, timeout: DU_TIMEOUT_MS },
|
|
@@ -159431,10 +159773,10 @@ async function duBytes(path) {
|
|
|
159431
159773
|
}
|
|
159432
159774
|
|
|
159433
159775
|
// src/server/infra/process/install.ts
|
|
159434
|
-
import { execFile as
|
|
159776
|
+
import { execFile as execFile10 } from "node:child_process";
|
|
159435
159777
|
async function brewInstall(pkg, resolvedPath) {
|
|
159436
159778
|
await new Promise((resolve12, reject) => {
|
|
159437
|
-
|
|
159779
|
+
execFile10(
|
|
159438
159780
|
"brew",
|
|
159439
159781
|
["install", pkg],
|
|
159440
159782
|
{ env: { ...process.env, PATH: resolvedPath }, timeout: 12e4 },
|
|
@@ -159541,11 +159883,11 @@ var HOOK_EVENTS = [
|
|
|
159541
159883
|
"SessionEnd"
|
|
159542
159884
|
];
|
|
159543
159885
|
function claudeSettingsPath() {
|
|
159544
|
-
return
|
|
159886
|
+
return join31(homedir9(), ".claude", "settings.json");
|
|
159545
159887
|
}
|
|
159546
159888
|
function loadClaudeSettings() {
|
|
159547
159889
|
try {
|
|
159548
|
-
const data2 =
|
|
159890
|
+
const data2 = readFileSync9(claudeSettingsPath(), "utf-8");
|
|
159549
159891
|
return JSON.parse(data2);
|
|
159550
159892
|
} catch {
|
|
159551
159893
|
return {};
|
|
@@ -159965,11 +160307,11 @@ var prereqsRouter = t3.router({
|
|
|
159965
160307
|
// src/server/services/project-service.ts
|
|
159966
160308
|
init_dist38();
|
|
159967
160309
|
import { existsSync as existsSync13 } from "node:fs";
|
|
159968
|
-
import { basename as basename4, join as
|
|
160310
|
+
import { basename as basename4, join as join33, resolve as resolve7 } from "node:path";
|
|
159969
160311
|
|
|
159970
160312
|
// src/server/services/project-avatar-service.ts
|
|
159971
160313
|
import { mkdir as mkdir4, readFile as readFile5, rename as rename2, writeFile as writeFile4 } from "node:fs/promises";
|
|
159972
|
-
import { join as
|
|
160314
|
+
import { join as join32 } from "node:path";
|
|
159973
160315
|
|
|
159974
160316
|
// src/server/infra/github/github-client.ts
|
|
159975
160317
|
var FETCH_TIMEOUT_MS = 1e4;
|
|
@@ -160119,7 +160461,7 @@ var ProjectAvatarService = class {
|
|
|
160119
160461
|
return null;
|
|
160120
160462
|
}
|
|
160121
160463
|
await mkdir4(cacheDir(), { recursive: true });
|
|
160122
|
-
const imagePath =
|
|
160464
|
+
const imagePath = join32(cacheDir(), `${key2}.img`);
|
|
160123
160465
|
await writeFile4(`${imagePath}.tmp`, result.bytes);
|
|
160124
160466
|
await rename2(`${imagePath}.tmp`, imagePath);
|
|
160125
160467
|
await this.writeMeta(key2, entry, {
|
|
@@ -160137,7 +160479,7 @@ var ProjectAvatarService = class {
|
|
|
160137
160479
|
async readCached(key2, meta2) {
|
|
160138
160480
|
if (meta2?.status !== "ok" || !meta2.contentType) return null;
|
|
160139
160481
|
try {
|
|
160140
|
-
const bytes = await readFile5(
|
|
160482
|
+
const bytes = await readFile5(join32(cacheDir(), `${key2}.img`));
|
|
160141
160483
|
return { bytes, contentType: meta2.contentType };
|
|
160142
160484
|
} catch {
|
|
160143
160485
|
return null;
|
|
@@ -160147,7 +160489,7 @@ var ProjectAvatarService = class {
|
|
|
160147
160489
|
entry.meta = meta2;
|
|
160148
160490
|
entry.retryAfter = 0;
|
|
160149
160491
|
await mkdir4(cacheDir(), { recursive: true });
|
|
160150
|
-
await writeFile4(
|
|
160492
|
+
await writeFile4(join32(cacheDir(), `${key2}.json`), JSON.stringify(meta2));
|
|
160151
160493
|
}
|
|
160152
160494
|
/** In-memory view of one owner's cache sidecar, loaded from disk once. */
|
|
160153
160495
|
async entry(ref) {
|
|
@@ -160156,7 +160498,7 @@ var ProjectAvatarService = class {
|
|
|
160156
160498
|
if (entry) return entry;
|
|
160157
160499
|
let meta2 = null;
|
|
160158
160500
|
try {
|
|
160159
|
-
meta2 = JSON.parse(await readFile5(
|
|
160501
|
+
meta2 = JSON.parse(await readFile5(join32(cacheDir(), `${key2}.json`), "utf-8"));
|
|
160160
160502
|
} catch {
|
|
160161
160503
|
}
|
|
160162
160504
|
entry = this.entries.get(key2) ?? { meta: meta2, retryAfter: 0 };
|
|
@@ -160175,7 +160517,7 @@ var ProjectAvatarService = class {
|
|
|
160175
160517
|
}
|
|
160176
160518
|
};
|
|
160177
160519
|
function cacheDir() {
|
|
160178
|
-
return
|
|
160520
|
+
return join32(bandHome(), "cache", "github-avatars");
|
|
160179
160521
|
}
|
|
160180
160522
|
function cacheKey2(ref) {
|
|
160181
160523
|
return `${ref.host.replace(/[^a-z0-9.-]/g, "_")}__${ref.owner.toLowerCase()}`;
|
|
@@ -160265,7 +160607,7 @@ var ProjectService = class {
|
|
|
160265
160607
|
*/
|
|
160266
160608
|
checkPath(path) {
|
|
160267
160609
|
const resolvedPath = resolve7(path);
|
|
160268
|
-
const isGitRepo = existsSync13(
|
|
160610
|
+
const isGitRepo = existsSync13(join33(resolvedPath, ".git"));
|
|
160269
160611
|
return { isGitRepo };
|
|
160270
160612
|
}
|
|
160271
160613
|
/**
|
|
@@ -160301,7 +160643,7 @@ var ProjectService = class {
|
|
|
160301
160643
|
}
|
|
160302
160644
|
}
|
|
160303
160645
|
const resolvedPath = resolve7(path);
|
|
160304
|
-
const kind = existsSync13(
|
|
160646
|
+
const kind = existsSync13(join33(resolvedPath, ".git")) ? "git" : "plain";
|
|
160305
160647
|
let defaultBranch = "main";
|
|
160306
160648
|
let worktrees2 = [];
|
|
160307
160649
|
if (kind === "git") {
|
|
@@ -160480,8 +160822,8 @@ var projectsRouter = t3.router({
|
|
|
160480
160822
|
});
|
|
160481
160823
|
|
|
160482
160824
|
// src/server/api/queue/router.ts
|
|
160483
|
-
import { realpathSync as
|
|
160484
|
-
import { join as
|
|
160825
|
+
import { realpathSync as realpathSync5 } from "node:fs";
|
|
160826
|
+
import { join as join34, resolve as resolve8, sep as sep5 } from "node:path";
|
|
160485
160827
|
var log40 = createLogger("trpc.queue");
|
|
160486
160828
|
var queuedFileSchema = external_exports2.object({
|
|
160487
160829
|
mediaType: external_exports2.string(),
|
|
@@ -160490,14 +160832,14 @@ var queuedFileSchema = external_exports2.object({
|
|
|
160490
160832
|
filename: external_exports2.string().optional()
|
|
160491
160833
|
});
|
|
160492
160834
|
function isPathWithinUploadDir(p3) {
|
|
160493
|
-
const uploadDir =
|
|
160835
|
+
const uploadDir = join34(bandHome(), "uploads");
|
|
160494
160836
|
const normalized2 = resolve8(p3);
|
|
160495
160837
|
if (normalized2 !== uploadDir && !normalized2.startsWith(uploadDir + sep5)) {
|
|
160496
160838
|
return false;
|
|
160497
160839
|
}
|
|
160498
160840
|
try {
|
|
160499
|
-
const canonicalUploadDir =
|
|
160500
|
-
const canonicalPath =
|
|
160841
|
+
const canonicalUploadDir = realpathSync5(uploadDir);
|
|
160842
|
+
const canonicalPath = realpathSync5(p3);
|
|
160501
160843
|
return canonicalPath === canonicalUploadDir || canonicalPath.startsWith(canonicalUploadDir + sep5);
|
|
160502
160844
|
} catch {
|
|
160503
160845
|
return true;
|
|
@@ -160511,7 +160853,7 @@ async function resolveQueuedFiles(chatId, files) {
|
|
|
160511
160853
|
for (let i = 0; i < files.length; i++) {
|
|
160512
160854
|
const file2 = files[i];
|
|
160513
160855
|
const uploadsUrlMatch = file2.url.match(/^\/api\/uploads\/(.+)$/);
|
|
160514
|
-
const derivedPath = file2.path ?? (uploadsUrlMatch ?
|
|
160856
|
+
const derivedPath = file2.path ?? (uploadsUrlMatch ? join34(bandHome(), "uploads", uploadsUrlMatch[1]) : void 0);
|
|
160515
160857
|
if (derivedPath) {
|
|
160516
160858
|
if (!isPathWithinUploadDir(derivedPath)) {
|
|
160517
160859
|
log40.warn(
|
|
@@ -160747,7 +161089,7 @@ var schedulerState2 = g6[SCHEDULER_KEY2];
|
|
|
160747
161089
|
var USAGE_SCAN_INTERVAL_MS = 5 * 60 * 1e3;
|
|
160748
161090
|
var MAX_SESSIONS_PER_TICK = 100;
|
|
160749
161091
|
var EPOCH_SENTINEL = 0;
|
|
160750
|
-
function
|
|
161092
|
+
function yieldToEventLoop2() {
|
|
160751
161093
|
return new Promise((resolve12) => setImmediate(resolve12));
|
|
160752
161094
|
}
|
|
160753
161095
|
var UsageScannerService = class {
|
|
@@ -160871,7 +161213,7 @@ var UsageScannerService = class {
|
|
|
160871
161213
|
let rowsWritten = 0;
|
|
160872
161214
|
let maxObserved = watermark;
|
|
160873
161215
|
for (const s2 of slice) {
|
|
160874
|
-
await
|
|
161216
|
+
await yieldToEventLoop2();
|
|
160875
161217
|
let snap;
|
|
160876
161218
|
try {
|
|
160877
161219
|
snap = await reader.getSessionUsage(s2.sessionId, ws.worktreePath);
|
|
@@ -161990,7 +162332,7 @@ init_dist38();
|
|
|
161990
162332
|
// src/server/services/diff-service.ts
|
|
161991
162333
|
import { existsSync as existsSync14 } from "node:fs";
|
|
161992
162334
|
import { readFile as readFile6, rm as rm3, stat as stat6 } from "node:fs/promises";
|
|
161993
|
-
import { join as
|
|
162335
|
+
import { join as join35, resolve as resolve9, sep as sep6 } from "node:path";
|
|
161994
162336
|
var log48 = createLogger("diff-service");
|
|
161995
162337
|
var EMPTY_TREE_ARGS = ["hash-object", "-t", "tree", "/dev/null"];
|
|
161996
162338
|
var DEFAULT_BRANCH_LIMIT = 50;
|
|
@@ -162087,7 +162429,7 @@ function parseFileStatuses(nameStatusOutput) {
|
|
|
162087
162429
|
return fileStatuses;
|
|
162088
162430
|
}
|
|
162089
162431
|
function assertWorktreeRelative(cwd, filePath) {
|
|
162090
|
-
const target = resolve9(
|
|
162432
|
+
const target = resolve9(join35(cwd, filePath));
|
|
162091
162433
|
if (target !== cwd && !target.startsWith(cwd + sep6)) {
|
|
162092
162434
|
throw new Error("Invalid path");
|
|
162093
162435
|
}
|
|
@@ -162102,7 +162444,7 @@ function assertWorktreeRelative(cwd, filePath) {
|
|
|
162102
162444
|
}
|
|
162103
162445
|
async function readUntrackedFileLines(cwd, file2) {
|
|
162104
162446
|
try {
|
|
162105
|
-
const content2 = await readFile6(
|
|
162447
|
+
const content2 = await readFile6(join35(cwd, file2), "utf-8");
|
|
162106
162448
|
const lines = content2.split("\n");
|
|
162107
162449
|
if (lines.length > 0 && lines[lines.length - 1] === "") {
|
|
162108
162450
|
lines.pop();
|
|
@@ -162445,7 +162787,7 @@ var DiffService = class {
|
|
|
162445
162787
|
const defaultBranch = workspace.project.defaultBranch;
|
|
162446
162788
|
const compareBranch = options2.compareBranch ?? defaultBranch;
|
|
162447
162789
|
const cwd = workspace.worktree.path;
|
|
162448
|
-
const hasGit = existsSync14(
|
|
162790
|
+
const hasGit = existsSync14(join35(cwd, ".git"));
|
|
162449
162791
|
if (workspace.project.kind === "plain" || !hasGit) {
|
|
162450
162792
|
return {
|
|
162451
162793
|
headBranch: defaultBranch,
|
|
@@ -162477,7 +162819,7 @@ var DiffService = class {
|
|
|
162477
162819
|
applyLineCounts(status.staged, parseNumstat(stagedNumstat));
|
|
162478
162820
|
await Promise.all(
|
|
162479
162821
|
status.untracked.map(async (entry) => {
|
|
162480
|
-
const lines = await countUntrackedLines(
|
|
162822
|
+
const lines = await countUntrackedLines(join35(cwd, entry.path));
|
|
162481
162823
|
if (lines !== null) {
|
|
162482
162824
|
entry.additions = lines;
|
|
162483
162825
|
entry.deletions = 0;
|
|
@@ -162619,7 +162961,7 @@ var diffService = new DiffService();
|
|
|
162619
162961
|
// src/server/services/files-service.ts
|
|
162620
162962
|
import { existsSync as existsSync15 } from "node:fs";
|
|
162621
162963
|
import { cp, mkdir as mkdir5, readdir as readdir4, readFile as readFile7, rename as rename3, rm as rm4, stat as stat7, writeFile as writeFile5 } from "node:fs/promises";
|
|
162622
|
-
import { dirname as dirname10, extname as extname3, join as
|
|
162964
|
+
import { dirname as dirname10, extname as extname3, join as join36, resolve as resolve10, sep as sep7 } from "node:path";
|
|
162623
162965
|
var MAX_FILE_SIZE2 = 1024 * 1024;
|
|
162624
162966
|
var LANG_MAP2 = {
|
|
162625
162967
|
".js": "javascript",
|
|
@@ -162667,7 +163009,7 @@ var FilesService = class {
|
|
|
162667
163009
|
throw new WorkspaceNotFoundError(workspaceId2);
|
|
162668
163010
|
}
|
|
162669
163011
|
const root = workspace.worktree.path;
|
|
162670
|
-
const target = resolve10(
|
|
163012
|
+
const target = resolve10(join36(root, relative2));
|
|
162671
163013
|
const insideRoot = target === root || target.startsWith(root + sep7);
|
|
162672
163014
|
if (!insideRoot) {
|
|
162673
163015
|
throw new Error("Invalid path");
|
|
@@ -163034,7 +163376,7 @@ var GitGraphService = class {
|
|
|
163034
163376
|
var gitGraphService = new GitGraphService();
|
|
163035
163377
|
|
|
163036
163378
|
// src/server/infra/search/ripgrep-client.ts
|
|
163037
|
-
import { execFile as
|
|
163379
|
+
import { execFile as execFile11, spawn as spawn5 } from "node:child_process";
|
|
163038
163380
|
import { rgPath } from "@vscode/ripgrep";
|
|
163039
163381
|
function streamMatches(options2) {
|
|
163040
163382
|
return {
|
|
@@ -163156,7 +163498,7 @@ function listFiles2(cwd) {
|
|
|
163156
163498
|
"!**/.DS_Store"
|
|
163157
163499
|
];
|
|
163158
163500
|
return new Promise((resolve12, reject) => {
|
|
163159
|
-
|
|
163501
|
+
execFile11(
|
|
163160
163502
|
rgPath,
|
|
163161
163503
|
args,
|
|
163162
163504
|
{ cwd, maxBuffer: LIST_FILES_MAX_BUFFER, encoding: "utf-8" },
|
|
@@ -165414,15 +165756,15 @@ async function handleLspConnection(ws, req) {
|
|
|
165414
165756
|
}
|
|
165415
165757
|
|
|
165416
165758
|
// src/server/infra/terminals/create-backend.ts
|
|
165417
|
-
import { existsSync as existsSync16, statSync as
|
|
165418
|
-
import { join as
|
|
165759
|
+
import { existsSync as existsSync16, statSync as statSync10 } from "node:fs";
|
|
165760
|
+
import { join as join37 } from "node:path";
|
|
165419
165761
|
var log53 = createLogger("terminal-backend");
|
|
165420
165762
|
function createTerminalBackend(serverRoot, bandHome2) {
|
|
165421
165763
|
if (process.platform === "win32") return new InProcessTerminalBackend();
|
|
165422
165764
|
if (process.env.BAND_TERMINAL_DAEMON === "0") return new InProcessTerminalBackend();
|
|
165423
165765
|
const entry = [
|
|
165424
|
-
|
|
165425
|
-
|
|
165766
|
+
join37(serverRoot, "terminal-daemon.mjs"),
|
|
165767
|
+
join37(serverRoot, "terminal-daemon.ts")
|
|
165426
165768
|
].find((candidate) => existsSync16(candidate));
|
|
165427
165769
|
if (!entry) {
|
|
165428
165770
|
log53.error(
|
|
@@ -165431,10 +165773,10 @@ function createTerminalBackend(serverRoot, bandHome2) {
|
|
|
165431
165773
|
);
|
|
165432
165774
|
return new InProcessTerminalBackend();
|
|
165433
165775
|
}
|
|
165434
|
-
const { size: size4, mtimeMs } =
|
|
165776
|
+
const { size: size4, mtimeMs } = statSync10(entry);
|
|
165435
165777
|
return new DaemonTerminalBackend({
|
|
165436
165778
|
entry,
|
|
165437
|
-
runDir:
|
|
165779
|
+
runDir: join37(bandHome2, "run"),
|
|
165438
165780
|
cwd: bandHome2,
|
|
165439
165781
|
buildId: `${size4}-${Math.trunc(mtimeMs)}`
|
|
165440
165782
|
});
|
|
@@ -165474,10 +165816,10 @@ async function listenWithFallback(server, startPort, attempts = 20) {
|
|
|
165474
165816
|
}
|
|
165475
165817
|
|
|
165476
165818
|
// src/server/services/cli-skills-service.ts
|
|
165477
|
-
import { execFile as
|
|
165478
|
-
import { statSync as
|
|
165479
|
-
import { homedir as
|
|
165480
|
-
import { join as
|
|
165819
|
+
import { execFile as execFile12 } from "node:child_process";
|
|
165820
|
+
import { statSync as statSync11 } from "node:fs";
|
|
165821
|
+
import { homedir as homedir10 } from "node:os";
|
|
165822
|
+
import { join as join38 } from "node:path";
|
|
165481
165823
|
var BAND_SKILL_NAMES = [
|
|
165482
165824
|
"band",
|
|
165483
165825
|
"band-chat",
|
|
@@ -165490,7 +165832,7 @@ var SKILL_FILE = "SKILL.md";
|
|
|
165490
165832
|
async function findBandBinary() {
|
|
165491
165833
|
if (process.platform !== "win32") {
|
|
165492
165834
|
try {
|
|
165493
|
-
|
|
165835
|
+
statSync11("/usr/local/bin/band");
|
|
165494
165836
|
return "/usr/local/bin/band";
|
|
165495
165837
|
} catch {
|
|
165496
165838
|
}
|
|
@@ -165501,7 +165843,7 @@ async function findBandBinary() {
|
|
|
165501
165843
|
}
|
|
165502
165844
|
async function runBandSkillsInstall(bandPath, home) {
|
|
165503
165845
|
return new Promise((resolve12, reject) => {
|
|
165504
|
-
|
|
165846
|
+
execFile12(
|
|
165505
165847
|
bandPath,
|
|
165506
165848
|
["--output", "json", "skills", "install", "--home", home],
|
|
165507
165849
|
{ timeout: 3e4 },
|
|
@@ -165526,11 +165868,11 @@ async function installSkills(opts = {}) {
|
|
|
165526
165868
|
conflicts: [],
|
|
165527
165869
|
skipped: []
|
|
165528
165870
|
};
|
|
165529
|
-
const home = opts.home ??
|
|
165871
|
+
const home = opts.home ?? homedir10();
|
|
165530
165872
|
const sharedDir = getSharedSkillsDir(home);
|
|
165531
165873
|
const markAllSkipped = () => {
|
|
165532
165874
|
for (const name3 of BAND_SKILL_NAMES) {
|
|
165533
|
-
result.skipped.push(
|
|
165875
|
+
result.skipped.push(join38(sharedDir, name3, SKILL_FILE));
|
|
165534
165876
|
}
|
|
165535
165877
|
};
|
|
165536
165878
|
const bandPath = await findBandBinary();
|
|
@@ -165760,7 +166102,7 @@ var setupService = new SetupService();
|
|
|
165760
166102
|
function logCrash(message) {
|
|
165761
166103
|
try {
|
|
165762
166104
|
mkdirSync8(bandHome(), { recursive: true });
|
|
165763
|
-
appendFileSync(
|
|
166105
|
+
appendFileSync(join39(bandHome(), "server.log"), message, "utf-8");
|
|
165764
166106
|
} catch {
|
|
165765
166107
|
}
|
|
165766
166108
|
}
|
|
@@ -165790,7 +166132,7 @@ ${error40.stack || error40.message}
|
|
|
165790
166132
|
process.exit(1);
|
|
165791
166133
|
});
|
|
165792
166134
|
var SERVER_ROOT = import.meta.dirname;
|
|
165793
|
-
var clientDir =
|
|
166135
|
+
var clientDir = join39(SERVER_ROOT, "client");
|
|
165794
166136
|
function resolveInitialPort() {
|
|
165795
166137
|
const fromEnv = Number.parseInt(process.env.PORT ?? "", 10);
|
|
165796
166138
|
if (Number.isFinite(fromEnv) && fromEnv > 0) return fromEnv;
|
|
@@ -165817,7 +166159,7 @@ function getOpenApiSpec() {
|
|
|
165817
166159
|
if (isDev) {
|
|
165818
166160
|
const { generateOpenAPIDocument } = await import("@trpc/openapi");
|
|
165819
166161
|
const doc2 = await generateOpenAPIDocument(
|
|
165820
|
-
|
|
166162
|
+
join39(SERVER_ROOT, "src", "server", "api", "router.ts"),
|
|
165821
166163
|
{
|
|
165822
166164
|
title: "Band API",
|
|
165823
166165
|
version: "1.0.0"
|
|
@@ -165826,7 +166168,7 @@ function getOpenApiSpec() {
|
|
|
165826
166168
|
doc2.servers = [{ url: "/trpc" }];
|
|
165827
166169
|
return JSON.stringify(doc2, null, 2);
|
|
165828
166170
|
}
|
|
165829
|
-
const openApiDoc = JSON.parse(
|
|
166171
|
+
const openApiDoc = JSON.parse(readFileSync10(join39(SERVER_ROOT, "openapi.json"), "utf-8"));
|
|
165830
166172
|
openApiDoc.servers = [{ url: "/trpc" }];
|
|
165831
166173
|
return JSON.stringify(openApiDoc, null, 2);
|
|
165832
166174
|
})().catch((err) => {
|
|
@@ -165849,9 +166191,9 @@ function serveStaticFile(res, root, subdir, rawFilename) {
|
|
|
165849
166191
|
res.end("Bad request");
|
|
165850
166192
|
return;
|
|
165851
166193
|
}
|
|
165852
|
-
const filePath =
|
|
166194
|
+
const filePath = join39(root, subdir, filename);
|
|
165853
166195
|
try {
|
|
165854
|
-
const fileStat =
|
|
166196
|
+
const fileStat = statSync12(filePath);
|
|
165855
166197
|
const contentType = mimeTypeFromFilename(filename);
|
|
165856
166198
|
res.writeHead(200, {
|
|
165857
166199
|
"Content-Type": contentType,
|
|
@@ -165872,14 +166214,14 @@ function serveWorkspaceFile(res, workspaceId2, rawPath) {
|
|
|
165872
166214
|
return;
|
|
165873
166215
|
}
|
|
165874
166216
|
const root = workspace.worktree.path;
|
|
165875
|
-
const target = resolve11(
|
|
166217
|
+
const target = resolve11(join39(root, rawPath));
|
|
165876
166218
|
if (!target.startsWith(root + sep8) && target !== root) {
|
|
165877
166219
|
res.writeHead(400);
|
|
165878
166220
|
res.end("Bad request");
|
|
165879
166221
|
return;
|
|
165880
166222
|
}
|
|
165881
166223
|
try {
|
|
165882
|
-
const fileStat =
|
|
166224
|
+
const fileStat = statSync12(target);
|
|
165883
166225
|
const contentType = mimeTypeFromFilename(basename5(target));
|
|
165884
166226
|
res.writeHead(200, {
|
|
165885
166227
|
"Content-Type": contentType,
|
|
@@ -166069,7 +166411,7 @@ async function main() {
|
|
|
166069
166411
|
res.end("Bad request");
|
|
166070
166412
|
return;
|
|
166071
166413
|
}
|
|
166072
|
-
serveStaticFile(res, bandHome(),
|
|
166414
|
+
serveStaticFile(res, bandHome(), join39("shared", partition), rest.slice(slashIdx + 1));
|
|
166073
166415
|
return;
|
|
166074
166416
|
}
|
|
166075
166417
|
if (req.url?.startsWith("/api/workspace-file/")) {
|
|
@@ -166250,7 +166592,7 @@ async function main() {
|
|
|
166250
166592
|
const mod = await viteServer.ssrLoadModule("@tanstack/react-start/server-entry");
|
|
166251
166593
|
return mod.default.fetch(request);
|
|
166252
166594
|
};
|
|
166253
|
-
const apiDir =
|
|
166595
|
+
const apiDir = join39(SERVER_ROOT, "src", "server", "api");
|
|
166254
166596
|
viteServer.watcher.on("change", (file2) => {
|
|
166255
166597
|
if (file2.startsWith(apiDir)) {
|
|
166256
166598
|
_openApiSpec = null;
|
|
@@ -166395,6 +166737,7 @@ Failed to bind any port in ${initialPort}..${initialPort + 19}:
|
|
|
166395
166737
|
await viteServer.close().catch(() => {
|
|
166396
166738
|
});
|
|
166397
166739
|
}
|
|
166740
|
+
await stopAllAgentProcesses();
|
|
166398
166741
|
closeDb();
|
|
166399
166742
|
process.exit(0);
|
|
166400
166743
|
};
|