@lesscap/baton-cli 0.7.7 → 0.7.8
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/baton.mjs
CHANGED
|
@@ -4179,598 +4179,1546 @@ function _getBuiltinFlags(long, short, userNames, userAliases) {
|
|
|
4179
4179
|
return [`--${long}`, `-${short}`];
|
|
4180
4180
|
}
|
|
4181
4181
|
|
|
4182
|
-
//
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
var
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4182
|
+
// src/commands/artifact.ts
|
|
4183
|
+
import { openAsBlob } from "node:fs";
|
|
4184
|
+
import { stat } from "node:fs/promises";
|
|
4185
|
+
import { basename, resolve } from "node:path";
|
|
4186
|
+
|
|
4187
|
+
// ../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/types/other.js
|
|
4188
|
+
var types = {
|
|
4189
|
+
"application/prs.cww": ["cww"],
|
|
4190
|
+
"application/prs.xsf+xml": ["xsf"],
|
|
4191
|
+
"application/vnd.1000minds.decision-model+xml": ["1km"],
|
|
4192
|
+
"application/vnd.3gpp.pic-bw-large": ["plb"],
|
|
4193
|
+
"application/vnd.3gpp.pic-bw-small": ["psb"],
|
|
4194
|
+
"application/vnd.3gpp.pic-bw-var": ["pvb"],
|
|
4195
|
+
"application/vnd.3gpp2.tcap": ["tcap"],
|
|
4196
|
+
"application/vnd.3m.post-it-notes": ["pwn"],
|
|
4197
|
+
"application/vnd.accpac.simply.aso": ["aso"],
|
|
4198
|
+
"application/vnd.accpac.simply.imp": ["imp"],
|
|
4199
|
+
"application/vnd.acucobol": ["acu"],
|
|
4200
|
+
"application/vnd.acucorp": ["atc", "acutc"],
|
|
4201
|
+
"application/vnd.adobe.air-application-installer-package+zip": ["air"],
|
|
4202
|
+
"application/vnd.adobe.formscentral.fcdt": ["fcdt"],
|
|
4203
|
+
"application/vnd.adobe.fxp": ["fxp", "fxpl"],
|
|
4204
|
+
"application/vnd.adobe.xdp+xml": ["xdp"],
|
|
4205
|
+
"application/vnd.adobe.xfdf": ["*xfdf"],
|
|
4206
|
+
"application/vnd.age": ["age"],
|
|
4207
|
+
"application/vnd.ahead.space": ["ahead"],
|
|
4208
|
+
"application/vnd.airzip.filesecure.azf": ["azf"],
|
|
4209
|
+
"application/vnd.airzip.filesecure.azs": ["azs"],
|
|
4210
|
+
"application/vnd.amazon.ebook": ["azw"],
|
|
4211
|
+
"application/vnd.americandynamics.acc": ["acc"],
|
|
4212
|
+
"application/vnd.amiga.ami": ["ami"],
|
|
4213
|
+
"application/vnd.android.package-archive": ["apk"],
|
|
4214
|
+
"application/vnd.anser-web-certificate-issue-initiation": ["cii"],
|
|
4215
|
+
"application/vnd.anser-web-funds-transfer-initiation": ["fti"],
|
|
4216
|
+
"application/vnd.antix.game-component": ["atx"],
|
|
4217
|
+
"application/vnd.apple.installer+xml": ["mpkg"],
|
|
4218
|
+
"application/vnd.apple.keynote": ["key"],
|
|
4219
|
+
"application/vnd.apple.mpegurl": ["m3u8"],
|
|
4220
|
+
"application/vnd.apple.numbers": ["numbers"],
|
|
4221
|
+
"application/vnd.apple.pages": ["pages"],
|
|
4222
|
+
"application/vnd.apple.pkpass": ["pkpass"],
|
|
4223
|
+
"application/vnd.aristanetworks.swi": ["swi"],
|
|
4224
|
+
"application/vnd.astraea-software.iota": ["iota"],
|
|
4225
|
+
"application/vnd.audiograph": ["aep"],
|
|
4226
|
+
"application/vnd.autodesk.fbx": ["fbx"],
|
|
4227
|
+
"application/vnd.balsamiq.bmml+xml": ["bmml"],
|
|
4228
|
+
"application/vnd.blueice.multipass": ["mpm"],
|
|
4229
|
+
"application/vnd.bmi": ["bmi"],
|
|
4230
|
+
"application/vnd.businessobjects": ["rep"],
|
|
4231
|
+
"application/vnd.chemdraw+xml": ["cdxml"],
|
|
4232
|
+
"application/vnd.chipnuts.karaoke-mmd": ["mmd"],
|
|
4233
|
+
"application/vnd.cinderella": ["cdy"],
|
|
4234
|
+
"application/vnd.citationstyles.style+xml": ["csl"],
|
|
4235
|
+
"application/vnd.claymore": ["cla"],
|
|
4236
|
+
"application/vnd.cloanto.rp9": ["rp9"],
|
|
4237
|
+
"application/vnd.clonk.c4group": ["c4g", "c4d", "c4f", "c4p", "c4u"],
|
|
4238
|
+
"application/vnd.cluetrust.cartomobile-config": ["c11amc"],
|
|
4239
|
+
"application/vnd.cluetrust.cartomobile-config-pkg": ["c11amz"],
|
|
4240
|
+
"application/vnd.commonspace": ["csp"],
|
|
4241
|
+
"application/vnd.contact.cmsg": ["cdbcmsg"],
|
|
4242
|
+
"application/vnd.cosmocaller": ["cmc"],
|
|
4243
|
+
"application/vnd.crick.clicker": ["clkx"],
|
|
4244
|
+
"application/vnd.crick.clicker.keyboard": ["clkk"],
|
|
4245
|
+
"application/vnd.crick.clicker.palette": ["clkp"],
|
|
4246
|
+
"application/vnd.crick.clicker.template": ["clkt"],
|
|
4247
|
+
"application/vnd.crick.clicker.wordbank": ["clkw"],
|
|
4248
|
+
"application/vnd.criticaltools.wbs+xml": ["wbs"],
|
|
4249
|
+
"application/vnd.ctc-posml": ["pml"],
|
|
4250
|
+
"application/vnd.cups-ppd": ["ppd"],
|
|
4251
|
+
"application/vnd.curl.car": ["car"],
|
|
4252
|
+
"application/vnd.curl.pcurl": ["pcurl"],
|
|
4253
|
+
"application/vnd.dart": ["dart"],
|
|
4254
|
+
"application/vnd.data-vision.rdz": ["rdz"],
|
|
4255
|
+
"application/vnd.dbf": ["dbf"],
|
|
4256
|
+
"application/vnd.dcmp+xml": ["dcmp"],
|
|
4257
|
+
"application/vnd.dece.data": ["uvf", "uvvf", "uvd", "uvvd"],
|
|
4258
|
+
"application/vnd.dece.ttml+xml": ["uvt", "uvvt"],
|
|
4259
|
+
"application/vnd.dece.unspecified": ["uvx", "uvvx"],
|
|
4260
|
+
"application/vnd.dece.zip": ["uvz", "uvvz"],
|
|
4261
|
+
"application/vnd.denovo.fcselayout-link": ["fe_launch"],
|
|
4262
|
+
"application/vnd.dna": ["dna"],
|
|
4263
|
+
"application/vnd.dolby.mlp": ["mlp"],
|
|
4264
|
+
"application/vnd.dpgraph": ["dpg"],
|
|
4265
|
+
"application/vnd.dreamfactory": ["dfac"],
|
|
4266
|
+
"application/vnd.ds-keypoint": ["kpxx"],
|
|
4267
|
+
"application/vnd.dvb.ait": ["ait"],
|
|
4268
|
+
"application/vnd.dvb.service": ["svc"],
|
|
4269
|
+
"application/vnd.dynageo": ["geo"],
|
|
4270
|
+
"application/vnd.ecowin.chart": ["mag"],
|
|
4271
|
+
"application/vnd.enliven": ["nml"],
|
|
4272
|
+
"application/vnd.epson.esf": ["esf"],
|
|
4273
|
+
"application/vnd.epson.msf": ["msf"],
|
|
4274
|
+
"application/vnd.epson.quickanime": ["qam"],
|
|
4275
|
+
"application/vnd.epson.salt": ["slt"],
|
|
4276
|
+
"application/vnd.epson.ssf": ["ssf"],
|
|
4277
|
+
"application/vnd.eszigno3+xml": ["es3", "et3"],
|
|
4278
|
+
"application/vnd.ezpix-album": ["ez2"],
|
|
4279
|
+
"application/vnd.ezpix-package": ["ez3"],
|
|
4280
|
+
"application/vnd.fdf": ["*fdf"],
|
|
4281
|
+
"application/vnd.fdsn.mseed": ["mseed"],
|
|
4282
|
+
"application/vnd.fdsn.seed": ["seed", "dataless"],
|
|
4283
|
+
"application/vnd.flographit": ["gph"],
|
|
4284
|
+
"application/vnd.fluxtime.clip": ["ftc"],
|
|
4285
|
+
"application/vnd.framemaker": ["fm", "frame", "maker", "book"],
|
|
4286
|
+
"application/vnd.frogans.fnc": ["fnc"],
|
|
4287
|
+
"application/vnd.frogans.ltf": ["ltf"],
|
|
4288
|
+
"application/vnd.fsc.weblaunch": ["fsc"],
|
|
4289
|
+
"application/vnd.fujitsu.oasys": ["oas"],
|
|
4290
|
+
"application/vnd.fujitsu.oasys2": ["oa2"],
|
|
4291
|
+
"application/vnd.fujitsu.oasys3": ["oa3"],
|
|
4292
|
+
"application/vnd.fujitsu.oasysgp": ["fg5"],
|
|
4293
|
+
"application/vnd.fujitsu.oasysprs": ["bh2"],
|
|
4294
|
+
"application/vnd.fujixerox.ddd": ["ddd"],
|
|
4295
|
+
"application/vnd.fujixerox.docuworks": ["xdw"],
|
|
4296
|
+
"application/vnd.fujixerox.docuworks.binder": ["xbd"],
|
|
4297
|
+
"application/vnd.fuzzysheet": ["fzs"],
|
|
4298
|
+
"application/vnd.genomatix.tuxedo": ["txd"],
|
|
4299
|
+
"application/vnd.geogebra.file": ["ggb"],
|
|
4300
|
+
"application/vnd.geogebra.slides": ["ggs"],
|
|
4301
|
+
"application/vnd.geogebra.tool": ["ggt"],
|
|
4302
|
+
"application/vnd.geometry-explorer": ["gex", "gre"],
|
|
4303
|
+
"application/vnd.geonext": ["gxt"],
|
|
4304
|
+
"application/vnd.geoplan": ["g2w"],
|
|
4305
|
+
"application/vnd.geospace": ["g3w"],
|
|
4306
|
+
"application/vnd.gmx": ["gmx"],
|
|
4307
|
+
"application/vnd.google-apps.document": ["gdoc"],
|
|
4308
|
+
"application/vnd.google-apps.drawing": ["gdraw"],
|
|
4309
|
+
"application/vnd.google-apps.form": ["gform"],
|
|
4310
|
+
"application/vnd.google-apps.jam": ["gjam"],
|
|
4311
|
+
"application/vnd.google-apps.map": ["gmap"],
|
|
4312
|
+
"application/vnd.google-apps.presentation": ["gslides"],
|
|
4313
|
+
"application/vnd.google-apps.script": ["gscript"],
|
|
4314
|
+
"application/vnd.google-apps.site": ["gsite"],
|
|
4315
|
+
"application/vnd.google-apps.spreadsheet": ["gsheet"],
|
|
4316
|
+
"application/vnd.google-earth.kml+xml": ["kml"],
|
|
4317
|
+
"application/vnd.google-earth.kmz": ["kmz"],
|
|
4318
|
+
"application/vnd.gov.sk.xmldatacontainer+xml": ["xdcf"],
|
|
4319
|
+
"application/vnd.grafeq": ["gqf", "gqs"],
|
|
4320
|
+
"application/vnd.groove-account": ["gac"],
|
|
4321
|
+
"application/vnd.groove-help": ["ghf"],
|
|
4322
|
+
"application/vnd.groove-identity-message": ["gim"],
|
|
4323
|
+
"application/vnd.groove-injector": ["grv"],
|
|
4324
|
+
"application/vnd.groove-tool-message": ["gtm"],
|
|
4325
|
+
"application/vnd.groove-tool-template": ["tpl"],
|
|
4326
|
+
"application/vnd.groove-vcard": ["vcg"],
|
|
4327
|
+
"application/vnd.hal+xml": ["hal"],
|
|
4328
|
+
"application/vnd.handheld-entertainment+xml": ["zmm"],
|
|
4329
|
+
"application/vnd.hbci": ["hbci"],
|
|
4330
|
+
"application/vnd.hhe.lesson-player": ["les"],
|
|
4331
|
+
"application/vnd.hp-hpgl": ["hpgl"],
|
|
4332
|
+
"application/vnd.hp-hpid": ["hpid"],
|
|
4333
|
+
"application/vnd.hp-hps": ["hps"],
|
|
4334
|
+
"application/vnd.hp-jlyt": ["jlt"],
|
|
4335
|
+
"application/vnd.hp-pcl": ["pcl"],
|
|
4336
|
+
"application/vnd.hp-pclxl": ["pclxl"],
|
|
4337
|
+
"application/vnd.hydrostatix.sof-data": ["sfd-hdstx"],
|
|
4338
|
+
"application/vnd.ibm.minipay": ["mpy"],
|
|
4339
|
+
"application/vnd.ibm.modcap": ["afp", "listafp", "list3820"],
|
|
4340
|
+
"application/vnd.ibm.rights-management": ["irm"],
|
|
4341
|
+
"application/vnd.ibm.secure-container": ["sc"],
|
|
4342
|
+
"application/vnd.iccprofile": ["icc", "icm"],
|
|
4343
|
+
"application/vnd.igloader": ["igl"],
|
|
4344
|
+
"application/vnd.immervision-ivp": ["ivp"],
|
|
4345
|
+
"application/vnd.immervision-ivu": ["ivu"],
|
|
4346
|
+
"application/vnd.insors.igm": ["igm"],
|
|
4347
|
+
"application/vnd.intercon.formnet": ["xpw", "xpx"],
|
|
4348
|
+
"application/vnd.intergeo": ["i2g"],
|
|
4349
|
+
"application/vnd.intu.qbo": ["qbo"],
|
|
4350
|
+
"application/vnd.intu.qfx": ["qfx"],
|
|
4351
|
+
"application/vnd.ipunplugged.rcprofile": ["rcprofile"],
|
|
4352
|
+
"application/vnd.irepository.package+xml": ["irp"],
|
|
4353
|
+
"application/vnd.is-xpr": ["xpr"],
|
|
4354
|
+
"application/vnd.isac.fcs": ["fcs"],
|
|
4355
|
+
"application/vnd.jam": ["jam"],
|
|
4356
|
+
"application/vnd.jcp.javame.midlet-rms": ["rms"],
|
|
4357
|
+
"application/vnd.jisp": ["jisp"],
|
|
4358
|
+
"application/vnd.joost.joda-archive": ["joda"],
|
|
4359
|
+
"application/vnd.kahootz": ["ktz", "ktr"],
|
|
4360
|
+
"application/vnd.kde.karbon": ["karbon"],
|
|
4361
|
+
"application/vnd.kde.kchart": ["chrt"],
|
|
4362
|
+
"application/vnd.kde.kformula": ["kfo"],
|
|
4363
|
+
"application/vnd.kde.kivio": ["flw"],
|
|
4364
|
+
"application/vnd.kde.kontour": ["kon"],
|
|
4365
|
+
"application/vnd.kde.kpresenter": ["kpr", "kpt"],
|
|
4366
|
+
"application/vnd.kde.kspread": ["ksp"],
|
|
4367
|
+
"application/vnd.kde.kword": ["kwd", "kwt"],
|
|
4368
|
+
"application/vnd.kenameaapp": ["htke"],
|
|
4369
|
+
"application/vnd.kidspiration": ["kia"],
|
|
4370
|
+
"application/vnd.kinar": ["kne", "knp"],
|
|
4371
|
+
"application/vnd.koan": ["skp", "skd", "skt", "skm"],
|
|
4372
|
+
"application/vnd.kodak-descriptor": ["sse"],
|
|
4373
|
+
"application/vnd.las.las+xml": ["lasxml"],
|
|
4374
|
+
"application/vnd.llamagraphics.life-balance.desktop": ["lbd"],
|
|
4375
|
+
"application/vnd.llamagraphics.life-balance.exchange+xml": ["lbe"],
|
|
4376
|
+
"application/vnd.lotus-1-2-3": ["123"],
|
|
4377
|
+
"application/vnd.lotus-approach": ["apr"],
|
|
4378
|
+
"application/vnd.lotus-freelance": ["pre"],
|
|
4379
|
+
"application/vnd.lotus-notes": ["nsf"],
|
|
4380
|
+
"application/vnd.lotus-organizer": ["org"],
|
|
4381
|
+
"application/vnd.lotus-screencam": ["scm"],
|
|
4382
|
+
"application/vnd.lotus-wordpro": ["lwp"],
|
|
4383
|
+
"application/vnd.macports.portpkg": ["portpkg"],
|
|
4384
|
+
"application/vnd.mapbox-vector-tile": ["mvt"],
|
|
4385
|
+
"application/vnd.mcd": ["mcd"],
|
|
4386
|
+
"application/vnd.medcalcdata": ["mc1"],
|
|
4387
|
+
"application/vnd.mediastation.cdkey": ["cdkey"],
|
|
4388
|
+
"application/vnd.mfer": ["mwf"],
|
|
4389
|
+
"application/vnd.mfmp": ["mfm"],
|
|
4390
|
+
"application/vnd.micrografx.flo": ["flo"],
|
|
4391
|
+
"application/vnd.micrografx.igx": ["igx"],
|
|
4392
|
+
"application/vnd.mif": ["mif"],
|
|
4393
|
+
"application/vnd.mobius.daf": ["daf"],
|
|
4394
|
+
"application/vnd.mobius.dis": ["dis"],
|
|
4395
|
+
"application/vnd.mobius.mbk": ["mbk"],
|
|
4396
|
+
"application/vnd.mobius.mqy": ["mqy"],
|
|
4397
|
+
"application/vnd.mobius.msl": ["msl"],
|
|
4398
|
+
"application/vnd.mobius.plc": ["plc"],
|
|
4399
|
+
"application/vnd.mobius.txf": ["txf"],
|
|
4400
|
+
"application/vnd.mophun.application": ["mpn"],
|
|
4401
|
+
"application/vnd.mophun.certificate": ["mpc"],
|
|
4402
|
+
"application/vnd.mozilla.xul+xml": ["xul"],
|
|
4403
|
+
"application/vnd.ms-artgalry": ["cil"],
|
|
4404
|
+
"application/vnd.ms-cab-compressed": ["cab"],
|
|
4405
|
+
"application/vnd.ms-excel": ["xls", "xlm", "xla", "xlc", "xlt", "xlw"],
|
|
4406
|
+
"application/vnd.ms-excel.addin.macroenabled.12": ["xlam"],
|
|
4407
|
+
"application/vnd.ms-excel.sheet.binary.macroenabled.12": ["xlsb"],
|
|
4408
|
+
"application/vnd.ms-excel.sheet.macroenabled.12": ["xlsm"],
|
|
4409
|
+
"application/vnd.ms-excel.template.macroenabled.12": ["xltm"],
|
|
4410
|
+
"application/vnd.ms-fontobject": ["eot"],
|
|
4411
|
+
"application/vnd.ms-htmlhelp": ["chm"],
|
|
4412
|
+
"application/vnd.ms-ims": ["ims"],
|
|
4413
|
+
"application/vnd.ms-lrm": ["lrm"],
|
|
4414
|
+
"application/vnd.ms-officetheme": ["thmx"],
|
|
4415
|
+
"application/vnd.ms-outlook": ["msg"],
|
|
4416
|
+
"application/vnd.ms-pki.seccat": ["cat"],
|
|
4417
|
+
"application/vnd.ms-pki.stl": ["*stl"],
|
|
4418
|
+
"application/vnd.ms-powerpoint": ["ppt", "pps", "pot"],
|
|
4419
|
+
"application/vnd.ms-powerpoint.addin.macroenabled.12": ["ppam"],
|
|
4420
|
+
"application/vnd.ms-powerpoint.presentation.macroenabled.12": ["pptm"],
|
|
4421
|
+
"application/vnd.ms-powerpoint.slide.macroenabled.12": ["sldm"],
|
|
4422
|
+
"application/vnd.ms-powerpoint.slideshow.macroenabled.12": ["ppsm"],
|
|
4423
|
+
"application/vnd.ms-powerpoint.template.macroenabled.12": ["potm"],
|
|
4424
|
+
"application/vnd.ms-project": ["*mpp", "mpt"],
|
|
4425
|
+
"application/vnd.ms-visio.viewer": ["vdx"],
|
|
4426
|
+
"application/vnd.ms-word.document.macroenabled.12": ["docm"],
|
|
4427
|
+
"application/vnd.ms-word.template.macroenabled.12": ["dotm"],
|
|
4428
|
+
"application/vnd.ms-works": ["wps", "wks", "wcm", "wdb"],
|
|
4429
|
+
"application/vnd.ms-wpl": ["wpl"],
|
|
4430
|
+
"application/vnd.ms-xpsdocument": ["xps"],
|
|
4431
|
+
"application/vnd.mseq": ["mseq"],
|
|
4432
|
+
"application/vnd.musician": ["mus"],
|
|
4433
|
+
"application/vnd.muvee.style": ["msty"],
|
|
4434
|
+
"application/vnd.mynfc": ["taglet"],
|
|
4435
|
+
"application/vnd.nato.bindingdataobject+xml": ["bdo"],
|
|
4436
|
+
"application/vnd.neurolanguage.nlu": ["nlu"],
|
|
4437
|
+
"application/vnd.nitf": ["ntf", "nitf"],
|
|
4438
|
+
"application/vnd.noblenet-directory": ["nnd"],
|
|
4439
|
+
"application/vnd.noblenet-sealer": ["nns"],
|
|
4440
|
+
"application/vnd.noblenet-web": ["nnw"],
|
|
4441
|
+
"application/vnd.nokia.n-gage.ac+xml": ["*ac"],
|
|
4442
|
+
"application/vnd.nokia.n-gage.data": ["ngdat"],
|
|
4443
|
+
"application/vnd.nokia.n-gage.symbian.install": ["n-gage"],
|
|
4444
|
+
"application/vnd.nokia.radio-preset": ["rpst"],
|
|
4445
|
+
"application/vnd.nokia.radio-presets": ["rpss"],
|
|
4446
|
+
"application/vnd.novadigm.edm": ["edm"],
|
|
4447
|
+
"application/vnd.novadigm.edx": ["edx"],
|
|
4448
|
+
"application/vnd.novadigm.ext": ["ext"],
|
|
4449
|
+
"application/vnd.oasis.opendocument.chart": ["odc"],
|
|
4450
|
+
"application/vnd.oasis.opendocument.chart-template": ["otc"],
|
|
4451
|
+
"application/vnd.oasis.opendocument.database": ["odb"],
|
|
4452
|
+
"application/vnd.oasis.opendocument.formula": ["odf"],
|
|
4453
|
+
"application/vnd.oasis.opendocument.formula-template": ["odft"],
|
|
4454
|
+
"application/vnd.oasis.opendocument.graphics": ["odg"],
|
|
4455
|
+
"application/vnd.oasis.opendocument.graphics-template": ["otg"],
|
|
4456
|
+
"application/vnd.oasis.opendocument.image": ["odi"],
|
|
4457
|
+
"application/vnd.oasis.opendocument.image-template": ["oti"],
|
|
4458
|
+
"application/vnd.oasis.opendocument.presentation": ["odp"],
|
|
4459
|
+
"application/vnd.oasis.opendocument.presentation-template": ["otp"],
|
|
4460
|
+
"application/vnd.oasis.opendocument.spreadsheet": ["ods"],
|
|
4461
|
+
"application/vnd.oasis.opendocument.spreadsheet-template": ["ots"],
|
|
4462
|
+
"application/vnd.oasis.opendocument.text": ["odt"],
|
|
4463
|
+
"application/vnd.oasis.opendocument.text-master": ["odm"],
|
|
4464
|
+
"application/vnd.oasis.opendocument.text-template": ["ott"],
|
|
4465
|
+
"application/vnd.oasis.opendocument.text-web": ["oth"],
|
|
4466
|
+
"application/vnd.olpc-sugar": ["xo"],
|
|
4467
|
+
"application/vnd.oma.dd2+xml": ["dd2"],
|
|
4468
|
+
"application/vnd.openblox.game+xml": ["obgx"],
|
|
4469
|
+
"application/vnd.openofficeorg.extension": ["oxt"],
|
|
4470
|
+
"application/vnd.openstreetmap.data+xml": ["osm"],
|
|
4471
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [
|
|
4472
|
+
"pptx"
|
|
4473
|
+
],
|
|
4474
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slide": [
|
|
4475
|
+
"sldx"
|
|
4476
|
+
],
|
|
4477
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow": [
|
|
4478
|
+
"ppsx"
|
|
4479
|
+
],
|
|
4480
|
+
"application/vnd.openxmlformats-officedocument.presentationml.template": [
|
|
4481
|
+
"potx"
|
|
4482
|
+
],
|
|
4483
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"],
|
|
4484
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.template": [
|
|
4485
|
+
"xltx"
|
|
4486
|
+
],
|
|
4487
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
|
|
4488
|
+
"docx"
|
|
4489
|
+
],
|
|
4490
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": [
|
|
4491
|
+
"dotx"
|
|
4492
|
+
],
|
|
4493
|
+
"application/vnd.osgeo.mapguide.package": ["mgp"],
|
|
4494
|
+
"application/vnd.osgi.dp": ["dp"],
|
|
4495
|
+
"application/vnd.osgi.subsystem": ["esa"],
|
|
4496
|
+
"application/vnd.palm": ["pdb", "pqa", "oprc"],
|
|
4497
|
+
"application/vnd.pawaafile": ["paw"],
|
|
4498
|
+
"application/vnd.pg.format": ["str"],
|
|
4499
|
+
"application/vnd.pg.osasli": ["ei6"],
|
|
4500
|
+
"application/vnd.picsel": ["efif"],
|
|
4501
|
+
"application/vnd.pmi.widget": ["wg"],
|
|
4502
|
+
"application/vnd.pocketlearn": ["plf"],
|
|
4503
|
+
"application/vnd.powerbuilder6": ["pbd"],
|
|
4504
|
+
"application/vnd.previewsystems.box": ["box"],
|
|
4505
|
+
"application/vnd.procrate.brushset": ["brushset"],
|
|
4506
|
+
"application/vnd.procreate.brush": ["brush"],
|
|
4507
|
+
"application/vnd.procreate.dream": ["drm"],
|
|
4508
|
+
"application/vnd.proteus.magazine": ["mgz"],
|
|
4509
|
+
"application/vnd.publishare-delta-tree": ["qps"],
|
|
4510
|
+
"application/vnd.pvi.ptid1": ["ptid"],
|
|
4511
|
+
"application/vnd.pwg-xhtml-print+xml": ["xhtm"],
|
|
4512
|
+
"application/vnd.quark.quarkxpress": [
|
|
4513
|
+
"qxd",
|
|
4514
|
+
"qxt",
|
|
4515
|
+
"qwd",
|
|
4516
|
+
"qwt",
|
|
4517
|
+
"qxl",
|
|
4518
|
+
"qxb"
|
|
4519
|
+
],
|
|
4520
|
+
"application/vnd.rar": ["rar"],
|
|
4521
|
+
"application/vnd.realvnc.bed": ["bed"],
|
|
4522
|
+
"application/vnd.recordare.musicxml": ["mxl"],
|
|
4523
|
+
"application/vnd.recordare.musicxml+xml": ["musicxml"],
|
|
4524
|
+
"application/vnd.rig.cryptonote": ["cryptonote"],
|
|
4525
|
+
"application/vnd.rim.cod": ["cod"],
|
|
4526
|
+
"application/vnd.rn-realmedia": ["rm"],
|
|
4527
|
+
"application/vnd.rn-realmedia-vbr": ["rmvb"],
|
|
4528
|
+
"application/vnd.route66.link66+xml": ["link66"],
|
|
4529
|
+
"application/vnd.sailingtracker.track": ["st"],
|
|
4530
|
+
"application/vnd.seemail": ["see"],
|
|
4531
|
+
"application/vnd.sema": ["sema"],
|
|
4532
|
+
"application/vnd.semd": ["semd"],
|
|
4533
|
+
"application/vnd.semf": ["semf"],
|
|
4534
|
+
"application/vnd.shana.informed.formdata": ["ifm"],
|
|
4535
|
+
"application/vnd.shana.informed.formtemplate": ["itp"],
|
|
4536
|
+
"application/vnd.shana.informed.interchange": ["iif"],
|
|
4537
|
+
"application/vnd.shana.informed.package": ["ipk"],
|
|
4538
|
+
"application/vnd.simtech-mindmapper": ["twd", "twds"],
|
|
4539
|
+
"application/vnd.smaf": ["mmf"],
|
|
4540
|
+
"application/vnd.smart.teacher": ["teacher"],
|
|
4541
|
+
"application/vnd.software602.filler.form+xml": ["fo"],
|
|
4542
|
+
"application/vnd.solent.sdkm+xml": ["sdkm", "sdkd"],
|
|
4543
|
+
"application/vnd.spotfire.dxp": ["dxp"],
|
|
4544
|
+
"application/vnd.spotfire.sfs": ["sfs"],
|
|
4545
|
+
"application/vnd.stardivision.calc": ["sdc"],
|
|
4546
|
+
"application/vnd.stardivision.draw": ["sda"],
|
|
4547
|
+
"application/vnd.stardivision.impress": ["sdd"],
|
|
4548
|
+
"application/vnd.stardivision.math": ["smf"],
|
|
4549
|
+
"application/vnd.stardivision.writer": ["sdw", "vor"],
|
|
4550
|
+
"application/vnd.stardivision.writer-global": ["sgl"],
|
|
4551
|
+
"application/vnd.stepmania.package": ["smzip"],
|
|
4552
|
+
"application/vnd.stepmania.stepchart": ["sm"],
|
|
4553
|
+
"application/vnd.sun.wadl+xml": ["wadl"],
|
|
4554
|
+
"application/vnd.sun.xml.calc": ["sxc"],
|
|
4555
|
+
"application/vnd.sun.xml.calc.template": ["stc"],
|
|
4556
|
+
"application/vnd.sun.xml.draw": ["sxd"],
|
|
4557
|
+
"application/vnd.sun.xml.draw.template": ["std"],
|
|
4558
|
+
"application/vnd.sun.xml.impress": ["sxi"],
|
|
4559
|
+
"application/vnd.sun.xml.impress.template": ["sti"],
|
|
4560
|
+
"application/vnd.sun.xml.math": ["sxm"],
|
|
4561
|
+
"application/vnd.sun.xml.writer": ["sxw"],
|
|
4562
|
+
"application/vnd.sun.xml.writer.global": ["sxg"],
|
|
4563
|
+
"application/vnd.sun.xml.writer.template": ["stw"],
|
|
4564
|
+
"application/vnd.sus-calendar": ["sus", "susp"],
|
|
4565
|
+
"application/vnd.svd": ["svd"],
|
|
4566
|
+
"application/vnd.symbian.install": ["sis", "sisx"],
|
|
4567
|
+
"application/vnd.syncml+xml": ["xsm"],
|
|
4568
|
+
"application/vnd.syncml.dm+wbxml": ["bdm"],
|
|
4569
|
+
"application/vnd.syncml.dm+xml": ["xdm"],
|
|
4570
|
+
"application/vnd.syncml.dmddf+xml": ["ddf"],
|
|
4571
|
+
"application/vnd.tao.intent-module-archive": ["tao"],
|
|
4572
|
+
"application/vnd.tcpdump.pcap": ["pcap", "cap", "dmp"],
|
|
4573
|
+
"application/vnd.tmobile-livetv": ["tmo"],
|
|
4574
|
+
"application/vnd.trid.tpt": ["tpt"],
|
|
4575
|
+
"application/vnd.triscape.mxs": ["mxs"],
|
|
4576
|
+
"application/vnd.trueapp": ["tra"],
|
|
4577
|
+
"application/vnd.ufdl": ["ufd", "ufdl"],
|
|
4578
|
+
"application/vnd.uiq.theme": ["utz"],
|
|
4579
|
+
"application/vnd.umajin": ["umj"],
|
|
4580
|
+
"application/vnd.unity": ["unityweb"],
|
|
4581
|
+
"application/vnd.uoml+xml": ["uoml", "uo"],
|
|
4582
|
+
"application/vnd.vcx": ["vcx"],
|
|
4583
|
+
"application/vnd.visio": ["vsd", "vst", "vss", "vsw", "vsdx", "vtx"],
|
|
4584
|
+
"application/vnd.visionary": ["vis"],
|
|
4585
|
+
"application/vnd.vsf": ["vsf"],
|
|
4586
|
+
"application/vnd.wap.wbxml": ["wbxml"],
|
|
4587
|
+
"application/vnd.wap.wmlc": ["wmlc"],
|
|
4588
|
+
"application/vnd.wap.wmlscriptc": ["wmlsc"],
|
|
4589
|
+
"application/vnd.webturbo": ["wtb"],
|
|
4590
|
+
"application/vnd.wolfram.player": ["nbp"],
|
|
4591
|
+
"application/vnd.wordperfect": ["wpd"],
|
|
4592
|
+
"application/vnd.wqd": ["wqd"],
|
|
4593
|
+
"application/vnd.wt.stf": ["stf"],
|
|
4594
|
+
"application/vnd.xara": ["xar"],
|
|
4595
|
+
"application/vnd.xfdl": ["xfdl"],
|
|
4596
|
+
"application/vnd.yamaha.hv-dic": ["hvd"],
|
|
4597
|
+
"application/vnd.yamaha.hv-script": ["hvs"],
|
|
4598
|
+
"application/vnd.yamaha.hv-voice": ["hvp"],
|
|
4599
|
+
"application/vnd.yamaha.openscoreformat": ["osf"],
|
|
4600
|
+
"application/vnd.yamaha.openscoreformat.osfpvg+xml": ["osfpvg"],
|
|
4601
|
+
"application/vnd.yamaha.smaf-audio": ["saf"],
|
|
4602
|
+
"application/vnd.yamaha.smaf-phrase": ["spf"],
|
|
4603
|
+
"application/vnd.yellowriver-custom-menu": ["cmp"],
|
|
4604
|
+
"application/vnd.zul": ["zir", "zirz"],
|
|
4605
|
+
"application/vnd.zzazz.deck+xml": ["zaz"],
|
|
4606
|
+
"application/x-7z-compressed": ["7z"],
|
|
4607
|
+
"application/x-abiword": ["abw"],
|
|
4608
|
+
"application/x-ace-compressed": ["ace"],
|
|
4609
|
+
"application/x-apple-diskimage": ["*dmg"],
|
|
4610
|
+
"application/x-arj": ["arj"],
|
|
4611
|
+
"application/x-authorware-bin": ["aab", "x32", "u32", "vox"],
|
|
4612
|
+
"application/x-authorware-map": ["aam"],
|
|
4613
|
+
"application/x-authorware-seg": ["aas"],
|
|
4614
|
+
"application/x-bcpio": ["bcpio"],
|
|
4615
|
+
"application/x-bdoc": ["*bdoc"],
|
|
4616
|
+
"application/x-bittorrent": ["torrent"],
|
|
4617
|
+
"application/x-blender": ["blend"],
|
|
4618
|
+
"application/x-blorb": ["blb", "blorb"],
|
|
4619
|
+
"application/x-bzip": ["bz"],
|
|
4620
|
+
"application/x-bzip2": ["bz2", "boz"],
|
|
4621
|
+
"application/x-cbr": ["cbr", "cba", "cbt", "cbz", "cb7"],
|
|
4622
|
+
"application/x-cdlink": ["vcd"],
|
|
4623
|
+
"application/x-cfs-compressed": ["cfs"],
|
|
4624
|
+
"application/x-chat": ["chat"],
|
|
4625
|
+
"application/x-chess-pgn": ["pgn"],
|
|
4626
|
+
"application/x-chrome-extension": ["crx"],
|
|
4627
|
+
"application/x-cocoa": ["cco"],
|
|
4628
|
+
"application/x-compressed": ["*rar"],
|
|
4629
|
+
"application/x-conference": ["nsc"],
|
|
4630
|
+
"application/x-cpio": ["cpio"],
|
|
4631
|
+
"application/x-csh": ["csh"],
|
|
4632
|
+
"application/x-debian-package": ["*deb", "udeb"],
|
|
4633
|
+
"application/x-dgc-compressed": ["dgc"],
|
|
4634
|
+
"application/x-director": [
|
|
4635
|
+
"dir",
|
|
4636
|
+
"dcr",
|
|
4637
|
+
"dxr",
|
|
4638
|
+
"cst",
|
|
4639
|
+
"cct",
|
|
4640
|
+
"cxt",
|
|
4641
|
+
"w3d",
|
|
4642
|
+
"fgd",
|
|
4643
|
+
"swa"
|
|
4644
|
+
],
|
|
4645
|
+
"application/x-doom": ["wad"],
|
|
4646
|
+
"application/x-dtbncx+xml": ["ncx"],
|
|
4647
|
+
"application/x-dtbook+xml": ["dtb"],
|
|
4648
|
+
"application/x-dtbresource+xml": ["res"],
|
|
4649
|
+
"application/x-dvi": ["dvi"],
|
|
4650
|
+
"application/x-envoy": ["evy"],
|
|
4651
|
+
"application/x-eva": ["eva"],
|
|
4652
|
+
"application/x-font-bdf": ["bdf"],
|
|
4653
|
+
"application/x-font-ghostscript": ["gsf"],
|
|
4654
|
+
"application/x-font-linux-psf": ["psf"],
|
|
4655
|
+
"application/x-font-pcf": ["pcf"],
|
|
4656
|
+
"application/x-font-snf": ["snf"],
|
|
4657
|
+
"application/x-font-type1": ["pfa", "pfb", "pfm", "afm"],
|
|
4658
|
+
"application/x-freearc": ["arc"],
|
|
4659
|
+
"application/x-futuresplash": ["spl"],
|
|
4660
|
+
"application/x-gca-compressed": ["gca"],
|
|
4661
|
+
"application/x-glulx": ["ulx"],
|
|
4662
|
+
"application/x-gnumeric": ["gnumeric"],
|
|
4663
|
+
"application/x-gramps-xml": ["gramps"],
|
|
4664
|
+
"application/x-gtar": ["gtar"],
|
|
4665
|
+
"application/x-hdf": ["hdf"],
|
|
4666
|
+
"application/x-httpd-php": ["php"],
|
|
4667
|
+
"application/x-install-instructions": ["install"],
|
|
4668
|
+
"application/x-ipynb+json": ["ipynb"],
|
|
4669
|
+
"application/x-iso9660-image": ["*iso"],
|
|
4670
|
+
"application/x-iwork-keynote-sffkey": ["*key"],
|
|
4671
|
+
"application/x-iwork-numbers-sffnumbers": ["*numbers"],
|
|
4672
|
+
"application/x-iwork-pages-sffpages": ["*pages"],
|
|
4673
|
+
"application/x-java-archive-diff": ["jardiff"],
|
|
4674
|
+
"application/x-java-jnlp-file": ["jnlp"],
|
|
4675
|
+
"application/x-keepass2": ["kdbx"],
|
|
4676
|
+
"application/x-latex": ["latex"],
|
|
4677
|
+
"application/x-lua-bytecode": ["luac"],
|
|
4678
|
+
"application/x-lzh-compressed": ["lzh", "lha"],
|
|
4679
|
+
"application/x-makeself": ["run"],
|
|
4680
|
+
"application/x-mie": ["mie"],
|
|
4681
|
+
"application/x-mobipocket-ebook": ["*prc", "mobi"],
|
|
4682
|
+
"application/x-ms-application": ["application"],
|
|
4683
|
+
"application/x-ms-shortcut": ["lnk"],
|
|
4684
|
+
"application/x-ms-wmd": ["wmd"],
|
|
4685
|
+
"application/x-ms-wmz": ["wmz"],
|
|
4686
|
+
"application/x-ms-xbap": ["xbap"],
|
|
4687
|
+
"application/x-msaccess": ["mdb"],
|
|
4688
|
+
"application/x-msbinder": ["obd"],
|
|
4689
|
+
"application/x-mscardfile": ["crd"],
|
|
4690
|
+
"application/x-msclip": ["clp"],
|
|
4691
|
+
"application/x-msdos-program": ["*exe"],
|
|
4692
|
+
"application/x-msdownload": ["*exe", "*dll", "com", "bat", "*msi"],
|
|
4693
|
+
"application/x-msmediaview": ["mvb", "m13", "m14"],
|
|
4694
|
+
"application/x-msmetafile": ["*wmf", "*wmz", "*emf", "emz"],
|
|
4695
|
+
"application/x-msmoney": ["mny"],
|
|
4696
|
+
"application/x-mspublisher": ["pub"],
|
|
4697
|
+
"application/x-msschedule": ["scd"],
|
|
4698
|
+
"application/x-msterminal": ["trm"],
|
|
4699
|
+
"application/x-mswrite": ["wri"],
|
|
4700
|
+
"application/x-netcdf": ["nc", "cdf"],
|
|
4701
|
+
"application/x-ns-proxy-autoconfig": ["pac"],
|
|
4702
|
+
"application/x-nzb": ["nzb"],
|
|
4703
|
+
"application/x-perl": ["pl", "pm"],
|
|
4704
|
+
"application/x-pilot": ["*prc", "*pdb"],
|
|
4705
|
+
"application/x-pkcs12": ["p12", "pfx"],
|
|
4706
|
+
"application/x-pkcs7-certificates": ["p7b", "spc"],
|
|
4707
|
+
"application/x-pkcs7-certreqresp": ["p7r"],
|
|
4708
|
+
"application/x-rar-compressed": ["*rar"],
|
|
4709
|
+
"application/x-redhat-package-manager": ["rpm"],
|
|
4710
|
+
"application/x-research-info-systems": ["ris"],
|
|
4711
|
+
"application/x-sea": ["sea"],
|
|
4712
|
+
"application/x-sh": ["sh"],
|
|
4713
|
+
"application/x-shar": ["shar"],
|
|
4714
|
+
"application/x-shockwave-flash": ["swf"],
|
|
4715
|
+
"application/x-silverlight-app": ["xap"],
|
|
4716
|
+
"application/x-sql": ["*sql"],
|
|
4717
|
+
"application/x-stuffit": ["sit"],
|
|
4718
|
+
"application/x-stuffitx": ["sitx"],
|
|
4719
|
+
"application/x-subrip": ["srt"],
|
|
4720
|
+
"application/x-sv4cpio": ["sv4cpio"],
|
|
4721
|
+
"application/x-sv4crc": ["sv4crc"],
|
|
4722
|
+
"application/x-t3vm-image": ["t3"],
|
|
4723
|
+
"application/x-tads": ["gam"],
|
|
4724
|
+
"application/x-tar": ["tar"],
|
|
4725
|
+
"application/x-tcl": ["tcl", "tk"],
|
|
4726
|
+
"application/x-tex": ["tex"],
|
|
4727
|
+
"application/x-tex-tfm": ["tfm"],
|
|
4728
|
+
"application/x-texinfo": ["texinfo", "texi"],
|
|
4729
|
+
"application/x-tgif": ["*obj"],
|
|
4730
|
+
"application/x-ustar": ["ustar"],
|
|
4731
|
+
"application/x-virtualbox-hdd": ["hdd"],
|
|
4732
|
+
"application/x-virtualbox-ova": ["ova"],
|
|
4733
|
+
"application/x-virtualbox-ovf": ["ovf"],
|
|
4734
|
+
"application/x-virtualbox-vbox": ["vbox"],
|
|
4735
|
+
"application/x-virtualbox-vbox-extpack": ["vbox-extpack"],
|
|
4736
|
+
"application/x-virtualbox-vdi": ["vdi"],
|
|
4737
|
+
"application/x-virtualbox-vhd": ["vhd"],
|
|
4738
|
+
"application/x-virtualbox-vmdk": ["vmdk"],
|
|
4739
|
+
"application/x-wais-source": ["src"],
|
|
4740
|
+
"application/x-web-app-manifest+json": ["webapp"],
|
|
4741
|
+
"application/x-x509-ca-cert": ["der", "crt", "pem"],
|
|
4742
|
+
"application/x-xfig": ["fig"],
|
|
4743
|
+
"application/x-xliff+xml": ["*xlf"],
|
|
4744
|
+
"application/x-xpinstall": ["xpi"],
|
|
4745
|
+
"application/x-xz": ["xz"],
|
|
4746
|
+
"application/x-zip-compressed": ["*zip"],
|
|
4747
|
+
"application/x-zmachine": ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"],
|
|
4748
|
+
"audio/vnd.dece.audio": ["uva", "uvva"],
|
|
4749
|
+
"audio/vnd.digital-winds": ["eol"],
|
|
4750
|
+
"audio/vnd.dra": ["dra"],
|
|
4751
|
+
"audio/vnd.dts": ["dts"],
|
|
4752
|
+
"audio/vnd.dts.hd": ["dtshd"],
|
|
4753
|
+
"audio/vnd.lucent.voice": ["lvp"],
|
|
4754
|
+
"audio/vnd.ms-playready.media.pya": ["pya"],
|
|
4755
|
+
"audio/vnd.nuera.ecelp4800": ["ecelp4800"],
|
|
4756
|
+
"audio/vnd.nuera.ecelp7470": ["ecelp7470"],
|
|
4757
|
+
"audio/vnd.nuera.ecelp9600": ["ecelp9600"],
|
|
4758
|
+
"audio/vnd.rip": ["rip"],
|
|
4759
|
+
"audio/x-aac": ["*aac"],
|
|
4760
|
+
"audio/x-aiff": ["aif", "aiff", "aifc"],
|
|
4761
|
+
"audio/x-caf": ["caf"],
|
|
4762
|
+
"audio/x-flac": ["flac"],
|
|
4763
|
+
"audio/x-m4a": ["*m4a"],
|
|
4764
|
+
"audio/x-matroska": ["mka"],
|
|
4765
|
+
"audio/x-mpegurl": ["m3u"],
|
|
4766
|
+
"audio/x-ms-wax": ["wax"],
|
|
4767
|
+
"audio/x-ms-wma": ["wma"],
|
|
4768
|
+
"audio/x-pn-realaudio": ["ram", "ra"],
|
|
4769
|
+
"audio/x-pn-realaudio-plugin": ["rmp"],
|
|
4770
|
+
"audio/x-realaudio": ["*ra"],
|
|
4771
|
+
"audio/x-wav": ["*wav"],
|
|
4772
|
+
"chemical/x-cdx": ["cdx"],
|
|
4773
|
+
"chemical/x-cif": ["cif"],
|
|
4774
|
+
"chemical/x-cmdf": ["cmdf"],
|
|
4775
|
+
"chemical/x-cml": ["cml"],
|
|
4776
|
+
"chemical/x-csml": ["csml"],
|
|
4777
|
+
"chemical/x-xyz": ["xyz"],
|
|
4778
|
+
"image/prs.btif": ["btif", "btf"],
|
|
4779
|
+
"image/prs.pti": ["pti"],
|
|
4780
|
+
"image/vnd.adobe.photoshop": ["psd"],
|
|
4781
|
+
"image/vnd.airzip.accelerator.azv": ["azv"],
|
|
4782
|
+
"image/vnd.blockfact.facti": ["facti"],
|
|
4783
|
+
"image/vnd.dece.graphic": ["uvi", "uvvi", "uvg", "uvvg"],
|
|
4784
|
+
"image/vnd.djvu": ["djvu", "djv"],
|
|
4785
|
+
"image/vnd.dvb.subtitle": ["*sub"],
|
|
4786
|
+
"image/vnd.dwg": ["dwg"],
|
|
4787
|
+
"image/vnd.dxf": ["dxf"],
|
|
4788
|
+
"image/vnd.fastbidsheet": ["fbs"],
|
|
4789
|
+
"image/vnd.fpx": ["fpx"],
|
|
4790
|
+
"image/vnd.fst": ["fst"],
|
|
4791
|
+
"image/vnd.fujixerox.edmics-mmr": ["mmr"],
|
|
4792
|
+
"image/vnd.fujixerox.edmics-rlc": ["rlc"],
|
|
4793
|
+
"image/vnd.microsoft.icon": ["ico"],
|
|
4794
|
+
"image/vnd.ms-dds": ["dds"],
|
|
4795
|
+
"image/vnd.ms-modi": ["mdi"],
|
|
4796
|
+
"image/vnd.ms-photo": ["wdp"],
|
|
4797
|
+
"image/vnd.net-fpx": ["npx"],
|
|
4798
|
+
"image/vnd.pco.b16": ["b16"],
|
|
4799
|
+
"image/vnd.tencent.tap": ["tap"],
|
|
4800
|
+
"image/vnd.valve.source.texture": ["vtf"],
|
|
4801
|
+
"image/vnd.wap.wbmp": ["wbmp"],
|
|
4802
|
+
"image/vnd.xiff": ["xif"],
|
|
4803
|
+
"image/vnd.zbrush.pcx": ["pcx"],
|
|
4804
|
+
"image/x-3ds": ["3ds"],
|
|
4805
|
+
"image/x-adobe-dng": ["dng"],
|
|
4806
|
+
"image/x-cmu-raster": ["ras"],
|
|
4807
|
+
"image/x-cmx": ["cmx"],
|
|
4808
|
+
"image/x-freehand": ["fh", "fhc", "fh4", "fh5", "fh7"],
|
|
4809
|
+
"image/x-icon": ["*ico"],
|
|
4810
|
+
"image/x-jng": ["jng"],
|
|
4811
|
+
"image/x-mrsid-image": ["sid"],
|
|
4812
|
+
"image/x-ms-bmp": ["*bmp"],
|
|
4813
|
+
"image/x-pcx": ["*pcx"],
|
|
4814
|
+
"image/x-pict": ["pic", "pct"],
|
|
4815
|
+
"image/x-portable-anymap": ["pnm"],
|
|
4816
|
+
"image/x-portable-bitmap": ["pbm"],
|
|
4817
|
+
"image/x-portable-graymap": ["pgm"],
|
|
4818
|
+
"image/x-portable-pixmap": ["ppm"],
|
|
4819
|
+
"image/x-rgb": ["rgb"],
|
|
4820
|
+
"image/x-tga": ["tga"],
|
|
4821
|
+
"image/x-xbitmap": ["xbm"],
|
|
4822
|
+
"image/x-xpixmap": ["xpm"],
|
|
4823
|
+
"image/x-xwindowdump": ["xwd"],
|
|
4824
|
+
"message/vnd.wfa.wsc": ["wsc"],
|
|
4825
|
+
"model/vnd.bary": ["bary"],
|
|
4826
|
+
"model/vnd.cld": ["cld"],
|
|
4827
|
+
"model/vnd.collada+xml": ["dae"],
|
|
4828
|
+
"model/vnd.dwf": ["dwf"],
|
|
4829
|
+
"model/vnd.gdl": ["gdl"],
|
|
4830
|
+
"model/vnd.gtw": ["gtw"],
|
|
4831
|
+
"model/vnd.mts": ["*mts"],
|
|
4832
|
+
"model/vnd.opengex": ["ogex"],
|
|
4833
|
+
"model/vnd.parasolid.transmit.binary": ["x_b"],
|
|
4834
|
+
"model/vnd.parasolid.transmit.text": ["x_t"],
|
|
4835
|
+
"model/vnd.pytha.pyox": ["pyo", "pyox"],
|
|
4836
|
+
"model/vnd.sap.vds": ["vds"],
|
|
4837
|
+
"model/vnd.usda": ["usda"],
|
|
4838
|
+
"model/vnd.usdz+zip": ["usdz"],
|
|
4839
|
+
"model/vnd.valve.source.compiled-map": ["bsp"],
|
|
4840
|
+
"model/vnd.vtu": ["vtu"],
|
|
4841
|
+
"text/prs.lines.tag": ["dsc"],
|
|
4842
|
+
"text/vnd.curl": ["curl"],
|
|
4843
|
+
"text/vnd.curl.dcurl": ["dcurl"],
|
|
4844
|
+
"text/vnd.curl.mcurl": ["mcurl"],
|
|
4845
|
+
"text/vnd.curl.scurl": ["scurl"],
|
|
4846
|
+
"text/vnd.dvb.subtitle": ["sub"],
|
|
4847
|
+
"text/vnd.familysearch.gedcom": ["ged"],
|
|
4848
|
+
"text/vnd.fly": ["fly"],
|
|
4849
|
+
"text/vnd.fmi.flexstor": ["flx"],
|
|
4850
|
+
"text/vnd.graphviz": ["gv"],
|
|
4851
|
+
"text/vnd.in3d.3dml": ["3dml"],
|
|
4852
|
+
"text/vnd.in3d.spot": ["spot"],
|
|
4853
|
+
"text/vnd.sun.j2me.app-descriptor": ["jad"],
|
|
4854
|
+
"text/vnd.wap.wml": ["wml"],
|
|
4855
|
+
"text/vnd.wap.wmlscript": ["wmls"],
|
|
4856
|
+
"text/x-asm": ["s", "asm"],
|
|
4857
|
+
"text/x-c": ["c", "cc", "cxx", "cpp", "h", "hh", "dic"],
|
|
4858
|
+
"text/x-component": ["htc"],
|
|
4859
|
+
"text/x-fortran": ["f", "for", "f77", "f90"],
|
|
4860
|
+
"text/x-handlebars-template": ["hbs"],
|
|
4861
|
+
"text/x-java-source": ["java"],
|
|
4862
|
+
"text/x-lua": ["lua"],
|
|
4863
|
+
"text/x-markdown": ["mkd"],
|
|
4864
|
+
"text/x-nfo": ["nfo"],
|
|
4865
|
+
"text/x-opml": ["opml"],
|
|
4866
|
+
"text/x-org": ["*org"],
|
|
4867
|
+
"text/x-pascal": ["p", "pas"],
|
|
4868
|
+
"text/x-processing": ["pde"],
|
|
4869
|
+
"text/x-sass": ["sass"],
|
|
4870
|
+
"text/x-scss": ["scss"],
|
|
4871
|
+
"text/x-setext": ["etx"],
|
|
4872
|
+
"text/x-sfv": ["sfv"],
|
|
4873
|
+
"text/x-suse-ymp": ["ymp"],
|
|
4874
|
+
"text/x-uuencode": ["uu"],
|
|
4875
|
+
"text/x-vcalendar": ["vcs"],
|
|
4876
|
+
"text/x-vcard": ["vcf"],
|
|
4877
|
+
"video/vnd.dece.hd": ["uvh", "uvvh"],
|
|
4878
|
+
"video/vnd.dece.mobile": ["uvm", "uvvm"],
|
|
4879
|
+
"video/vnd.dece.pd": ["uvp", "uvvp"],
|
|
4880
|
+
"video/vnd.dece.sd": ["uvs", "uvvs"],
|
|
4881
|
+
"video/vnd.dece.video": ["uvv", "uvvv"],
|
|
4882
|
+
"video/vnd.dvb.file": ["dvb"],
|
|
4883
|
+
"video/vnd.fvt": ["fvt"],
|
|
4884
|
+
"video/vnd.mpegurl": ["mxu", "m4u"],
|
|
4885
|
+
"video/vnd.ms-playready.media.pyv": ["pyv"],
|
|
4886
|
+
"video/vnd.uvvu.mp4": ["uvu", "uvvu"],
|
|
4887
|
+
"video/vnd.vivo": ["viv"],
|
|
4888
|
+
"video/x-f4v": ["f4v"],
|
|
4889
|
+
"video/x-fli": ["fli"],
|
|
4890
|
+
"video/x-flv": ["flv"],
|
|
4891
|
+
"video/x-m4v": ["m4v"],
|
|
4892
|
+
"video/x-matroska": ["mkv", "mk3d", "mks"],
|
|
4893
|
+
"video/x-mng": ["mng"],
|
|
4894
|
+
"video/x-ms-asf": ["asf", "asx"],
|
|
4895
|
+
"video/x-ms-vob": ["vob"],
|
|
4896
|
+
"video/x-ms-wm": ["wm"],
|
|
4897
|
+
"video/x-ms-wmv": ["wmv"],
|
|
4898
|
+
"video/x-ms-wmx": ["wmx"],
|
|
4899
|
+
"video/x-ms-wvx": ["wvx"],
|
|
4900
|
+
"video/x-msvideo": ["avi"],
|
|
4901
|
+
"video/x-sgi-movie": ["movie"],
|
|
4902
|
+
"video/x-smv": ["smv"],
|
|
4903
|
+
"x-conference/x-cooltalk": ["ice"]
|
|
4904
|
+
};
|
|
4905
|
+
Object.freeze(types);
|
|
4906
|
+
var other_default = types;
|
|
4907
|
+
|
|
4908
|
+
// ../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/types/standard.js
|
|
4909
|
+
var types2 = {
|
|
4910
|
+
"application/andrew-inset": ["ez"],
|
|
4911
|
+
"application/appinstaller": ["appinstaller"],
|
|
4912
|
+
"application/applixware": ["aw"],
|
|
4913
|
+
"application/appx": ["appx"],
|
|
4914
|
+
"application/appxbundle": ["appxbundle"],
|
|
4915
|
+
"application/atom+xml": ["atom"],
|
|
4916
|
+
"application/atomcat+xml": ["atomcat"],
|
|
4917
|
+
"application/atomdeleted+xml": ["atomdeleted"],
|
|
4918
|
+
"application/atomsvc+xml": ["atomsvc"],
|
|
4919
|
+
"application/atsc-dwd+xml": ["dwd"],
|
|
4920
|
+
"application/atsc-held+xml": ["held"],
|
|
4921
|
+
"application/atsc-rsat+xml": ["rsat"],
|
|
4922
|
+
"application/automationml-aml+xml": ["aml"],
|
|
4923
|
+
"application/automationml-amlx+zip": ["amlx"],
|
|
4924
|
+
"application/bdoc": ["bdoc"],
|
|
4925
|
+
"application/calendar+xml": ["xcs"],
|
|
4926
|
+
"application/ccxml+xml": ["ccxml"],
|
|
4927
|
+
"application/cdfx+xml": ["cdfx"],
|
|
4928
|
+
"application/cdmi-capability": ["cdmia"],
|
|
4929
|
+
"application/cdmi-container": ["cdmic"],
|
|
4930
|
+
"application/cdmi-domain": ["cdmid"],
|
|
4931
|
+
"application/cdmi-object": ["cdmio"],
|
|
4932
|
+
"application/cdmi-queue": ["cdmiq"],
|
|
4933
|
+
"application/cpl+xml": ["cpl"],
|
|
4934
|
+
"application/cu-seeme": ["cu"],
|
|
4935
|
+
"application/cwl": ["cwl"],
|
|
4936
|
+
"application/dash+xml": ["mpd"],
|
|
4937
|
+
"application/dash-patch+xml": ["mpp"],
|
|
4938
|
+
"application/davmount+xml": ["davmount"],
|
|
4939
|
+
"application/dicom": ["dcm"],
|
|
4940
|
+
"application/docbook+xml": ["dbk"],
|
|
4941
|
+
"application/dssc+der": ["dssc"],
|
|
4942
|
+
"application/dssc+xml": ["xdssc"],
|
|
4943
|
+
"application/ecmascript": ["ecma"],
|
|
4944
|
+
"application/emma+xml": ["emma"],
|
|
4945
|
+
"application/emotionml+xml": ["emotionml"],
|
|
4946
|
+
"application/epub+zip": ["epub"],
|
|
4947
|
+
"application/exi": ["exi"],
|
|
4948
|
+
"application/express": ["exp"],
|
|
4949
|
+
"application/fdf": ["fdf"],
|
|
4950
|
+
"application/fdt+xml": ["fdt"],
|
|
4951
|
+
"application/font-tdpfr": ["pfr"],
|
|
4952
|
+
"application/geo+json": ["geojson"],
|
|
4953
|
+
"application/gml+xml": ["gml"],
|
|
4954
|
+
"application/gpx+xml": ["gpx"],
|
|
4955
|
+
"application/gxf": ["gxf"],
|
|
4956
|
+
"application/gzip": ["gz"],
|
|
4957
|
+
"application/hjson": ["hjson"],
|
|
4958
|
+
"application/hyperstudio": ["stk"],
|
|
4959
|
+
"application/inkml+xml": ["ink", "inkml"],
|
|
4960
|
+
"application/ipfix": ["ipfix"],
|
|
4961
|
+
"application/its+xml": ["its"],
|
|
4962
|
+
"application/java-archive": ["jar", "war", "ear"],
|
|
4963
|
+
"application/java-serialized-object": ["ser"],
|
|
4964
|
+
"application/java-vm": ["class"],
|
|
4965
|
+
"application/javascript": ["*js"],
|
|
4966
|
+
"application/json": ["json", "map"],
|
|
4967
|
+
"application/json5": ["json5"],
|
|
4968
|
+
"application/jsonml+json": ["jsonml"],
|
|
4969
|
+
"application/ld+json": ["jsonld"],
|
|
4970
|
+
"application/lgr+xml": ["lgr"],
|
|
4971
|
+
"application/lost+xml": ["lostxml"],
|
|
4972
|
+
"application/mac-binhex40": ["hqx"],
|
|
4973
|
+
"application/mac-compactpro": ["cpt"],
|
|
4974
|
+
"application/mads+xml": ["mads"],
|
|
4975
|
+
"application/manifest+json": ["webmanifest"],
|
|
4976
|
+
"application/marc": ["mrc"],
|
|
4977
|
+
"application/marcxml+xml": ["mrcx"],
|
|
4978
|
+
"application/mathematica": ["ma", "nb", "mb"],
|
|
4979
|
+
"application/mathml+xml": ["mathml"],
|
|
4980
|
+
"application/mbox": ["mbox"],
|
|
4981
|
+
"application/media-policy-dataset+xml": ["mpf"],
|
|
4982
|
+
"application/mediaservercontrol+xml": ["mscml"],
|
|
4983
|
+
"application/metalink+xml": ["metalink"],
|
|
4984
|
+
"application/metalink4+xml": ["meta4"],
|
|
4985
|
+
"application/mets+xml": ["mets"],
|
|
4986
|
+
"application/mmt-aei+xml": ["maei"],
|
|
4987
|
+
"application/mmt-usd+xml": ["musd"],
|
|
4988
|
+
"application/mods+xml": ["mods"],
|
|
4989
|
+
"application/mp21": ["m21", "mp21"],
|
|
4990
|
+
"application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"],
|
|
4991
|
+
"application/msix": ["msix"],
|
|
4992
|
+
"application/msixbundle": ["msixbundle"],
|
|
4993
|
+
"application/msword": ["doc", "dot"],
|
|
4994
|
+
"application/mxf": ["mxf"],
|
|
4995
|
+
"application/n-quads": ["nq"],
|
|
4996
|
+
"application/n-triples": ["nt"],
|
|
4997
|
+
"application/node": ["cjs"],
|
|
4998
|
+
"application/octet-stream": [
|
|
4999
|
+
"bin",
|
|
5000
|
+
"dms",
|
|
5001
|
+
"lrf",
|
|
5002
|
+
"mar",
|
|
5003
|
+
"so",
|
|
5004
|
+
"dist",
|
|
5005
|
+
"distz",
|
|
5006
|
+
"pkg",
|
|
5007
|
+
"bpk",
|
|
5008
|
+
"dump",
|
|
5009
|
+
"elc",
|
|
5010
|
+
"deploy",
|
|
5011
|
+
"exe",
|
|
5012
|
+
"dll",
|
|
5013
|
+
"deb",
|
|
5014
|
+
"dmg",
|
|
5015
|
+
"iso",
|
|
5016
|
+
"img",
|
|
5017
|
+
"msi",
|
|
5018
|
+
"msp",
|
|
5019
|
+
"msm",
|
|
5020
|
+
"buffer"
|
|
5021
|
+
],
|
|
5022
|
+
"application/oda": ["oda"],
|
|
5023
|
+
"application/oebps-package+xml": ["opf"],
|
|
5024
|
+
"application/ogg": ["ogx"],
|
|
5025
|
+
"application/omdoc+xml": ["omdoc"],
|
|
5026
|
+
"application/onenote": [
|
|
5027
|
+
"onetoc",
|
|
5028
|
+
"onetoc2",
|
|
5029
|
+
"onetmp",
|
|
5030
|
+
"onepkg",
|
|
5031
|
+
"one",
|
|
5032
|
+
"onea"
|
|
5033
|
+
],
|
|
5034
|
+
"application/oxps": ["oxps"],
|
|
5035
|
+
"application/p2p-overlay+xml": ["relo"],
|
|
5036
|
+
"application/patch-ops-error+xml": ["xer"],
|
|
5037
|
+
"application/pdf": ["pdf"],
|
|
5038
|
+
"application/pgp-encrypted": ["pgp"],
|
|
5039
|
+
"application/pgp-keys": ["asc"],
|
|
5040
|
+
"application/pgp-signature": ["sig", "*asc"],
|
|
5041
|
+
"application/pics-rules": ["prf"],
|
|
5042
|
+
"application/pkcs10": ["p10"],
|
|
5043
|
+
"application/pkcs7-mime": ["p7m", "p7c"],
|
|
5044
|
+
"application/pkcs7-signature": ["p7s"],
|
|
5045
|
+
"application/pkcs8": ["p8"],
|
|
5046
|
+
"application/pkix-attr-cert": ["ac"],
|
|
5047
|
+
"application/pkix-cert": ["cer"],
|
|
5048
|
+
"application/pkix-crl": ["crl"],
|
|
5049
|
+
"application/pkix-pkipath": ["pkipath"],
|
|
5050
|
+
"application/pkixcmp": ["pki"],
|
|
5051
|
+
"application/pls+xml": ["pls"],
|
|
5052
|
+
"application/postscript": ["ai", "eps", "ps"],
|
|
5053
|
+
"application/provenance+xml": ["provx"],
|
|
5054
|
+
"application/pskc+xml": ["pskcxml"],
|
|
5055
|
+
"application/raml+yaml": ["raml"],
|
|
5056
|
+
"application/rdf+xml": ["rdf", "owl"],
|
|
5057
|
+
"application/reginfo+xml": ["rif"],
|
|
5058
|
+
"application/relax-ng-compact-syntax": ["rnc"],
|
|
5059
|
+
"application/resource-lists+xml": ["rl"],
|
|
5060
|
+
"application/resource-lists-diff+xml": ["rld"],
|
|
5061
|
+
"application/rls-services+xml": ["rs"],
|
|
5062
|
+
"application/route-apd+xml": ["rapd"],
|
|
5063
|
+
"application/route-s-tsid+xml": ["sls"],
|
|
5064
|
+
"application/route-usd+xml": ["rusd"],
|
|
5065
|
+
"application/rpki-ghostbusters": ["gbr"],
|
|
5066
|
+
"application/rpki-manifest": ["mft"],
|
|
5067
|
+
"application/rpki-roa": ["roa"],
|
|
5068
|
+
"application/rsd+xml": ["rsd"],
|
|
5069
|
+
"application/rss+xml": ["rss"],
|
|
5070
|
+
"application/rtf": ["rtf"],
|
|
5071
|
+
"application/sbml+xml": ["sbml"],
|
|
5072
|
+
"application/scvp-cv-request": ["scq"],
|
|
5073
|
+
"application/scvp-cv-response": ["scs"],
|
|
5074
|
+
"application/scvp-vp-request": ["spq"],
|
|
5075
|
+
"application/scvp-vp-response": ["spp"],
|
|
5076
|
+
"application/sdp": ["sdp"],
|
|
5077
|
+
"application/senml+xml": ["senmlx"],
|
|
5078
|
+
"application/sensml+xml": ["sensmlx"],
|
|
5079
|
+
"application/set-payment-initiation": ["setpay"],
|
|
5080
|
+
"application/set-registration-initiation": ["setreg"],
|
|
5081
|
+
"application/shf+xml": ["shf"],
|
|
5082
|
+
"application/sieve": ["siv", "sieve"],
|
|
5083
|
+
"application/smil+xml": ["smi", "smil"],
|
|
5084
|
+
"application/sparql-query": ["rq"],
|
|
5085
|
+
"application/sparql-results+xml": ["srx"],
|
|
5086
|
+
"application/sql": ["sql"],
|
|
5087
|
+
"application/srgs": ["gram"],
|
|
5088
|
+
"application/srgs+xml": ["grxml"],
|
|
5089
|
+
"application/sru+xml": ["sru"],
|
|
5090
|
+
"application/ssdl+xml": ["ssdl"],
|
|
5091
|
+
"application/ssml+xml": ["ssml"],
|
|
5092
|
+
"application/swid+xml": ["swidtag"],
|
|
5093
|
+
"application/tei+xml": ["tei", "teicorpus"],
|
|
5094
|
+
"application/thraud+xml": ["tfi"],
|
|
5095
|
+
"application/timestamped-data": ["tsd"],
|
|
5096
|
+
"application/toml": ["toml"],
|
|
5097
|
+
"application/trig": ["trig"],
|
|
5098
|
+
"application/ttml+xml": ["ttml"],
|
|
5099
|
+
"application/ubjson": ["ubj"],
|
|
5100
|
+
"application/urc-ressheet+xml": ["rsheet"],
|
|
5101
|
+
"application/urc-targetdesc+xml": ["td"],
|
|
5102
|
+
"application/voicexml+xml": ["vxml"],
|
|
5103
|
+
"application/wasm": ["wasm"],
|
|
5104
|
+
"application/watcherinfo+xml": ["wif"],
|
|
5105
|
+
"application/widget": ["wgt"],
|
|
5106
|
+
"application/winhlp": ["hlp"],
|
|
5107
|
+
"application/wsdl+xml": ["wsdl"],
|
|
5108
|
+
"application/wspolicy+xml": ["wspolicy"],
|
|
5109
|
+
"application/xaml+xml": ["xaml"],
|
|
5110
|
+
"application/xcap-att+xml": ["xav"],
|
|
5111
|
+
"application/xcap-caps+xml": ["xca"],
|
|
5112
|
+
"application/xcap-diff+xml": ["xdf"],
|
|
5113
|
+
"application/xcap-el+xml": ["xel"],
|
|
5114
|
+
"application/xcap-ns+xml": ["xns"],
|
|
5115
|
+
"application/xenc+xml": ["xenc"],
|
|
5116
|
+
"application/xfdf": ["xfdf"],
|
|
5117
|
+
"application/xhtml+xml": ["xhtml", "xht"],
|
|
5118
|
+
"application/xliff+xml": ["xlf"],
|
|
5119
|
+
"application/xml": ["xml", "xsl", "xsd", "rng"],
|
|
5120
|
+
"application/xml-dtd": ["dtd"],
|
|
5121
|
+
"application/xop+xml": ["xop"],
|
|
5122
|
+
"application/xproc+xml": ["xpl"],
|
|
5123
|
+
"application/xslt+xml": ["*xsl", "xslt"],
|
|
5124
|
+
"application/xspf+xml": ["xspf"],
|
|
5125
|
+
"application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"],
|
|
5126
|
+
"application/yang": ["yang"],
|
|
5127
|
+
"application/yin+xml": ["yin"],
|
|
5128
|
+
"application/zip": ["zip"],
|
|
5129
|
+
"application/zip+dotlottie": ["lottie"],
|
|
5130
|
+
"audio/3gpp": ["*3gpp"],
|
|
5131
|
+
"audio/aac": ["adts", "aac"],
|
|
5132
|
+
"audio/adpcm": ["adp"],
|
|
5133
|
+
"audio/amr": ["amr"],
|
|
5134
|
+
"audio/basic": ["au", "snd"],
|
|
5135
|
+
"audio/midi": ["mid", "midi", "kar", "rmi"],
|
|
5136
|
+
"audio/mobile-xmf": ["mxmf"],
|
|
5137
|
+
"audio/mp3": ["*mp3"],
|
|
5138
|
+
"audio/mp4": ["m4a", "mp4a", "m4b"],
|
|
5139
|
+
"audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"],
|
|
5140
|
+
"audio/ogg": ["oga", "ogg", "spx", "opus"],
|
|
5141
|
+
"audio/s3m": ["s3m"],
|
|
5142
|
+
"audio/silk": ["sil"],
|
|
5143
|
+
"audio/wav": ["wav"],
|
|
5144
|
+
"audio/wave": ["*wav"],
|
|
5145
|
+
"audio/webm": ["weba"],
|
|
5146
|
+
"audio/xm": ["xm"],
|
|
5147
|
+
"font/collection": ["ttc"],
|
|
5148
|
+
"font/otf": ["otf"],
|
|
5149
|
+
"font/ttf": ["ttf"],
|
|
5150
|
+
"font/woff": ["woff"],
|
|
5151
|
+
"font/woff2": ["woff2"],
|
|
5152
|
+
"image/aces": ["exr"],
|
|
5153
|
+
"image/apng": ["apng"],
|
|
5154
|
+
"image/avci": ["avci"],
|
|
5155
|
+
"image/avcs": ["avcs"],
|
|
5156
|
+
"image/avif": ["avif"],
|
|
5157
|
+
"image/bmp": ["bmp", "dib"],
|
|
5158
|
+
"image/cgm": ["cgm"],
|
|
5159
|
+
"image/dicom-rle": ["drle"],
|
|
5160
|
+
"image/dpx": ["dpx"],
|
|
5161
|
+
"image/emf": ["emf"],
|
|
5162
|
+
"image/fits": ["fits"],
|
|
5163
|
+
"image/g3fax": ["g3"],
|
|
5164
|
+
"image/gif": ["gif"],
|
|
5165
|
+
"image/heic": ["heic"],
|
|
5166
|
+
"image/heic-sequence": ["heics"],
|
|
5167
|
+
"image/heif": ["heif"],
|
|
5168
|
+
"image/heif-sequence": ["heifs"],
|
|
5169
|
+
"image/hej2k": ["hej2"],
|
|
5170
|
+
"image/ief": ["ief"],
|
|
5171
|
+
"image/jaii": ["jaii"],
|
|
5172
|
+
"image/jais": ["jais"],
|
|
5173
|
+
"image/jls": ["jls"],
|
|
5174
|
+
"image/jp2": ["jp2", "jpg2"],
|
|
5175
|
+
"image/jpeg": ["jpg", "jpeg", "jpe"],
|
|
5176
|
+
"image/jph": ["jph"],
|
|
5177
|
+
"image/jphc": ["jhc"],
|
|
5178
|
+
"image/jpm": ["jpm", "jpgm"],
|
|
5179
|
+
"image/jpx": ["jpx", "jpf"],
|
|
5180
|
+
"image/jxl": ["jxl"],
|
|
5181
|
+
"image/jxr": ["jxr"],
|
|
5182
|
+
"image/jxra": ["jxra"],
|
|
5183
|
+
"image/jxrs": ["jxrs"],
|
|
5184
|
+
"image/jxs": ["jxs"],
|
|
5185
|
+
"image/jxsc": ["jxsc"],
|
|
5186
|
+
"image/jxsi": ["jxsi"],
|
|
5187
|
+
"image/jxss": ["jxss"],
|
|
5188
|
+
"image/ktx": ["ktx"],
|
|
5189
|
+
"image/ktx2": ["ktx2"],
|
|
5190
|
+
"image/pjpeg": ["jfif"],
|
|
5191
|
+
"image/png": ["png"],
|
|
5192
|
+
"image/sgi": ["sgi"],
|
|
5193
|
+
"image/svg+xml": ["svg", "svgz"],
|
|
5194
|
+
"image/t38": ["t38"],
|
|
5195
|
+
"image/tiff": ["tif", "tiff"],
|
|
5196
|
+
"image/tiff-fx": ["tfx"],
|
|
5197
|
+
"image/webp": ["webp"],
|
|
5198
|
+
"image/wmf": ["wmf"],
|
|
5199
|
+
"message/disposition-notification": ["disposition-notification"],
|
|
5200
|
+
"message/global": ["u8msg"],
|
|
5201
|
+
"message/global-delivery-status": ["u8dsn"],
|
|
5202
|
+
"message/global-disposition-notification": ["u8mdn"],
|
|
5203
|
+
"message/global-headers": ["u8hdr"],
|
|
5204
|
+
"message/rfc822": ["eml", "mime", "mht", "mhtml"],
|
|
5205
|
+
"model/3mf": ["3mf"],
|
|
5206
|
+
"model/gltf+json": ["gltf"],
|
|
5207
|
+
"model/gltf-binary": ["glb"],
|
|
5208
|
+
"model/iges": ["igs", "iges"],
|
|
5209
|
+
"model/jt": ["jt"],
|
|
5210
|
+
"model/mesh": ["msh", "mesh", "silo"],
|
|
5211
|
+
"model/mtl": ["mtl"],
|
|
5212
|
+
"model/obj": ["obj"],
|
|
5213
|
+
"model/prc": ["prc"],
|
|
5214
|
+
"model/step": ["step", "stp", "stpnc", "p21", "210"],
|
|
5215
|
+
"model/step+xml": ["stpx"],
|
|
5216
|
+
"model/step+zip": ["stpz"],
|
|
5217
|
+
"model/step-xml+zip": ["stpxz"],
|
|
5218
|
+
"model/stl": ["stl"],
|
|
5219
|
+
"model/u3d": ["u3d"],
|
|
5220
|
+
"model/vrml": ["wrl", "vrml"],
|
|
5221
|
+
"model/x3d+binary": ["*x3db", "x3dbz"],
|
|
5222
|
+
"model/x3d+fastinfoset": ["x3db"],
|
|
5223
|
+
"model/x3d+vrml": ["*x3dv", "x3dvz"],
|
|
5224
|
+
"model/x3d+xml": ["x3d", "x3dz"],
|
|
5225
|
+
"model/x3d-vrml": ["x3dv"],
|
|
5226
|
+
"text/cache-manifest": ["appcache", "manifest"],
|
|
5227
|
+
"text/calendar": ["ics", "ifb"],
|
|
5228
|
+
"text/coffeescript": ["coffee", "litcoffee"],
|
|
5229
|
+
"text/css": ["css"],
|
|
5230
|
+
"text/csv": ["csv"],
|
|
5231
|
+
"text/html": ["html", "htm", "shtml"],
|
|
5232
|
+
"text/jade": ["jade"],
|
|
5233
|
+
"text/javascript": ["js", "mjs"],
|
|
5234
|
+
"text/jsx": ["jsx"],
|
|
5235
|
+
"text/less": ["less"],
|
|
5236
|
+
"text/markdown": ["md", "markdown"],
|
|
5237
|
+
"text/mathml": ["mml"],
|
|
5238
|
+
"text/mdx": ["mdx"],
|
|
5239
|
+
"text/n3": ["n3"],
|
|
5240
|
+
"text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"],
|
|
5241
|
+
"text/richtext": ["rtx"],
|
|
5242
|
+
"text/rtf": ["*rtf"],
|
|
5243
|
+
"text/sgml": ["sgml", "sgm"],
|
|
5244
|
+
"text/shex": ["shex"],
|
|
5245
|
+
"text/slim": ["slim", "slm"],
|
|
5246
|
+
"text/spdx": ["spdx"],
|
|
5247
|
+
"text/stylus": ["stylus", "styl"],
|
|
5248
|
+
"text/tab-separated-values": ["tsv"],
|
|
5249
|
+
"text/troff": ["t", "tr", "roff", "man", "me", "ms"],
|
|
5250
|
+
"text/turtle": ["ttl"],
|
|
5251
|
+
"text/uri-list": ["uri", "uris", "urls"],
|
|
5252
|
+
"text/vcard": ["vcard"],
|
|
5253
|
+
"text/vtt": ["vtt"],
|
|
5254
|
+
"text/wgsl": ["wgsl"],
|
|
5255
|
+
"text/xml": ["*xml"],
|
|
5256
|
+
"text/yaml": ["yaml", "yml"],
|
|
5257
|
+
"video/3gpp": ["3gp", "3gpp"],
|
|
5258
|
+
"video/3gpp2": ["3g2"],
|
|
5259
|
+
"video/h261": ["h261"],
|
|
5260
|
+
"video/h263": ["h263"],
|
|
5261
|
+
"video/h264": ["h264"],
|
|
5262
|
+
"video/iso.segment": ["m4s"],
|
|
5263
|
+
"video/jpeg": ["jpgv"],
|
|
5264
|
+
"video/jpm": ["*jpm", "*jpgm"],
|
|
5265
|
+
"video/mj2": ["mj2", "mjp2"],
|
|
5266
|
+
"video/mp2t": ["ts", "m2t", "m2ts", "mts"],
|
|
5267
|
+
"video/mp4": ["mp4", "mp4v", "mpg4"],
|
|
5268
|
+
"video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"],
|
|
5269
|
+
"video/ogg": ["ogv"],
|
|
5270
|
+
"video/quicktime": ["qt", "mov"],
|
|
5271
|
+
"video/webm": ["webm"]
|
|
5272
|
+
};
|
|
5273
|
+
Object.freeze(types2);
|
|
5274
|
+
var standard_default = types2;
|
|
5275
|
+
|
|
5276
|
+
// ../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/src/Mime.js
|
|
5277
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
5278
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5279
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5280
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5281
|
+
};
|
|
5282
|
+
var _Mime_extensionToType;
|
|
5283
|
+
var _Mime_typeToExtension;
|
|
5284
|
+
var _Mime_typeToExtensions;
|
|
5285
|
+
var Mime = class {
|
|
5286
|
+
constructor(...args) {
|
|
5287
|
+
_Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
|
|
5288
|
+
_Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
|
|
5289
|
+
_Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
|
|
5290
|
+
for (const arg of args) {
|
|
5291
|
+
this.define(arg);
|
|
4214
5292
|
}
|
|
4215
|
-
pendingFragments.push(chunk);
|
|
4216
|
-
const input = pendingFragments.join("");
|
|
4217
|
-
pendingFragments.length = 0, pendingFragmentsLength = 0;
|
|
4218
|
-
const trailing = processLines(input);
|
|
4219
|
-
trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
|
|
4220
|
-
}
|
|
4221
|
-
function checkBufferSize() {
|
|
4222
|
-
maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
|
|
4223
|
-
new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
|
|
4224
|
-
type: "max-buffer-size-exceeded"
|
|
4225
|
-
})
|
|
4226
|
-
)));
|
|
4227
5293
|
}
|
|
4228
|
-
|
|
4229
|
-
let
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
5294
|
+
define(typeMap, force = false) {
|
|
5295
|
+
for (let [type, extensions] of Object.entries(typeMap)) {
|
|
5296
|
+
type = type.toLowerCase();
|
|
5297
|
+
extensions = extensions.map((ext) => ext.toLowerCase());
|
|
5298
|
+
if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) {
|
|
5299
|
+
__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
|
|
5300
|
+
}
|
|
5301
|
+
const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
|
|
5302
|
+
let first = true;
|
|
5303
|
+
for (let extension2 of extensions) {
|
|
5304
|
+
const starred = extension2.startsWith("*");
|
|
5305
|
+
extension2 = starred ? extension2.slice(1) : extension2;
|
|
5306
|
+
allExtensions?.add(extension2);
|
|
5307
|
+
if (first) {
|
|
5308
|
+
__classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension2);
|
|
5309
|
+
}
|
|
5310
|
+
first = false;
|
|
5311
|
+
if (starred)
|
|
4237
5312
|
continue;
|
|
5313
|
+
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension2);
|
|
5314
|
+
if (currentType && currentType != type && !force) {
|
|
5315
|
+
throw new Error(`"${type} -> ${extension2}" conflicts with "${currentType} -> ${extension2}". Pass \`force=true\` to override this definition.`);
|
|
4238
5316
|
}
|
|
4239
|
-
|
|
4240
|
-
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
4241
|
-
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
4242
|
-
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
4243
|
-
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
4244
|
-
`, searchIndex);
|
|
4245
|
-
continue;
|
|
4246
|
-
}
|
|
4247
|
-
data = dataLines === 0 ? value : `${data}
|
|
4248
|
-
${value}`, dataLines++;
|
|
4249
|
-
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
4250
|
-
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
4251
|
-
lfIndex
|
|
4252
|
-
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
4253
|
-
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
4254
|
-
`, searchIndex);
|
|
4255
|
-
}
|
|
4256
|
-
return chunk.slice(searchIndex);
|
|
4257
|
-
}
|
|
4258
|
-
for (; searchIndex < chunk.length; ) {
|
|
4259
|
-
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
4260
|
-
`, searchIndex);
|
|
4261
|
-
let lineEnd = -1;
|
|
4262
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
4263
|
-
break;
|
|
4264
|
-
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
4265
|
-
}
|
|
4266
|
-
return chunk.slice(searchIndex);
|
|
4267
|
-
}
|
|
4268
|
-
function parseLine(chunk, start, end) {
|
|
4269
|
-
if (start === end) {
|
|
4270
|
-
dispatchEvent();
|
|
4271
|
-
return;
|
|
4272
|
-
}
|
|
4273
|
-
const firstCharCode = chunk.charCodeAt(start);
|
|
4274
|
-
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
4275
|
-
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
4276
|
-
data = dataLines === 0 ? value2 : `${data}
|
|
4277
|
-
${value2}`, dataLines++;
|
|
4278
|
-
return;
|
|
4279
|
-
}
|
|
4280
|
-
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
4281
|
-
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
4282
|
-
return;
|
|
4283
|
-
}
|
|
4284
|
-
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
4285
|
-
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
4286
|
-
id = value2.includes("\0") ? void 0 : value2;
|
|
4287
|
-
return;
|
|
4288
|
-
}
|
|
4289
|
-
if (firstCharCode === 58) {
|
|
4290
|
-
if (onComment) {
|
|
4291
|
-
const line2 = chunk.slice(start, end);
|
|
4292
|
-
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
5317
|
+
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension2, type);
|
|
4293
5318
|
}
|
|
4294
|
-
return;
|
|
4295
5319
|
}
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
const
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
new ParseError(
|
|
4328
|
-
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
4329
|
-
{ type: "unknown-field", field, value, line }
|
|
4330
|
-
)
|
|
4331
|
-
);
|
|
4332
|
-
break;
|
|
5320
|
+
return this;
|
|
5321
|
+
}
|
|
5322
|
+
getType(path) {
|
|
5323
|
+
if (typeof path !== "string")
|
|
5324
|
+
return null;
|
|
5325
|
+
const last = path.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
5326
|
+
const ext = last.replace(/^.*\./s, "").toLowerCase();
|
|
5327
|
+
const hasPath = last.length < path.length;
|
|
5328
|
+
const hasDot = ext.length < last.length - 1;
|
|
5329
|
+
if (!hasDot && hasPath)
|
|
5330
|
+
return null;
|
|
5331
|
+
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
5332
|
+
}
|
|
5333
|
+
getExtension(type) {
|
|
5334
|
+
if (typeof type !== "string")
|
|
5335
|
+
return null;
|
|
5336
|
+
type = type?.split?.(";")[0];
|
|
5337
|
+
return (type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null;
|
|
5338
|
+
}
|
|
5339
|
+
getAllExtensions(type) {
|
|
5340
|
+
if (typeof type !== "string")
|
|
5341
|
+
return null;
|
|
5342
|
+
return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
|
|
5343
|
+
}
|
|
5344
|
+
_freeze() {
|
|
5345
|
+
this.define = () => {
|
|
5346
|
+
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
5347
|
+
};
|
|
5348
|
+
Object.freeze(this);
|
|
5349
|
+
for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
|
|
5350
|
+
Object.freeze(extensions);
|
|
4333
5351
|
}
|
|
5352
|
+
return this;
|
|
4334
5353
|
}
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
4341
|
-
}
|
|
4342
|
-
function reset(options = {}) {
|
|
4343
|
-
if (options.consume && pendingFragments.length > 0) {
|
|
4344
|
-
const incompleteLine = pendingFragments.join("");
|
|
4345
|
-
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
4346
|
-
}
|
|
4347
|
-
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
|
|
5354
|
+
_getTestState() {
|
|
5355
|
+
return {
|
|
5356
|
+
types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
|
|
5357
|
+
extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f")
|
|
5358
|
+
};
|
|
4348
5359
|
}
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
4353
|
-
}
|
|
4354
|
-
function isEventPrefix(chunk, i, firstCharCode) {
|
|
4355
|
-
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
4356
|
-
}
|
|
5360
|
+
};
|
|
5361
|
+
_Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
|
|
5362
|
+
var Mime_default = Mime;
|
|
4357
5363
|
|
|
4358
|
-
// ../../node_modules/.pnpm/
|
|
4359
|
-
var
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
*
|
|
4376
|
-
* This is automatically called by Node.js when you `console.log` an instance of this class.
|
|
4377
|
-
*
|
|
4378
|
-
* @param _depth - The current depth
|
|
4379
|
-
* @param options - The options passed to `util.inspect`
|
|
4380
|
-
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
4381
|
-
* @returns A string representation of the error
|
|
4382
|
-
*/
|
|
4383
|
-
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
|
|
4384
|
-
return inspect(inspectableError(this), options);
|
|
4385
|
-
}
|
|
4386
|
-
/**
|
|
4387
|
-
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
4388
|
-
* when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
|
|
4389
|
-
* we explicitly include the properties in the `inspect` method.
|
|
4390
|
-
*
|
|
4391
|
-
* This is automatically called by Deno when you `console.log` an instance of this class.
|
|
4392
|
-
*
|
|
4393
|
-
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
4394
|
-
* @param options - The options passed to `Deno.inspect`
|
|
4395
|
-
* @returns A string representation of the error
|
|
4396
|
-
*/
|
|
4397
|
-
[/* @__PURE__ */ Symbol.for("Deno.customInspect")](inspect, options) {
|
|
4398
|
-
return inspect(inspectableError(this), options);
|
|
4399
|
-
}
|
|
5364
|
+
// ../../node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/src/index.js
|
|
5365
|
+
var src_default = new Mime_default(standard_default, other_default)._freeze();
|
|
5366
|
+
|
|
5367
|
+
// src/mime.ts
|
|
5368
|
+
var contentTypeForPath = (path) => src_default.getType(path) ?? "application/octet-stream";
|
|
5369
|
+
|
|
5370
|
+
// src/output.ts
|
|
5371
|
+
var toJson = (data) => JSON.stringify(data, null, 2);
|
|
5372
|
+
var fmtWorkspace = (w) => `${w.id} ${w.name}`;
|
|
5373
|
+
var fmtProject = (p) => `${p.id} ${p.name}`;
|
|
5374
|
+
var fmtRequirement = (r) => `${r.code} [${r.status}] ${r.title}`;
|
|
5375
|
+
var fmtTask = (t) => `${t.code} [${t.status}] ${t.title}`;
|
|
5376
|
+
var fmtComment = (c) => `${c.workerId !== void 0 ? `worker#${c.workerId}` : "you"} ${c.body}`;
|
|
5377
|
+
var fmtSession = (s) => `${s.id} ${s.name} ${s.attached ? "[active]" : "[inactive]"} ${s.worktreePath ?? "(pending)"}`;
|
|
5378
|
+
var fmtWorker = (w) => {
|
|
5379
|
+
const offline = w.connected === false ? " [offline]" : "";
|
|
5380
|
+
return `W-${w.id} ${w.name} ${w.hostname} ${w.agentKind}${offline}`;
|
|
4400
5381
|
};
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
}
|
|
4405
|
-
|
|
4406
|
-
return err instanceof Error ? "errors" in err && Array.isArray(err.errors) ? err.errors.map(flattenError).join(", ") : "cause" in err && err.cause instanceof Error ? `${err}: ${flattenError(err.cause)}` : err.message : `${err}`;
|
|
4407
|
-
}
|
|
4408
|
-
function inspectableError(err) {
|
|
4409
|
-
return {
|
|
4410
|
-
type: err.type,
|
|
4411
|
-
message: err.message,
|
|
4412
|
-
code: err.code,
|
|
4413
|
-
defaultPrevented: err.defaultPrevented,
|
|
4414
|
-
cancelable: err.cancelable,
|
|
4415
|
-
timeStamp: err.timeStamp
|
|
4416
|
-
};
|
|
4417
|
-
}
|
|
4418
|
-
var __typeError = (msg) => {
|
|
4419
|
-
throw TypeError(msg);
|
|
5382
|
+
var fmtInterval = (sec) => {
|
|
5383
|
+
if (sec % 86400 === 0) return `${sec / 86400}d`;
|
|
5384
|
+
if (sec % 3600 === 0) return `${sec / 3600}h`;
|
|
5385
|
+
if (sec % 60 === 0) return `${sec / 60}m`;
|
|
5386
|
+
return `${sec}s`;
|
|
4420
5387
|
};
|
|
4421
|
-
var
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
var
|
|
4427
|
-
var
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
var
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
var
|
|
4435
|
-
var
|
|
4436
|
-
var
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
var
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
var
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
typeof event.id == "string" && __privateSet(this, _lastEventId, event.id);
|
|
4486
|
-
const messageEvent = new MessageEvent(event.event || "message", {
|
|
4487
|
-
data: event.data,
|
|
4488
|
-
origin: __privateGet(this, _redirectUrl) ? __privateGet(this, _redirectUrl).origin : __privateGet(this, _url).origin,
|
|
4489
|
-
lastEventId: event.id || ""
|
|
5388
|
+
var fmtLoop = (l) => {
|
|
5389
|
+
const label = l.name ? `${l.name} ` : "";
|
|
5390
|
+
const last = l.lastStatus ? ` last:${l.lastStatus}` : "";
|
|
5391
|
+
return `${l.id} [${l.enabled ? "on" : "off"}] ${label}every ${fmtInterval(l.intervalSec)}${last} "${l.message}"`;
|
|
5392
|
+
};
|
|
5393
|
+
var renderOne = (item, fmt, json) => json ? toJson(item) : fmt(item);
|
|
5394
|
+
var renderList = (items, fmt, json) => {
|
|
5395
|
+
if (json) return toJson(items);
|
|
5396
|
+
return items.length ? items.map(fmt).join("\n") : "(none)";
|
|
5397
|
+
};
|
|
5398
|
+
var removed = (kind, id, json) => json ? toJson({ ok: true, deleted: id }) : `deleted ${kind} ${id}`;
|
|
5399
|
+
|
|
5400
|
+
// src/client/request.ts
|
|
5401
|
+
var authHeaders = {};
|
|
5402
|
+
var loginGate = null;
|
|
5403
|
+
var setAuthHeaders = (h) => {
|
|
5404
|
+
authHeaders = h;
|
|
5405
|
+
};
|
|
5406
|
+
var setLoginGate = (p) => {
|
|
5407
|
+
loginGate = p;
|
|
5408
|
+
};
|
|
5409
|
+
var request = async (url, init2) => {
|
|
5410
|
+
if (loginGate) await loginGate;
|
|
5411
|
+
const baseHeaders = init2.body !== void 0 ? { "content-type": "application/json" } : {};
|
|
5412
|
+
const res = await fetch(url, {
|
|
5413
|
+
method: init2.method,
|
|
5414
|
+
headers: { ...baseHeaders, ...authHeaders, ...init2.headers ?? {} },
|
|
5415
|
+
...init2.body !== void 0 ? { body: JSON.stringify(init2.body) } : {}
|
|
5416
|
+
});
|
|
5417
|
+
if (!res.ok) throw new Error(`${init2.method} ${url} \u2192 ${res.status}: ${await res.text()}`);
|
|
5418
|
+
if (res.status === 204) return void 0;
|
|
5419
|
+
return await res.json();
|
|
5420
|
+
};
|
|
5421
|
+
var rawRequest = async (url, init2) => {
|
|
5422
|
+
if (loginGate) await loginGate;
|
|
5423
|
+
const res = await fetch(url, {
|
|
5424
|
+
method: init2.method,
|
|
5425
|
+
headers: { ...authHeaders, ...init2.headers ?? {} },
|
|
5426
|
+
...init2.body !== void 0 ? { body: init2.body } : {}
|
|
5427
|
+
});
|
|
5428
|
+
if (!res.ok) throw new Error(`${init2.method} ${url} \u2192 ${res.status}: ${await res.text()}`);
|
|
5429
|
+
if (res.status === 204) return void 0;
|
|
5430
|
+
return await res.json();
|
|
5431
|
+
};
|
|
5432
|
+
|
|
5433
|
+
// src/client/auth.ts
|
|
5434
|
+
var primed = false;
|
|
5435
|
+
var primeLogin = (baseUrl) => {
|
|
5436
|
+
if (primed) return;
|
|
5437
|
+
primed = true;
|
|
5438
|
+
const token = process.env.BATON_TOKEN;
|
|
5439
|
+
if (token) {
|
|
5440
|
+
setAuthHeaders({ authorization: `Bearer ${token}` });
|
|
5441
|
+
return;
|
|
5442
|
+
}
|
|
5443
|
+
const username = process.env.BATON_USER;
|
|
5444
|
+
const password = process.env.BATON_PASS;
|
|
5445
|
+
if (!username || !password) return;
|
|
5446
|
+
setLoginGate(
|
|
5447
|
+
(async () => {
|
|
5448
|
+
const res = await fetch(`${baseUrl}/auth/login`, {
|
|
5449
|
+
method: "POST",
|
|
5450
|
+
headers: { "content-type": "application/json" },
|
|
5451
|
+
body: JSON.stringify({ username, password })
|
|
4490
5452
|
});
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
})
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
5453
|
+
const cookie = (res.headers.getSetCookie()[0] ?? "").split(";")[0];
|
|
5454
|
+
if (res.ok && cookie) setAuthHeaders({ cookie });
|
|
5455
|
+
})().catch(() => {
|
|
5456
|
+
})
|
|
5457
|
+
);
|
|
5458
|
+
};
|
|
5459
|
+
|
|
5460
|
+
// src/client/artifacts.ts
|
|
5461
|
+
var artifactsClient = (baseUrl) => {
|
|
5462
|
+
const url = (path) => `${baseUrl}${path}`;
|
|
5463
|
+
return {
|
|
5464
|
+
publish: (projectId, input) => rawRequest(
|
|
5465
|
+
url(`/artifacts?projectId=${projectId}&filename=${encodeURIComponent(input.filename)}`),
|
|
5466
|
+
{
|
|
5467
|
+
method: "POST",
|
|
5468
|
+
body: input.body,
|
|
5469
|
+
headers: {
|
|
5470
|
+
"content-type": input.contentType,
|
|
5471
|
+
"content-length": String(input.body.size)
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
),
|
|
5475
|
+
listByProject: (projectId) => request(url(`/artifacts?projectId=${projectId}`), { method: "GET" }),
|
|
5476
|
+
remove: (id) => request(url(`/artifacts/${id}`), { method: "DELETE" })
|
|
5477
|
+
};
|
|
5478
|
+
};
|
|
5479
|
+
|
|
5480
|
+
// src/client/loops.ts
|
|
5481
|
+
var loopsClient = (baseUrl) => {
|
|
5482
|
+
const u = (p) => `${baseUrl}${p}`;
|
|
5483
|
+
return {
|
|
5484
|
+
create: (sessionId, input) => request(u(`/sessions/${sessionId}/loops`), { method: "POST", body: input }),
|
|
5485
|
+
listBySession: (sessionId) => request(u(`/sessions/${sessionId}/loops`), { method: "GET" }),
|
|
5486
|
+
get: (id) => request(u(`/loops/${id}`), { method: "GET" }),
|
|
5487
|
+
update: (id, input) => request(u(`/loops/${id}`), { method: "PATCH", body: input }),
|
|
5488
|
+
remove: async (id) => {
|
|
5489
|
+
await request(u(`/loops/${id}`), { method: "DELETE" });
|
|
4506
5490
|
}
|
|
4507
|
-
|
|
4508
|
-
onEvent: __privateGet(this, _onEvent),
|
|
4509
|
-
onRetry: __privateGet(this, _onRetryChange)
|
|
4510
|
-
})), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a : globalThis.fetch), __privateSet(this, _withCredentials, (_b = eventSourceInitDict == null ? void 0 : eventSourceInitDict.withCredentials) != null ? _b : false), __privateMethod(this, _EventSource_instances, connect_fn).call(this);
|
|
4511
|
-
}
|
|
4512
|
-
/**
|
|
4513
|
-
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
4514
|
-
*
|
|
4515
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
|
|
4516
|
-
*
|
|
4517
|
-
* Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface,
|
|
4518
|
-
* defined in the TypeScript `dom` library.
|
|
4519
|
-
*
|
|
4520
|
-
* @public
|
|
4521
|
-
*/
|
|
4522
|
-
get readyState() {
|
|
4523
|
-
return __privateGet(this, _readyState);
|
|
4524
|
-
}
|
|
4525
|
-
/**
|
|
4526
|
-
* Returns the URL providing the event stream.
|
|
4527
|
-
*
|
|
4528
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
|
|
4529
|
-
*
|
|
4530
|
-
* @public
|
|
4531
|
-
*/
|
|
4532
|
-
get url() {
|
|
4533
|
-
return __privateGet(this, _url).href;
|
|
4534
|
-
}
|
|
4535
|
-
/**
|
|
4536
|
-
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
4537
|
-
*
|
|
4538
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
4539
|
-
*/
|
|
4540
|
-
get withCredentials() {
|
|
4541
|
-
return __privateGet(this, _withCredentials);
|
|
4542
|
-
}
|
|
4543
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
4544
|
-
get onerror() {
|
|
4545
|
-
return __privateGet(this, _onError);
|
|
4546
|
-
}
|
|
4547
|
-
set onerror(value) {
|
|
4548
|
-
__privateSet(this, _onError, value);
|
|
4549
|
-
}
|
|
4550
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
4551
|
-
get onmessage() {
|
|
4552
|
-
return __privateGet(this, _onMessage);
|
|
4553
|
-
}
|
|
4554
|
-
set onmessage(value) {
|
|
4555
|
-
__privateSet(this, _onMessage, value);
|
|
4556
|
-
}
|
|
4557
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
4558
|
-
get onopen() {
|
|
4559
|
-
return __privateGet(this, _onOpen);
|
|
4560
|
-
}
|
|
4561
|
-
set onopen(value) {
|
|
4562
|
-
__privateSet(this, _onOpen, value);
|
|
4563
|
-
}
|
|
4564
|
-
addEventListener(type, listener, options) {
|
|
4565
|
-
const listen = listener;
|
|
4566
|
-
super.addEventListener(type, listen, options);
|
|
4567
|
-
}
|
|
4568
|
-
removeEventListener(type, listener, options) {
|
|
4569
|
-
const listen = listener;
|
|
4570
|
-
super.removeEventListener(type, listen, options);
|
|
4571
|
-
}
|
|
4572
|
-
/**
|
|
4573
|
-
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
4574
|
-
*
|
|
4575
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
|
|
4576
|
-
*
|
|
4577
|
-
* @public
|
|
4578
|
-
*/
|
|
4579
|
-
close() {
|
|
4580
|
-
__privateGet(this, _reconnectTimer) && clearTimeout(__privateGet(this, _reconnectTimer)), __privateGet(this, _readyState) !== this.CLOSED && (__privateGet(this, _controller) && __privateGet(this, _controller).abort(), __privateSet(this, _readyState, this.CLOSED), __privateSet(this, _controller, void 0));
|
|
4581
|
-
}
|
|
5491
|
+
};
|
|
4582
5492
|
};
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
* @returns The request options
|
|
4594
|
-
* @internal
|
|
4595
|
-
*/
|
|
4596
|
-
getRequestOptions_fn = function() {
|
|
4597
|
-
var _a;
|
|
4598
|
-
const init2 = {
|
|
4599
|
-
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
4600
|
-
// [spec] …will have their mode set to "cors"…
|
|
4601
|
-
mode: "cors",
|
|
4602
|
-
redirect: "follow",
|
|
4603
|
-
headers: { Accept: "text/event-stream", ...__privateGet(this, _lastEventId) ? { "Last-Event-ID": __privateGet(this, _lastEventId) } : void 0 },
|
|
4604
|
-
cache: "no-store",
|
|
4605
|
-
signal: (_a = __privateGet(this, _controller)) == null ? void 0 : _a.signal
|
|
5493
|
+
|
|
5494
|
+
// src/client/projects.ts
|
|
5495
|
+
var projectClient = (baseUrl) => {
|
|
5496
|
+
const u = (p) => `${baseUrl}${p}`;
|
|
5497
|
+
return {
|
|
5498
|
+
create: (input) => request(u("/projects"), { method: "POST", body: input }),
|
|
5499
|
+
listByWorkspace: (workspaceId) => request(u(`/workspaces/${workspaceId}/projects`), { method: "GET" }),
|
|
5500
|
+
get: (id) => request(u(`/projects/${id}`), { method: "GET" }),
|
|
5501
|
+
update: (id, patch) => request(u(`/projects/${id}`), { method: "PATCH", body: patch }),
|
|
5502
|
+
remove: (id) => request(u(`/projects/${id}`), { method: "DELETE" })
|
|
4606
5503
|
};
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
*
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
value: true,
|
|
4652
|
-
writable: false,
|
|
4653
|
-
configurable: false,
|
|
4654
|
-
enumerable: false
|
|
4655
|
-
});
|
|
4656
|
-
function getBaseURL() {
|
|
4657
|
-
const doc = "document" in globalThis ? globalThis.document : void 0;
|
|
4658
|
-
return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
|
|
4659
|
-
}
|
|
5504
|
+
};
|
|
5505
|
+
|
|
5506
|
+
// src/client/items.ts
|
|
5507
|
+
var fetchItemByCode = async (baseUrl, projectId, code, expectKind) => {
|
|
5508
|
+
const r = await request(
|
|
5509
|
+
`${baseUrl}/projects/${projectId}/items/${encodeURIComponent(code)}`,
|
|
5510
|
+
{ method: "GET" }
|
|
5511
|
+
);
|
|
5512
|
+
if (r.kind !== expectKind) throw new Error(`expected ${expectKind} but got ${r.kind} for ${code}`);
|
|
5513
|
+
return r.item;
|
|
5514
|
+
};
|
|
5515
|
+
|
|
5516
|
+
// src/client/requirements.ts
|
|
5517
|
+
var requirementClient = (baseUrl) => {
|
|
5518
|
+
const u = (p) => `${baseUrl}${p}`;
|
|
5519
|
+
return {
|
|
5520
|
+
create: (input) => request(u("/requirements"), { method: "POST", body: input }),
|
|
5521
|
+
listByProject: (projectId) => request(u(`/projects/${projectId}/requirements`), { method: "GET" }),
|
|
5522
|
+
get: (id) => request(u(`/requirements/${id}`), { method: "GET" }),
|
|
5523
|
+
getByCode: (projectId, code) => fetchItemByCode(baseUrl, projectId, code, "requirement"),
|
|
5524
|
+
update: (id, patch) => request(u(`/requirements/${id}`), { method: "PATCH", body: patch }),
|
|
5525
|
+
setStatus: (id, status) => request(u(`/requirements/${id}`), { method: "PATCH", body: { status } }),
|
|
5526
|
+
remove: (id) => request(u(`/requirements/${id}`), { method: "DELETE" })
|
|
5527
|
+
};
|
|
5528
|
+
};
|
|
5529
|
+
|
|
5530
|
+
// src/client/retry.ts
|
|
5531
|
+
var sleep = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
5532
|
+
var withRetry = async (fn, opts = {}) => {
|
|
5533
|
+
const tries = Math.max(1, opts.tries ?? 4);
|
|
5534
|
+
const baseMs = opts.baseMs ?? 300;
|
|
5535
|
+
let lastErr;
|
|
5536
|
+
for (let i = 0; i < tries; i++) {
|
|
5537
|
+
try {
|
|
5538
|
+
return await fn();
|
|
5539
|
+
} catch (err) {
|
|
5540
|
+
lastErr = err;
|
|
5541
|
+
if (i === tries - 1) break;
|
|
5542
|
+
const backoff = baseMs * 2 ** i;
|
|
5543
|
+
await sleep(backoff + Math.random() * baseMs);
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5546
|
+
throw lastErr;
|
|
5547
|
+
};
|
|
4660
5548
|
|
|
4661
|
-
// src/client/
|
|
4662
|
-
var
|
|
5549
|
+
// src/client/services.ts
|
|
5550
|
+
var servicesClient = (baseUrl) => {
|
|
5551
|
+
const u = (path) => `${baseUrl}${path}`;
|
|
5552
|
+
return {
|
|
5553
|
+
listByProject: (projectId) => request(u(`/projects/${projectId}/services`), { method: "GET" }),
|
|
5554
|
+
run: (workerId, input) => request(u(`/workers/${workerId}/services`), { method: "POST", body: input }),
|
|
5555
|
+
stop: (workerId, name) => request(u(`/workers/${workerId}/services/${encodeURIComponent(name)}`), {
|
|
5556
|
+
method: "DELETE"
|
|
5557
|
+
}),
|
|
5558
|
+
report: (input) => request(u("/workers/me/services"), { method: "PUT", body: input })
|
|
5559
|
+
};
|
|
5560
|
+
};
|
|
5561
|
+
|
|
5562
|
+
// src/client/sessions.ts
|
|
5563
|
+
var sessionsClient = (baseUrl) => {
|
|
4663
5564
|
const u = (p) => `${baseUrl}${p}`;
|
|
4664
|
-
const JSON_CT = { "content-type": "application/json" };
|
|
4665
|
-
const member = (channelId, name) => u(`/channels/${channelId}/members/${encodeURIComponent(name)}`);
|
|
4666
5565
|
return {
|
|
4667
|
-
create:
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
}
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
},
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
help: async () => {
|
|
4697
|
-
const res = await fetch(u("/channels/help"));
|
|
4698
|
-
if (!res.ok) throw new Error(`GET /channels/help \u2192 ${res.status}: ${await res.text()}`);
|
|
4699
|
-
return await res.text();
|
|
4700
|
-
},
|
|
4701
|
-
destroy: async (channelId) => {
|
|
4702
|
-
const res = await fetch(u(`/channels/${channelId}`), { method: "DELETE" });
|
|
4703
|
-
if (!res.ok) throw new Error(`DELETE channel \u2192 ${res.status}: ${await res.text()}`);
|
|
4704
|
-
},
|
|
4705
|
-
join: async (channelId, name, kind) => {
|
|
4706
|
-
const res = await fetch(member(channelId, name), {
|
|
4707
|
-
method: "PUT",
|
|
4708
|
-
headers: JSON_CT,
|
|
4709
|
-
body: JSON.stringify({ kind: kind ?? "agent" })
|
|
4710
|
-
});
|
|
4711
|
-
if (!res.ok) throw new Error(`join channel \u2192 ${res.status}: ${await res.text()}`);
|
|
4712
|
-
return (await res.json()).members;
|
|
4713
|
-
},
|
|
4714
|
-
leave: async (channelId, name) => {
|
|
4715
|
-
const res = await fetch(member(channelId, name), { method: "DELETE" });
|
|
4716
|
-
if (!res.ok) throw new Error(`leave channel \u2192 ${res.status}: ${await res.text()}`);
|
|
4717
|
-
},
|
|
4718
|
-
members: async (channelId) => {
|
|
4719
|
-
const res = await fetch(u(`/channels/${channelId}/members`));
|
|
4720
|
-
if (!res.ok) throw new Error(`GET members \u2192 ${res.status}: ${await res.text()}`);
|
|
4721
|
-
return (await res.json()).members;
|
|
5566
|
+
create: (input) => request(u("/sessions"), { method: "POST", body: input }),
|
|
5567
|
+
materialize: (id, input, workerToken) => request(u(`/sessions/${id}`), {
|
|
5568
|
+
method: "PATCH",
|
|
5569
|
+
body: input,
|
|
5570
|
+
headers: { authorization: `Bearer ${workerToken}` }
|
|
5571
|
+
}),
|
|
5572
|
+
setStatus: (id, active, workerToken) => request(u(`/sessions/${id}/status`), {
|
|
5573
|
+
method: "POST",
|
|
5574
|
+
body: { active },
|
|
5575
|
+
headers: { authorization: `Bearer ${workerToken}` }
|
|
5576
|
+
}),
|
|
5577
|
+
setName: (id, name, workerToken) => request(u(`/sessions/${id}`), {
|
|
5578
|
+
method: "PATCH",
|
|
5579
|
+
body: { name },
|
|
5580
|
+
headers: { authorization: `Bearer ${workerToken}` }
|
|
5581
|
+
}),
|
|
5582
|
+
resume: (id) => request(u(`/sessions/${id}/resume`), { method: "POST" }),
|
|
5583
|
+
stop: (id) => request(u(`/sessions/${id}/stop`), { method: "POST" }),
|
|
5584
|
+
openTerminal: (id) => request(u(`/sessions/${id}/terminal`), { method: "POST", body: { action: "open" } }),
|
|
5585
|
+
closeTerminal: (id) => request(u(`/sessions/${id}/terminal`), { method: "POST", body: { action: "close" } }),
|
|
5586
|
+
clear: (id) => request(u(`/sessions/${id}/clear`), { method: "POST" }),
|
|
5587
|
+
abort: (id) => request(u(`/sessions/${id}/abort`), { method: "POST" }),
|
|
5588
|
+
rename: (id, name) => request(u(`/sessions/${id}/rename`), { method: "POST", body: { name } }),
|
|
5589
|
+
listByProject: (projectId) => request(u(`/projects/${projectId}/sessions`), { method: "GET" }),
|
|
5590
|
+
get: (id) => request(u(`/sessions/${id}`), { method: "GET" }),
|
|
5591
|
+
findByName: async (projectId, name) => {
|
|
5592
|
+
const all = await request(u(`/projects/${projectId}/sessions`), { method: "GET" });
|
|
5593
|
+
const matches = all.filter((s) => s.name === name);
|
|
5594
|
+
return matches.length === 0 ? null : matches[matches.length - 1] ?? null;
|
|
4722
5595
|
},
|
|
4723
|
-
|
|
4724
|
-
|
|
5596
|
+
listEvents: (id) => request(u(`/sessions/${id}/events`), { method: "GET" }),
|
|
5597
|
+
sendMessage: (id, text, attachments, planMode) => request(u(`/sessions/${id}/messages`), {
|
|
5598
|
+
method: "POST",
|
|
5599
|
+
body: {
|
|
5600
|
+
text,
|
|
5601
|
+
...attachments && attachments.length > 0 ? { attachments } : {},
|
|
5602
|
+
...planMode ? { planMode: true } : {}
|
|
5603
|
+
}
|
|
5604
|
+
}),
|
|
5605
|
+
// Raw-body upload: the file streams as the request body (no multipart), so
|
|
5606
|
+
// a Blob backed by a file on disk uploads without buffering. filename rides
|
|
5607
|
+
// a query param; content-type carries the media type.
|
|
5608
|
+
uploadAttachment: async (id, input) => {
|
|
5609
|
+
const url = u(`/sessions/${id}/attachments?filename=${encodeURIComponent(input.filename)}`);
|
|
5610
|
+
const res = await fetch(url, {
|
|
4725
5611
|
method: "POST",
|
|
4726
|
-
|
|
4727
|
-
|
|
5612
|
+
body: input.body,
|
|
5613
|
+
headers: { "content-type": input.contentType }
|
|
4728
5614
|
});
|
|
4729
|
-
if (!res.ok) throw new Error(`POST
|
|
4730
|
-
return await res.json();
|
|
4731
|
-
},
|
|
4732
|
-
uploadAttachment: async (channelId, input) => {
|
|
4733
|
-
const res = await fetch(
|
|
4734
|
-
u(`/channels/${channelId}/attachments?filename=${encodeURIComponent(input.filename)}`),
|
|
4735
|
-
{ method: "POST", headers: { "content-type": input.contentType }, body: input.body }
|
|
4736
|
-
);
|
|
4737
|
-
if (!res.ok) throw new Error(`upload attachment \u2192 ${res.status}: ${await res.text()}`);
|
|
5615
|
+
if (!res.ok) throw new Error(`POST ${url} \u2192 ${res.status}: ${await res.text()}`);
|
|
4738
5616
|
return await res.json();
|
|
4739
5617
|
},
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
5618
|
+
destroy: async (id) => {
|
|
5619
|
+
await request(u(`/sessions/${id}`), { method: "DELETE" });
|
|
5620
|
+
}
|
|
5621
|
+
};
|
|
5622
|
+
};
|
|
5623
|
+
|
|
5624
|
+
// src/client/tasks.ts
|
|
5625
|
+
var taskClient = (baseUrl) => {
|
|
5626
|
+
const u = (p) => `${baseUrl}${p}`;
|
|
5627
|
+
return {
|
|
5628
|
+
create: (input) => request(u("/tasks"), { method: "POST", body: input }),
|
|
5629
|
+
listByRequirement: (requirementId) => request(u(`/requirements/${requirementId}/tasks`), { method: "GET" }),
|
|
5630
|
+
get: (id) => request(u(`/tasks/${id}`), { method: "GET" }),
|
|
5631
|
+
getByCode: (projectId, code) => fetchItemByCode(baseUrl, projectId, code, "task"),
|
|
5632
|
+
update: (id, patch) => request(u(`/tasks/${id}`), { method: "PATCH", body: patch }),
|
|
5633
|
+
setStatus: (id, status) => request(u(`/tasks/${id}`), { method: "PATCH", body: { status } }),
|
|
5634
|
+
remove: (id) => request(u(`/tasks/${id}`), { method: "DELETE" }),
|
|
5635
|
+
listComments: (id) => request(u(`/tasks/${id}/comments`), { method: "GET" }),
|
|
5636
|
+
addComment: (id, body, workerId) => request(u(`/tasks/${id}/comments`), { method: "POST", body: { body, workerId } })
|
|
5637
|
+
};
|
|
5638
|
+
};
|
|
5639
|
+
|
|
5640
|
+
// src/client/workers.ts
|
|
5641
|
+
var workersClient = (baseUrl) => {
|
|
5642
|
+
const u = (p) => `${baseUrl}${p}`;
|
|
5643
|
+
return {
|
|
5644
|
+
register: (input) => request(u("/workers"), { method: "POST", body: input }),
|
|
5645
|
+
listByProject: (projectId) => request(u(`/projects/${projectId}/workers`), { method: "GET" }),
|
|
5646
|
+
get: (id) => request(u(`/workers/${id}`), { method: "GET" }),
|
|
5647
|
+
findByName: async (projectId, name) => {
|
|
5648
|
+
const all = await request(u(`/projects/${projectId}/workers`), {
|
|
5649
|
+
method: "GET"
|
|
5650
|
+
});
|
|
5651
|
+
const matches = all.filter((w) => w.name === name);
|
|
5652
|
+
return matches.length === 0 ? null : matches[matches.length - 1] ?? null;
|
|
4751
5653
|
},
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
if (opts.for) params.set("for", opts.for);
|
|
4756
|
-
if (opts.as) params.set("as", opts.as);
|
|
4757
|
-
const es = new EventSource(u(`/channels/${channelId}/stream?${params}`));
|
|
4758
|
-
es.onmessage = (e) => {
|
|
4759
|
-
try {
|
|
4760
|
-
const m = JSON.parse(e.data);
|
|
4761
|
-
if (m.seq <= cursor) return;
|
|
4762
|
-
cursor = m.seq;
|
|
4763
|
-
opts.onMessage(m);
|
|
4764
|
-
} catch (err) {
|
|
4765
|
-
opts.onError?.(err);
|
|
4766
|
-
}
|
|
4767
|
-
};
|
|
4768
|
-
es.onerror = (err) => opts.onError?.(err);
|
|
4769
|
-
return () => es.close();
|
|
5654
|
+
heartbeat: (machineId) => request(u("/workers/heartbeat"), { method: "POST", body: { machineId } }),
|
|
5655
|
+
destroy: async (id) => {
|
|
5656
|
+
await request(u(`/workers/${id}`), { method: "DELETE" });
|
|
4770
5657
|
}
|
|
4771
5658
|
};
|
|
4772
5659
|
};
|
|
4773
5660
|
|
|
5661
|
+
// src/client/workspaces.ts
|
|
5662
|
+
var workspaceClient = (baseUrl) => {
|
|
5663
|
+
const u = (p) => `${baseUrl}${p}`;
|
|
5664
|
+
return {
|
|
5665
|
+
create: (input) => request(u("/workspaces"), { method: "POST", body: input }),
|
|
5666
|
+
list: () => request(u("/workspaces"), { method: "GET" }),
|
|
5667
|
+
get: (id) => request(u(`/workspaces/${id}`), { method: "GET" }),
|
|
5668
|
+
update: (id, patch) => request(u(`/workspaces/${id}`), { method: "PATCH", body: patch }),
|
|
5669
|
+
remove: (id) => request(u(`/workspaces/${id}`), { method: "DELETE" })
|
|
5670
|
+
};
|
|
5671
|
+
};
|
|
5672
|
+
|
|
5673
|
+
// src/client.ts
|
|
5674
|
+
var createClient = (baseUrl, opts) => {
|
|
5675
|
+
if (opts?.bearer) setAuthHeaders({ authorization: `Bearer ${opts.bearer}` });
|
|
5676
|
+
else primeLogin(baseUrl);
|
|
5677
|
+
return clientFromBase(baseUrl);
|
|
5678
|
+
};
|
|
5679
|
+
var clientFromBase = (baseUrl) => ({
|
|
5680
|
+
artifacts: artifactsClient(baseUrl),
|
|
5681
|
+
workspaces: workspaceClient(baseUrl),
|
|
5682
|
+
projects: projectClient(baseUrl),
|
|
5683
|
+
requirements: requirementClient(baseUrl),
|
|
5684
|
+
tasks: taskClient(baseUrl),
|
|
5685
|
+
sessions: sessionsClient(baseUrl),
|
|
5686
|
+
services: servicesClient(baseUrl),
|
|
5687
|
+
loops: loopsClient(baseUrl),
|
|
5688
|
+
workers: workersClient(baseUrl)
|
|
5689
|
+
});
|
|
5690
|
+
var BOUNDARY_EVENTS = /* @__PURE__ */ new Set([
|
|
5691
|
+
"turn_start",
|
|
5692
|
+
"turn_complete",
|
|
5693
|
+
"turn_error"
|
|
5694
|
+
]);
|
|
5695
|
+
var emitRetries = () => Number(process.env.BATON_EMIT_RETRIES) || 4;
|
|
5696
|
+
var createWorkerClient = (baseUrl, workerToken, sessionId) => {
|
|
5697
|
+
const u = (p) => `${baseUrl}${p}`;
|
|
5698
|
+
const auth = { authorization: `Bearer ${workerToken}` };
|
|
5699
|
+
return {
|
|
5700
|
+
emitEvent: (type, payload) => {
|
|
5701
|
+
const post = () => request(u(`/sessions/${sessionId}/events`), {
|
|
5702
|
+
method: "POST",
|
|
5703
|
+
body: { type, payload },
|
|
5704
|
+
headers: auth
|
|
5705
|
+
});
|
|
5706
|
+
return BOUNDARY_EVENTS.has(type) ? withRetry(post, { tries: emitRetries() }) : post();
|
|
5707
|
+
},
|
|
5708
|
+
setActive: (active) => request(u(`/sessions/${sessionId}/status`), {
|
|
5709
|
+
method: "POST",
|
|
5710
|
+
body: { active },
|
|
5711
|
+
headers: auth
|
|
5712
|
+
}),
|
|
5713
|
+
listEvents: () => request(u(`/sessions/${sessionId}/events`), { method: "GET", headers: auth }),
|
|
5714
|
+
materialize: (input) => request(u(`/sessions/${sessionId}`), {
|
|
5715
|
+
method: "PATCH",
|
|
5716
|
+
body: input,
|
|
5717
|
+
headers: auth
|
|
5718
|
+
})
|
|
5719
|
+
};
|
|
5720
|
+
};
|
|
5721
|
+
|
|
4774
5722
|
// src/project-config.ts
|
|
4775
5723
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
4776
5724
|
import { join } from "node:path";
|
|
@@ -4843,378 +5791,711 @@ var resolveBaseUrlOrNull = (urlArg, env = process.env) => {
|
|
|
4843
5791
|
return env.BATON_URL ?? null;
|
|
4844
5792
|
};
|
|
4845
5793
|
|
|
4846
|
-
// src/
|
|
4847
|
-
var
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
var fmtSession = (s) => `${s.id} ${s.name} ${s.attached ? "[active]" : "[inactive]"} ${s.worktreePath ?? "(pending)"}`;
|
|
4854
|
-
var fmtWorker = (w) => {
|
|
4855
|
-
const offline = w.connected === false ? " [offline]" : "";
|
|
4856
|
-
return `W-${w.id} ${w.name} ${w.hostname} ${w.agentKind}${offline}`;
|
|
5794
|
+
// src/util.ts
|
|
5795
|
+
var common = {
|
|
5796
|
+
url: {
|
|
5797
|
+
type: "string",
|
|
5798
|
+
description: "baton server url (--url > .baton.json > BATON_URL > http://localhost:3280)"
|
|
5799
|
+
},
|
|
5800
|
+
json: { type: "boolean", description: "output JSON" }
|
|
4857
5801
|
};
|
|
4858
|
-
var
|
|
4859
|
-
|
|
4860
|
-
if (
|
|
4861
|
-
if (
|
|
4862
|
-
return
|
|
5802
|
+
var resolveAuth = (env, fileToken) => {
|
|
5803
|
+
const envBearer = env.BATON_TOKEN ?? env.BATON_WORKER_TOKEN;
|
|
5804
|
+
if (envBearer) return { bearer: envBearer };
|
|
5805
|
+
if (env.BATON_USER && env.BATON_PASS) return "cookie";
|
|
5806
|
+
return fileToken ? { bearer: fileToken } : void 0;
|
|
4863
5807
|
};
|
|
4864
|
-
var
|
|
4865
|
-
const
|
|
4866
|
-
const
|
|
4867
|
-
|
|
5808
|
+
var clientFor = (args) => {
|
|
5809
|
+
const baseUrl = resolveBaseUrl(args.url);
|
|
5810
|
+
const fileToken = loadProjectConfigOrNull(projectConfigPath())?.worker?.apiToken;
|
|
5811
|
+
const auth = resolveAuth(process.env, fileToken);
|
|
5812
|
+
return createClient(baseUrl, auth && auth !== "cookie" ? auth : void 0);
|
|
4868
5813
|
};
|
|
4869
|
-
var
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
return
|
|
5814
|
+
var resolveBearer = () => {
|
|
5815
|
+
const fileToken = loadProjectConfigOrNull(projectConfigPath())?.worker?.apiToken;
|
|
5816
|
+
const auth = resolveAuth(process.env, fileToken);
|
|
5817
|
+
return auth && auth !== "cookie" ? auth.bearer : void 0;
|
|
4873
5818
|
};
|
|
4874
|
-
var
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
var setAuthHeaders = (h) => {
|
|
4880
|
-
authHeaders = h;
|
|
5819
|
+
var resolveProjectId = (args) => {
|
|
5820
|
+
if (args.project !== void 0 && args.project !== "") return Number(args.project);
|
|
5821
|
+
const cfg = loadProjectConfigOrNull(projectConfigPath());
|
|
5822
|
+
if (cfg?.project !== void 0) return cfg.project;
|
|
5823
|
+
throw new Error("no project in scope. pass --project <id> or run `baton init` in this directory.");
|
|
4881
5824
|
};
|
|
4882
|
-
var
|
|
4883
|
-
|
|
5825
|
+
var resolveWorkspaceId = (args) => {
|
|
5826
|
+
if (args.workspace !== void 0 && args.workspace !== "") return Number(args.workspace);
|
|
5827
|
+
const cfg = loadProjectConfigOrNull(projectConfigPath());
|
|
5828
|
+
if (cfg?.workspace !== void 0) return cfg.workspace;
|
|
5829
|
+
throw new Error(
|
|
5830
|
+
"no workspace in scope. pass --workspace <id> or run `baton init` in this directory."
|
|
5831
|
+
);
|
|
4884
5832
|
};
|
|
4885
|
-
var
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
5833
|
+
var parseWorkerHandle = (handle) => {
|
|
5834
|
+
const m = handle.trim().match(/^(?:[wW]-)?(\d+)$/);
|
|
5835
|
+
return m ? Number(m[1]) : null;
|
|
5836
|
+
};
|
|
5837
|
+
var splitCsv = (s) => s ? s.split(",").map((x) => x.trim()).filter(Boolean) : void 0;
|
|
5838
|
+
var parseDuration = (s) => {
|
|
5839
|
+
const m = s.trim().match(/^(\d+)\s*([smhd]?)$/);
|
|
5840
|
+
if (!m) throw new Error(`bad interval "${s}" \u2014 use e.g. 90s, 30m, 2h, 1d`);
|
|
5841
|
+
const n = Number(m[1]);
|
|
5842
|
+
const mult = m[2] === "d" ? 86400 : m[2] === "h" ? 3600 : m[2] === "m" ? 60 : 1;
|
|
5843
|
+
return n * mult;
|
|
5844
|
+
};
|
|
5845
|
+
|
|
5846
|
+
// src/commands/artifact.ts
|
|
5847
|
+
var formatArtifact = (artifact2) => `${artifact2.id} ${artifact2.size} B ${artifact2.filename} ${artifact2.url}`;
|
|
5848
|
+
var publishArtifact = async (client, projectId, inputPath) => {
|
|
5849
|
+
const path = resolve(inputPath);
|
|
5850
|
+
const info = await stat(path);
|
|
5851
|
+
if (!info.isFile()) throw new Error(`not a file: ${inputPath}`);
|
|
5852
|
+
const contentType = contentTypeForPath(path);
|
|
5853
|
+
return client.artifacts.publish(projectId, {
|
|
5854
|
+
filename: basename(path),
|
|
5855
|
+
contentType,
|
|
5856
|
+
body: await openAsBlob(path, { type: contentType })
|
|
4892
5857
|
});
|
|
4893
|
-
if (!res.ok) throw new Error(`${init2.method} ${url} \u2192 ${res.status}: ${await res.text()}`);
|
|
4894
|
-
if (res.status === 204) return void 0;
|
|
4895
|
-
return await res.json();
|
|
4896
5858
|
};
|
|
5859
|
+
var publishCommand = defineCommand({
|
|
5860
|
+
meta: { name: "publish", description: "publish a file as a project artifact" },
|
|
5861
|
+
args: {
|
|
5862
|
+
file: { type: "positional", required: true, description: "file to publish" },
|
|
5863
|
+
...common
|
|
5864
|
+
},
|
|
5865
|
+
run: async ({ args }) => {
|
|
5866
|
+
const artifact2 = await publishArtifact(clientFor(args), resolveProjectId({}), args.file);
|
|
5867
|
+
console.log(
|
|
5868
|
+
args.json ? toJson(artifact2) : `${formatArtifact(artifact2)}
|
|
5869
|
+
download: ${artifact2.downloadUrl}`
|
|
5870
|
+
);
|
|
5871
|
+
}
|
|
5872
|
+
});
|
|
5873
|
+
var listCommand = defineCommand({
|
|
5874
|
+
meta: { name: "ls", description: "list artifacts in the current project" },
|
|
5875
|
+
args: common,
|
|
5876
|
+
run: async ({ args }) => {
|
|
5877
|
+
const artifacts = await clientFor(args).artifacts.listByProject(resolveProjectId({}));
|
|
5878
|
+
console.log(
|
|
5879
|
+
args.json ? toJson(artifacts) : artifacts.length ? artifacts.map(formatArtifact).join("\n") : "(none)"
|
|
5880
|
+
);
|
|
5881
|
+
}
|
|
5882
|
+
});
|
|
5883
|
+
var removeCommand = defineCommand({
|
|
5884
|
+
meta: { name: "rm", description: "delete a project artifact" },
|
|
5885
|
+
args: {
|
|
5886
|
+
id: { type: "positional", required: true, description: "artifact id" },
|
|
5887
|
+
...common
|
|
5888
|
+
},
|
|
5889
|
+
run: async ({ args }) => {
|
|
5890
|
+
const id = Number(args.id);
|
|
5891
|
+
if (!Number.isInteger(id) || id <= 0) throw new Error("artifact id must be a positive integer");
|
|
5892
|
+
const client = clientFor(args);
|
|
5893
|
+
const projectId = resolveProjectId({});
|
|
5894
|
+
const belongsToProject = (await client.artifacts.listByProject(projectId)).some(
|
|
5895
|
+
(artifact2) => artifact2.id === id
|
|
5896
|
+
);
|
|
5897
|
+
if (!belongsToProject) throw new Error(`artifact ${id} not found in current project`);
|
|
5898
|
+
await client.artifacts.remove(id);
|
|
5899
|
+
console.log(args.json ? toJson({ ok: true, deleted: id }) : `deleted artifact ${id}`);
|
|
5900
|
+
}
|
|
5901
|
+
});
|
|
5902
|
+
var artifact = defineCommand({
|
|
5903
|
+
meta: { name: "artifact", description: "publish and manage project artifacts" },
|
|
5904
|
+
subCommands: { publish: publishCommand, ls: listCommand, rm: removeCommand }
|
|
5905
|
+
});
|
|
4897
5906
|
|
|
4898
|
-
//
|
|
4899
|
-
var
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
5907
|
+
// ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
|
|
5908
|
+
var ParseError = class extends Error {
|
|
5909
|
+
constructor(message, options) {
|
|
5910
|
+
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
5911
|
+
}
|
|
5912
|
+
};
|
|
5913
|
+
var LF = 10;
|
|
5914
|
+
var CR = 13;
|
|
5915
|
+
var SPACE = 32;
|
|
5916
|
+
function noop(_arg) {
|
|
5917
|
+
}
|
|
5918
|
+
function createParser(config) {
|
|
5919
|
+
if (typeof config == "function")
|
|
5920
|
+
throw new TypeError(
|
|
5921
|
+
"`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
|
|
5922
|
+
);
|
|
5923
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
|
|
5924
|
+
let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
|
|
5925
|
+
function feed(chunk) {
|
|
5926
|
+
if (terminated)
|
|
5927
|
+
throw new Error(
|
|
5928
|
+
"Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
|
|
5929
|
+
);
|
|
5930
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
5931
|
+
const trailing2 = processLines(chunk);
|
|
5932
|
+
trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
|
|
5933
|
+
return;
|
|
5934
|
+
}
|
|
5935
|
+
if (chunk.indexOf(`
|
|
5936
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
5937
|
+
pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
|
|
5938
|
+
return;
|
|
5939
|
+
}
|
|
5940
|
+
pendingFragments.push(chunk);
|
|
5941
|
+
const input = pendingFragments.join("");
|
|
5942
|
+
pendingFragments.length = 0, pendingFragmentsLength = 0;
|
|
5943
|
+
const trailing = processLines(input);
|
|
5944
|
+
trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
|
|
5945
|
+
}
|
|
5946
|
+
function checkBufferSize() {
|
|
5947
|
+
maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
|
|
5948
|
+
new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
|
|
5949
|
+
type: "max-buffer-size-exceeded"
|
|
5950
|
+
})
|
|
5951
|
+
)));
|
|
5952
|
+
}
|
|
5953
|
+
function processLines(chunk) {
|
|
5954
|
+
let searchIndex = 0;
|
|
5955
|
+
if (chunk.indexOf("\r") === -1) {
|
|
5956
|
+
let lfIndex = chunk.indexOf(`
|
|
5957
|
+
`, searchIndex);
|
|
5958
|
+
for (; lfIndex !== -1; ) {
|
|
5959
|
+
if (searchIndex === lfIndex) {
|
|
5960
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
5961
|
+
`, searchIndex);
|
|
5962
|
+
continue;
|
|
5963
|
+
}
|
|
5964
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
5965
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
5966
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
5967
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
5968
|
+
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
5969
|
+
`, searchIndex);
|
|
5970
|
+
continue;
|
|
5971
|
+
}
|
|
5972
|
+
data = dataLines === 0 ? value : `${data}
|
|
5973
|
+
${value}`, dataLines++;
|
|
5974
|
+
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
5975
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
5976
|
+
lfIndex
|
|
5977
|
+
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
5978
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
5979
|
+
`, searchIndex);
|
|
5980
|
+
}
|
|
5981
|
+
return chunk.slice(searchIndex);
|
|
5982
|
+
}
|
|
5983
|
+
for (; searchIndex < chunk.length; ) {
|
|
5984
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
5985
|
+
`, searchIndex);
|
|
5986
|
+
let lineEnd = -1;
|
|
5987
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
5988
|
+
break;
|
|
5989
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
5990
|
+
}
|
|
5991
|
+
return chunk.slice(searchIndex);
|
|
5992
|
+
}
|
|
5993
|
+
function parseLine(chunk, start, end) {
|
|
5994
|
+
if (start === end) {
|
|
5995
|
+
dispatchEvent();
|
|
5996
|
+
return;
|
|
5997
|
+
}
|
|
5998
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
5999
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
6000
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
6001
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
6002
|
+
${value2}`, dataLines++;
|
|
6003
|
+
return;
|
|
6004
|
+
}
|
|
6005
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
6006
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
6007
|
+
return;
|
|
6008
|
+
}
|
|
6009
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
6010
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
6011
|
+
id = value2.includes("\0") ? void 0 : value2;
|
|
6012
|
+
return;
|
|
6013
|
+
}
|
|
6014
|
+
if (firstCharCode === 58) {
|
|
6015
|
+
if (onComment) {
|
|
6016
|
+
const line2 = chunk.slice(start, end);
|
|
6017
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
6018
|
+
}
|
|
6019
|
+
return;
|
|
6020
|
+
}
|
|
6021
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
6022
|
+
if (fieldSeparatorIndex === -1) {
|
|
6023
|
+
processField(line, "", line);
|
|
6024
|
+
return;
|
|
6025
|
+
}
|
|
6026
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
6027
|
+
processField(field, value, line);
|
|
4907
6028
|
}
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
6029
|
+
function processField(field, value, line) {
|
|
6030
|
+
switch (field) {
|
|
6031
|
+
case "event":
|
|
6032
|
+
eventType = value || void 0;
|
|
6033
|
+
break;
|
|
6034
|
+
case "data":
|
|
6035
|
+
data = dataLines === 0 ? value : `${data}
|
|
6036
|
+
${value}`, dataLines++;
|
|
6037
|
+
break;
|
|
6038
|
+
case "id":
|
|
6039
|
+
id = value.includes("\0") ? void 0 : value;
|
|
6040
|
+
break;
|
|
6041
|
+
case "retry":
|
|
6042
|
+
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
6043
|
+
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
6044
|
+
type: "invalid-retry",
|
|
6045
|
+
value,
|
|
6046
|
+
line
|
|
6047
|
+
})
|
|
6048
|
+
);
|
|
6049
|
+
break;
|
|
6050
|
+
default:
|
|
6051
|
+
onError(
|
|
6052
|
+
new ParseError(
|
|
6053
|
+
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
6054
|
+
{ type: "unknown-field", field, value, line }
|
|
6055
|
+
)
|
|
6056
|
+
);
|
|
6057
|
+
break;
|
|
4935
6058
|
}
|
|
4936
|
-
}
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
};
|
|
4949
|
-
};
|
|
4950
|
-
|
|
4951
|
-
// src/client/items.ts
|
|
4952
|
-
var fetchItemByCode = async (baseUrl, projectId, code, expectKind) => {
|
|
4953
|
-
const r = await request(
|
|
4954
|
-
`${baseUrl}/projects/${projectId}/items/${encodeURIComponent(code)}`,
|
|
4955
|
-
{ method: "GET" }
|
|
4956
|
-
);
|
|
4957
|
-
if (r.kind !== expectKind) throw new Error(`expected ${expectKind} but got ${r.kind} for ${code}`);
|
|
4958
|
-
return r.item;
|
|
4959
|
-
};
|
|
4960
|
-
|
|
4961
|
-
// src/client/requirements.ts
|
|
4962
|
-
var requirementClient = (baseUrl) => {
|
|
4963
|
-
const u = (p) => `${baseUrl}${p}`;
|
|
4964
|
-
return {
|
|
4965
|
-
create: (input) => request(u("/requirements"), { method: "POST", body: input }),
|
|
4966
|
-
listByProject: (projectId) => request(u(`/projects/${projectId}/requirements`), { method: "GET" }),
|
|
4967
|
-
get: (id) => request(u(`/requirements/${id}`), { method: "GET" }),
|
|
4968
|
-
getByCode: (projectId, code) => fetchItemByCode(baseUrl, projectId, code, "requirement"),
|
|
4969
|
-
update: (id, patch) => request(u(`/requirements/${id}`), { method: "PATCH", body: patch }),
|
|
4970
|
-
setStatus: (id, status) => request(u(`/requirements/${id}`), { method: "PATCH", body: { status } }),
|
|
4971
|
-
remove: (id) => request(u(`/requirements/${id}`), { method: "DELETE" })
|
|
4972
|
-
};
|
|
4973
|
-
};
|
|
4974
|
-
|
|
4975
|
-
// src/client/retry.ts
|
|
4976
|
-
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
4977
|
-
var withRetry = async (fn, opts = {}) => {
|
|
4978
|
-
const tries = Math.max(1, opts.tries ?? 4);
|
|
4979
|
-
const baseMs = opts.baseMs ?? 300;
|
|
4980
|
-
let lastErr;
|
|
4981
|
-
for (let i = 0; i < tries; i++) {
|
|
4982
|
-
try {
|
|
4983
|
-
return await fn();
|
|
4984
|
-
} catch (err) {
|
|
4985
|
-
lastErr = err;
|
|
4986
|
-
if (i === tries - 1) break;
|
|
4987
|
-
const backoff = baseMs * 2 ** i;
|
|
4988
|
-
await sleep(backoff + Math.random() * baseMs);
|
|
6059
|
+
}
|
|
6060
|
+
function dispatchEvent() {
|
|
6061
|
+
dataLines > 0 && onEvent({
|
|
6062
|
+
id,
|
|
6063
|
+
event: eventType,
|
|
6064
|
+
data
|
|
6065
|
+
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
6066
|
+
}
|
|
6067
|
+
function reset(options = {}) {
|
|
6068
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
6069
|
+
const incompleteLine = pendingFragments.join("");
|
|
6070
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
4989
6071
|
}
|
|
6072
|
+
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
|
|
4990
6073
|
}
|
|
4991
|
-
|
|
4992
|
-
}
|
|
6074
|
+
return { feed, reset };
|
|
6075
|
+
}
|
|
6076
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
6077
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
6078
|
+
}
|
|
6079
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
6080
|
+
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
6081
|
+
}
|
|
4993
6082
|
|
|
4994
|
-
//
|
|
4995
|
-
var
|
|
4996
|
-
|
|
6083
|
+
// ../../node_modules/.pnpm/eventsource@4.1.0/node_modules/eventsource/dist/index.js
|
|
6084
|
+
var ErrorEvent = class extends Event {
|
|
6085
|
+
/**
|
|
6086
|
+
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
6087
|
+
* but rather emitted by the `EventSource` object when an error occurs.
|
|
6088
|
+
*
|
|
6089
|
+
* @param type - The type of the event (should be "error")
|
|
6090
|
+
* @param errorEventInitDict - Optional properties to include in the error event
|
|
6091
|
+
*/
|
|
6092
|
+
constructor(type, errorEventInitDict) {
|
|
6093
|
+
var _a, _b;
|
|
6094
|
+
super(type), this.code = (_a = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a : void 0, this.message = (_b = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b : void 0;
|
|
6095
|
+
}
|
|
6096
|
+
/**
|
|
6097
|
+
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
6098
|
+
* when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
|
|
6099
|
+
* we explicitly include the properties in the `inspect` method.
|
|
6100
|
+
*
|
|
6101
|
+
* This is automatically called by Node.js when you `console.log` an instance of this class.
|
|
6102
|
+
*
|
|
6103
|
+
* @param _depth - The current depth
|
|
6104
|
+
* @param options - The options passed to `util.inspect`
|
|
6105
|
+
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
6106
|
+
* @returns A string representation of the error
|
|
6107
|
+
*/
|
|
6108
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
|
|
6109
|
+
return inspect(inspectableError(this), options);
|
|
6110
|
+
}
|
|
6111
|
+
/**
|
|
6112
|
+
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
6113
|
+
* when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
|
|
6114
|
+
* we explicitly include the properties in the `inspect` method.
|
|
6115
|
+
*
|
|
6116
|
+
* This is automatically called by Deno when you `console.log` an instance of this class.
|
|
6117
|
+
*
|
|
6118
|
+
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
6119
|
+
* @param options - The options passed to `Deno.inspect`
|
|
6120
|
+
* @returns A string representation of the error
|
|
6121
|
+
*/
|
|
6122
|
+
[/* @__PURE__ */ Symbol.for("Deno.customInspect")](inspect, options) {
|
|
6123
|
+
return inspect(inspectableError(this), options);
|
|
6124
|
+
}
|
|
6125
|
+
};
|
|
6126
|
+
function syntaxError(message) {
|
|
6127
|
+
const DomException = globalThis.DOMException;
|
|
6128
|
+
return typeof DomException == "function" ? new DomException(message, "SyntaxError") : new SyntaxError(message);
|
|
6129
|
+
}
|
|
6130
|
+
function flattenError(err) {
|
|
6131
|
+
return err instanceof Error ? "errors" in err && Array.isArray(err.errors) ? err.errors.map(flattenError).join(", ") : "cause" in err && err.cause instanceof Error ? `${err}: ${flattenError(err.cause)}` : err.message : `${err}`;
|
|
6132
|
+
}
|
|
6133
|
+
function inspectableError(err) {
|
|
4997
6134
|
return {
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
6135
|
+
type: err.type,
|
|
6136
|
+
message: err.message,
|
|
6137
|
+
code: err.code,
|
|
6138
|
+
defaultPrevented: err.defaultPrevented,
|
|
6139
|
+
cancelable: err.cancelable,
|
|
6140
|
+
timeStamp: err.timeStamp
|
|
5004
6141
|
};
|
|
6142
|
+
}
|
|
6143
|
+
var __typeError = (msg) => {
|
|
6144
|
+
throw TypeError(msg);
|
|
5005
6145
|
};
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
var
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
body: {
|
|
5045
|
-
text,
|
|
5046
|
-
...attachments && attachments.length > 0 ? { attachments } : {},
|
|
5047
|
-
...planMode ? { planMode: true } : {}
|
|
6146
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
6147
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6148
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
6149
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
6150
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
6151
|
+
var _readyState;
|
|
6152
|
+
var _url;
|
|
6153
|
+
var _redirectUrl;
|
|
6154
|
+
var _withCredentials;
|
|
6155
|
+
var _fetch;
|
|
6156
|
+
var _reconnectInterval;
|
|
6157
|
+
var _reconnectTimer;
|
|
6158
|
+
var _lastEventId;
|
|
6159
|
+
var _controller;
|
|
6160
|
+
var _parser;
|
|
6161
|
+
var _onError;
|
|
6162
|
+
var _onMessage;
|
|
6163
|
+
var _onOpen;
|
|
6164
|
+
var _EventSource_instances;
|
|
6165
|
+
var connect_fn;
|
|
6166
|
+
var _onFetchResponse;
|
|
6167
|
+
var _onFetchError;
|
|
6168
|
+
var getRequestOptions_fn;
|
|
6169
|
+
var _onEvent;
|
|
6170
|
+
var _onRetryChange;
|
|
6171
|
+
var failConnection_fn;
|
|
6172
|
+
var scheduleReconnect_fn;
|
|
6173
|
+
var _reconnect;
|
|
6174
|
+
var EventSource = class extends EventTarget {
|
|
6175
|
+
constructor(url, eventSourceInitDict) {
|
|
6176
|
+
var _a, _b;
|
|
6177
|
+
super(), __privateAdd(this, _EventSource_instances), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, __privateAdd(this, _readyState), __privateAdd(this, _url), __privateAdd(this, _redirectUrl), __privateAdd(this, _withCredentials), __privateAdd(this, _fetch), __privateAdd(this, _reconnectInterval), __privateAdd(this, _reconnectTimer), __privateAdd(this, _lastEventId, null), __privateAdd(this, _controller), __privateAdd(this, _parser), __privateAdd(this, _onError, null), __privateAdd(this, _onMessage, null), __privateAdd(this, _onOpen, null), __privateAdd(this, _onFetchResponse, async (response) => {
|
|
6178
|
+
var _a2;
|
|
6179
|
+
__privateGet(this, _parser).reset();
|
|
6180
|
+
const { body, redirected, status, headers } = response;
|
|
6181
|
+
if (status === 204) {
|
|
6182
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
6183
|
+
return;
|
|
5048
6184
|
}
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
6185
|
+
if (redirected ? __privateSet(this, _redirectUrl, new URL(response.url)) : __privateSet(this, _redirectUrl, void 0), status !== 200) {
|
|
6186
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, `Non-200 status code (${status})`, status);
|
|
6187
|
+
return;
|
|
6188
|
+
}
|
|
6189
|
+
if (!(headers.get("content-type") || "").startsWith("text/event-stream")) {
|
|
6190
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, 'Invalid content type, expected "text/event-stream"', status);
|
|
6191
|
+
return;
|
|
6192
|
+
}
|
|
6193
|
+
if (__privateGet(this, _readyState) === this.CLOSED)
|
|
6194
|
+
return;
|
|
6195
|
+
__privateSet(this, _readyState, this.OPEN);
|
|
6196
|
+
const openEvent = new Event("open");
|
|
6197
|
+
if ((_a2 = __privateGet(this, _onOpen)) == null || _a2.call(this, openEvent), this.dispatchEvent(openEvent), typeof body != "object" || !body || !("getReader" in body)) {
|
|
6198
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, "Invalid response body, expected a web ReadableStream", status), this.close();
|
|
6199
|
+
return;
|
|
6200
|
+
}
|
|
6201
|
+
const decoder = new TextDecoder(), reader = body.getReader();
|
|
6202
|
+
let open = true;
|
|
6203
|
+
do {
|
|
6204
|
+
const { done, value } = await reader.read();
|
|
6205
|
+
value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (open = false, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));
|
|
6206
|
+
} while (open);
|
|
6207
|
+
}), __privateAdd(this, _onFetchError, (err) => {
|
|
6208
|
+
__privateSet(this, _controller, void 0), !(err.name === "AbortError" || err.type === "aborted") && __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this, flattenError(err));
|
|
6209
|
+
}), __privateAdd(this, _onEvent, (event) => {
|
|
6210
|
+
typeof event.id == "string" && __privateSet(this, _lastEventId, event.id);
|
|
6211
|
+
const messageEvent = new MessageEvent(event.event || "message", {
|
|
6212
|
+
data: event.data,
|
|
6213
|
+
origin: __privateGet(this, _redirectUrl) ? __privateGet(this, _redirectUrl).origin : __privateGet(this, _url).origin,
|
|
6214
|
+
lastEventId: event.id || ""
|
|
5059
6215
|
});
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
6216
|
+
__privateGet(this, _onMessage) && (!event.event || event.event === "message") && __privateGet(this, _onMessage).call(this, messageEvent), this.dispatchEvent(messageEvent);
|
|
6217
|
+
}), __privateAdd(this, _onRetryChange, (value) => {
|
|
6218
|
+
__privateSet(this, _reconnectInterval, value);
|
|
6219
|
+
}), __privateAdd(this, _reconnect, () => {
|
|
6220
|
+
__privateSet(this, _reconnectTimer, void 0), __privateGet(this, _readyState) === this.CONNECTING && __privateMethod(this, _EventSource_instances, connect_fn).call(this);
|
|
6221
|
+
});
|
|
6222
|
+
try {
|
|
6223
|
+
if (url instanceof URL)
|
|
6224
|
+
__privateSet(this, _url, url);
|
|
6225
|
+
else if (typeof url == "string")
|
|
6226
|
+
__privateSet(this, _url, new URL(url, getBaseURL()));
|
|
6227
|
+
else
|
|
6228
|
+
throw new Error("Invalid URL");
|
|
6229
|
+
} catch {
|
|
6230
|
+
throw syntaxError("An invalid or illegal string was specified");
|
|
5065
6231
|
}
|
|
5066
|
-
|
|
6232
|
+
__privateSet(this, _parser, createParser({
|
|
6233
|
+
onEvent: __privateGet(this, _onEvent),
|
|
6234
|
+
onRetry: __privateGet(this, _onRetryChange)
|
|
6235
|
+
})), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a : globalThis.fetch), __privateSet(this, _withCredentials, (_b = eventSourceInitDict == null ? void 0 : eventSourceInitDict.withCredentials) != null ? _b : false), __privateMethod(this, _EventSource_instances, connect_fn).call(this);
|
|
6236
|
+
}
|
|
6237
|
+
/**
|
|
6238
|
+
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
6239
|
+
*
|
|
6240
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
|
|
6241
|
+
*
|
|
6242
|
+
* Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface,
|
|
6243
|
+
* defined in the TypeScript `dom` library.
|
|
6244
|
+
*
|
|
6245
|
+
* @public
|
|
6246
|
+
*/
|
|
6247
|
+
get readyState() {
|
|
6248
|
+
return __privateGet(this, _readyState);
|
|
6249
|
+
}
|
|
6250
|
+
/**
|
|
6251
|
+
* Returns the URL providing the event stream.
|
|
6252
|
+
*
|
|
6253
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
|
|
6254
|
+
*
|
|
6255
|
+
* @public
|
|
6256
|
+
*/
|
|
6257
|
+
get url() {
|
|
6258
|
+
return __privateGet(this, _url).href;
|
|
6259
|
+
}
|
|
6260
|
+
/**
|
|
6261
|
+
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
6262
|
+
*
|
|
6263
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
6264
|
+
*/
|
|
6265
|
+
get withCredentials() {
|
|
6266
|
+
return __privateGet(this, _withCredentials);
|
|
6267
|
+
}
|
|
6268
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
6269
|
+
get onerror() {
|
|
6270
|
+
return __privateGet(this, _onError);
|
|
6271
|
+
}
|
|
6272
|
+
set onerror(value) {
|
|
6273
|
+
__privateSet(this, _onError, value);
|
|
6274
|
+
}
|
|
6275
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
6276
|
+
get onmessage() {
|
|
6277
|
+
return __privateGet(this, _onMessage);
|
|
6278
|
+
}
|
|
6279
|
+
set onmessage(value) {
|
|
6280
|
+
__privateSet(this, _onMessage, value);
|
|
6281
|
+
}
|
|
6282
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
6283
|
+
get onopen() {
|
|
6284
|
+
return __privateGet(this, _onOpen);
|
|
6285
|
+
}
|
|
6286
|
+
set onopen(value) {
|
|
6287
|
+
__privateSet(this, _onOpen, value);
|
|
6288
|
+
}
|
|
6289
|
+
addEventListener(type, listener, options) {
|
|
6290
|
+
const listen = listener;
|
|
6291
|
+
super.addEventListener(type, listen, options);
|
|
6292
|
+
}
|
|
6293
|
+
removeEventListener(type, listener, options) {
|
|
6294
|
+
const listen = listener;
|
|
6295
|
+
super.removeEventListener(type, listen, options);
|
|
6296
|
+
}
|
|
6297
|
+
/**
|
|
6298
|
+
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
6299
|
+
*
|
|
6300
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
|
|
6301
|
+
*
|
|
6302
|
+
* @public
|
|
6303
|
+
*/
|
|
6304
|
+
close() {
|
|
6305
|
+
__privateGet(this, _reconnectTimer) && clearTimeout(__privateGet(this, _reconnectTimer)), __privateGet(this, _readyState) !== this.CLOSED && (__privateGet(this, _controller) && __privateGet(this, _controller).abort(), __privateSet(this, _readyState, this.CLOSED), __privateSet(this, _controller, void 0));
|
|
6306
|
+
}
|
|
5067
6307
|
};
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
6308
|
+
_readyState = /* @__PURE__ */ new WeakMap(), _url = /* @__PURE__ */ new WeakMap(), _redirectUrl = /* @__PURE__ */ new WeakMap(), _withCredentials = /* @__PURE__ */ new WeakMap(), _fetch = /* @__PURE__ */ new WeakMap(), _reconnectInterval = /* @__PURE__ */ new WeakMap(), _reconnectTimer = /* @__PURE__ */ new WeakMap(), _lastEventId = /* @__PURE__ */ new WeakMap(), _controller = /* @__PURE__ */ new WeakMap(), _parser = /* @__PURE__ */ new WeakMap(), _onError = /* @__PURE__ */ new WeakMap(), _onMessage = /* @__PURE__ */ new WeakMap(), _onOpen = /* @__PURE__ */ new WeakMap(), _EventSource_instances = /* @__PURE__ */ new WeakSet(), /**
|
|
6309
|
+
* Connect to the given URL and start receiving events
|
|
6310
|
+
*
|
|
6311
|
+
* @internal
|
|
6312
|
+
*/
|
|
6313
|
+
connect_fn = function() {
|
|
6314
|
+
__privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _controller, new AbortController()), __privateGet(this, _fetch)(__privateGet(this, _url), __privateMethod(this, _EventSource_instances, getRequestOptions_fn).call(this)).then(__privateGet(this, _onFetchResponse)).catch(__privateGet(this, _onFetchError));
|
|
6315
|
+
}, _onFetchResponse = /* @__PURE__ */ new WeakMap(), _onFetchError = /* @__PURE__ */ new WeakMap(), /**
|
|
6316
|
+
* Get request options for the `fetch()` request
|
|
6317
|
+
*
|
|
6318
|
+
* @returns The request options
|
|
6319
|
+
* @internal
|
|
6320
|
+
*/
|
|
6321
|
+
getRequestOptions_fn = function() {
|
|
6322
|
+
var _a;
|
|
6323
|
+
const init2 = {
|
|
6324
|
+
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
6325
|
+
// [spec] …will have their mode set to "cors"…
|
|
6326
|
+
mode: "cors",
|
|
6327
|
+
redirect: "follow",
|
|
6328
|
+
headers: { Accept: "text/event-stream", ...__privateGet(this, _lastEventId) ? { "Last-Event-ID": __privateGet(this, _lastEventId) } : void 0 },
|
|
6329
|
+
cache: "no-store",
|
|
6330
|
+
signal: (_a = __privateGet(this, _controller)) == null ? void 0 : _a.signal
|
|
5082
6331
|
};
|
|
5083
|
-
|
|
6332
|
+
return "window" in globalThis && (init2.credentials = this.withCredentials ? "include" : "same-origin"), init2;
|
|
6333
|
+
}, _onEvent = /* @__PURE__ */ new WeakMap(), _onRetryChange = /* @__PURE__ */ new WeakMap(), /**
|
|
6334
|
+
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
6335
|
+
*
|
|
6336
|
+
* @param error - The error causing the connection to fail
|
|
6337
|
+
* @param code - The HTTP status code, if available
|
|
6338
|
+
* @internal
|
|
6339
|
+
*/
|
|
6340
|
+
failConnection_fn = function(message, code) {
|
|
6341
|
+
var _a;
|
|
6342
|
+
__privateGet(this, _readyState) !== this.CLOSED && __privateSet(this, _readyState, this.CLOSED);
|
|
6343
|
+
const errorEvent = new ErrorEvent("error", { code, message });
|
|
6344
|
+
(_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent);
|
|
6345
|
+
}, /**
|
|
6346
|
+
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
6347
|
+
*
|
|
6348
|
+
* @param message - The error causing the connection to fail
|
|
6349
|
+
* @param code - The HTTP status code, if available
|
|
6350
|
+
* @internal
|
|
6351
|
+
*/
|
|
6352
|
+
scheduleReconnect_fn = function(message, code) {
|
|
6353
|
+
var _a;
|
|
6354
|
+
if (__privateGet(this, _readyState) === this.CLOSED)
|
|
6355
|
+
return;
|
|
6356
|
+
__privateSet(this, _readyState, this.CONNECTING);
|
|
6357
|
+
const errorEvent = new ErrorEvent("error", { code, message });
|
|
6358
|
+
(_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent), __privateSet(this, _reconnectTimer, setTimeout(__privateGet(this, _reconnect), __privateGet(this, _reconnectInterval)));
|
|
6359
|
+
}, _reconnect = /* @__PURE__ */ new WeakMap(), /**
|
|
6360
|
+
* ReadyState representing an EventSource currently trying to connect
|
|
6361
|
+
*
|
|
6362
|
+
* @public
|
|
6363
|
+
*/
|
|
6364
|
+
EventSource.CONNECTING = 0, /**
|
|
6365
|
+
* ReadyState representing an EventSource connection that is open (eg connected)
|
|
6366
|
+
*
|
|
6367
|
+
* @public
|
|
6368
|
+
*/
|
|
6369
|
+
EventSource.OPEN = 1, /**
|
|
6370
|
+
* ReadyState representing an EventSource connection that is closed (eg disconnected)
|
|
6371
|
+
*
|
|
6372
|
+
* @public
|
|
6373
|
+
*/
|
|
6374
|
+
EventSource.CLOSED = 2;
|
|
6375
|
+
Object.defineProperty(EventSource, /* @__PURE__ */ Symbol.for("eventsource.supports-fetch-override"), {
|
|
6376
|
+
value: true,
|
|
6377
|
+
writable: false,
|
|
6378
|
+
configurable: false,
|
|
6379
|
+
enumerable: false
|
|
6380
|
+
});
|
|
6381
|
+
function getBaseURL() {
|
|
6382
|
+
const doc = "document" in globalThis ? globalThis.document : void 0;
|
|
6383
|
+
return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
|
|
6384
|
+
}
|
|
5084
6385
|
|
|
5085
|
-
// src/client/
|
|
5086
|
-
var
|
|
6386
|
+
// src/client/channel.ts
|
|
6387
|
+
var channelClient = (baseUrl) => {
|
|
5087
6388
|
const u = (p) => `${baseUrl}${p}`;
|
|
6389
|
+
const JSON_CT = { "content-type": "application/json" };
|
|
6390
|
+
const member = (channelId, name) => u(`/channels/${channelId}/members/${encodeURIComponent(name)}`);
|
|
5088
6391
|
return {
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
6392
|
+
create: async (workspaceId, title, description, token) => {
|
|
6393
|
+
const res = await fetch(u(`/workspaces/${workspaceId}/channels`), {
|
|
6394
|
+
method: "POST",
|
|
6395
|
+
headers: { ...JSON_CT, ...token ? { authorization: `Bearer ${token}` } : {} },
|
|
6396
|
+
body: JSON.stringify({
|
|
6397
|
+
...title ? { title } : {},
|
|
6398
|
+
...description ? { description } : {}
|
|
6399
|
+
})
|
|
5095
6400
|
});
|
|
5096
|
-
|
|
5097
|
-
|
|
6401
|
+
if (!res.ok)
|
|
6402
|
+
throw new Error(
|
|
6403
|
+
`POST /workspaces/${workspaceId}/channels \u2192 ${res.status}: ${await res.text()}`
|
|
6404
|
+
);
|
|
6405
|
+
return await res.json();
|
|
5098
6406
|
},
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
});
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
const auth = { authorization: `Bearer ${workerToken}` };
|
|
5143
|
-
return {
|
|
5144
|
-
emitEvent: (type, payload) => {
|
|
5145
|
-
const post = () => request(u(`/sessions/${sessionId}/events`), {
|
|
6407
|
+
manifest: async (channelId) => {
|
|
6408
|
+
const res = await fetch(u(`/channels/${channelId}`));
|
|
6409
|
+
if (!res.ok) throw new Error(`GET channel \u2192 ${res.status}: ${await res.text()}`);
|
|
6410
|
+
return await res.json();
|
|
6411
|
+
},
|
|
6412
|
+
update: async (channelId, patch) => {
|
|
6413
|
+
const res = await fetch(u(`/channels/${channelId}`), {
|
|
6414
|
+
method: "PATCH",
|
|
6415
|
+
headers: JSON_CT,
|
|
6416
|
+
body: JSON.stringify(patch)
|
|
6417
|
+
});
|
|
6418
|
+
if (!res.ok) throw new Error(`PATCH channel \u2192 ${res.status}: ${await res.text()}`);
|
|
6419
|
+
return await res.json();
|
|
6420
|
+
},
|
|
6421
|
+
help: async () => {
|
|
6422
|
+
const res = await fetch(u("/channels/help"));
|
|
6423
|
+
if (!res.ok) throw new Error(`GET /channels/help \u2192 ${res.status}: ${await res.text()}`);
|
|
6424
|
+
return await res.text();
|
|
6425
|
+
},
|
|
6426
|
+
destroy: async (channelId) => {
|
|
6427
|
+
const res = await fetch(u(`/channels/${channelId}`), { method: "DELETE" });
|
|
6428
|
+
if (!res.ok) throw new Error(`DELETE channel \u2192 ${res.status}: ${await res.text()}`);
|
|
6429
|
+
},
|
|
6430
|
+
join: async (channelId, name, kind) => {
|
|
6431
|
+
const res = await fetch(member(channelId, name), {
|
|
6432
|
+
method: "PUT",
|
|
6433
|
+
headers: JSON_CT,
|
|
6434
|
+
body: JSON.stringify({ kind: kind ?? "agent" })
|
|
6435
|
+
});
|
|
6436
|
+
if (!res.ok) throw new Error(`join channel \u2192 ${res.status}: ${await res.text()}`);
|
|
6437
|
+
return (await res.json()).members;
|
|
6438
|
+
},
|
|
6439
|
+
leave: async (channelId, name) => {
|
|
6440
|
+
const res = await fetch(member(channelId, name), { method: "DELETE" });
|
|
6441
|
+
if (!res.ok) throw new Error(`leave channel \u2192 ${res.status}: ${await res.text()}`);
|
|
6442
|
+
},
|
|
6443
|
+
members: async (channelId) => {
|
|
6444
|
+
const res = await fetch(u(`/channels/${channelId}/members`));
|
|
6445
|
+
if (!res.ok) throw new Error(`GET members \u2192 ${res.status}: ${await res.text()}`);
|
|
6446
|
+
return (await res.json()).members;
|
|
6447
|
+
},
|
|
6448
|
+
send: async (channelId, msg) => {
|
|
6449
|
+
const res = await fetch(u(`/channels/${channelId}/messages`), {
|
|
5146
6450
|
method: "POST",
|
|
5147
|
-
|
|
5148
|
-
|
|
6451
|
+
headers: JSON_CT,
|
|
6452
|
+
body: JSON.stringify(msg)
|
|
5149
6453
|
});
|
|
5150
|
-
|
|
6454
|
+
if (!res.ok) throw new Error(`POST channel message \u2192 ${res.status}: ${await res.text()}`);
|
|
6455
|
+
return await res.json();
|
|
5151
6456
|
},
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
6457
|
+
uploadAttachment: async (channelId, input) => {
|
|
6458
|
+
const res = await fetch(
|
|
6459
|
+
u(`/channels/${channelId}/attachments?filename=${encodeURIComponent(input.filename)}`),
|
|
6460
|
+
{ method: "POST", headers: { "content-type": input.contentType }, body: input.body }
|
|
6461
|
+
);
|
|
6462
|
+
if (!res.ok) throw new Error(`upload attachment \u2192 ${res.status}: ${await res.text()}`);
|
|
6463
|
+
return await res.json();
|
|
6464
|
+
},
|
|
6465
|
+
downloadAttachment: async (channelId, attId) => {
|
|
6466
|
+
const res = await fetch(u(`/channels/${channelId}/attachments/${attId}`));
|
|
6467
|
+
if (!res.ok) throw new Error(`download attachment \u2192 ${res.status}: ${await res.text()}`);
|
|
6468
|
+
return res;
|
|
6469
|
+
},
|
|
6470
|
+
read: async (channelId, opts) => {
|
|
6471
|
+
const params = new URLSearchParams({ since: String(opts?.since ?? 0) });
|
|
6472
|
+
if (opts?.for) params.set("for", opts.for);
|
|
6473
|
+
const res = await fetch(u(`/channels/${channelId}/messages?${params}`));
|
|
6474
|
+
if (!res.ok) throw new Error(`GET messages \u2192 ${res.status}: ${await res.text()}`);
|
|
6475
|
+
return (await res.json()).messages;
|
|
6476
|
+
},
|
|
6477
|
+
listen: (channelId, opts) => {
|
|
6478
|
+
let cursor = opts.since ?? 0;
|
|
6479
|
+
const params = new URLSearchParams({ since: String(cursor) });
|
|
6480
|
+
if (opts.for) params.set("for", opts.for);
|
|
6481
|
+
if (opts.as) params.set("as", opts.as);
|
|
6482
|
+
const es = new EventSource(u(`/channels/${channelId}/stream?${params}`));
|
|
6483
|
+
es.onmessage = (e) => {
|
|
6484
|
+
try {
|
|
6485
|
+
const m = JSON.parse(e.data);
|
|
6486
|
+
if (m.seq <= cursor) return;
|
|
6487
|
+
cursor = m.seq;
|
|
6488
|
+
opts.onMessage(m);
|
|
6489
|
+
} catch (err) {
|
|
6490
|
+
opts.onError?.(err);
|
|
6491
|
+
}
|
|
6492
|
+
};
|
|
6493
|
+
es.onerror = (err) => opts.onError?.(err);
|
|
6494
|
+
return () => es.close();
|
|
6495
|
+
}
|
|
5163
6496
|
};
|
|
5164
6497
|
};
|
|
5165
6498
|
|
|
5166
|
-
// src/util.ts
|
|
5167
|
-
var common = {
|
|
5168
|
-
url: {
|
|
5169
|
-
type: "string",
|
|
5170
|
-
description: "baton server url (--url > .baton.json > BATON_URL > http://localhost:3280)"
|
|
5171
|
-
},
|
|
5172
|
-
json: { type: "boolean", description: "output JSON" }
|
|
5173
|
-
};
|
|
5174
|
-
var resolveAuth = (env, fileToken) => {
|
|
5175
|
-
const envBearer = env.BATON_TOKEN ?? env.BATON_WORKER_TOKEN;
|
|
5176
|
-
if (envBearer) return { bearer: envBearer };
|
|
5177
|
-
if (env.BATON_USER && env.BATON_PASS) return "cookie";
|
|
5178
|
-
return fileToken ? { bearer: fileToken } : void 0;
|
|
5179
|
-
};
|
|
5180
|
-
var clientFor = (args) => {
|
|
5181
|
-
const baseUrl = resolveBaseUrl(args.url);
|
|
5182
|
-
const fileToken = loadProjectConfigOrNull(projectConfigPath())?.worker?.apiToken;
|
|
5183
|
-
const auth = resolveAuth(process.env, fileToken);
|
|
5184
|
-
return createClient(baseUrl, auth && auth !== "cookie" ? auth : void 0);
|
|
5185
|
-
};
|
|
5186
|
-
var resolveBearer = () => {
|
|
5187
|
-
const fileToken = loadProjectConfigOrNull(projectConfigPath())?.worker?.apiToken;
|
|
5188
|
-
const auth = resolveAuth(process.env, fileToken);
|
|
5189
|
-
return auth && auth !== "cookie" ? auth.bearer : void 0;
|
|
5190
|
-
};
|
|
5191
|
-
var resolveProjectId = (args) => {
|
|
5192
|
-
if (args.project !== void 0 && args.project !== "") return Number(args.project);
|
|
5193
|
-
const cfg = loadProjectConfigOrNull(projectConfigPath());
|
|
5194
|
-
if (cfg?.project !== void 0) return cfg.project;
|
|
5195
|
-
throw new Error("no project in scope. pass --project <id> or run `baton init` in this directory.");
|
|
5196
|
-
};
|
|
5197
|
-
var resolveWorkspaceId = (args) => {
|
|
5198
|
-
if (args.workspace !== void 0 && args.workspace !== "") return Number(args.workspace);
|
|
5199
|
-
const cfg = loadProjectConfigOrNull(projectConfigPath());
|
|
5200
|
-
if (cfg?.workspace !== void 0) return cfg.workspace;
|
|
5201
|
-
throw new Error(
|
|
5202
|
-
"no workspace in scope. pass --workspace <id> or run `baton init` in this directory."
|
|
5203
|
-
);
|
|
5204
|
-
};
|
|
5205
|
-
var parseWorkerHandle = (handle) => {
|
|
5206
|
-
const m = handle.trim().match(/^(?:[wW]-)?(\d+)$/);
|
|
5207
|
-
return m ? Number(m[1]) : null;
|
|
5208
|
-
};
|
|
5209
|
-
var splitCsv = (s) => s ? s.split(",").map((x) => x.trim()).filter(Boolean) : void 0;
|
|
5210
|
-
var parseDuration = (s) => {
|
|
5211
|
-
const m = s.trim().match(/^(\d+)\s*([smhd]?)$/);
|
|
5212
|
-
if (!m) throw new Error(`bad interval "${s}" \u2014 use e.g. 90s, 30m, 2h, 1d`);
|
|
5213
|
-
const n = Number(m[1]);
|
|
5214
|
-
const mult = m[2] === "d" ? 86400 : m[2] === "h" ? 3600 : m[2] === "m" ? 60 : 1;
|
|
5215
|
-
return n * mult;
|
|
5216
|
-
};
|
|
5217
|
-
|
|
5218
6499
|
// src/commands/channel/close.ts
|
|
5219
6500
|
var closeCommand = defineCommand({
|
|
5220
6501
|
meta: { name: "close", description: "delete a channel (removes the room and all its messages)" },
|
|
@@ -5486,10 +6767,10 @@ var runListen = async (o) => {
|
|
|
5486
6767
|
onError: (e) => emit({ type: "channel.error", error: describe(e) })
|
|
5487
6768
|
});
|
|
5488
6769
|
emit({ type: "channel.listening", channel: o.channel, from: o.from, url: o.url });
|
|
5489
|
-
await new Promise((
|
|
6770
|
+
await new Promise((resolve3) => {
|
|
5490
6771
|
const stop = () => {
|
|
5491
6772
|
close();
|
|
5492
|
-
|
|
6773
|
+
resolve3();
|
|
5493
6774
|
};
|
|
5494
6775
|
process.on("SIGINT", stop);
|
|
5495
6776
|
process.on("SIGTERM", stop);
|
|
@@ -5587,37 +6868,20 @@ var readCommand = defineCommand({
|
|
|
5587
6868
|
});
|
|
5588
6869
|
|
|
5589
6870
|
// src/commands/channel/send.ts
|
|
5590
|
-
import { openAsBlob as
|
|
5591
|
-
import { basename as
|
|
5592
|
-
|
|
5593
|
-
// src/mime.ts
|
|
5594
|
-
import { extname } from "node:path";
|
|
5595
|
-
var BY_EXT = {
|
|
5596
|
-
".png": "image/png",
|
|
5597
|
-
".jpg": "image/jpeg",
|
|
5598
|
-
".jpeg": "image/jpeg",
|
|
5599
|
-
".gif": "image/gif",
|
|
5600
|
-
".webp": "image/webp",
|
|
5601
|
-
".svg": "image/svg+xml",
|
|
5602
|
-
".pdf": "application/pdf",
|
|
5603
|
-
".txt": "text/plain",
|
|
5604
|
-
".md": "text/markdown",
|
|
5605
|
-
".json": "application/json",
|
|
5606
|
-
".csv": "text/csv"
|
|
5607
|
-
};
|
|
5608
|
-
var contentTypeForPath = (path) => BY_EXT[extname(path).toLowerCase()] ?? "application/octet-stream";
|
|
6871
|
+
import { openAsBlob as openAsBlob3, readFileSync as readFileSync2 } from "node:fs";
|
|
6872
|
+
import { basename as basename3 } from "node:path";
|
|
5609
6873
|
|
|
5610
6874
|
// src/commands/attach.ts
|
|
5611
|
-
import { openAsBlob } from "node:fs";
|
|
5612
|
-
import { basename } from "node:path";
|
|
6875
|
+
import { openAsBlob as openAsBlob2 } from "node:fs";
|
|
6876
|
+
import { basename as basename2 } from "node:path";
|
|
5613
6877
|
var attachPaths = (raw) => (raw === void 0 ? [] : Array.isArray(raw) ? raw : [raw]).flatMap((p) => p.split(",")).map((p) => p.trim()).filter(Boolean);
|
|
5614
6878
|
var uploadAttachments = async (client, sessionId, paths) => {
|
|
5615
6879
|
const out = [];
|
|
5616
6880
|
for (const path of paths) {
|
|
5617
|
-
const body = await
|
|
6881
|
+
const body = await openAsBlob2(path, { type: contentTypeForPath(path) });
|
|
5618
6882
|
out.push(
|
|
5619
6883
|
await client.sessions.uploadAttachment(sessionId, {
|
|
5620
|
-
filename:
|
|
6884
|
+
filename: basename2(path),
|
|
5621
6885
|
contentType: contentTypeForPath(path),
|
|
5622
6886
|
body
|
|
5623
6887
|
})
|
|
@@ -5654,9 +6918,9 @@ var sendCommand = defineCommand({
|
|
|
5654
6918
|
for (const path of attachPaths(args.attach)) {
|
|
5655
6919
|
attachments.push(
|
|
5656
6920
|
await client.uploadAttachment(args.channel, {
|
|
5657
|
-
filename:
|
|
6921
|
+
filename: basename3(path),
|
|
5658
6922
|
contentType: contentTypeForPath(path),
|
|
5659
|
-
body: await
|
|
6923
|
+
body: await openAsBlob3(path, { type: contentTypeForPath(path) })
|
|
5660
6924
|
})
|
|
5661
6925
|
);
|
|
5662
6926
|
}
|
|
@@ -6153,10 +7417,10 @@ var listenCommand2 = defineCommand({
|
|
|
6153
7417
|
onError: (e) => emit({ type: "relay.error", error: describe2(e) })
|
|
6154
7418
|
});
|
|
6155
7419
|
emit({ type: "relay.listening", channel: args.channel, from: me, url });
|
|
6156
|
-
await new Promise((
|
|
7420
|
+
await new Promise((resolve3) => {
|
|
6157
7421
|
const stop = () => {
|
|
6158
7422
|
close();
|
|
6159
|
-
|
|
7423
|
+
resolve3();
|
|
6160
7424
|
};
|
|
6161
7425
|
process.on("SIGINT", stop);
|
|
6162
7426
|
process.on("SIGTERM", stop);
|
|
@@ -7264,12 +8528,12 @@ var runTurn = async (config, worker2, msg, resuming, queryFn, log = (m) => conso
|
|
|
7264
8528
|
const ceiling = turnTimeoutMs();
|
|
7265
8529
|
let timer;
|
|
7266
8530
|
let heartbeat;
|
|
7267
|
-
const timeout = new Promise((
|
|
7268
|
-
timer = setTimeout(() =>
|
|
8531
|
+
const timeout = new Promise((resolve3) => {
|
|
8532
|
+
timer = setTimeout(() => resolve3(TIMEOUT), ceiling);
|
|
7269
8533
|
});
|
|
7270
|
-
const interrupted = new Promise((
|
|
7271
|
-
if (externalSignal?.aborted)
|
|
7272
|
-
else externalSignal?.addEventListener("abort", () =>
|
|
8534
|
+
const interrupted = new Promise((resolve3) => {
|
|
8535
|
+
if (externalSignal?.aborted) resolve3(ABORTED);
|
|
8536
|
+
else externalSignal?.addEventListener("abort", () => resolve3(ABORTED), { once: true });
|
|
7273
8537
|
});
|
|
7274
8538
|
try {
|
|
7275
8539
|
heartbeat = setInterval(() => {
|
|
@@ -7345,9 +8609,9 @@ var subscribeStream = (url, ESCtor, seen, log, onUserMessage, onInterrupt, onRea
|
|
|
7345
8609
|
es.onerror = () => log("sse error (eventsource will retry)");
|
|
7346
8610
|
return es;
|
|
7347
8611
|
};
|
|
7348
|
-
var waitForAbort = (signal) => new Promise((
|
|
7349
|
-
if (signal.aborted) return
|
|
7350
|
-
signal.addEventListener("abort", () =>
|
|
8612
|
+
var waitForAbort = (signal) => new Promise((resolve3) => {
|
|
8613
|
+
if (signal.aborted) return resolve3();
|
|
8614
|
+
signal.addEventListener("abort", () => resolve3(), { once: true });
|
|
7351
8615
|
});
|
|
7352
8616
|
var shouldReap = (lastActivity, now, busy, queueLen, idleMs) => !busy && queueLen === 0 && now - lastActivity >= idleMs;
|
|
7353
8617
|
var idleMsFromEnv = () => Number(process.env.BATON_SESSION_IDLE_MS) || 30 * 6e4;
|
|
@@ -7470,12 +8734,12 @@ var runDaemon = async (config, deps, signal) => {
|
|
|
7470
8734
|
);
|
|
7471
8735
|
const idleMs = idleMsFromEnv();
|
|
7472
8736
|
let idleTimer;
|
|
7473
|
-
const reaped = new Promise((
|
|
8737
|
+
const reaped = new Promise((resolve3) => {
|
|
7474
8738
|
idleTimer = setInterval(
|
|
7475
8739
|
() => {
|
|
7476
8740
|
if (!reconciling && shouldReap(lastActivity, Date.now(), busy, pendingQueue.length, idleMs)) {
|
|
7477
8741
|
log("idle \u2014 shutting down (resumes on next message)");
|
|
7478
|
-
|
|
8742
|
+
resolve3();
|
|
7479
8743
|
}
|
|
7480
8744
|
},
|
|
7481
8745
|
Math.min(idleMs, 3e4)
|
|
@@ -7817,7 +9081,7 @@ import { hostname as osHostname } from "node:os";
|
|
|
7817
9081
|
// src/session/worktree.ts
|
|
7818
9082
|
import { execFile, execFileSync, spawnSync as spawnSync2 } from "node:child_process";
|
|
7819
9083
|
import { appendFileSync, existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
7820
|
-
import { dirname, isAbsolute as isAbsolute2, resolve } from "node:path";
|
|
9084
|
+
import { dirname, isAbsolute as isAbsolute2, resolve as resolve2 } from "node:path";
|
|
7821
9085
|
import { promisify } from "node:util";
|
|
7822
9086
|
var git = (repo, args) => spawnSync2("git", ["-C", repo, ...args], {
|
|
7823
9087
|
stdio: "pipe",
|
|
@@ -7927,7 +9191,7 @@ var ensureExcluded = (repo, pattern) => {
|
|
|
7927
9191
|
});
|
|
7928
9192
|
if (r.status !== 0) return;
|
|
7929
9193
|
const rel = r.stdout.trim();
|
|
7930
|
-
const path = isAbsolute2(rel) ? rel :
|
|
9194
|
+
const path = isAbsolute2(rel) ? rel : resolve2(repo, rel);
|
|
7931
9195
|
const current = existsSync4(path) ? readFileSync5(path, "utf8") : "";
|
|
7932
9196
|
if (current.split("\n").includes(pattern)) return;
|
|
7933
9197
|
mkdirSync3(dirname(path), { recursive: true });
|
|
@@ -7963,6 +9227,38 @@ var restoreWorktree = async (repo, worktreePath, sessionCode, baseBranch = repoH
|
|
|
7963
9227
|
});
|
|
7964
9228
|
};
|
|
7965
9229
|
|
|
9230
|
+
// src/worker/bundled-skills.ts
|
|
9231
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
9232
|
+
import { cpSync, existsSync as existsSync5 } from "node:fs";
|
|
9233
|
+
import { dirname as dirname2, join as join7 } from "node:path";
|
|
9234
|
+
import { fileURLToPath } from "node:url";
|
|
9235
|
+
var SKILL_NAME = "baton-publish-artifact";
|
|
9236
|
+
var TARGETS = [`.claude/skills/${SKILL_NAME}`, `.agents/skills/${SKILL_NAME}`];
|
|
9237
|
+
var bundledSkillPath = () => {
|
|
9238
|
+
const here = dirname2(fileURLToPath(import.meta.url));
|
|
9239
|
+
const candidates = [
|
|
9240
|
+
join7(here, "..", "skills", SKILL_NAME),
|
|
9241
|
+
join7(here, "..", "..", "skills", SKILL_NAME)
|
|
9242
|
+
];
|
|
9243
|
+
const found = candidates.find(existsSync5);
|
|
9244
|
+
if (!found) throw new Error(`bundled skill missing: ${SKILL_NAME}`);
|
|
9245
|
+
return found;
|
|
9246
|
+
};
|
|
9247
|
+
var isTracked = (worktreePath, relativePath) => {
|
|
9248
|
+
const result = spawnSync3("git", ["-C", worktreePath, "ls-files", "--", relativePath], {
|
|
9249
|
+
encoding: "utf8",
|
|
9250
|
+
stdio: "pipe"
|
|
9251
|
+
});
|
|
9252
|
+
return result.status === 0 && result.stdout.trim().length > 0;
|
|
9253
|
+
};
|
|
9254
|
+
var syncBundledArtifactSkill = (repo, worktreePath) => {
|
|
9255
|
+
const source = bundledSkillPath();
|
|
9256
|
+
TARGETS.filter((target) => !isTracked(worktreePath, target)).forEach((target) => {
|
|
9257
|
+
ensureExcluded(repo, `${target}/`);
|
|
9258
|
+
cpSync(source, join7(worktreePath, target), { recursive: true, force: true });
|
|
9259
|
+
});
|
|
9260
|
+
};
|
|
9261
|
+
|
|
7966
9262
|
// src/worker/watchdog.ts
|
|
7967
9263
|
var stale = (okAt, now, thresholdMs) => now - okAt > thresholdMs;
|
|
7968
9264
|
var streamWedged = (isOpen, okAt, now, thresholdMs) => !isOpen && stale(okAt, now, thresholdMs);
|
|
@@ -8021,13 +9317,13 @@ var createLiveness = (deps) => {
|
|
|
8021
9317
|
|
|
8022
9318
|
// src/worker/service-supervisor.ts
|
|
8023
9319
|
import { mkdirSync as mkdirSync4 } from "node:fs";
|
|
8024
|
-
import { join as
|
|
9320
|
+
import { join as join9 } from "node:path";
|
|
8025
9321
|
|
|
8026
9322
|
// src/worker/service-process.ts
|
|
8027
9323
|
import { spawn as spawn2 } from "node:child_process";
|
|
8028
|
-
import { closeSync, existsSync as
|
|
8029
|
-
import { dirname as
|
|
8030
|
-
import { fileURLToPath } from "node:url";
|
|
9324
|
+
import { closeSync, existsSync as existsSync6, openSync } from "node:fs";
|
|
9325
|
+
import { dirname as dirname3, join as join8 } from "node:path";
|
|
9326
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8031
9327
|
var START_TIMEOUT_MS = 1e4;
|
|
8032
9328
|
var isWrapperMessage = (message) => {
|
|
8033
9329
|
if (typeof message !== "object" || message === null) return false;
|
|
@@ -8036,9 +9332,9 @@ var isWrapperMessage = (message) => {
|
|
|
8036
9332
|
return value.type === "error" && typeof value.error === "string";
|
|
8037
9333
|
};
|
|
8038
9334
|
var binPath = () => {
|
|
8039
|
-
const here =
|
|
8040
|
-
const devShim =
|
|
8041
|
-
return
|
|
9335
|
+
const here = dirname3(fileURLToPath2(import.meta.url));
|
|
9336
|
+
const devShim = join8(here, "..", "..", "bin", "baton.mjs");
|
|
9337
|
+
return existsSync6(devShim) ? devShim : fileURLToPath2(import.meta.url);
|
|
8042
9338
|
};
|
|
8043
9339
|
var startServiceProcess = (input) => {
|
|
8044
9340
|
const logFd = openSync(input.logPath, "a");
|
|
@@ -8052,7 +9348,7 @@ var startServiceProcess = (input) => {
|
|
|
8052
9348
|
} finally {
|
|
8053
9349
|
closeSync(logFd);
|
|
8054
9350
|
}
|
|
8055
|
-
const started = new Promise((
|
|
9351
|
+
const started = new Promise((resolve3, reject) => {
|
|
8056
9352
|
let settled = false;
|
|
8057
9353
|
let timer;
|
|
8058
9354
|
const cleanup = () => {
|
|
@@ -8066,7 +9362,7 @@ var startServiceProcess = (input) => {
|
|
|
8066
9362
|
settled = true;
|
|
8067
9363
|
cleanup();
|
|
8068
9364
|
if (result instanceof Error) reject(result);
|
|
8069
|
-
else
|
|
9365
|
+
else resolve3(result);
|
|
8070
9366
|
};
|
|
8071
9367
|
const onMessage = (message) => {
|
|
8072
9368
|
if (!isWrapperMessage(message)) return;
|
|
@@ -8091,7 +9387,7 @@ var startServiceProcess = (input) => {
|
|
|
8091
9387
|
};
|
|
8092
9388
|
|
|
8093
9389
|
// src/worker/service-supervisor.ts
|
|
8094
|
-
var waitForExit = (child) => child.exitCode !== null ? Promise.resolve() : new Promise((
|
|
9390
|
+
var waitForExit = (child) => child.exitCode !== null ? Promise.resolve() : new Promise((resolve3) => child.once("exit", () => resolve3()));
|
|
8095
9391
|
var createServiceSupervisor = (deps) => {
|
|
8096
9392
|
const { getSession, sendReport, cfg, log } = deps;
|
|
8097
9393
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -8140,8 +9436,8 @@ var createServiceSupervisor = (deps) => {
|
|
|
8140
9436
|
error: "session is not materialized on this worker",
|
|
8141
9437
|
status: 400
|
|
8142
9438
|
});
|
|
8143
|
-
const logDir =
|
|
8144
|
-
const logPath =
|
|
9439
|
+
const logDir = join9(session2.worktreePath, ".baton-services");
|
|
9440
|
+
const logPath = join9(logDir, `${name}.log`);
|
|
8145
9441
|
mkdirSync4(logDir, { recursive: true });
|
|
8146
9442
|
const { wrapper, started } = startServiceProcess({ argv, cwd: session2.worktreePath, logPath });
|
|
8147
9443
|
const entry = {
|
|
@@ -8203,9 +9499,9 @@ var createServiceSupervisor = (deps) => {
|
|
|
8203
9499
|
// src/worker/session-supervisor.ts
|
|
8204
9500
|
import { spawn as spawn3 } from "node:child_process";
|
|
8205
9501
|
import { randomUUID } from "node:crypto";
|
|
8206
|
-
import { existsSync as
|
|
8207
|
-
import { dirname as
|
|
8208
|
-
import { fileURLToPath as
|
|
9502
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
9503
|
+
import { dirname as dirname4, join as join11 } from "node:path";
|
|
9504
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8209
9505
|
import { query as query2 } from "@anthropic-ai/claude-agent-sdk";
|
|
8210
9506
|
|
|
8211
9507
|
// src/session/runner/title.ts
|
|
@@ -8298,7 +9594,7 @@ var generateTitle = async (input) => {
|
|
|
8298
9594
|
// src/session/runner/title-codex.ts
|
|
8299
9595
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
8300
9596
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
8301
|
-
import { join as
|
|
9597
|
+
import { join as join10 } from "node:path";
|
|
8302
9598
|
import { Codex as Codex2 } from "@openai/codex-sdk";
|
|
8303
9599
|
var generateTitleWithCodex = async (input) => {
|
|
8304
9600
|
const { userText, assistantText } = input;
|
|
@@ -8307,7 +9603,7 @@ var generateTitleWithCodex = async (input) => {
|
|
|
8307
9603
|
const timer = setTimeout(() => abort.abort(), TITLE_TIMEOUT_MS);
|
|
8308
9604
|
let cwd = "";
|
|
8309
9605
|
try {
|
|
8310
|
-
cwd = await mkdtemp(
|
|
9606
|
+
cwd = await mkdtemp(join10(tmpdir3(), "baton-title-"));
|
|
8311
9607
|
const client = input.client ?? new Codex2();
|
|
8312
9608
|
const thread = client.startThread({
|
|
8313
9609
|
workingDirectory: cwd,
|
|
@@ -8335,9 +9631,9 @@ var generateTitleWithCodex = async (input) => {
|
|
|
8335
9631
|
|
|
8336
9632
|
// src/worker/session-supervisor.ts
|
|
8337
9633
|
var binPath2 = () => {
|
|
8338
|
-
const here =
|
|
8339
|
-
const devShim =
|
|
8340
|
-
return
|
|
9634
|
+
const here = dirname4(fileURLToPath3(import.meta.url));
|
|
9635
|
+
const devShim = join11(here, "..", "..", "bin", "baton.mjs");
|
|
9636
|
+
return existsSync7(devShim) ? devShim : fileURLToPath3(import.meta.url);
|
|
8341
9637
|
};
|
|
8342
9638
|
var createSessionSupervisor = (deps) => {
|
|
8343
9639
|
const { client, cfg, repo, log, hasTerminal, closeTerminal } = deps;
|
|
@@ -8390,7 +9686,7 @@ var createSessionSupervisor = (deps) => {
|
|
|
8390
9686
|
if (!session2.agentSessionId || !worktreePath) {
|
|
8391
9687
|
const sessionCode = randomUUID();
|
|
8392
9688
|
const agentSessionId = session2.agentKind === "codex" ? `pending:${sessionCode}` : sessionCode;
|
|
8393
|
-
worktreePath =
|
|
9689
|
+
worktreePath = join11(worktreeDir, slug(`${name}-${sessionCode.slice(0, 8)}`));
|
|
8394
9690
|
const base = await syncedBase();
|
|
8395
9691
|
if (wasCanceled()) return log(`session #${sessionId} start canceled during git sync`);
|
|
8396
9692
|
createWorktree({
|
|
@@ -8402,14 +9698,15 @@ var createSessionSupervisor = (deps) => {
|
|
|
8402
9698
|
await client.sessions.materialize(sessionId, { agentSessionId, worktreePath }, cfg.apiToken);
|
|
8403
9699
|
if (wasCanceled()) return log(`session #${sessionId} start canceled after materializing`);
|
|
8404
9700
|
log(`materialized session #${sessionId} \u2192 ${worktreePath}`);
|
|
8405
|
-
} else if (!
|
|
9701
|
+
} else if (!existsSync7(worktreePath)) {
|
|
8406
9702
|
await restoreWorktree(repo, worktreePath, session2.agentSessionId.slice(0, 8), baseBranch);
|
|
8407
9703
|
if (wasCanceled()) return log(`session #${sessionId} start canceled during worktree restore`);
|
|
8408
9704
|
log(`recreated session #${sessionId} worktree (was missing) \u2192 ${worktreePath}`);
|
|
8409
9705
|
}
|
|
8410
9706
|
ensureExcluded(repo, PROJECT_CONFIG_NAME);
|
|
8411
9707
|
ensureExcluded(repo, ".baton-services/");
|
|
8412
|
-
saveProjectConfig(
|
|
9708
|
+
saveProjectConfig(join11(worktreePath, PROJECT_CONFIG_NAME), worktreeConfig(cfg, sessionId));
|
|
9709
|
+
syncBundledArtifactSkill(repo, worktreePath);
|
|
8413
9710
|
if (hasTerminal(sessionId))
|
|
8414
9711
|
return log(`session #${sessionId} terminal opened mid-start \u2014 skipping headless start`);
|
|
8415
9712
|
spawnChild(sessionId, worktreePath);
|
|
@@ -8497,7 +9794,7 @@ var createSessionSupervisor = (deps) => {
|
|
|
8497
9794
|
};
|
|
8498
9795
|
|
|
8499
9796
|
// src/worker/terminal-manager.ts
|
|
8500
|
-
import { existsSync as
|
|
9797
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
8501
9798
|
import { spawn as spawn4 } from "node-pty";
|
|
8502
9799
|
|
|
8503
9800
|
// ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/wrapper.mjs
|
|
@@ -8511,16 +9808,16 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
8511
9808
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
8512
9809
|
|
|
8513
9810
|
// src/worker/pty.ts
|
|
8514
|
-
import { existsSync as
|
|
9811
|
+
import { existsSync as existsSync8, readdirSync as readdirSync2 } from "node:fs";
|
|
8515
9812
|
import { homedir as homedir3 } from "node:os";
|
|
8516
|
-
import { join as
|
|
9813
|
+
import { join as join12 } from "node:path";
|
|
8517
9814
|
var MAX_TERMINALS = 10;
|
|
8518
9815
|
var ptyArgs = (agentSessionId, hasJsonl) => hasJsonl ? ["--resume", agentSessionId] : ["--session-id", agentSessionId];
|
|
8519
9816
|
var hasSessionJsonl = (agentSessionId) => {
|
|
8520
|
-
const root =
|
|
8521
|
-
if (!
|
|
9817
|
+
const root = join12(homedir3(), ".claude", "projects");
|
|
9818
|
+
if (!existsSync8(root)) return false;
|
|
8522
9819
|
for (const dir of readdirSync2(root))
|
|
8523
|
-
if (
|
|
9820
|
+
if (existsSync8(join12(root, dir, `${agentSessionId}.jsonl`))) return true;
|
|
8524
9821
|
return false;
|
|
8525
9822
|
};
|
|
8526
9823
|
var serverTerminalWsUrl = (server, sessionId) => `${server.replace(/^http/, "ws")}/workers/me/terminal/ws?sessionId=${sessionId}`;
|
|
@@ -8528,14 +9825,20 @@ var isPositiveDim = (v) => typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
|
8528
9825
|
|
|
8529
9826
|
// src/worker/terminal-manager.ts
|
|
8530
9827
|
var createTerminalManager = (deps) => {
|
|
8531
|
-
const { cfg, log, hasChild } = deps;
|
|
9828
|
+
const { cfg, log, hasChild, prepareWorktree } = deps;
|
|
8532
9829
|
const terminals = /* @__PURE__ */ new Map();
|
|
8533
9830
|
const open = (sessionId, agentSessionId, worktreePath) => {
|
|
8534
|
-
const why = terminals.has(sessionId) ? "already open" : hasChild(sessionId) ? "headless child running" : !
|
|
9831
|
+
const why = terminals.has(sessionId) ? "already open" : hasChild(sessionId) ? "headless child running" : !existsSync9(worktreePath) ? `worktree missing (${worktreePath})` : terminals.size >= MAX_TERMINALS ? `cap ${MAX_TERMINALS} reached` : null;
|
|
8535
9832
|
if (why) {
|
|
8536
9833
|
log(`terminal #${sessionId}: ${why} \u2014 refusing`);
|
|
8537
9834
|
return;
|
|
8538
9835
|
}
|
|
9836
|
+
try {
|
|
9837
|
+
prepareWorktree(worktreePath);
|
|
9838
|
+
} catch (error) {
|
|
9839
|
+
log(`terminal #${sessionId}: worktree preparation failed: ${String(error)}`);
|
|
9840
|
+
return;
|
|
9841
|
+
}
|
|
8539
9842
|
const claudeBin = process.env.BATON_CLAUDE_BIN ?? "claude";
|
|
8540
9843
|
const term = spawn4(claudeBin, ptyArgs(agentSessionId, hasSessionJsonl(agentSessionId)), {
|
|
8541
9844
|
name: "xterm-color",
|
|
@@ -8609,11 +9912,12 @@ var createTerminalManager = (deps) => {
|
|
|
8609
9912
|
// src/worker/daemon.ts
|
|
8610
9913
|
var ES_OPEN = 1;
|
|
8611
9914
|
var runWorkerDaemon = async (cfg, client, signal) => {
|
|
9915
|
+
const repo = process.cwd();
|
|
8612
9916
|
const log = (m) => console.log(`[worker #${cfg.workerId} ${cfg.name}] ${m}`);
|
|
8613
9917
|
const supervisor = createSessionSupervisor({
|
|
8614
9918
|
client,
|
|
8615
9919
|
cfg,
|
|
8616
|
-
repo
|
|
9920
|
+
repo,
|
|
8617
9921
|
log,
|
|
8618
9922
|
hasTerminal: (id) => terminals.has(id),
|
|
8619
9923
|
closeTerminal: (id) => terminals.close(id)
|
|
@@ -8621,7 +9925,8 @@ var runWorkerDaemon = async (cfg, client, signal) => {
|
|
|
8621
9925
|
const terminals = createTerminalManager({
|
|
8622
9926
|
cfg,
|
|
8623
9927
|
log,
|
|
8624
|
-
hasChild: (id) => supervisor.has(id)
|
|
9928
|
+
hasChild: (id) => supervisor.has(id),
|
|
9929
|
+
prepareWorktree: (worktreePath) => syncBundledArtifactSkill(repo, worktreePath)
|
|
8625
9930
|
});
|
|
8626
9931
|
const services = createServiceSupervisor({
|
|
8627
9932
|
getSession: (sessionId) => client.sessions.get(sessionId),
|
|
@@ -8681,12 +9986,12 @@ var runWorkerDaemon = async (cfg, client, signal) => {
|
|
|
8681
9986
|
}
|
|
8682
9987
|
};
|
|
8683
9988
|
es.onerror = () => log("command stream error (eventsource will retry)");
|
|
8684
|
-
log(`listening for commands (server ${cfg.server}, repo ${
|
|
9989
|
+
log(`listening for commands (server ${cfg.server}, repo ${repo})`);
|
|
8685
9990
|
liveness.start();
|
|
8686
|
-
await new Promise((
|
|
8687
|
-
stop =
|
|
8688
|
-
if (signal.aborted) return
|
|
8689
|
-
signal.addEventListener("abort", () =>
|
|
9991
|
+
await new Promise((resolve3) => {
|
|
9992
|
+
stop = resolve3;
|
|
9993
|
+
if (signal.aborted) return resolve3();
|
|
9994
|
+
signal.addEventListener("abort", () => resolve3(), { once: true });
|
|
8690
9995
|
});
|
|
8691
9996
|
es.close();
|
|
8692
9997
|
liveness.stop();
|
|
@@ -8698,17 +10003,17 @@ var runWorkerDaemon = async (cfg, client, signal) => {
|
|
|
8698
10003
|
|
|
8699
10004
|
// src/worker/machine-id.ts
|
|
8700
10005
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8701
|
-
import { existsSync as
|
|
10006
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
|
|
8702
10007
|
import { homedir as homedir4 } from "node:os";
|
|
8703
|
-
import { dirname as
|
|
8704
|
-
var machineIdPath = (env = process.env) =>
|
|
10008
|
+
import { dirname as dirname5, join as join13 } from "node:path";
|
|
10009
|
+
var machineIdPath = (env = process.env) => join13(env.XDG_DATA_HOME ?? join13(env.HOME ?? homedir4(), ".local/share"), "baton", "machine-id");
|
|
8705
10010
|
var readOrCreateMachineId = (path = machineIdPath()) => {
|
|
8706
|
-
if (
|
|
10011
|
+
if (existsSync10(path)) {
|
|
8707
10012
|
const s = readFileSync6(path, "utf8").trim();
|
|
8708
10013
|
if (s) return s;
|
|
8709
10014
|
}
|
|
8710
10015
|
const id = randomUUID2();
|
|
8711
|
-
mkdirSync5(
|
|
10016
|
+
mkdirSync5(dirname5(path), { recursive: true });
|
|
8712
10017
|
writeFileSync5(path, `${id}
|
|
8713
10018
|
`, "utf8");
|
|
8714
10019
|
return id;
|
|
@@ -9024,6 +10329,7 @@ var main = defineCommand({
|
|
|
9024
10329
|
worker,
|
|
9025
10330
|
session,
|
|
9026
10331
|
service,
|
|
10332
|
+
artifact,
|
|
9027
10333
|
loop,
|
|
9028
10334
|
relay,
|
|
9029
10335
|
channel,
|