@sideboard-ai/core 0.1.280 → 0.1.282

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{abletime-VCVPSLSU.js → abletime-WLDBJJUI.js} +3 -3
  2. package/dist/{abletime-VRATUMDO.js → abletime-X64E3GUJ.js} +3 -3
  3. package/dist/{abletime-oauth-4K7MICAD.js → abletime-oauth-AXR676W5.js} +2 -2
  4. package/dist/{abletime-oauth-4C4G2J3R.js → abletime-oauth-UWOCEICP.js} +2 -2
  5. package/dist/{abletime-rest-PIBCNHF3.js → abletime-rest-LPUDJUEP.js} +2 -2
  6. package/dist/{abletime-rest-6N63ZVQ3.js → abletime-rest-S4XWEXV2.js} +2 -2
  7. package/dist/{agents-DYCFLDNL.js → agents-2IE4HKHA.js} +5 -5
  8. package/dist/{agents-RXP5NZBC.js → agents-XA2E64AW.js} +5 -5
  9. package/dist/{chunk-DK4DKQ2H.js → chunk-2KNO2GJQ.js} +722 -139
  10. package/dist/{chunk-TZ5JHIYK.js → chunk-2SJXQ4UX.js} +68 -21
  11. package/dist/{chunk-K7MWJLR7.js → chunk-5MGLNVNK.js} +6 -906
  12. package/dist/{chunk-RK5PIWCW.js → chunk-ADXVTKLC.js} +12 -4
  13. package/dist/{chunk-Y7JPL4WA.js → chunk-BDAUPNHL.js} +3 -4
  14. package/dist/{chunk-R7HLXD4I.js → chunk-BS3QLVPL.js} +93 -57
  15. package/dist/{chunk-2P75E243.js → chunk-BYZ7F2BQ.js} +707 -128
  16. package/dist/{chunk-2J34G3WJ.js → chunk-DGPROCE5.js} +93 -57
  17. package/dist/{chunk-HQXBBUQX.js → chunk-DQZPF6WL.js} +12 -11
  18. package/dist/{chunk-YDXNCBA2.js → chunk-EIEAR62M.js} +12 -11
  19. package/dist/{chunk-XKZAVGTT.js → chunk-I6HSGKMZ.js} +1 -1
  20. package/dist/chunk-JPH7PYSK.js +1241 -0
  21. package/dist/{chunk-IPPY3FG5.js → chunk-K5XSTHHP.js} +6 -906
  22. package/dist/chunk-N5UGX3JL.js +1239 -0
  23. package/dist/{chunk-HNNS25SG.js → chunk-OCUIZD4Y.js} +14 -4
  24. package/dist/{chunk-IJDQKC5A.js → chunk-PY4UCMRI.js} +4 -4
  25. package/dist/{chunk-NQ7JMVSU.js → chunk-U7HAVAGJ.js} +1 -1
  26. package/dist/{chunk-PZURG3XN.js → chunk-VA55JG2I.js} +4 -4
  27. package/dist/{chunk-CPA43FBK.js → chunk-W7HIK2A6.js} +3 -4
  28. package/dist/{chunk-SKSOCIJT.js → chunk-WY2IAB7J.js} +68 -21
  29. package/dist/{chunk-QINJKNLR.js → chunk-XTPQEZZA.js} +2 -2
  30. package/dist/{conductor-J6WDOXWM.js → conductor-CNSCOC54.js} +5 -5
  31. package/dist/{conductor-OW6NAK3N.js → conductor-U776JSXQ.js} +5 -5
  32. package/dist/{coordinator-prompt-Z2D32HWK.js → coordinator-prompt-4DJIHSE6.js} +3 -3
  33. package/dist/{coordinator-prompt-ERTHREGJ.js → coordinator-prompt-SVVGU6AZ.js} +3 -3
  34. package/dist/{global-workspace-5PJXO45Z.js → global-workspace-UPUDWIS6.js} +3 -3
  35. package/dist/{global-workspace-AK5PSPQ2.js → global-workspace-XON4YZXE.js} +3 -3
  36. package/dist/index.cjs +3690 -2912
  37. package/dist/index.d.cts +101 -28
  38. package/dist/index.d.ts +101 -28
  39. package/dist/index.js +1013 -1001
  40. package/dist/mcp/run-stdio.cjs +1975 -1259
  41. package/dist/mcp/run-stdio.js +743 -785
  42. package/dist/{orchestrator-XEKODYDQ.js → orchestrator-FPGVKEID.js} +7 -7
  43. package/dist/{orchestrator-K66OMTQO.js → orchestrator-HWJHK5NL.js} +7 -7
  44. package/dist/{thread-store-B3ZM4QEZ.js → thread-store-7XBOUQ5K.js} +1 -1
  45. package/dist/{thread-store-SHCUBWB3.js → thread-store-ZQZDREVH.js} +1 -1
  46. package/dist/{workspaces-UP6DQ3WL.js → workspaces-7AJ5RZ3P.js} +7 -3
  47. package/dist/{workspaces-WU2RNLDV.js → workspaces-F76BWCSI.js} +7 -3
  48. package/dist/{worktree-L57T3KH7.js → worktree-NKLNVNXX.js} +20 -15
  49. package/dist/{worktree-Q6UJHG25.js → worktree-YTZC3UQN.js} +14 -9
  50. package/package.json +1 -1
  51. package/dist/chunk-FWNL62VA.js +0 -308
  52. package/dist/chunk-JANCPF7Z.js +0 -310
@@ -0,0 +1,1239 @@
1
+ import {
2
+ cursorSdkStoreDir
3
+ } from "./chunk-UWQ6UCIB.js";
4
+ import {
5
+ normalizeThinkingEffort
6
+ } from "./chunk-77WWLBCI.js";
7
+ import {
8
+ threadFilePath,
9
+ threadLockPath,
10
+ threadsDir
11
+ } from "./chunk-EHT2DRT4.js";
12
+
13
+ // src/store/thread-store.ts
14
+ import { randomUUID } from "crypto";
15
+
16
+ // src/git/team-meta.ts
17
+ var SOCCER_TEAM_META = {
18
+ "aalborg": { location: "Aalborg, Denmark", league: "Danish Superliga" },
19
+ "aalesund": { location: "\xC5lesund, Norway", league: "Norwegian First Division" },
20
+ "aarhus": { location: "Aarhus, Denmark", league: "Danish Superliga" },
21
+ "aberdeen": { location: "Aberdeen, Scotland", league: "Scottish Premiership" },
22
+ "ac-milan": { location: "Milan, Italy", league: "Serie A" },
23
+ "ado-den-haag": { location: "The Hague, Netherlands", league: "Eerste Divisie" },
24
+ "aik": { location: "Stockholm, Sweden", league: "Allsvenskan" },
25
+ "ajaccio": { location: "Ajaccio, France", league: "Ligue 2" },
26
+ "ajax": { location: "Amsterdam, Netherlands", league: "Eredivisie" },
27
+ "al-ahly": { location: "Cairo, Egypt", league: "Egyptian Premier League" },
28
+ "al-hilal": { location: "Riyadh, Saudi Arabia", league: "Saudi Pro League" },
29
+ "alajuelense": { location: "Alajuela, Costa Rica", league: "Liga FPD" },
30
+ "almere-city": { location: "Almere, Netherlands", league: "Eredivisie" },
31
+ "amiens": { location: "Amiens, France", league: "Ligue 2" },
32
+ "angers": { location: "Angers, France", league: "Ligue 1" },
33
+ "anyang": { location: "Anyang, South Korea", league: "K League 1" },
34
+ "argentinos-juniors": { location: "Buenos Aires, Argentina", league: "Argentine Primera Divisi\xF3n" },
35
+ "arsenal": { location: "London, England", league: "Premier League" },
36
+ "aston-villa": { location: "Birmingham, England", league: "Premier League" },
37
+ "athletico-paranaense": { location: "Curitiba, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
38
+ "atlanta-united": { location: "Atlanta, USA", league: "MLS" },
39
+ "atlas": { location: "Guadalajara, Mexico", league: "Liga MX" },
40
+ "atletico-madrid": { location: "Madrid, Spain", league: "La Liga" },
41
+ "atletico-mineiro": { location: "Belo Horizonte, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
42
+ "atletico-san-luis": { location: "San Luis Potos\xED, Mexico", league: "Liga MX" },
43
+ "augsburg": { location: "Augsburg, Germany", league: "Bundesliga" },
44
+ "austin-fc": { location: "Austin, USA", league: "MLS" },
45
+ "auxerre": { location: "Auxerre, France", league: "Ligue 1" },
46
+ "avispa-fukuoka": { location: "Fukuoka, Japan", league: "J1 League" },
47
+ "az": { location: "Alkmaar, Netherlands", league: "Eredivisie" },
48
+ "bahia": { location: "Salvador, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
49
+ "banfield": { location: "Banfield, Argentina", league: "Argentine Primera Divisi\xF3n" },
50
+ "barcelona": { location: "Barcelona, Spain", league: "La Liga" },
51
+ "bayer-leverkusen": { location: "Leverkusen, Germany", league: "Bundesliga" },
52
+ "bayern-munich": { location: "Munich, Germany", league: "Bundesliga" },
53
+ "belgrano": { location: "C\xF3rdoba, Argentina", league: "Argentine Primera Divisi\xF3n" },
54
+ "benfica": { location: "Lisbon, Portugal", league: "Primeira Liga" },
55
+ "birmingham-legion": { location: "Birmingham, USA", league: "USL Championship" },
56
+ "boca-juniors": { location: "Buenos Aires, Argentina", league: "Argentine Primera Divisi\xF3n" },
57
+ "bodo-glimt": { location: "Bod\xF8, Norway", league: "Eliteserien" },
58
+ "bordeaux": { location: "Bordeaux, France", league: "Championnat National" },
59
+ "borussia-dortmund": { location: "Dortmund, Germany", league: "Bundesliga" },
60
+ "botafogo": { location: "Rio de Janeiro, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
61
+ "bragantino": { location: "Bragan\xE7a Paulista, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
62
+ "brann": { location: "Bergen, Norway", league: "Eliteserien" },
63
+ "brest": { location: "Brest, France", league: "Ligue 1" },
64
+ "brommapojkarna": { location: "Stockholm, Sweden", league: "Allsvenskan" },
65
+ "brondby": { location: "Br\xF8ndby, Denmark", league: "Danish Superliga" },
66
+ "brooklyn-fc": { location: "Brooklyn, USA", league: "USL Championship" },
67
+ "bucheon": { location: "Bucheon, South Korea", league: "K League 2" },
68
+ "caen": { location: "Caen, France", league: "Ligue 2" },
69
+ "cambuur": { location: "Leeuwarden, Netherlands", league: "Eerste Divisie" },
70
+ "carmelita": { location: "Alajuela, Costa Rica", league: "Liga de Ascenso" },
71
+ "cartagines": { location: "Cartago, Costa Rica", league: "Liga FPD" },
72
+ "ceara": { location: "Fortaleza, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
73
+ "celtic": { location: "Glasgow, Scotland", league: "Scottish Premiership" },
74
+ "central-cordoba": { location: "Santiago del Estero, Argentina", league: "Argentine Primera Divisi\xF3n" },
75
+ "cerezo-osaka": { location: "Osaka, Japan", league: "J1 League" },
76
+ "cf-montreal": { location: "Montreal, Canada", league: "MLS" },
77
+ "charleston-battery": { location: "Charleston, USA", league: "USL Championship" },
78
+ "charlotte-fc": { location: "Charlotte, USA", league: "MLS" },
79
+ "chelsea": { location: "London, England", league: "Premier League" },
80
+ "chicago-fire": { location: "Chicago, USA", league: "MLS" },
81
+ "chivas": { location: "Guadalajara, Mexico", league: "Liga MX" },
82
+ "clermont": { location: "Clermont-Ferrand, France", league: "Ligue 2" },
83
+ "club-america": { location: "Mexico City, Mexico", league: "Liga MX" },
84
+ "cologne": { location: "Cologne, Germany", league: "Bundesliga" },
85
+ "colorado-rapids": { location: "Commerce City, USA", league: "MLS" },
86
+ "columbus-crew": { location: "Columbus, USA", league: "MLS" },
87
+ "corinthians": { location: "S\xE3o Paulo, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
88
+ "cruz-azul": { location: "Mexico City, Mexico", league: "Liga MX" },
89
+ "cruzeiro": { location: "Belo Horizonte, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
90
+ "daejeon": { location: "Daejeon, South Korea", league: "K League 1" },
91
+ "dc-united": { location: "Washington, D.C., USA", league: "MLS" },
92
+ "defensa-y-justicia": { location: "Florencio Varela, Argentina", league: "Argentine Primera Divisi\xF3n" },
93
+ "degerfors": { location: "Degerfors, Sweden", league: "Allsvenskan" },
94
+ "detroit-city": { location: "Detroit, USA", league: "USL Championship" },
95
+ "dijon": { location: "Dijon, France", league: "Championnat National" },
96
+ "djurgarden": { location: "Stockholm, Sweden", league: "Allsvenskan" },
97
+ "dundee": { location: "Dundee, Scotland", league: "Scottish Premiership" },
98
+ "dundee-united": { location: "Dundee, Scotland", league: "Scottish Premiership" },
99
+ "dynamo-kyiv": { location: "Kyiv, Ukraine", league: "Ukrainian Premier League" },
100
+ "eintracht-frankfurt": { location: "Frankfurt, Germany", league: "Bundesliga" },
101
+ "el-paso-locomotive": { location: "El Paso, USA", league: "USL Championship" },
102
+ "elfsborg": { location: "Bor\xE5s, Sweden", league: "Allsvenskan" },
103
+ "emmen": { location: "Emmen, Netherlands", league: "Eerste Divisie" },
104
+ "esbjerg": { location: "Esbjerg, Denmark", league: "Danish 1st Division" },
105
+ "estudiantes": { location: "La Plata, Argentina", league: "Argentine Primera Divisi\xF3n" },
106
+ "everton": { location: "Liverpool, England", league: "Premier League" },
107
+ "excelsior": { location: "Rotterdam, Netherlands", league: "Eerste Divisie" },
108
+ "fagiano-okayama": { location: "Okayama, Japan", league: "J1 League" },
109
+ "falkirk": { location: "Falkirk, Scotland", league: "Scottish Championship" },
110
+ "fc-cincinnati": { location: "Cincinnati, USA", league: "MLS" },
111
+ "fc-copenhagen": { location: "Copenhagen, Denmark", league: "Danish Superliga" },
112
+ "fc-dallas": { location: "Frisco, USA", league: "MLS" },
113
+ "fc-seoul": { location: "Seoul, South Korea", league: "K League 1" },
114
+ "fc-tokyo": { location: "Tokyo, Japan", league: "J1 League" },
115
+ "fc-tulsa": { location: "Tulsa, USA", league: "USL Championship" },
116
+ "feyenoord": { location: "Rotterdam, Netherlands", league: "Eredivisie" },
117
+ "flamengo": { location: "Rio de Janeiro, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
118
+ "fluminense": { location: "Rio de Janeiro, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
119
+ "fortaleza": { location: "Fortaleza, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
120
+ "fortuna-sittard": { location: "Sittard, Netherlands", league: "Eredivisie" },
121
+ "fredrikstad": { location: "Fredrikstad, Norway", league: "Eliteserien" },
122
+ "freiburg": { location: "Freiburg, Germany", league: "Bundesliga" },
123
+ "gais": { location: "Gothenburg, Sweden", league: "Allsvenskan" },
124
+ "galatasaray": { location: "Istanbul, Turkey", league: "S\xFCper Lig" },
125
+ "gamba-osaka": { location: "Osaka, Japan", league: "J1 League" },
126
+ "gangwon": { location: "Gangneung, South Korea", league: "K League 1" },
127
+ "gimcheon-sangmu": { location: "Gimcheon, South Korea", league: "K League 1" },
128
+ "gimnasia": { location: "La Plata, Argentina", league: "Argentine Primera Divisi\xF3n" },
129
+ "gladbach": { location: "M\xF6nchengladbach, Germany", league: "Bundesliga" },
130
+ "go-ahead-eagles": { location: "Deventer, Netherlands", league: "Eredivisie" },
131
+ "godoy-cruz": { location: "Mendoza, Argentina", league: "Argentine Primera Divisi\xF3n" },
132
+ "gremio": { location: "Porto Alegre, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
133
+ "groningen": { location: "Groningen, Netherlands", league: "Eredivisie" },
134
+ "guadalupe": { location: "Goicoechea, Costa Rica", league: "Liga de Ascenso" },
135
+ "guanacasteca": { location: "Nicoya, Costa Rica", league: "Liga FPD" },
136
+ "guingamp": { location: "Guingamp, France", league: "Ligue 2" },
137
+ "gwangju": { location: "Gwangju, South Korea", league: "K League 1" },
138
+ "hacken": { location: "Gothenburg, Sweden", league: "Allsvenskan" },
139
+ "halmstad": { location: "Halmstad, Sweden", league: "Allsvenskan" },
140
+ "hamburg": { location: "Hamburg, Germany", league: "2. Bundesliga" },
141
+ "hammarby": { location: "Stockholm, Sweden", league: "Allsvenskan" },
142
+ "hartford-athletic": { location: "Hartford, USA", league: "USL Championship" },
143
+ "haugesund": { location: "Haugesund, Norway", league: "Eliteserien" },
144
+ "hearts": { location: "Edinburgh, Scotland", league: "Scottish Premiership" },
145
+ "heerenveen": { location: "Heerenveen, Netherlands", league: "Eredivisie" },
146
+ "heidenheim": { location: "Heidenheim, Germany", league: "Bundesliga" },
147
+ "helsingborg": { location: "Helsingborg, Sweden", league: "Superettan" },
148
+ "heracles": { location: "Almelo, Netherlands", league: "Eredivisie" },
149
+ "herediano": { location: "Heredia, Costa Rica", league: "Liga FPD" },
150
+ "hibernian": { location: "Edinburgh, Scotland", league: "Scottish Premiership" },
151
+ "hoffenheim": { location: "Sinsheim, Germany", league: "Bundesliga" },
152
+ "horsens": { location: "Horsens, Denmark", league: "Danish 1st Division" },
153
+ "houston-dynamo": { location: "Houston, USA", league: "MLS" },
154
+ "huracan": { location: "Buenos Aires, Argentina", league: "Argentine Primera Divisi\xF3n" },
155
+ "ifk-goteborg": { location: "Gothenburg, Sweden", league: "Allsvenskan" },
156
+ "norrkoping": { location: "Norrk\xF6ping, Sweden", league: "Allsvenskan" },
157
+ "incheon-united": { location: "Incheon, South Korea", league: "K League 1" },
158
+ "independiente": { location: "Avellaneda, Argentina", league: "Argentine Primera Divisi\xF3n" },
159
+ "indy-eleven": { location: "Indianapolis, USA", league: "USL Championship" },
160
+ "instituto": { location: "C\xF3rdoba, Argentina", league: "Argentine Primera Divisi\xF3n" },
161
+ "inter-miami": { location: "Fort Lauderdale, USA", league: "MLS" },
162
+ "inter-milan": { location: "Milan, Italy", league: "Serie A" },
163
+ "internacional": { location: "Porto Alegre, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
164
+ "jef-united": { location: "Chiba, Japan", league: "J2 League" },
165
+ "jeju-sk": { location: "Jeju, South Korea", league: "K League 1" },
166
+ "jeonbuk": { location: "Jeonju, South Korea", league: "K League 1" },
167
+ "juarez": { location: "Ciudad Ju\xE1rez, Mexico", league: "Liga MX" },
168
+ "juventude": { location: "Caxias do Sul, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
169
+ "juventus": { location: "Turin, Italy", league: "Serie A" },
170
+ "kalmar": { location: "Kalmar, Sweden", league: "Superettan" },
171
+ "kashima-antlers": { location: "Kashima, Japan", league: "J1 League" },
172
+ "kashiwa-reysol": { location: "Kashiwa, Japan", league: "J1 League" },
173
+ "kawasaki-frontale": { location: "Kawasaki, Japan", league: "J1 League" },
174
+ "kfum-oslo": { location: "Oslo, Norway", league: "Eliteserien" },
175
+ "kilmarnock": { location: "Kilmarnock, Scotland", league: "Scottish Premiership" },
176
+ "kristiansund": { location: "Kristiansund, Norway", league: "Eliteserien" },
177
+ "kyoto-sanga": { location: "Kyoto, Japan", league: "J1 League" },
178
+ "la-galaxy": { location: "Carson, USA", league: "MLS" },
179
+ "lafc": { location: "Los Angeles, USA", league: "MLS" },
180
+ "lanus": { location: "Lan\xFAs, Argentina", league: "Argentine Primera Divisi\xF3n" },
181
+ "las-vegas-lights": { location: "Las Vegas, USA", league: "USL Championship" },
182
+ "lazio": { location: "Rome, Italy", league: "Serie A" },
183
+ "le-havre": { location: "Le Havre, France", league: "Ligue 1" },
184
+ "le-mans": { location: "Le Mans, France", league: "Ligue 2" },
185
+ "leeds-united": { location: "Leeds, England", league: "Premier League" },
186
+ "leicester-city": { location: "Leicester, England", league: "Championship" },
187
+ "lens": { location: "Lens, France", league: "Ligue 1" },
188
+ "leon": { location: "Le\xF3n, Mexico", league: "Liga MX" },
189
+ "lexington-sc": { location: "Lexington, USA", league: "USL Championship" },
190
+ "liberia": { location: "Liberia, Costa Rica", league: "Liga FPD" },
191
+ "lille": { location: "Lille, France", league: "Ligue 1" },
192
+ "lillestrom": { location: "Lillestr\xF8m, Norway", league: "Eliteserien" },
193
+ "limon": { location: "Lim\xF3n, Costa Rica", league: "Liga de Ascenso" },
194
+ "liverpool": { location: "Liverpool, England", league: "Premier League" },
195
+ "livingston": { location: "Livingston, Scotland", league: "Scottish Championship" },
196
+ "lorient": { location: "Lorient, France", league: "Ligue 1" },
197
+ "loudoun-united": { location: "Leesburg, USA", league: "USL Championship" },
198
+ "louisville-city": { location: "Louisville, USA", league: "USL Championship" },
199
+ "lyngby": { location: "Kongens Lyngby, Denmark", league: "Danish Superliga" },
200
+ "lyon": { location: "Lyon, France", league: "Ligue 1" },
201
+ "machida-zelvia": { location: "Machida, Japan", league: "J1 League" },
202
+ "mainz": { location: "Mainz, Germany", league: "Bundesliga" },
203
+ "malmo": { location: "Malm\xF6, Sweden", league: "Allsvenskan" },
204
+ "manchester-city": { location: "Manchester, England", league: "Premier League" },
205
+ "manchester-united": { location: "Manchester, England", league: "Premier League" },
206
+ "marseille": { location: "Marseille, France", league: "Ligue 1" },
207
+ "mazatlan": { location: "Mazatl\xE1n, Mexico", league: "Liga MX" },
208
+ "metz": { location: "Metz, France", league: "Ligue 1" },
209
+ "miami-fc": { location: "Miami, USA", league: "USL Championship" },
210
+ "midtjylland": { location: "Herning, Denmark", league: "Danish Superliga" },
211
+ "minnesota-united": { location: "Saint Paul, USA", league: "MLS" },
212
+ "mirassol": { location: "Mirassol, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
213
+ "mito-hollyhock": { location: "Mito, Japan", league: "J2 League" },
214
+ "mjallby": { location: "H\xE4llevik, Sweden", league: "Allsvenskan" },
215
+ "molde": { location: "Molde, Norway", league: "Eliteserien" },
216
+ "monaco": { location: "Monaco", league: "Ligue 1" },
217
+ "monterey-bay": { location: "Monterey, USA", league: "USL Championship" },
218
+ "monterrey": { location: "Monterrey, Mexico", league: "Liga MX" },
219
+ "montpellier": { location: "Montpellier, France", league: "Ligue 2" },
220
+ "motherwell": { location: "Motherwell, Scotland", league: "Scottish Premiership" },
221
+ "grecia": { location: "Grecia, Costa Rica", league: "Liga de Ascenso" },
222
+ "nac-breda": { location: "Breda, Netherlands", league: "Eredivisie" },
223
+ "nagoya-grampus": { location: "Nagoya, Japan", league: "J1 League" },
224
+ "nancy": { location: "Nancy, France", league: "Ligue 2" },
225
+ "nantes": { location: "Nantes, France", league: "Ligue 1" },
226
+ "napoli": { location: "Naples, Italy", league: "Serie A" },
227
+ "nashville-sc": { location: "Nashville, USA", league: "MLS" },
228
+ "nec": { location: "Nijmegen, Netherlands", league: "Eredivisie" },
229
+ "necaxa": { location: "Aguascalientes, Mexico", league: "Liga MX" },
230
+ "new-england": { location: "Foxborough, USA", league: "MLS" },
231
+ "new-mexico-united": { location: "Albuquerque, USA", league: "USL Championship" },
232
+ "newcastle": { location: "Newcastle, England", league: "Premier League" },
233
+ "newells": { location: "Rosario, Argentina", league: "Argentine Primera Divisi\xF3n" },
234
+ "nice": { location: "Nice, France", league: "Ligue 1" },
235
+ "nimes": { location: "N\xEEmes, France", league: "Championnat National" },
236
+ "nordsjaelland": { location: "Farum, Denmark", league: "Danish Superliga" },
237
+ "ny-red-bulls": { location: "Harrison, USA", league: "MLS" },
238
+ "nycfc": { location: "New York City, USA", league: "MLS" },
239
+ "oakland-roots": { location: "Oakland, USA", league: "USL Championship" },
240
+ "ob-odense": { location: "Odense, Denmark", league: "Danish Superliga" },
241
+ "odd": { location: "Skien, Norway", league: "Norwegian First Division" },
242
+ "olympiacos": { location: "Piraeus, Greece", league: "Super League Greece" },
243
+ "orange-county-sc": { location: "Irvine, USA", league: "USL Championship" },
244
+ "orebro": { location: "\xD6rebro, Sweden", league: "Superettan" },
245
+ "orlando-city": { location: "Orlando, USA", league: "MLS" },
246
+ "pachuca": { location: "Pachuca, Mexico", league: "Liga MX" },
247
+ "palmeiras": { location: "S\xE3o Paulo, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
248
+ "paris-fc": { location: "Paris, France", league: "Ligue 1" },
249
+ "psg": { location: "Paris, France", league: "Ligue 1" },
250
+ "pec-zwolle": { location: "Zwolle, Netherlands", league: "Eredivisie" },
251
+ "perez-zeledon": { location: "San Isidro, Costa Rica", league: "Liga FPD" },
252
+ "philadelphia-union": { location: "Chester, USA", league: "MLS" },
253
+ "phoenix-rising": { location: "Phoenix, USA", league: "USL Championship" },
254
+ "pittsburgh-riverhounds": { location: "Pittsburgh, USA", league: "USL Championship" },
255
+ "platense": { location: "Florida, Argentina", league: "Argentine Primera Divisi\xF3n" },
256
+ "pohang-steelers": { location: "Pohang, South Korea", league: "K League 1" },
257
+ "portland-timbers": { location: "Portland, USA", league: "MLS" },
258
+ "porto": { location: "Porto, Portugal", league: "Primeira Liga" },
259
+ "psv": { location: "Eindhoven, Netherlands", league: "Eredivisie" },
260
+ "puebla": { location: "Puebla, Mexico", league: "Liga MX" },
261
+ "pumas": { location: "Mexico City, Mexico", league: "Liga MX" },
262
+ "puntarenas": { location: "Puntarenas, Costa Rica", league: "Liga FPD" },
263
+ "queretaro": { location: "Quer\xE9taro, Mexico", league: "Liga MX" },
264
+ "racing": { location: "Avellaneda, Argentina", league: "Argentine Primera Divisi\xF3n" },
265
+ "randers": { location: "Randers, Denmark", league: "Danish Superliga" },
266
+ "rangers": { location: "Glasgow, Scotland", league: "Scottish Premiership" },
267
+ "rb-leipzig": { location: "Leipzig, Germany", league: "Bundesliga" },
268
+ "real-madrid": { location: "Madrid, Spain", league: "La Liga" },
269
+ "real-salt-lake": { location: "Sandy, USA", league: "MLS" },
270
+ "red-star": { location: "Saint-Ouen, France", league: "Ligue 2" },
271
+ "reims": { location: "Reims, France", league: "Ligue 2" },
272
+ "rennes": { location: "Rennes, France", league: "Ligue 1" },
273
+ "rhode-island-fc": { location: "Pawtucket, USA", league: "USL Championship" },
274
+ "river-plate": { location: "Buenos Aires, Argentina", league: "Argentine Primera Divisi\xF3n" },
275
+ "rkc": { location: "Waalwijk, Netherlands", league: "Eredivisie" },
276
+ "roma": { location: "Rome, Italy", league: "Serie A" },
277
+ "rosario-central": { location: "Rosario, Argentina", league: "Argentine Primera Divisi\xF3n" },
278
+ "rosenborg": { location: "Trondheim, Norway", league: "Eliteserien" },
279
+ "sacramento-republic": { location: "Sacramento, USA", league: "USL Championship" },
280
+ "saint-etienne": { location: "Saint-\xC9tienne, France", league: "Ligue 2" },
281
+ "san-antonio-fc": { location: "San Antonio, USA", league: "USL Championship" },
282
+ "san-carlos": { location: "Quesada, Costa Rica", league: "Liga FPD" },
283
+ "san-diego-fc": { location: "San Diego, USA", league: "MLS" },
284
+ "san-jose-earthquakes": { location: "San Jose, USA", league: "MLS" },
285
+ "san-lorenzo": { location: "Buenos Aires, Argentina", league: "Argentine Primera Divisi\xF3n" },
286
+ "sanfrecce-hiroshima": { location: "Hiroshima, Japan", league: "J1 League" },
287
+ "santos": { location: "Santos, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
288
+ "santos-guapiles": { location: "Gu\xE1piles, Costa Rica", league: "Liga FPD" },
289
+ "santos-laguna": { location: "Torre\xF3n, Mexico", league: "Liga MX" },
290
+ "sao-paulo": { location: "S\xE3o Paulo, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
291
+ "saprissa": { location: "San Jos\xE9, Costa Rica", league: "Liga FPD" },
292
+ "sarpsborg": { location: "Sarpsborg, Norway", league: "Eliteserien" },
293
+ "schalke": { location: "Gelsenkirchen, Germany", league: "2. Bundesliga" },
294
+ "seattle-sounders": { location: "Seattle, USA", league: "MLS" },
295
+ "sevilla": { location: "Seville, Spain", league: "La Liga" },
296
+ "shakhtar": { location: "Donetsk, Ukraine", league: "Ukrainian Premier League" },
297
+ "shimizu-s-pulse": { location: "Shizuoka, Japan", league: "J1 League" },
298
+ "silkeborg": { location: "Silkeborg, Denmark", league: "Danish Superliga" },
299
+ "sirius": { location: "Uppsala, Sweden", league: "Allsvenskan" },
300
+ "sochaux": { location: "Montb\xE9liard, France", league: "Championnat National" },
301
+ "sonderjyske": { location: "Haderslev, Denmark", league: "Danish Superliga" },
302
+ "sparta-rotterdam": { location: "Rotterdam, Netherlands", league: "Eredivisie" },
303
+ "sport-recife": { location: "Recife, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
304
+ "sporting": { location: "Lisbon, Portugal", league: "Primeira Liga" },
305
+ "sporting-jax": { location: "Jacksonville, USA", league: "MLS Next Pro" },
306
+ "sporting-kc": { location: "Kansas City, USA", league: "MLS" },
307
+ "sporting-san-jose": { location: "San Jos\xE9, Costa Rica", league: "Liga FPD" },
308
+ "st-mirren": { location: "Paisley, Scotland", league: "Scottish Premiership" },
309
+ "st-louis-city": { location: "St. Louis, USA", league: "MLS" },
310
+ "st-pauli": { location: "Hamburg, Germany", league: "Bundesliga" },
311
+ "stabaek": { location: "B\xE6rum, Norway", league: "Norwegian First Division" },
312
+ "strasbourg": { location: "Strasbourg, France", league: "Ligue 1" },
313
+ "stromsgodset": { location: "Drammen, Norway", league: "Eliteserien" },
314
+ "stuttgart": { location: "Stuttgart, Germany", league: "Bundesliga" },
315
+ "switchbacks": { location: "Colorado Springs, USA", league: "USL Championship" },
316
+ "talleres": { location: "C\xF3rdoba, Argentina", league: "Argentine Primera Divisi\xF3n" },
317
+ "tampa-bay-rowdies": { location: "St. Petersburg, USA", league: "USL Championship" },
318
+ "tigre": { location: "Victoria, Argentina", league: "Argentine Primera Divisi\xF3n" },
319
+ "tigres": { location: "San Nicol\xE1s de los Garza, Mexico", league: "Liga MX" },
320
+ "tijuana": { location: "Tijuana, Mexico", league: "Liga MX" },
321
+ "tokyo-verdy": { location: "Tokyo, Japan", league: "J1 League" },
322
+ "toluca": { location: "Toluca, Mexico", league: "Liga MX" },
323
+ "toronto-fc": { location: "Toronto, Canada", league: "MLS" },
324
+ "tottenham": { location: "London, England", league: "Premier League" },
325
+ "toulouse": { location: "Toulouse, France", league: "Ligue 1" },
326
+ "tromso": { location: "Troms\xF8, Norway", league: "Eliteserien" },
327
+ "troyes": { location: "Troyes, France", league: "Ligue 2" },
328
+ "twente": { location: "Enschede, Netherlands", league: "Eredivisie" },
329
+ "ulsan-hd": { location: "Ulsan, South Korea", league: "K League 1" },
330
+ "union": { location: "Santa Fe, Argentina", league: "Argentine Primera Divisi\xF3n" },
331
+ "union-berlin": { location: "Berlin, Germany", league: "Bundesliga" },
332
+ "urawa-reds": { location: "Saitama, Japan", league: "J1 League" },
333
+ "utrecht": { location: "Utrecht, Netherlands", league: "Eredivisie" },
334
+ "v-varen-nagasaki": { location: "Nagasaki, Japan", league: "J2 League" },
335
+ "valencia": { location: "Valencia, Spain", league: "La Liga" },
336
+ "valerenga": { location: "Oslo, Norway", league: "Eliteserien" },
337
+ "vancouver-whitecaps": { location: "Vancouver, Canada", league: "MLS" },
338
+ "varnamo": { location: "V\xE4rnamo, Sweden", league: "Allsvenskan" },
339
+ "vasco": { location: "Rio de Janeiro, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
340
+ "vejle": { location: "Vejle, Denmark", league: "Danish Superliga" },
341
+ "velez": { location: "Buenos Aires, Argentina", league: "Argentine Primera Divisi\xF3n" },
342
+ "viborg": { location: "Viborg, Denmark", league: "Danish Superliga" },
343
+ "viking": { location: "Stavanger, Norway", league: "Eliteserien" },
344
+ "vissel-kobe": { location: "Kobe, Japan", league: "J1 League" },
345
+ "vitesse": { location: "Arnhem, Netherlands", league: "Eerste Divisie" },
346
+ "vitoria": { location: "Salvador, Brazil", league: "Brasileir\xE3o S\xE9rie A" },
347
+ "volendam": { location: "Volendam, Netherlands", league: "Eredivisie" },
348
+ "werder-bremen": { location: "Bremen, Germany", league: "Bundesliga" },
349
+ "west-ham": { location: "London, England", league: "Premier League" },
350
+ "willem-ii": { location: "Tilburg, Netherlands", league: "Eerste Divisie" },
351
+ "wolfsburg": { location: "Wolfsburg, Germany", league: "Bundesliga" },
352
+ "yokohama-marinos": { location: "Yokohama, Japan", league: "J1 League" }
353
+ };
354
+
355
+ // src/git/teams.ts
356
+ function withMeta(seed) {
357
+ const baseSlug = seed.slug.replace(/-\d+$/, "");
358
+ const meta = SOCCER_TEAM_META[baseSlug];
359
+ return {
360
+ name: seed.name,
361
+ slug: seed.slug,
362
+ location: meta?.location ?? "Unknown",
363
+ league: meta?.league ?? "Unknown league"
364
+ };
365
+ }
366
+ var FAMOUS_SOCCER_TEAM_SEEDS = [
367
+ { name: "Aalborg", slug: "aalborg" },
368
+ { name: "Aalesund", slug: "aalesund" },
369
+ { name: "Aarhus", slug: "aarhus" },
370
+ { name: "Aberdeen", slug: "aberdeen" },
371
+ { name: "AC Milan", slug: "ac-milan" },
372
+ { name: "ADO Den Haag", slug: "ado-den-haag" },
373
+ { name: "AIK", slug: "aik" },
374
+ { name: "Ajaccio", slug: "ajaccio" },
375
+ { name: "Ajax", slug: "ajax" },
376
+ { name: "Al Ahly", slug: "al-ahly" },
377
+ { name: "Al Hilal", slug: "al-hilal" },
378
+ { name: "Alajuelense", slug: "alajuelense" },
379
+ { name: "Almere City", slug: "almere-city" },
380
+ { name: "Amiens", slug: "amiens" },
381
+ { name: "Angers", slug: "angers" },
382
+ { name: "Anyang", slug: "anyang" },
383
+ { name: "Argentinos Juniors", slug: "argentinos-juniors" },
384
+ { name: "Arsenal", slug: "arsenal" },
385
+ { name: "Aston Villa", slug: "aston-villa" },
386
+ { name: "Athletico Paranaense", slug: "athletico-paranaense" },
387
+ { name: "Atlanta United", slug: "atlanta-united" },
388
+ { name: "Atlas", slug: "atlas" },
389
+ { name: "Atl\xE9tico Madrid", slug: "atletico-madrid" },
390
+ { name: "Atl\xE9tico Mineiro", slug: "atletico-mineiro" },
391
+ { name: "Atl\xE9tico San Luis", slug: "atletico-san-luis" },
392
+ { name: "Augsburg", slug: "augsburg" },
393
+ { name: "Austin FC", slug: "austin-fc" },
394
+ { name: "Auxerre", slug: "auxerre" },
395
+ { name: "Avispa Fukuoka", slug: "avispa-fukuoka" },
396
+ { name: "AZ Alkmaar", slug: "az" },
397
+ { name: "Bahia", slug: "bahia" },
398
+ { name: "Banfield", slug: "banfield" },
399
+ { name: "Barcelona", slug: "barcelona" },
400
+ { name: "Bayer Leverkusen", slug: "bayer-leverkusen" },
401
+ { name: "Bayern Munich", slug: "bayern-munich" },
402
+ { name: "Belgrano", slug: "belgrano" },
403
+ { name: "Benfica", slug: "benfica" },
404
+ { name: "Birmingham Legion", slug: "birmingham-legion" },
405
+ { name: "Boca Juniors", slug: "boca-juniors" },
406
+ { name: "Bod\xF8/Glimt", slug: "bodo-glimt" },
407
+ { name: "Bordeaux", slug: "bordeaux" },
408
+ { name: "Borussia Dortmund", slug: "borussia-dortmund" },
409
+ { name: "Botafogo", slug: "botafogo" },
410
+ { name: "Bragantino", slug: "bragantino" },
411
+ { name: "Brann", slug: "brann" },
412
+ { name: "Brest", slug: "brest" },
413
+ { name: "Brommapojkarna", slug: "brommapojkarna" },
414
+ { name: "Br\xF8ndby", slug: "brondby" },
415
+ { name: "Brooklyn FC", slug: "brooklyn-fc" },
416
+ { name: "Bucheon", slug: "bucheon" },
417
+ { name: "Caen", slug: "caen" },
418
+ { name: "Cambuur", slug: "cambuur" },
419
+ { name: "Carmelita", slug: "carmelita" },
420
+ { name: "Cartagin\xE9s", slug: "cartagines" },
421
+ { name: "Cear\xE1", slug: "ceara" },
422
+ { name: "Celtic", slug: "celtic" },
423
+ { name: "Central C\xF3rdoba", slug: "central-cordoba" },
424
+ { name: "Cerezo Osaka", slug: "cerezo-osaka" },
425
+ { name: "CF Montr\xE9al", slug: "cf-montreal" },
426
+ { name: "Charleston Battery", slug: "charleston-battery" },
427
+ { name: "Charlotte FC", slug: "charlotte-fc" },
428
+ { name: "Chelsea", slug: "chelsea" },
429
+ { name: "Chicago Fire", slug: "chicago-fire" },
430
+ { name: "Chivas", slug: "chivas" },
431
+ { name: "Clermont", slug: "clermont" },
432
+ { name: "Club Am\xE9rica", slug: "club-america" },
433
+ { name: "Cologne", slug: "cologne" },
434
+ { name: "Colorado Rapids", slug: "colorado-rapids" },
435
+ { name: "Columbus Crew", slug: "columbus-crew" },
436
+ { name: "Corinthians", slug: "corinthians" },
437
+ { name: "Cruz Azul", slug: "cruz-azul" },
438
+ { name: "Cruzeiro", slug: "cruzeiro" },
439
+ { name: "Daejeon", slug: "daejeon" },
440
+ { name: "DC United", slug: "dc-united" },
441
+ { name: "Defensa y Justicia", slug: "defensa-y-justicia" },
442
+ { name: "Degerfors", slug: "degerfors" },
443
+ { name: "Detroit City", slug: "detroit-city" },
444
+ { name: "Dijon", slug: "dijon" },
445
+ { name: "Djurg\xE5rden", slug: "djurgarden" },
446
+ { name: "Dundee", slug: "dundee" },
447
+ { name: "Dundee United", slug: "dundee-united" },
448
+ { name: "Dynamo Kyiv", slug: "dynamo-kyiv" },
449
+ { name: "Eintracht Frankfurt", slug: "eintracht-frankfurt" },
450
+ { name: "El Paso Locomotive", slug: "el-paso-locomotive" },
451
+ { name: "Elfsborg", slug: "elfsborg" },
452
+ { name: "Emmen", slug: "emmen" },
453
+ { name: "Esbjerg", slug: "esbjerg" },
454
+ { name: "Estudiantes", slug: "estudiantes" },
455
+ { name: "Everton", slug: "everton" },
456
+ { name: "Excelsior", slug: "excelsior" },
457
+ { name: "Fagiano Okayama", slug: "fagiano-okayama" },
458
+ { name: "Falkirk", slug: "falkirk" },
459
+ { name: "FC Cincinnati", slug: "fc-cincinnati" },
460
+ { name: "FC Copenhagen", slug: "fc-copenhagen" },
461
+ { name: "FC Dallas", slug: "fc-dallas" },
462
+ { name: "FC Seoul", slug: "fc-seoul" },
463
+ { name: "FC Tokyo", slug: "fc-tokyo" },
464
+ { name: "FC Tulsa", slug: "fc-tulsa" },
465
+ { name: "Feyenoord", slug: "feyenoord" },
466
+ { name: "Flamengo", slug: "flamengo" },
467
+ { name: "Fluminense", slug: "fluminense" },
468
+ { name: "Fortaleza", slug: "fortaleza" },
469
+ { name: "Fortuna Sittard", slug: "fortuna-sittard" },
470
+ { name: "Fredrikstad", slug: "fredrikstad" },
471
+ { name: "Freiburg", slug: "freiburg" },
472
+ { name: "GAIS", slug: "gais" },
473
+ { name: "Galatasaray", slug: "galatasaray" },
474
+ { name: "Gamba Osaka", slug: "gamba-osaka" },
475
+ { name: "Gangwon", slug: "gangwon" },
476
+ { name: "Gimcheon Sangmu", slug: "gimcheon-sangmu" },
477
+ { name: "Gimnasia", slug: "gimnasia" },
478
+ { name: "Gladbach", slug: "gladbach" },
479
+ { name: "Go Ahead Eagles", slug: "go-ahead-eagles" },
480
+ { name: "Godoy Cruz", slug: "godoy-cruz" },
481
+ { name: "Gr\xEAmio", slug: "gremio" },
482
+ { name: "Groningen", slug: "groningen" },
483
+ { name: "Guadalupe", slug: "guadalupe" },
484
+ { name: "Guanacasteca", slug: "guanacasteca" },
485
+ { name: "Guingamp", slug: "guingamp" },
486
+ { name: "Gwangju", slug: "gwangju" },
487
+ { name: "H\xE4cken", slug: "hacken" },
488
+ { name: "Halmstad", slug: "halmstad" },
489
+ { name: "Hamburg", slug: "hamburg" },
490
+ { name: "Hammarby", slug: "hammarby" },
491
+ { name: "Hartford Athletic", slug: "hartford-athletic" },
492
+ { name: "Haugesund", slug: "haugesund" },
493
+ { name: "Hearts", slug: "hearts" },
494
+ { name: "Heerenveen", slug: "heerenveen" },
495
+ { name: "Heidenheim", slug: "heidenheim" },
496
+ { name: "Helsingborg", slug: "helsingborg" },
497
+ { name: "Heracles", slug: "heracles" },
498
+ { name: "Herediano", slug: "herediano" },
499
+ { name: "Hibernian", slug: "hibernian" },
500
+ { name: "Hoffenheim", slug: "hoffenheim" },
501
+ { name: "Horsens", slug: "horsens" },
502
+ { name: "Houston Dynamo", slug: "houston-dynamo" },
503
+ { name: "Hurac\xE1n", slug: "huracan" },
504
+ { name: "IFK G\xF6teborg", slug: "ifk-goteborg" },
505
+ { name: "IFK Norrk\xF6ping", slug: "norrkoping" },
506
+ { name: "Incheon United", slug: "incheon-united" },
507
+ { name: "Independiente", slug: "independiente" },
508
+ { name: "Indy Eleven", slug: "indy-eleven" },
509
+ { name: "Instituto", slug: "instituto" },
510
+ { name: "Inter Miami", slug: "inter-miami" },
511
+ { name: "Inter Milan", slug: "inter-milan" },
512
+ { name: "Internacional", slug: "internacional" },
513
+ { name: "JEF United", slug: "jef-united" },
514
+ { name: "Jeju SK", slug: "jeju-sk" },
515
+ { name: "Jeonbuk", slug: "jeonbuk" },
516
+ { name: "Ju\xE1rez", slug: "juarez" },
517
+ { name: "Juventude", slug: "juventude" },
518
+ { name: "Juventus", slug: "juventus" },
519
+ { name: "Kalmar FF", slug: "kalmar" },
520
+ { name: "Kashima Antlers", slug: "kashima-antlers" },
521
+ { name: "Kashiwa Reysol", slug: "kashiwa-reysol" },
522
+ { name: "Kawasaki Frontale", slug: "kawasaki-frontale" },
523
+ { name: "KFUM Oslo", slug: "kfum-oslo" },
524
+ { name: "Kilmarnock", slug: "kilmarnock" },
525
+ { name: "Kristiansund", slug: "kristiansund" },
526
+ { name: "Kyoto Sanga", slug: "kyoto-sanga" },
527
+ { name: "LA Galaxy", slug: "la-galaxy" },
528
+ { name: "LAFC", slug: "lafc" },
529
+ { name: "Lan\xFAs", slug: "lanus" },
530
+ { name: "Las Vegas Lights", slug: "las-vegas-lights" },
531
+ { name: "Lazio", slug: "lazio" },
532
+ { name: "Le Havre", slug: "le-havre" },
533
+ { name: "Le Mans", slug: "le-mans" },
534
+ { name: "Leeds United", slug: "leeds-united" },
535
+ { name: "Leicester City", slug: "leicester-city" },
536
+ { name: "Lens", slug: "lens" },
537
+ { name: "Le\xF3n", slug: "leon" },
538
+ { name: "Lexington SC", slug: "lexington-sc" },
539
+ { name: "Liberia", slug: "liberia" },
540
+ { name: "Lille", slug: "lille" },
541
+ { name: "Lillestr\xF8m", slug: "lillestrom" },
542
+ { name: "Lim\xF3n", slug: "limon" },
543
+ { name: "Liverpool", slug: "liverpool" },
544
+ { name: "Livingston", slug: "livingston" },
545
+ { name: "Lorient", slug: "lorient" },
546
+ { name: "Loudoun United", slug: "loudoun-united" },
547
+ { name: "Louisville City", slug: "louisville-city" },
548
+ { name: "Lyngby", slug: "lyngby" },
549
+ { name: "Lyon", slug: "lyon" },
550
+ { name: "Machida Zelvia", slug: "machida-zelvia" },
551
+ { name: "Mainz", slug: "mainz" },
552
+ { name: "Malm\xF6 FF", slug: "malmo" },
553
+ { name: "Manchester City", slug: "manchester-city" },
554
+ { name: "Manchester United", slug: "manchester-united" },
555
+ { name: "Marseille", slug: "marseille" },
556
+ { name: "Mazatl\xE1n", slug: "mazatlan" },
557
+ { name: "Metz", slug: "metz" },
558
+ { name: "Miami FC", slug: "miami-fc" },
559
+ { name: "Midtjylland", slug: "midtjylland" },
560
+ { name: "Minnesota United", slug: "minnesota-united" },
561
+ { name: "Mirassol", slug: "mirassol" },
562
+ { name: "Mito Hollyhock", slug: "mito-hollyhock" },
563
+ { name: "Mj\xE4llby", slug: "mjallby" },
564
+ { name: "Molde", slug: "molde" },
565
+ { name: "Monaco", slug: "monaco" },
566
+ { name: "Monterey Bay", slug: "monterey-bay" },
567
+ { name: "Monterrey", slug: "monterrey" },
568
+ { name: "Montpellier", slug: "montpellier" },
569
+ { name: "Motherwell", slug: "motherwell" },
570
+ { name: "Municipal Grecia", slug: "grecia" },
571
+ { name: "NAC Breda", slug: "nac-breda" },
572
+ { name: "Nagoya Grampus", slug: "nagoya-grampus" },
573
+ { name: "Nancy", slug: "nancy" },
574
+ { name: "Nantes", slug: "nantes" },
575
+ { name: "Napoli", slug: "napoli" },
576
+ { name: "Nashville SC", slug: "nashville-sc" },
577
+ { name: "NEC Nijmegen", slug: "nec" },
578
+ { name: "Necaxa", slug: "necaxa" },
579
+ { name: "New England", slug: "new-england" },
580
+ { name: "New Mexico United", slug: "new-mexico-united" },
581
+ { name: "Newcastle", slug: "newcastle" },
582
+ { name: "Newell's Old Boys", slug: "newells" },
583
+ { name: "Nice", slug: "nice" },
584
+ { name: "N\xEEmes", slug: "nimes" },
585
+ { name: "Nordsj\xE6lland", slug: "nordsjaelland" },
586
+ { name: "NY Red Bulls", slug: "ny-red-bulls" },
587
+ { name: "NYCFC", slug: "nycfc" },
588
+ { name: "Oakland Roots", slug: "oakland-roots" },
589
+ { name: "OB Odense", slug: "ob-odense" },
590
+ { name: "Odd", slug: "odd" },
591
+ { name: "Olympiacos", slug: "olympiacos" },
592
+ { name: "Orange County SC", slug: "orange-county-sc" },
593
+ { name: "\xD6rebro", slug: "orebro" },
594
+ { name: "Orlando City", slug: "orlando-city" },
595
+ { name: "Pachuca", slug: "pachuca" },
596
+ { name: "Palmeiras", slug: "palmeiras" },
597
+ { name: "Paris FC", slug: "paris-fc" },
598
+ { name: "Paris Saint-Germain", slug: "psg" },
599
+ { name: "PEC Zwolle", slug: "pec-zwolle" },
600
+ { name: "P\xE9rez Zeled\xF3n", slug: "perez-zeledon" },
601
+ { name: "Philadelphia Union", slug: "philadelphia-union" },
602
+ { name: "Phoenix Rising", slug: "phoenix-rising" },
603
+ { name: "Pittsburgh Riverhounds", slug: "pittsburgh-riverhounds" },
604
+ { name: "Platense", slug: "platense" },
605
+ { name: "Pohang Steelers", slug: "pohang-steelers" },
606
+ { name: "Portland Timbers", slug: "portland-timbers" },
607
+ { name: "Porto", slug: "porto" },
608
+ { name: "PSV", slug: "psv" },
609
+ { name: "Puebla", slug: "puebla" },
610
+ { name: "Pumas", slug: "pumas" },
611
+ { name: "Puntarenas", slug: "puntarenas" },
612
+ { name: "Quer\xE9taro", slug: "queretaro" },
613
+ { name: "Racing", slug: "racing" },
614
+ { name: "Randers", slug: "randers" },
615
+ { name: "Rangers", slug: "rangers" },
616
+ { name: "RB Leipzig", slug: "rb-leipzig" },
617
+ { name: "Real Madrid", slug: "real-madrid" },
618
+ { name: "Real Salt Lake", slug: "real-salt-lake" },
619
+ { name: "Red Star Belgrade", slug: "red-star" },
620
+ { name: "Reims", slug: "reims" },
621
+ { name: "Rennes", slug: "rennes" },
622
+ { name: "Rhode Island FC", slug: "rhode-island-fc" },
623
+ { name: "River Plate", slug: "river-plate" },
624
+ { name: "RKC Waalwijk", slug: "rkc" },
625
+ { name: "Roma", slug: "roma" },
626
+ { name: "Rosario Central", slug: "rosario-central" },
627
+ { name: "Rosenborg", slug: "rosenborg" },
628
+ { name: "Sacramento Republic", slug: "sacramento-republic" },
629
+ { name: "Saint-\xC9tienne", slug: "saint-etienne" },
630
+ { name: "San Antonio FC", slug: "san-antonio-fc" },
631
+ { name: "San Carlos", slug: "san-carlos" },
632
+ { name: "San Diego FC", slug: "san-diego-fc" },
633
+ { name: "San Jose Earthquakes", slug: "san-jose-earthquakes" },
634
+ { name: "San Lorenzo", slug: "san-lorenzo" },
635
+ { name: "Sanfrecce Hiroshima", slug: "sanfrecce-hiroshima" },
636
+ { name: "Santos", slug: "santos" },
637
+ { name: "Santos de Gu\xE1piles", slug: "santos-guapiles" },
638
+ { name: "Santos Laguna", slug: "santos-laguna" },
639
+ { name: "S\xE3o Paulo", slug: "sao-paulo" },
640
+ { name: "Saprissa", slug: "saprissa" },
641
+ { name: "Sarpsborg", slug: "sarpsborg" },
642
+ { name: "Schalke", slug: "schalke" },
643
+ { name: "Seattle Sounders", slug: "seattle-sounders" },
644
+ { name: "Sevilla", slug: "sevilla" },
645
+ { name: "Shakhtar", slug: "shakhtar" },
646
+ { name: "Shimizu S-Pulse", slug: "shimizu-s-pulse" },
647
+ { name: "Silkeborg", slug: "silkeborg" },
648
+ { name: "Sirius", slug: "sirius" },
649
+ { name: "Sochaux", slug: "sochaux" },
650
+ { name: "S\xF8nderjyske", slug: "sonderjyske" },
651
+ { name: "Sparta Rotterdam", slug: "sparta-rotterdam" },
652
+ { name: "Sport Recife", slug: "sport-recife" },
653
+ { name: "Sporting", slug: "sporting" },
654
+ { name: "Sporting Jax", slug: "sporting-jax" },
655
+ { name: "Sporting KC", slug: "sporting-kc" },
656
+ { name: "Sporting San Jos\xE9", slug: "sporting-san-jose" },
657
+ { name: "St Mirren", slug: "st-mirren" },
658
+ { name: "St. Louis City", slug: "st-louis-city" },
659
+ { name: "St. Pauli", slug: "st-pauli" },
660
+ { name: "Stab\xE6k", slug: "stabaek" },
661
+ { name: "Strasbourg", slug: "strasbourg" },
662
+ { name: "Str\xF8msgodset", slug: "stromsgodset" },
663
+ { name: "Stuttgart", slug: "stuttgart" },
664
+ { name: "Switchbacks", slug: "switchbacks" },
665
+ { name: "Talleres", slug: "talleres" },
666
+ { name: "Tampa Bay Rowdies", slug: "tampa-bay-rowdies" },
667
+ { name: "Tigre", slug: "tigre" },
668
+ { name: "Tigres", slug: "tigres" },
669
+ { name: "Tijuana", slug: "tijuana" },
670
+ { name: "Tokyo Verdy", slug: "tokyo-verdy" },
671
+ { name: "Toluca", slug: "toluca" },
672
+ { name: "Toronto FC", slug: "toronto-fc" },
673
+ { name: "Tottenham", slug: "tottenham" },
674
+ { name: "Toulouse", slug: "toulouse" },
675
+ { name: "Troms\xF8", slug: "tromso" },
676
+ { name: "Troyes", slug: "troyes" },
677
+ { name: "Twente", slug: "twente" },
678
+ { name: "Ulsan HD", slug: "ulsan-hd" },
679
+ { name: "Uni\xF3n", slug: "union" },
680
+ { name: "Union Berlin", slug: "union-berlin" },
681
+ { name: "Urawa Reds", slug: "urawa-reds" },
682
+ { name: "Utrecht", slug: "utrecht" },
683
+ { name: "V-Varen Nagasaki", slug: "v-varen-nagasaki" },
684
+ { name: "Valencia", slug: "valencia" },
685
+ { name: "V\xE5lerenga", slug: "valerenga" },
686
+ { name: "Vancouver Whitecaps", slug: "vancouver-whitecaps" },
687
+ { name: "V\xE4rnamo", slug: "varnamo" },
688
+ { name: "Vasco da Gama", slug: "vasco" },
689
+ { name: "Vejle", slug: "vejle" },
690
+ { name: "V\xE9lez Sarsfield", slug: "velez" },
691
+ { name: "Viborg", slug: "viborg" },
692
+ { name: "Viking", slug: "viking" },
693
+ { name: "Vissel Kobe", slug: "vissel-kobe" },
694
+ { name: "Vitesse", slug: "vitesse" },
695
+ { name: "Vit\xF3ria", slug: "vitoria" },
696
+ { name: "Volendam", slug: "volendam" },
697
+ { name: "Werder Bremen", slug: "werder-bremen" },
698
+ { name: "West Ham", slug: "west-ham" },
699
+ { name: "Willem II", slug: "willem-ii" },
700
+ { name: "Wolfsburg", slug: "wolfsburg" },
701
+ { name: "Yokohama Marinos", slug: "yokohama-marinos" }
702
+ ];
703
+ var FAMOUS_SOCCER_TEAMS = FAMOUS_SOCCER_TEAM_SEEDS.map(withMeta);
704
+ function lookupSoccerTeam(titleOrSlug) {
705
+ const trimmed = titleOrSlug.trim();
706
+ if (!trimmed) return null;
707
+ const fromName = teamSlugFromName(trimmed);
708
+ const slug = fromName ?? normalizeTakenSlug(trimmed);
709
+ const baseSlug = slug.replace(/-\d+$/, "");
710
+ const seed = FAMOUS_SOCCER_TEAM_SEEDS.find((t) => t.slug === baseSlug);
711
+ if (!seed) return null;
712
+ const suffixMatch = slug.match(/-(\d+)$/) || trimmed.match(/\s+(\d+)$/);
713
+ const suffix = suffixMatch?.[1];
714
+ return withMeta({
715
+ name: suffix ? `${seed.name} ${suffix}` : seed.name,
716
+ slug: suffix ? `${seed.slug}-${suffix}` : seed.slug
717
+ });
718
+ }
719
+ function teamNameFromSlug(slug) {
720
+ const normalized = slug.toLowerCase().replace(/^thread\//, "");
721
+ const withoutTicket = normalized.replace(/^[a-z]{2,8}-\d{1,6}-/, "").replace(/^\d{1,8}-/, "");
722
+ const lookup = withoutTicket || normalized;
723
+ const suffixMatch = lookup.match(/^(.+)-(\d+)$/);
724
+ const base = suffixMatch?.[1] ?? lookup;
725
+ const suffix = suffixMatch?.[2];
726
+ const team = FAMOUS_SOCCER_TEAM_SEEDS.find((t) => t.slug === base);
727
+ if (team) return suffix ? `${team.name} ${suffix}` : team.name;
728
+ return normalized.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
729
+ }
730
+ function teamSlugFromName(name) {
731
+ const trimmed = name.trim();
732
+ if (!trimmed) return null;
733
+ const suffixMatch = trimmed.match(/^(.+?)\s+(\d+)$/);
734
+ const baseName = suffixMatch?.[1] ?? trimmed;
735
+ const suffix = suffixMatch?.[2];
736
+ const team = FAMOUS_SOCCER_TEAM_SEEDS.find(
737
+ (t) => t.name.toLowerCase() === baseName.toLowerCase()
738
+ );
739
+ if (!team) return null;
740
+ return suffix ? `${team.slug}-${suffix}` : team.slug;
741
+ }
742
+ function normalizeTakenSlug(raw) {
743
+ return raw.toLowerCase().replace(/^thread\//, "").replace(/\/+$/, "");
744
+ }
745
+ function soccerTokenFromTakenSlug(raw) {
746
+ const normalized = normalizeTakenSlug(raw);
747
+ if (!normalized) return null;
748
+ const withoutTicket = normalized.replace(/^[a-z]{2,8}-\d{1,6}-/, "").replace(/^\d{1,8}-/, "");
749
+ const lookup = withoutTicket || normalized;
750
+ const suffixMatch = lookup.match(/^(.+)-(\d+)$/);
751
+ const base = suffixMatch?.[1] ?? lookup;
752
+ const team = FAMOUS_SOCCER_TEAM_SEEDS.find((t) => t.slug === base);
753
+ if (!team) return null;
754
+ return suffixMatch ? `${team.slug}-${suffixMatch[2]}` : team.slug;
755
+ }
756
+ function addTakenSlug(out, raw) {
757
+ const normalized = normalizeTakenSlug(raw);
758
+ if (!normalized) return;
759
+ out.add(normalized);
760
+ const token = soccerTokenFromTakenSlug(normalized);
761
+ if (token) out.add(token);
762
+ }
763
+ function takenSlugsFromThread(thread) {
764
+ const out = /* @__PURE__ */ new Set();
765
+ const titleSlug = thread.title ? teamSlugFromName(thread.title) : null;
766
+ if (titleSlug) out.add(normalizeTakenSlug(titleSlug));
767
+ if (thread.branchName?.trim()) {
768
+ addTakenSlug(out, thread.branchName.trim());
769
+ }
770
+ if (thread.worktreePath) {
771
+ const parts = thread.worktreePath.replace(/\/+$/, "").split("/");
772
+ const dir = parts[parts.length - 1];
773
+ if (dir) addTakenSlug(out, dir);
774
+ }
775
+ return [...out];
776
+ }
777
+ function allocateTeamName(taken, random = Math.random) {
778
+ const takenSet = new Set(
779
+ [...taken].map((s) => normalizeTakenSlug(s)).filter(Boolean)
780
+ );
781
+ const available = FAMOUS_SOCCER_TEAM_SEEDS.filter((t) => !takenSet.has(t.slug));
782
+ if (available.length > 0) {
783
+ const idx = Math.floor(random() * available.length);
784
+ return withMeta(available[idx]);
785
+ }
786
+ for (let n = 2; n < 1e3; n++) {
787
+ for (const t of FAMOUS_SOCCER_TEAM_SEEDS) {
788
+ const slug = `${t.slug}-${n}`;
789
+ if (!takenSet.has(slug)) {
790
+ return withMeta({ name: `${t.name} ${n}`, slug });
791
+ }
792
+ }
793
+ }
794
+ throw new Error("No available soccer team names left");
795
+ }
796
+
797
+ // src/git/worktree-labels.ts
798
+ function normalizeWorktreePath(worktreePath) {
799
+ const trimmed = (worktreePath ?? "").replace(/\/+$/, "") || "/";
800
+ const absolute = trimmed.startsWith("/");
801
+ const parts = trimmed.split("/").filter((p) => p && p !== ".");
802
+ const out = [];
803
+ for (const p of parts) {
804
+ if (p === "..") {
805
+ out.pop();
806
+ continue;
807
+ }
808
+ out.push(p);
809
+ }
810
+ return (absolute ? "/" : "") + out.join("/");
811
+ }
812
+ function worktreeNameFromPath(worktreePath) {
813
+ const normalized = worktreePath.replace(/\/+$/, "");
814
+ const parts = normalized.split("/");
815
+ return parts[parts.length - 1] || worktreePath;
816
+ }
817
+ var WORKSPACE_TAG_LIMIT = 8;
818
+ var WORKSPACE_TAG_MAX_LENGTH = 32;
819
+ function normalizeWorkspaceTags(raw) {
820
+ const items = Array.isArray(raw) ? raw : typeof raw === "string" ? raw.split(",") : [];
821
+ const out = [];
822
+ const seen = /* @__PURE__ */ new Set();
823
+ for (const item of items) {
824
+ if (typeof item !== "string") continue;
825
+ const tag = item.trim().replace(/\s+/g, " ").slice(0, WORKSPACE_TAG_MAX_LENGTH);
826
+ if (!tag) continue;
827
+ const key = tag.toLowerCase();
828
+ if (seen.has(key)) continue;
829
+ seen.add(key);
830
+ out.push(tag);
831
+ if (out.length >= WORKSPACE_TAG_LIMIT) break;
832
+ }
833
+ return out;
834
+ }
835
+ function workspaceTagsFromGroup(threads) {
836
+ return normalizeWorkspaceTags(threads.flatMap((thread) => thread.tags ?? []));
837
+ }
838
+ function ticketSlugForBranch(sourceRef) {
839
+ const raw = sourceRef.trim();
840
+ if (!raw) return null;
841
+ const linear = raw.match(/\b([A-Za-z]{2,8}-\d{1,6})\b/);
842
+ if (linear) return linear[1].toLowerCase();
843
+ const hashed = raw.match(/^#(\d{1,8})$/);
844
+ if (hashed) return hashed[1];
845
+ const digits = raw.match(/^(\d{1,8})$/);
846
+ if (digits) return digits[1];
847
+ const slug = raw.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
848
+ return slug || null;
849
+ }
850
+ function worktreeSlugForTicket(ticketRef, teamSlug) {
851
+ const ticket = ticketSlugForBranch(ticketRef);
852
+ const team = teamSlug.trim().replace(/^thread\//, "");
853
+ if (!ticket) return team;
854
+ if (!team) return ticket;
855
+ return `${ticket}-${team}`;
856
+ }
857
+ function isPlaceholderBranch(branchName, worktreePath) {
858
+ const branch = branchName.trim();
859
+ if (!branch || branch === "HEAD") return true;
860
+ if (branch.startsWith("thread/")) return true;
861
+ const dir = worktreeNameFromPath(worktreePath).toLowerCase();
862
+ const lower = branch.toLowerCase();
863
+ if (lower === dir) return true;
864
+ return Boolean(dir) && lower.startsWith(`${dir}-`) && /-\d+$/.test(lower);
865
+ }
866
+ function branchDisplayLabel(branchName, worktreePath) {
867
+ const dir = worktreeNameFromPath(worktreePath);
868
+ if (isPlaceholderBranch(branchName, worktreePath)) {
869
+ const slug = branchName.replace(/^thread\//, "") || dir;
870
+ return teamNameFromSlug(slug);
871
+ }
872
+ return branchName.trim();
873
+ }
874
+ function threadDisplayLabel(thread) {
875
+ if (thread.userSetTitle && thread.title?.trim()) return thread.title.trim();
876
+ if (thread.prTitle?.trim()) return thread.prTitle.trim();
877
+ return branchDisplayLabel(thread.branchName, thread.worktreePath);
878
+ }
879
+ function worktreeDisplayLabel(thread) {
880
+ return threadDisplayLabel(thread);
881
+ }
882
+ function worktreeDisplayLabelForGroup(threads) {
883
+ if (threads.length === 0) return "Worktree";
884
+ const canonical = [...threads].sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];
885
+ return threadDisplayLabel(canonical);
886
+ }
887
+ function agentNicknameFromWorktreePath(worktreePath) {
888
+ const dir = worktreeNameFromPath(worktreePath);
889
+ if (!soccerTokenFromTakenSlug(dir)) return null;
890
+ return teamNameFromSlug(dir);
891
+ }
892
+ function worktreeIdentityTitles(thread, parentTitle) {
893
+ const out = [];
894
+ const push = (value) => {
895
+ const trimmed = value?.trim();
896
+ if (trimmed) out.push(trimmed);
897
+ };
898
+ push(parentTitle);
899
+ push(thread.prTitle);
900
+ const branch = thread.branchName?.trim() ?? "";
901
+ const path = thread.worktreePath?.trim() ?? "";
902
+ if (branch && path && branch !== "HEAD" && !isPlaceholderBranch(branch, path)) {
903
+ push(branch);
904
+ }
905
+ return out;
906
+ }
907
+ function foldLabel(value) {
908
+ return value.trim().replace(/[.…]+$/g, "").replace(/\s+/g, " ").toLowerCase();
909
+ }
910
+ function isWorktreeIdentityTitle(title, identities) {
911
+ const a = foldLabel(title);
912
+ if (!a || a === "untitled" || a === "new agent") return true;
913
+ for (const identity of identities) {
914
+ const b = foldLabel(identity);
915
+ if (!b) continue;
916
+ if (a === b) return true;
917
+ const shorter = a.length <= b.length ? a : b;
918
+ const longer = a.length <= b.length ? b : a;
919
+ if (shorter.length >= 20 && longer.startsWith(shorter)) return true;
920
+ }
921
+ return false;
922
+ }
923
+
924
+ // src/store/thread-store.ts
925
+ import {
926
+ existsSync,
927
+ readFileSync,
928
+ renameSync,
929
+ rmSync,
930
+ statSync,
931
+ unlinkSync,
932
+ writeFileSync,
933
+ readdirSync
934
+ } from "fs";
935
+ import { basename } from "path";
936
+ import lockfile from "proper-lockfile";
937
+ function nowIso() {
938
+ return (/* @__PURE__ */ new Date()).toISOString();
939
+ }
940
+ function resolveThreadEffort(raw) {
941
+ const fromField = normalizeThinkingEffort(raw.effort);
942
+ if (fromField) return fromField;
943
+ if (raw.fast) return "low";
944
+ return "high";
945
+ }
946
+ function normalizeRunScriptRequest(raw) {
947
+ if (!raw || typeof raw !== "object") return void 0;
948
+ const req = raw;
949
+ if (req.op !== "start" && req.op !== "stop") return void 0;
950
+ if (typeof req.requestId !== "string" || !req.requestId.trim()) return void 0;
951
+ if (typeof req.requestedAt !== "string" || !req.requestedAt.trim()) return void 0;
952
+ return {
953
+ op: req.op,
954
+ scriptName: req.scriptName ?? null,
955
+ requestId: req.requestId,
956
+ requestedAt: req.requestedAt,
957
+ claimedAt: req.claimedAt ?? null,
958
+ fulfilledAt: req.fulfilledAt ?? null,
959
+ error: req.error ?? null
960
+ };
961
+ }
962
+ function normalizeThread(raw) {
963
+ return {
964
+ ...raw,
965
+ model: raw.model ?? null,
966
+ effort: resolveThreadEffort(raw),
967
+ fast: Boolean(raw.fast),
968
+ planMode: Boolean(raw.planMode),
969
+ isolateCodexPlugins: raw.isolateCodexPlugins === true ? true : void 0,
970
+ autonomy: raw.autonomy ?? "default",
971
+ lastError: raw.lastError ?? null,
972
+ agentPid: raw.agentPid ?? null,
973
+ attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
974
+ pendingTurnAttachments: Array.isArray(raw.pendingTurnAttachments) ? raw.pendingTurnAttachments : [],
975
+ queueAttachments: Array.isArray(raw.queueAttachments) ? raw.queueAttachments : [],
976
+ prTitle: raw.prTitle ?? null,
977
+ prState: raw.prState ?? null,
978
+ prIsDraft: Boolean(raw.prIsDraft),
979
+ prReviewDecision: raw.prReviewDecision ?? null,
980
+ prMergeable: raw.prMergeable ?? null,
981
+ prMergeStateStatus: raw.prMergeStateStatus ?? null,
982
+ prIsInMergeQueue: Boolean(raw.prIsInMergeQueue),
983
+ prLabels: Array.isArray(raw.prLabels) ? raw.prLabels : [],
984
+ prChecksFailed: typeof raw.prChecksFailed === "boolean" ? raw.prChecksFailed : void 0,
985
+ skipAutoArchiveOnMerge: Boolean(raw.skipAutoArchiveOnMerge),
986
+ cowboy: Boolean(raw.cowboy),
987
+ stackId: raw.stackId ?? null,
988
+ stackLayer: raw.stackLayer ?? null,
989
+ userSetTitle: Boolean(raw.userSetTitle),
990
+ activeRuns: Array.isArray(raw.activeRuns) ? raw.activeRuns : [],
991
+ runScriptRequest: normalizeRunScriptRequest(raw.runScriptRequest),
992
+ quotaResumeAt: raw.quotaResumeAt ?? null,
993
+ quotaContinuedFromId: raw.quotaContinuedFromId ?? null,
994
+ accountId: raw.accountId === null ? null : typeof raw.accountId === "string" && raw.accountId.trim() ? raw.accountId.trim() : void 0,
995
+ archivedAt: typeof raw.archivedAt === "string" && raw.archivedAt.trim() ? raw.archivedAt.trim() : void 0,
996
+ compactedMessages: Array.isArray(raw.compactedMessages) ? raw.compactedMessages : void 0
997
+ };
998
+ }
999
+ function createEmptyThread(partial) {
1000
+ const ts = nowIso();
1001
+ return {
1002
+ id: randomUUID(),
1003
+ sessionId: partial.sessionId ?? null,
1004
+ autonomy: partial.autonomy ?? "default",
1005
+ model: partial.model ?? null,
1006
+ effort: partial.effort ?? "high",
1007
+ fast: partial.fast ?? false,
1008
+ planMode: partial.planMode ?? false,
1009
+ sourceIsFork: partial.sourceIsFork ?? false,
1010
+ status: partial.status ?? "idle",
1011
+ queue: partial.queue ?? [],
1012
+ parentThreadId: partial.parentThreadId ?? null,
1013
+ devPort: partial.devPort ?? null,
1014
+ activeRuns: partial.activeRuns ?? [],
1015
+ prUrl: partial.prUrl ?? null,
1016
+ prTitle: partial.prTitle ?? null,
1017
+ prState: partial.prState ?? null,
1018
+ prIsDraft: Boolean(partial.prIsDraft),
1019
+ prAuthorLogin: partial.prAuthorLogin?.trim() || null,
1020
+ prReviewerLogins: partial.prReviewerLogins ?? [],
1021
+ prReviewDecision: partial.prReviewDecision ?? null,
1022
+ prMergeable: partial.prMergeable ?? null,
1023
+ prMergeStateStatus: partial.prMergeStateStatus ?? null,
1024
+ prIsInMergeQueue: Boolean(partial.prIsInMergeQueue),
1025
+ prLabels: partial.prLabels ?? [],
1026
+ prChecksFailed: partial.prChecksFailed,
1027
+ skipAutoArchiveOnMerge: partial.skipAutoArchiveOnMerge ?? false,
1028
+ cowboy: Boolean(partial.cowboy),
1029
+ stackId: partial.stackId ?? null,
1030
+ stackLayer: partial.stackLayer ?? null,
1031
+ userSetTitle: partial.userSetTitle ?? false,
1032
+ messages: partial.messages ?? [],
1033
+ attachments: partial.attachments ?? [],
1034
+ pendingTurnAttachments: partial.pendingTurnAttachments ?? [],
1035
+ queueAttachments: partial.queueAttachments ?? [],
1036
+ createdAt: ts,
1037
+ updatedAt: ts,
1038
+ archivedAt: typeof partial.archivedAt === "string" && partial.archivedAt.trim() ? partial.archivedAt.trim() : void 0,
1039
+ title: partial.title,
1040
+ ...partial.tags !== void 0 ? { tags: normalizeWorkspaceTags(partial.tags) } : {},
1041
+ sourceType: partial.sourceType,
1042
+ sourceRef: partial.sourceRef,
1043
+ branchName: partial.branchName,
1044
+ worktreePath: partial.worktreePath,
1045
+ repoPath: partial.repoPath,
1046
+ agent: partial.agent,
1047
+ lastError: null,
1048
+ agentPid: null,
1049
+ ...partial.accountId !== void 0 ? { accountId: partial.accountId } : {}
1050
+ };
1051
+ }
1052
+ async function withThreadLock(id, fn) {
1053
+ const lockPath = threadLockPath(id);
1054
+ writeFileSync(lockPath, "", { flag: "a" });
1055
+ let release;
1056
+ try {
1057
+ release = await lockfile.lock(lockPath, {
1058
+ retries: { retries: 10, minTimeout: 50, maxTimeout: 200 },
1059
+ stale: 6e4
1060
+ });
1061
+ return await fn();
1062
+ } finally {
1063
+ if (release) await release();
1064
+ }
1065
+ }
1066
+ var listCache = null;
1067
+ function cacheForDir() {
1068
+ const dir = threadsDir();
1069
+ if (!listCache || listCache.dir !== dir) {
1070
+ listCache = { dir, byId: /* @__PURE__ */ new Map(), mtimeMs: /* @__PURE__ */ new Map() };
1071
+ }
1072
+ return listCache;
1073
+ }
1074
+ function fileMtimeMs(path) {
1075
+ try {
1076
+ return statSync(path).mtimeMs;
1077
+ } catch {
1078
+ return null;
1079
+ }
1080
+ }
1081
+ function rememberThread(thread, mtimeMs) {
1082
+ const cache = cacheForDir();
1083
+ cache.byId.set(thread.id, thread);
1084
+ if (mtimeMs != null) cache.mtimeMs.set(thread.id, mtimeMs);
1085
+ }
1086
+ function forgetThread(id) {
1087
+ const cache = cacheForDir();
1088
+ cache.byId.delete(id);
1089
+ cache.mtimeMs.delete(id);
1090
+ selfWriteMtimes.delete(id);
1091
+ }
1092
+ function invalidateThreadListCache() {
1093
+ listCache = null;
1094
+ }
1095
+ function invalidateThreadRecord(id) {
1096
+ if (!id) return;
1097
+ forgetThread(id);
1098
+ }
1099
+ function readThread(id) {
1100
+ const path = threadFilePath(id);
1101
+ const mtimeMs = fileMtimeMs(path);
1102
+ if (mtimeMs == null) {
1103
+ forgetThread(id);
1104
+ return null;
1105
+ }
1106
+ const cache = cacheForDir();
1107
+ const cached = cache.byId.get(id);
1108
+ if (cached && cache.mtimeMs.get(id) === mtimeMs) return cached;
1109
+ const raw = readFileSync(path, "utf8");
1110
+ const thread = normalizeThread(JSON.parse(raw));
1111
+ rememberThread(thread, mtimeMs);
1112
+ return thread;
1113
+ }
1114
+ var selfWriteMtimes = /* @__PURE__ */ new Map();
1115
+ function writeThread(thread, opts) {
1116
+ const path = threadFilePath(idPath(thread.id));
1117
+ const tmp = `${path}.${process.pid}.tmp`;
1118
+ const next = opts?.touch === false ? { ...thread } : { ...thread, updatedAt: nowIso() };
1119
+ writeFileSync(tmp, JSON.stringify(next, null, 2), "utf8");
1120
+ renameSync(tmp, path);
1121
+ const mtimeMs = fileMtimeMs(path) ?? Date.now();
1122
+ rememberThread(next, mtimeMs);
1123
+ selfWriteMtimes.set(thread.id, mtimeMs);
1124
+ }
1125
+ function isSelfWrittenRecord(id) {
1126
+ const ours = selfWriteMtimes.get(id);
1127
+ if (ours == null) return false;
1128
+ return fileMtimeMs(threadFilePath(id)) === ours;
1129
+ }
1130
+ function idPath(id) {
1131
+ return id;
1132
+ }
1133
+ function isThreadRecordFile(nameOrPath) {
1134
+ const name = basename(nameOrPath);
1135
+ return name.endsWith(".json") && !name.endsWith(".live.json") && !name.endsWith(".setup.log.json");
1136
+ }
1137
+ function listThreads(opts) {
1138
+ const cache = cacheForDir();
1139
+ const files = readdirSync(threadsDir()).filter(isThreadRecordFile);
1140
+ const seen = /* @__PURE__ */ new Set();
1141
+ for (const f of files) {
1142
+ const id = f.replace(/\.json$/, "");
1143
+ if (!id) continue;
1144
+ seen.add(id);
1145
+ try {
1146
+ readThread(id);
1147
+ } catch {
1148
+ }
1149
+ }
1150
+ for (const id of [...cache.byId.keys()]) {
1151
+ if (!seen.has(id)) forgetThread(id);
1152
+ }
1153
+ const threads = [...cache.byId.values()].sort(
1154
+ (a, b) => b.updatedAt.localeCompare(a.updatedAt)
1155
+ );
1156
+ if (opts?.includeArchived) return threads;
1157
+ return threads.filter((t) => t.status !== "archived");
1158
+ }
1159
+ function deleteThreadRecord(id) {
1160
+ forgetThread(id);
1161
+ const path = threadFilePath(id);
1162
+ if (existsSync(path)) unlinkSync(path);
1163
+ const lock = threadLockPath(id);
1164
+ if (existsSync(lock)) {
1165
+ try {
1166
+ unlinkSync(lock);
1167
+ } catch {
1168
+ }
1169
+ }
1170
+ try {
1171
+ rmSync(cursorSdkStoreDir(id), { recursive: true, force: true });
1172
+ } catch {
1173
+ }
1174
+ }
1175
+ function updateThread(id, patch) {
1176
+ const current = readThread(id);
1177
+ if (!current) throw new Error(`Thread not found: ${id}`);
1178
+ const next = { ...current, ...patch, id: current.id, updatedAt: nowIso() };
1179
+ if (next.status === "archived") {
1180
+ next.archivedAt = typeof next.archivedAt === "string" && next.archivedAt.trim() || current.archivedAt || nowIso();
1181
+ } else {
1182
+ delete next.archivedAt;
1183
+ }
1184
+ writeThread(next);
1185
+ return next;
1186
+ }
1187
+ function appendMessage(id, message) {
1188
+ const current = readThread(id);
1189
+ if (!current) throw new Error(`Thread not found: ${id}`);
1190
+ return updateThread(id, { messages: [...current.messages, message] });
1191
+ }
1192
+ function setStatus(id, status, lastError) {
1193
+ return updateThread(id, { status, lastError: lastError ?? null });
1194
+ }
1195
+ function findThreadByRef(ref) {
1196
+ const all = listThreads({ includeArchived: true });
1197
+ return all.find(
1198
+ (t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref
1199
+ ) ?? null;
1200
+ }
1201
+
1202
+ export {
1203
+ FAMOUS_SOCCER_TEAMS,
1204
+ lookupSoccerTeam,
1205
+ teamSlugFromName,
1206
+ normalizeTakenSlug,
1207
+ takenSlugsFromThread,
1208
+ allocateTeamName,
1209
+ normalizeWorktreePath,
1210
+ worktreeNameFromPath,
1211
+ normalizeWorkspaceTags,
1212
+ workspaceTagsFromGroup,
1213
+ ticketSlugForBranch,
1214
+ worktreeSlugForTicket,
1215
+ isPlaceholderBranch,
1216
+ branchDisplayLabel,
1217
+ threadDisplayLabel,
1218
+ worktreeDisplayLabel,
1219
+ worktreeDisplayLabelForGroup,
1220
+ agentNicknameFromWorktreePath,
1221
+ worktreeIdentityTitles,
1222
+ isWorktreeIdentityTitle,
1223
+ resolveThreadEffort,
1224
+ normalizeThread,
1225
+ createEmptyThread,
1226
+ withThreadLock,
1227
+ invalidateThreadListCache,
1228
+ invalidateThreadRecord,
1229
+ readThread,
1230
+ writeThread,
1231
+ isSelfWrittenRecord,
1232
+ isThreadRecordFile,
1233
+ listThreads,
1234
+ deleteThreadRecord,
1235
+ updateThread,
1236
+ appendMessage,
1237
+ setStatus,
1238
+ findThreadByRef
1239
+ };