linkit-all 1.0.0__py3-none-any.whl

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 (511) hide show
  1. linkit_all/__init__.py +0 -0
  2. linkit_all/api/__init__.py +0 -0
  3. linkit_all/api/app.py +120 -0
  4. linkit_all/api/assist.py +496 -0
  5. linkit_all/api/events.py +57 -0
  6. linkit_all/api/routes.py +2054 -0
  7. linkit_all/api/runner.py +165 -0
  8. linkit_all/api/security.py +60 -0
  9. linkit_all/api/suggest.py +129 -0
  10. linkit_all/apply/__init__.py +0 -0
  11. linkit_all/apply/accounts/__init__.py +93 -0
  12. linkit_all/apply/agent/__init__.py +845 -0
  13. linkit_all/apply/agent/snapshot.js +203 -0
  14. linkit_all/apply/answers.py +711 -0
  15. linkit_all/apply/assist.py +409 -0
  16. linkit_all/apply/browser.py +138 -0
  17. linkit_all/apply/email_apply.py +133 -0
  18. linkit_all/apply/email_send/__init__.py +125 -0
  19. linkit_all/apply/email_verify/__init__.py +259 -0
  20. linkit_all/apply/email_verify/microsoft.py +142 -0
  21. linkit_all/apply/followup.py +174 -0
  22. linkit_all/apply/form.py +216 -0
  23. linkit_all/apply/google_signin.py +90 -0
  24. linkit_all/apply/handlers/__init__.py +8 -0
  25. linkit_all/apply/handlers/ashby.py +23 -0
  26. linkit_all/apply/handlers/base.py +184 -0
  27. linkit_all/apply/handlers/greenhouse.py +51 -0
  28. linkit_all/apply/handlers/lever.py +18 -0
  29. linkit_all/apply/knockout.py +168 -0
  30. linkit_all/apply/probe.py +355 -0
  31. linkit_all/apply/quirks.py +44 -0
  32. linkit_all/apply/replies.py +173 -0
  33. linkit_all/apply/runner.py +1736 -0
  34. linkit_all/apply/vault/__init__.py +286 -0
  35. linkit_all/bench/__init__.py +2 -0
  36. linkit_all/bench/ai.py +176 -0
  37. linkit_all/bench/board.py +182 -0
  38. linkit_all/bench/data.py +318 -0
  39. linkit_all/bench/run.py +316 -0
  40. linkit_all/bench/tailor.py +200 -0
  41. linkit_all/cli.py +547 -0
  42. linkit_all/core/__init__.py +0 -0
  43. linkit_all/core/api_keys.py +100 -0
  44. linkit_all/core/chrome.py +397 -0
  45. linkit_all/core/config.py +57 -0
  46. linkit_all/core/db.py +47 -0
  47. linkit_all/core/fx.py +111 -0
  48. linkit_all/core/geo.py +306 -0
  49. linkit_all/core/infer.py +715 -0
  50. linkit_all/core/lo_install.py +117 -0
  51. linkit_all/core/log.py +36 -0
  52. linkit_all/core/migrations/env.py +28 -0
  53. linkit_all/core/migrations/script.py.mako +25 -0
  54. linkit_all/core/migrations/versions/20261015_1a751e8cf9b5_profile_locked_facts_tailored_cvs.py +67 -0
  55. linkit_all/core/migrations/versions/20261015_3da1531eb0e9_initial_schema.py +184 -0
  56. linkit_all/core/migrations/versions/20261015_9278cd22d5ef_search_config_and_source_checkpoints.py +47 -0
  57. linkit_all/core/migrations/versions/20261015_cc7ce03e7850_answers_answer_bank_action_center.py +89 -0
  58. linkit_all/core/migrations/versions/20261016_5a3e8b1c9d20_vault.py +48 -0
  59. linkit_all/core/migrations/versions/20261016_7c4d2e9f1a63_cv_source_format_approved.py +32 -0
  60. linkit_all/core/migrations/versions/20261017_b0a4d7e2c158_boards.py +39 -0
  61. linkit_all/core/migrations/versions/20261018_d3a1c5e7f902_message_codes.py +32 -0
  62. linkit_all/core/migrations/versions/20261019_e4b2d6f8a013_job_sightings.py +43 -0
  63. linkit_all/core/migrations/versions/20261031_f5c3e7a9b124_profile_home_address.py +30 -0
  64. linkit_all/core/migrations/versions/20261101_a6d4f8b0c235_run_reason_stages.py +32 -0
  65. linkit_all/core/migrations/versions/20261108_b7e5a9c1d346_answer_scope.py +28 -0
  66. linkit_all/core/migrations/versions/20261109_c8f6b0d2e457_profile_home_state.py +26 -0
  67. linkit_all/core/migrations/versions/20261117_d9a7c1e3f568_job_outcome.py +28 -0
  68. linkit_all/core/models.py +330 -0
  69. linkit_all/core/names.py +126 -0
  70. linkit_all/core/places.py +97 -0
  71. linkit_all/core/presets.py +156 -0
  72. linkit_all/core/profile.py +297 -0
  73. linkit_all/core/runs.py +99 -0
  74. linkit_all/core/scheduler.py +109 -0
  75. linkit_all/core/search.py +381 -0
  76. linkit_all/core/sightings.py +106 -0
  77. linkit_all/core/state.py +94 -0
  78. linkit_all/core/timing.py +89 -0
  79. linkit_all/core/tools.py +101 -0
  80. linkit_all/data/cities.json +1 -0
  81. linkit_all/data/company_boards.json +717 -0
  82. linkit_all/data/countries.json +1 -0
  83. linkit_all/data/fx.json +1 -0
  84. linkit_all/data/name_pairs.json +22799 -0
  85. linkit_all/data/titles.json +1 -0
  86. linkit_all/extension/background.js +163 -0
  87. linkit_all/extension/content.js +390 -0
  88. linkit_all/extension/manifest.json +20 -0
  89. linkit_all/extension/options.html +23 -0
  90. linkit_all/extension/options.js +10 -0
  91. linkit_all/extension/snapshot.js +205 -0
  92. linkit_all/matching/__init__.py +0 -0
  93. linkit_all/matching/audit.py +75 -0
  94. linkit_all/matching/deadline.py +89 -0
  95. linkit_all/matching/rank.py +211 -0
  96. linkit_all/matching/reasons.py +87 -0
  97. linkit_all/matching/rules.py +108 -0
  98. linkit_all/matching/score.py +210 -0
  99. linkit_all/matching/trash.py +162 -0
  100. linkit_all/matching/trust/__init__.py +22 -0
  101. linkit_all/matching/trust/ghost.py +562 -0
  102. linkit_all/matching/trust/normalize.py +164 -0
  103. linkit_all/matching/trust/scam.py +779 -0
  104. linkit_all/matching/trust_stage.py +80 -0
  105. linkit_all/matching/years.py +327 -0
  106. linkit_all/pipeline.py +221 -0
  107. linkit_all/providers/__init__.py +28 -0
  108. linkit_all/providers/base.py +273 -0
  109. linkit_all/providers/claude_cli.py +41 -0
  110. linkit_all/providers/codex_cli.py +56 -0
  111. linkit_all/providers/litellm_api.py +81 -0
  112. linkit_all/providers/prompts/answer.j2 +51 -0
  113. linkit_all/providers/prompts/application_email.j2 +29 -0
  114. linkit_all/providers/prompts/cover_letter.j2 +23 -0
  115. linkit_all/providers/prompts/extract_recipe.j2 +29 -0
  116. linkit_all/providers/prompts/followup_email.j2 +23 -0
  117. linkit_all/providers/prompts/form_map.j2 +39 -0
  118. linkit_all/providers/prompts/infer_fill.j2 +11 -0
  119. linkit_all/providers/prompts/json_output.j2 +4 -0
  120. linkit_all/providers/prompts/json_retry.j2 +6 -0
  121. linkit_all/providers/prompts/ping.j2 +1 -0
  122. linkit_all/providers/prompts/score.j2 +40 -0
  123. linkit_all/providers/prompts/tailor.j2 +26 -0
  124. linkit_all/providers/prompts/verify_email.j2 +16 -0
  125. linkit_all/providers/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +100256 -0
  126. linkit_all/py.typed +0 -0
  127. linkit_all/reports/__init__.py +291 -0
  128. linkit_all/sources/__init__.py +120 -0
  129. linkit_all/sources/aggregators/__init__.py +0 -0
  130. linkit_all/sources/aggregators/adzuna.py +133 -0
  131. linkit_all/sources/aggregators/arbeitnow.py +55 -0
  132. linkit_all/sources/aggregators/arbeitsagentur.py +90 -0
  133. linkit_all/sources/aggregators/bulldogjob.py +79 -0
  134. linkit_all/sources/aggregators/careerviet.py +95 -0
  135. linkit_all/sources/aggregators/computrabajo.py +89 -0
  136. linkit_all/sources/aggregators/devglobaljobs.py +59 -0
  137. linkit_all/sources/aggregators/edjoin.py +119 -0
  138. linkit_all/sources/aggregators/empregos.py +78 -0
  139. linkit_all/sources/aggregators/eures.py +94 -0
  140. linkit_all/sources/aggregators/flowxtra.py +63 -0
  141. linkit_all/sources/aggregators/functionalworks.py +61 -0
  142. linkit_all/sources/aggregators/germantechjobs.py +61 -0
  143. linkit_all/sources/aggregators/getmanfred.py +68 -0
  144. linkit_all/sources/aggregators/getmatch.py +74 -0
  145. linkit_all/sources/aggregators/getonbrd.py +89 -0
  146. linkit_all/sources/aggregators/glints.py +98 -0
  147. linkit_all/sources/aggregators/golangjobs.py +98 -0
  148. linkit_all/sources/aggregators/hackernews.py +93 -0
  149. linkit_all/sources/aggregators/herkey.py +125 -0
  150. linkit_all/sources/aggregators/himalayas.py +59 -0
  151. linkit_all/sources/aggregators/jobbankca.py +90 -0
  152. linkit_all/sources/aggregators/jobdanmark.py +73 -0
  153. linkit_all/sources/aggregators/jobicy.py +46 -0
  154. linkit_all/sources/aggregators/jobnet.py +62 -0
  155. linkit_all/sources/aggregators/jobscz.py +122 -0
  156. linkit_all/sources/aggregators/jobstash.py +65 -0
  157. linkit_all/sources/aggregators/jobstreet.py +90 -0
  158. linkit_all/sources/aggregators/jobtech.py +64 -0
  159. linkit_all/sources/aggregators/joinup.py +66 -0
  160. linkit_all/sources/aggregators/justjoin.py +75 -0
  161. linkit_all/sources/aggregators/kalibrr.py +104 -0
  162. linkit_all/sources/aggregators/keys.py +100 -0
  163. linkit_all/sources/aggregators/landingjobs.py +83 -0
  164. linkit_all/sources/aggregators/magneto.py +81 -0
  165. linkit_all/sources/aggregators/mycareersfuture.py +80 -0
  166. linkit_all/sources/aggregators/nofluffjobs.py +88 -0
  167. linkit_all/sources/aggregators/occ.py +86 -0
  168. linkit_all/sources/aggregators/powertofly.py +58 -0
  169. linkit_all/sources/aggregators/pracecz.py +96 -0
  170. linkit_all/sources/aggregators/reed.py +111 -0
  171. linkit_all/sources/aggregators/remoteok.py +55 -0
  172. linkit_all/sources/aggregators/remotive.py +48 -0
  173. linkit_all/sources/aggregators/remotli.py +62 -0
  174. linkit_all/sources/aggregators/schoolspring.py +86 -0
  175. linkit_all/sources/aggregators/seek.py +111 -0
  176. linkit_all/sources/aggregators/senjob.py +93 -0
  177. linkit_all/sources/aggregators/solidjobs.py +62 -0
  178. linkit_all/sources/aggregators/teamex.py +72 -0
  179. linkit_all/sources/aggregators/techinasia.py +116 -0
  180. linkit_all/sources/aggregators/tecla.py +54 -0
  181. linkit_all/sources/aggregators/tes.py +116 -0
  182. linkit_all/sources/aggregators/themuse.py +58 -0
  183. linkit_all/sources/aggregators/topco.py +87 -0
  184. linkit_all/sources/aggregators/topdev.py +119 -0
  185. linkit_all/sources/aggregators/tyomarkkinatori.py +123 -0
  186. linkit_all/sources/aggregators/usajobs.py +117 -0
  187. linkit_all/sources/aggregators/vdab.py +132 -0
  188. linkit_all/sources/aggregators/whatjobs.py +129 -0
  189. linkit_all/sources/aggregators/workablemarketplace.py +89 -0
  190. linkit_all/sources/aggregators/workingnomads.py +46 -0
  191. linkit_all/sources/aggregators/wttj.py +147 -0
  192. linkit_all/sources/aggregators/yourator.py +74 -0
  193. linkit_all/sources/ashby.py +76 -0
  194. linkit_all/sources/ats/__init__.py +0 -0
  195. linkit_all/sources/ats/adp.py +89 -0
  196. linkit_all/sources/ats/adpmyjobs.py +93 -0
  197. linkit_all/sources/ats/applicantstack.py +110 -0
  198. linkit_all/sources/ats/applitrack.py +166 -0
  199. linkit_all/sources/ats/appone.py +104 -0
  200. linkit_all/sources/ats/ashbygraphql.py +85 -0
  201. linkit_all/sources/ats/avature.py +155 -0
  202. linkit_all/sources/ats/bamboohr.py +83 -0
  203. linkit_all/sources/ats/beesite.py +111 -0
  204. linkit_all/sources/ats/betterteam.py +70 -0
  205. linkit_all/sources/ats/breezy.py +63 -0
  206. linkit_all/sources/ats/bullhorn.py +73 -0
  207. linkit_all/sources/ats/careerplug.py +74 -0
  208. linkit_all/sources/ats/catsone.py +60 -0
  209. linkit_all/sources/ats/clearcompany.py +77 -0
  210. linkit_all/sources/ats/collage.py +77 -0
  211. linkit_all/sources/ats/comeet.py +67 -0
  212. linkit_all/sources/ats/compleo.py +52 -0
  213. linkit_all/sources/ats/consider.py +97 -0
  214. linkit_all/sources/ats/cornerstone.py +115 -0
  215. linkit_all/sources/ats/crelate.py +58 -0
  216. linkit_all/sources/ats/darwinbox.py +94 -0
  217. linkit_all/sources/ats/dayforce.py +100 -0
  218. linkit_all/sources/ats/deel.py +76 -0
  219. linkit_all/sources/ats/dover.py +109 -0
  220. linkit_all/sources/ats/earcu.py +88 -0
  221. linkit_all/sources/ats/eightfold.py +121 -0
  222. linkit_all/sources/ats/emply.py +82 -0
  223. linkit_all/sources/ats/eploy.py +76 -0
  224. linkit_all/sources/ats/erecruiter.py +137 -0
  225. linkit_all/sources/ats/factorial.py +99 -0
  226. linkit_all/sources/ats/feishu_jobs.py +81 -0
  227. linkit_all/sources/ats/freshteam.py +69 -0
  228. linkit_all/sources/ats/friendwork.py +63 -0
  229. linkit_all/sources/ats/geekhunter.py +66 -0
  230. linkit_all/sources/ats/gem.py +91 -0
  231. linkit_all/sources/ats/gethired.py +67 -0
  232. linkit_all/sources/ats/getro.py +88 -0
  233. linkit_all/sources/ats/gr8people.py +85 -0
  234. linkit_all/sources/ats/gupy.py +65 -0
  235. linkit_all/sources/ats/gusto.py +110 -0
  236. linkit_all/sources/ats/harri.py +114 -0
  237. linkit_all/sources/ats/hcshiring.py +102 -0
  238. linkit_all/sources/ats/herp.py +91 -0
  239. linkit_all/sources/ats/hibob.py +62 -0
  240. linkit_all/sources/ats/higherme.py +112 -0
  241. linkit_all/sources/ats/hireclick.py +101 -0
  242. linkit_all/sources/ats/hirehive.py +102 -0
  243. linkit_all/sources/ats/hireology.py +54 -0
  244. linkit_all/sources/ats/hiringroom.py +135 -0
  245. linkit_all/sources/ats/hiringthing.py +112 -0
  246. linkit_all/sources/ats/homerun.py +94 -0
  247. linkit_all/sources/ats/hrmanager.py +99 -0
  248. linkit_all/sources/ats/hrmdirect.py +97 -0
  249. linkit_all/sources/ats/hrmos.py +57 -0
  250. linkit_all/sources/ats/humanbit.py +90 -0
  251. linkit_all/sources/ats/huntflow.py +78 -0
  252. linkit_all/sources/ats/hurma.py +86 -0
  253. linkit_all/sources/ats/icims.py +58 -0
  254. linkit_all/sources/ats/idealtraits.py +120 -0
  255. linkit_all/sources/ats/inhire.py +71 -0
  256. linkit_all/sources/ats/inrecruiting.py +103 -0
  257. linkit_all/sources/ats/ismartrecruit.py +111 -0
  258. linkit_all/sources/ats/isolvedhire.py +56 -0
  259. linkit_all/sources/ats/jazzhr.py +48 -0
  260. linkit_all/sources/ats/jibe.py +58 -0
  261. linkit_all/sources/ats/jobappnetwork.py +76 -0
  262. linkit_all/sources/ats/jobboardly.py +75 -0
  263. linkit_all/sources/ats/jobscore.py +76 -0
  264. linkit_all/sources/ats/jobspage.py +95 -0
  265. linkit_all/sources/ats/jobvite.py +52 -0
  266. linkit_all/sources/ats/join.py +94 -0
  267. linkit_all/sources/ats/keka.py +65 -0
  268. linkit_all/sources/ats/likeit.py +69 -0
  269. linkit_all/sources/ats/loxo.py +113 -0
  270. linkit_all/sources/ats/manatal.py +60 -0
  271. linkit_all/sources/ats/mindsight.py +79 -0
  272. linkit_all/sources/ats/mokahr.py +125 -0
  273. linkit_all/sources/ats/neogov.py +93 -0
  274. linkit_all/sources/ats/northstone.py +80 -0
  275. linkit_all/sources/ats/notion.py +234 -0
  276. linkit_all/sources/ats/odoo.py +78 -0
  277. linkit_all/sources/ats/opencats.py +123 -0
  278. linkit_all/sources/ats/oracle.py +105 -0
  279. linkit_all/sources/ats/pageup.py +118 -0
  280. linkit_all/sources/ats/pandape.py +161 -0
  281. linkit_all/sources/ats/paradox.py +105 -0
  282. linkit_all/sources/ats/paycom.py +119 -0
  283. linkit_all/sources/ats/paycor.py +97 -0
  284. linkit_all/sources/ats/paylocity.py +96 -0
  285. linkit_all/sources/ats/peoplesoft.py +218 -0
  286. linkit_all/sources/ats/personio.py +110 -0
  287. linkit_all/sources/ats/phenom.py +107 -0
  288. linkit_all/sources/ats/pinpoint.py +51 -0
  289. linkit_all/sources/ats/polymer.py +78 -0
  290. linkit_all/sources/ats/potok.py +84 -0
  291. linkit_all/sources/ats/prevueaps.py +86 -0
  292. linkit_all/sources/ats/pyjamahr.py +95 -0
  293. linkit_all/sources/ats/quickin.py +73 -0
  294. linkit_all/sources/ats/radancy.py +95 -0
  295. linkit_all/sources/ats/rapyd.py +67 -0
  296. linkit_all/sources/ats/recruiterflow.py +69 -0
  297. linkit_all/sources/ats/recruitingsolutions.py +77 -0
  298. linkit_all/sources/ats/recrutei.py +89 -0
  299. linkit_all/sources/ats/redrover.py +83 -0
  300. linkit_all/sources/ats/rexx.py +93 -0
  301. linkit_all/sources/ats/rippling.py +65 -0
  302. linkit_all/sources/ats/scalis.py +108 -0
  303. linkit_all/sources/ats/selfrecruit.py +76 -0
  304. linkit_all/sources/ats/senior.py +100 -0
  305. linkit_all/sources/ats/sitemap.py +112 -0
  306. linkit_all/sources/ats/softgarden.py +36 -0
  307. linkit_all/sources/ats/solides.py +56 -0
  308. linkit_all/sources/ats/spark.py +53 -0
  309. linkit_all/sources/ats/speedrun.py +68 -0
  310. linkit_all/sources/ats/successfactors.py +66 -0
  311. linkit_all/sources/ats/talentadore.py +52 -0
  312. linkit_all/sources/ats/talenthr.py +74 -0
  313. linkit_all/sources/ats/talentlink.py +152 -0
  314. linkit_all/sources/ats/talentlyft.py +37 -0
  315. linkit_all/sources/ats/taleo.py +136 -0
  316. linkit_all/sources/ats/taleobe.py +94 -0
  317. linkit_all/sources/ats/teamtailor.py +102 -0
  318. linkit_all/sources/ats/tenstreet.py +121 -0
  319. linkit_all/sources/ats/traffit.py +64 -0
  320. linkit_all/sources/ats/trakstar.py +79 -0
  321. linkit_all/sources/ats/turbohire.py +103 -0
  322. linkit_all/sources/ats/ukg.py +107 -0
  323. linkit_all/sources/ats/ukgready.py +118 -0
  324. linkit_all/sources/ats/vouch.py +83 -0
  325. linkit_all/sources/ats/werecruit.py +85 -0
  326. linkit_all/sources/ats/workstream.py +150 -0
  327. linkit_all/sources/ats/wp_job_manager.py +75 -0
  328. linkit_all/sources/ats/wpyoast.py +49 -0
  329. linkit_all/sources/ats/zoho.py +97 -0
  330. linkit_all/sources/ats_detector.py +35 -0
  331. linkit_all/sources/base.py +133 -0
  332. linkit_all/sources/boards/__init__.py +0 -0
  333. linkit_all/sources/boards/agentic_jobs.py +80 -0
  334. linkit_all/sources/boards/builtin.py +153 -0
  335. linkit_all/sources/boards/cryptocurrencyjobs.py +62 -0
  336. linkit_all/sources/boards/fourdayweek.py +65 -0
  337. linkit_all/sources/boards/generalist_world.py +62 -0
  338. linkit_all/sources/boards/higheredjobs.py +69 -0
  339. linkit_all/sources/boards/instaffo.py +41 -0
  340. linkit_all/sources/boards/itviec.py +163 -0
  341. linkit_all/sources/boards/japandev.py +166 -0
  342. linkit_all/sources/boards/jobspresso.py +62 -0
  343. linkit_all/sources/boards/jobylon.py +34 -0
  344. linkit_all/sources/boards/joppy.py +115 -0
  345. linkit_all/sources/boards/larajobs.py +54 -0
  346. linkit_all/sources/boards/nodesk.py +55 -0
  347. linkit_all/sources/boards/profession.py +125 -0
  348. linkit_all/sources/boards/pythonorg.py +97 -0
  349. linkit_all/sources/boards/remotedotcom.py +129 -0
  350. linkit_all/sources/boards/startup_jobs.py +70 -0
  351. linkit_all/sources/boards/startupandvc.py +74 -0
  352. linkit_all/sources/boards/techtree.py +50 -0
  353. linkit_all/sources/boards/thehub.py +51 -0
  354. linkit_all/sources/boards/torre.py +89 -0
  355. linkit_all/sources/boards/weworkremotely.py +48 -0
  356. linkit_all/sources/boards/work180.py +97 -0
  357. linkit_all/sources/browser_extract.py +533 -0
  358. linkit_all/sources/careers.py +308 -0
  359. linkit_all/sources/common.py +261 -0
  360. linkit_all/sources/companies/__init__.py +0 -0
  361. linkit_all/sources/companies/aldi_nord.py +109 -0
  362. linkit_all/sources/companies/alibaba.py +81 -0
  363. linkit_all/sources/companies/alignerr.py +69 -0
  364. linkit_all/sources/companies/amazon.py +65 -0
  365. linkit_all/sources/companies/apple.py +90 -0
  366. linkit_all/sources/companies/atlassian.py +63 -0
  367. linkit_all/sources/companies/aviasales.py +64 -0
  368. linkit_all/sources/companies/avito.py +72 -0
  369. linkit_all/sources/companies/bairesdev.py +96 -0
  370. linkit_all/sources/companies/briefhq.py +39 -0
  371. linkit_all/sources/companies/bwi.py +104 -0
  372. linkit_all/sources/companies/dassault.py +101 -0
  373. linkit_all/sources/companies/dataart.py +75 -0
  374. linkit_all/sources/companies/deutschebahn.py +84 -0
  375. linkit_all/sources/companies/dodo.py +65 -0
  376. linkit_all/sources/companies/domclick.py +65 -0
  377. linkit_all/sources/companies/emagine.py +85 -0
  378. linkit_all/sources/companies/epam.py +104 -0
  379. linkit_all/sources/companies/garena.py +78 -0
  380. linkit_all/sources/companies/googlecareers.py +101 -0
  381. linkit_all/sources/companies/halyk.py +83 -0
  382. linkit_all/sources/companies/hecklerkoch.py +62 -0
  383. linkit_all/sources/companies/ibm.py +126 -0
  384. linkit_all/sources/companies/itechart.py +40 -0
  385. linkit_all/sources/companies/jettycloud.py +99 -0
  386. linkit_all/sources/companies/kaspersky.py +98 -0
  387. linkit_all/sources/companies/kaspi.py +80 -0
  388. linkit_all/sources/companies/kuper.py +51 -0
  389. linkit_all/sources/companies/lamoda.py +65 -0
  390. linkit_all/sources/companies/lesta.py +68 -0
  391. linkit_all/sources/companies/lumenalta.py +50 -0
  392. linkit_all/sources/companies/luxoft.py +63 -0
  393. linkit_all/sources/companies/magnit.py +78 -0
  394. linkit_all/sources/companies/megafon.py +112 -0
  395. linkit_all/sources/companies/meituan.py +82 -0
  396. linkit_all/sources/companies/micro1.py +71 -0
  397. linkit_all/sources/companies/mts.py +86 -0
  398. linkit_all/sources/companies/mtslink.py +65 -0
  399. linkit_all/sources/companies/orion.py +68 -0
  400. linkit_all/sources/companies/ozon.py +65 -0
  401. linkit_all/sources/companies/rheinmetall.py +79 -0
  402. linkit_all/sources/companies/rostelecom.py +65 -0
  403. linkit_all/sources/companies/rwb.py +66 -0
  404. linkit_all/sources/companies/sber.py +65 -0
  405. linkit_all/sources/companies/selectel.py +92 -0
  406. linkit_all/sources/companies/staffy.py +75 -0
  407. linkit_all/sources/companies/telegramcareers.py +60 -0
  408. linkit_all/sources/companies/tencent.py +91 -0
  409. linkit_all/sources/companies/tkms.py +79 -0
  410. linkit_all/sources/companies/uzum.py +99 -0
  411. linkit_all/sources/companies/vention.py +63 -0
  412. linkit_all/sources/companies/vk.py +67 -0
  413. linkit_all/sources/companies/x5.py +109 -0
  414. linkit_all/sources/companies/yandex.py +91 -0
  415. linkit_all/sources/companies/yandexcrowd.py +67 -0
  416. linkit_all/sources/discovery.py +272 -0
  417. linkit_all/sources/forasna.py +78 -0
  418. linkit_all/sources/greenhouse.py +65 -0
  419. linkit_all/sources/http.py +209 -0
  420. linkit_all/sources/jobspy_sites.py +238 -0
  421. linkit_all/sources/jsonld.py +69 -0
  422. linkit_all/sources/labels.py +109 -0
  423. linkit_all/sources/lever.py +78 -0
  424. linkit_all/sources/linkedin_posts/__init__.py +1 -0
  425. linkit_all/sources/linkedin_posts/extract.py +105 -0
  426. linkit_all/sources/linkedin_posts/google.py +183 -0
  427. linkit_all/sources/linkedin_posts/post.py +66 -0
  428. linkit_all/sources/linkedin_posts/source.py +131 -0
  429. linkit_all/sources/liveness.py +85 -0
  430. linkit_all/sources/parsing.py +433 -0
  431. linkit_all/sources/posts.py +297 -0
  432. linkit_all/sources/recruitee.py +56 -0
  433. linkit_all/sources/resolve.py +103 -0
  434. linkit_all/sources/runner.py +205 -0
  435. linkit_all/sources/smartrecruiters.py +83 -0
  436. linkit_all/sources/store.py +203 -0
  437. linkit_all/sources/tasks.py +76 -0
  438. linkit_all/sources/telegram.py +189 -0
  439. linkit_all/sources/text.py +89 -0
  440. linkit_all/sources/workable.py +59 -0
  441. linkit_all/sources/workday.py +231 -0
  442. linkit_all/sources/wuzzuf.py +70 -0
  443. linkit_all/static/3rdpartylicenses.txt +409 -0
  444. linkit_all/static/browser/chunk-3IURHPEU.js +58 -0
  445. linkit_all/static/browser/chunk-42BADFSQ.js +1 -0
  446. linkit_all/static/browser/chunk-7T72MNCA.js +1 -0
  447. linkit_all/static/browser/chunk-AI7LROEI.js +1 -0
  448. linkit_all/static/browser/chunk-AMBLX23U.js +1 -0
  449. linkit_all/static/browser/chunk-BZKQ3A25.js +1 -0
  450. linkit_all/static/browser/chunk-C4QONTGL.js +1 -0
  451. linkit_all/static/browser/chunk-DGKOYYG3.js +1 -0
  452. linkit_all/static/browser/chunk-FKHJ623F.js +1 -0
  453. linkit_all/static/browser/chunk-JIENMJBQ.js +1 -0
  454. linkit_all/static/browser/chunk-KCKRSWA6.js +3 -0
  455. linkit_all/static/browser/chunk-OQPM64HQ.js +1 -0
  456. linkit_all/static/browser/chunk-PNRBPP4I.js +1 -0
  457. linkit_all/static/browser/chunk-T5K52GPO.js +6 -0
  458. linkit_all/static/browser/chunk-VBY7R3AJ.js +3 -0
  459. linkit_all/static/browser/favicon.ico +0 -0
  460. linkit_all/static/browser/index.html +13 -0
  461. linkit_all/static/browser/main-ROCPXH6K.js +1 -0
  462. linkit_all/static/browser/media/ibm-plex-sans-arabic-arabic-400-normal-HDFIX7LY.woff2 +0 -0
  463. linkit_all/static/browser/media/ibm-plex-sans-arabic-arabic-400-normal-N4DMJBB5.woff +0 -0
  464. linkit_all/static/browser/media/ibm-plex-sans-arabic-arabic-500-normal-5MTGWOCT.woff +0 -0
  465. linkit_all/static/browser/media/ibm-plex-sans-arabic-arabic-500-normal-AAIACC75.woff2 +0 -0
  466. linkit_all/static/browser/media/ibm-plex-sans-arabic-arabic-600-normal-LS4CIPTS.woff2 +0 -0
  467. linkit_all/static/browser/media/ibm-plex-sans-arabic-arabic-600-normal-USVRKN2F.woff +0 -0
  468. linkit_all/static/browser/media/ibm-plex-sans-arabic-cyrillic-ext-400-normal-P2AL3NYX.woff +0 -0
  469. linkit_all/static/browser/media/ibm-plex-sans-arabic-cyrillic-ext-400-normal-XJDTNQZ3.woff2 +0 -0
  470. linkit_all/static/browser/media/ibm-plex-sans-arabic-cyrillic-ext-500-normal-G66K6AVN.woff +0 -0
  471. linkit_all/static/browser/media/ibm-plex-sans-arabic-cyrillic-ext-500-normal-JDN6M2QH.woff2 +0 -0
  472. linkit_all/static/browser/media/ibm-plex-sans-arabic-cyrillic-ext-600-normal-AJDAM7LZ.woff +0 -0
  473. linkit_all/static/browser/media/ibm-plex-sans-arabic-cyrillic-ext-600-normal-HM5VVFOZ.woff2 +0 -0
  474. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-400-normal-7WCZAUHA.woff +0 -0
  475. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-400-normal-W2AG3YJR.woff2 +0 -0
  476. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-500-normal-5LQDONK7.woff2 +0 -0
  477. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-500-normal-TFD6UMQA.woff +0 -0
  478. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-600-normal-XUUOQ5DA.woff2 +0 -0
  479. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-600-normal-ZE5R3UMF.woff +0 -0
  480. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-ext-400-normal-BNYZJBRB.woff +0 -0
  481. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-ext-400-normal-ZJNBCCQT.woff2 +0 -0
  482. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-ext-500-normal-N3YASIEA.woff +0 -0
  483. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-ext-500-normal-R4TZYXNB.woff2 +0 -0
  484. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-ext-600-normal-TVCPUHHD.woff +0 -0
  485. linkit_all/static/browser/media/ibm-plex-sans-arabic-latin-ext-600-normal-V6CVHTRX.woff2 +0 -0
  486. linkit_all/static/browser/media/ibm-plex-sans-cyrillic-ext-wght-normal-DEWRJMSP.woff2 +0 -0
  487. linkit_all/static/browser/media/ibm-plex-sans-cyrillic-wght-normal-WC4RT7HT.woff2 +0 -0
  488. linkit_all/static/browser/media/ibm-plex-sans-greek-wght-normal-54OIUMHA.woff2 +0 -0
  489. linkit_all/static/browser/media/ibm-plex-sans-latin-ext-wght-normal-VCUQOPLP.woff2 +0 -0
  490. linkit_all/static/browser/media/ibm-plex-sans-latin-wght-normal-U42Y2LR5.woff2 +0 -0
  491. linkit_all/static/browser/media/ibm-plex-sans-vietnamese-wght-normal-XXCN3S4J.woff2 +0 -0
  492. linkit_all/static/browser/styles-CBY6DI3K.css +1 -0
  493. linkit_all/static/prerendered-routes.json +3 -0
  494. linkit_all/tailor/__init__.py +0 -0
  495. linkit_all/tailor/docx/__init__.py +0 -0
  496. linkit_all/tailor/docx/segments.py +113 -0
  497. linkit_all/tailor/latex/__init__.py +333 -0
  498. linkit_all/tailor/patches.py +180 -0
  499. linkit_all/tailor/pipeline.py +328 -0
  500. linkit_all/tailor/render/__init__.py +0 -0
  501. linkit_all/tailor/render/latex.py +30 -0
  502. linkit_all/tailor/render/libreoffice.py +57 -0
  503. linkit_all/tailor/verify/__init__.py +0 -0
  504. linkit_all/tailor/verify/facts.py +109 -0
  505. linkit_all/tailor/verify/layout.py +48 -0
  506. linkit_all-1.0.0.dist-info/METADATA +167 -0
  507. linkit_all-1.0.0.dist-info/RECORD +511 -0
  508. linkit_all-1.0.0.dist-info/WHEEL +4 -0
  509. linkit_all-1.0.0.dist-info/entry_points.txt +2 -0
  510. linkit_all-1.0.0.dist-info/licenses/LICENSE +661 -0
  511. linkit_all-1.0.0.dist-info/licenses/NOTICE +152 -0
linkit_all/__init__.py ADDED
File without changes
File without changes
linkit_all/api/app.py ADDED
@@ -0,0 +1,120 @@
1
+ """FastAPI app: API, live events, and the built Angular UI from the wheel."""
2
+
3
+ import asyncio
4
+ import json
5
+ from collections.abc import AsyncIterator
6
+ from contextlib import asynccontextmanager
7
+ from pathlib import Path
8
+
9
+ from fastapi import FastAPI, HTTPException
10
+ from fastapi.responses import FileResponse
11
+ from loguru import logger
12
+ from sqlalchemy.orm import Session, sessionmaker
13
+
14
+ from linkit_all.api.assist import router as assist_router
15
+ from linkit_all.api.events import EventBus
16
+ from linkit_all.api.routes import router
17
+ from linkit_all.api.runner import PipelineRunner
18
+ from linkit_all.api.security import LocalOnly
19
+ from linkit_all.api.suggest import router as suggest_router
20
+ from linkit_all.apply.browser import UserBrowser
21
+ from linkit_all.apply.vault import vault_for
22
+ from linkit_all.core.config import Settings, get_settings
23
+ from linkit_all.core.db import init_db
24
+ from linkit_all.core.lo_install import LibreOfficeInstaller
25
+ from linkit_all.core.log import setup_logging
26
+ from linkit_all.core.scheduler import apply_schedule, make_scheduler, register_runner
27
+ from linkit_all.core.search import SearchConfig, load_search
28
+ from linkit_all.matching.trash import sweep
29
+
30
+ STATIC = Path(__file__).parent.parent / "static" / "browser" # Angular build output
31
+ EXTENSION_ADDRESS = Path(__file__).parent.parent / "extension" / "app.json"
32
+
33
+
34
+ def create_app(settings: Settings | None = None) -> FastAPI:
35
+ settings = settings or get_settings()
36
+
37
+ @asynccontextmanager
38
+ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
39
+ app.state.bus.bind(asyncio.get_running_loop())
40
+ app.state.vault.unlock_from_keyring()
41
+ sink = logger.add(app.state.bus.log_sink, level="INFO",
42
+ filter=lambda r: (r["name"] or "").startswith("linkit_all")) # fmt: skip
43
+ register_runner(app.state.runner, app.state.user_browser)
44
+ app.state.scheduler.start()
45
+ apply_schedule(app.state.scheduler, load_search(app.state.db) or SearchConfig())
46
+ yield
47
+ app.state.scheduler.shutdown(wait=False)
48
+ register_runner(None)
49
+ app.state.runner.cancel()
50
+ await app.state.user_browser.close()
51
+ logger.remove(sink)
52
+
53
+ app = FastAPI(
54
+ title="LinKit All", lifespan=lifespan, docs_url="/api/docs", openapi_url="/api/openapi.json"
55
+ )
56
+ app.state.settings = settings
57
+ app.state.db = init_db(settings.db_path)
58
+ app.state.vault = vault_for(settings, app.state.db)
59
+ app.state.bus = EventBus()
60
+ app.state.user_browser = UserBrowser()
61
+ app.state.lo_installer = LibreOfficeInstaller(settings)
62
+ app.state.runner = PipelineRunner(app.state.db, settings, app.state.bus, app.state.vault)
63
+ app.state.scheduler = make_scheduler(app.state.db.kw["bind"])
64
+ app.add_middleware(LocalOnly, extra_origins=settings.dev_origins)
65
+ app.include_router(router)
66
+ app.include_router(suggest_router)
67
+ app.include_router(assist_router)
68
+
69
+ @app.get("/{path:path}", include_in_schema=False)
70
+ def spa(path: str) -> FileResponse:
71
+ """Static files, else index.html so Angular's router handles deep links."""
72
+ if path.startswith("api/"):
73
+ raise HTTPException(404)
74
+ # index.html must be revalidated, or browsers keep an old build for hours (no Cache-Control
75
+ # means a guessed lifetime); the hashed JS/CSS names change per build, so they cache fine
76
+ fresh = {"Cache-Control": "no-cache"}
77
+ file = (STATIC / path).resolve()
78
+ if path and file.is_file() and file.is_relative_to(STATIC.resolve()):
79
+ return FileResponse(file, headers=fresh if file.suffix == ".html" else None)
80
+ index = STATIC / "index.html"
81
+ if not index.is_file():
82
+ raise HTTPException(404, "UI not built: run `npm run build` in frontend/")
83
+ return FileResponse(index, headers=fresh)
84
+
85
+ return app
86
+
87
+
88
+ def _tell_extension(port: int) -> None:
89
+ """LinkIt Fill reads this from its own folder, so nobody has to type the port."""
90
+ try:
91
+ EXTENSION_ADDRESS.write_text(json.dumps({"port": port}), "utf-8")
92
+ except OSError as e: # the extension then tries the default port
93
+ logger.warning("could not tell LinkIt Fill the port: {}", e)
94
+
95
+
96
+ def _sweep_trash(db: sessionmaker[Session], settings: Settings) -> None:
97
+ """Start-up pass, so a change of rules needs no new search before old jobs disappear."""
98
+ from linkit_all.pipeline import _get_embedder
99
+
100
+ try:
101
+ sweep(db, load_search(db) or SearchConfig(),
102
+ lambda texts: asyncio.run(_get_embedder(settings))(texts)) # fmt: skip
103
+ except Exception:
104
+ logger.exception("could not update the hidden jobs")
105
+
106
+
107
+ def serve(host: str = "127.0.0.1", port: int = 8765, open_browser: bool = True) -> None:
108
+ import threading
109
+ import webbrowser
110
+
111
+ import uvicorn
112
+
113
+ settings = get_settings()
114
+ setup_logging(settings)
115
+ if open_browser:
116
+ threading.Timer(1.5, webbrowser.open, [f"http://{host}:{port}/"]).start()
117
+ app = create_app(settings)
118
+ _tell_extension(port)
119
+ threading.Thread(target=_sweep_trash, args=(app.state.db, settings), daemon=True).start()
120
+ uvicorn.run(app, host=host, port=port, log_level="warning")
@@ -0,0 +1,496 @@
1
+ """LinkIt Fill: the browser extension that fills an application in the user's own browser.
2
+
3
+ Used for ban-risk sites (LinkedIn Easy Apply, Indeed Apply) and for any job the app handed to
4
+ the user. The extension sends the page's controls; each is identified by its label or field
5
+ name and answered from the app's data, and the AI is asked only for what is not recorded (the
6
+ same answer engine as the app's agent; sensitive questions never reach the AI). The extension
7
+ fills them. It never presses Next or Submit: the user does (CLAUDE.md §5.5).
8
+
9
+ Every call needs the pairing token shown in Settings > Applying; the extension keeps it. The
10
+ server only listens on 127.0.0.1, and data goes only to the provider the user chose.
11
+ """
12
+
13
+ import asyncio
14
+ import hmac
15
+ import re
16
+ import secrets
17
+ from pathlib import Path
18
+ from typing import Annotated, Any
19
+ from urllib.parse import urlparse
20
+
21
+ from fastapi import APIRouter, Header, HTTPException, Request
22
+ from fastapi.responses import FileResponse
23
+ from pydantic import BaseModel, Field
24
+ from sqlalchemy import select
25
+ from sqlalchemy.orm import Session, sessionmaker
26
+
27
+ from linkit_all.apply.agent import Control, page_questions
28
+ from linkit_all.apply.answers import (
29
+ ApplicationAnswers,
30
+ is_cover_letter,
31
+ remember_secrets,
32
+ scrub,
33
+ secrets_seen,
34
+ sensitive_category,
35
+ )
36
+ from linkit_all.apply.assist import (
37
+ AnswerBank,
38
+ answer_questions,
39
+ keepable,
40
+ profile_summary,
41
+ remember_bank_secrets,
42
+ role_key,
43
+ scope_of,
44
+ )
45
+ from linkit_all.apply.email_send import valid_address
46
+ from linkit_all.apply.handlers.base import GENERIC_CONFIRMATION
47
+ from linkit_all.apply.runner import (
48
+ Applier,
49
+ ApplyBlocked,
50
+ emailed,
51
+ emails_sent_today,
52
+ job_context,
53
+ )
54
+ from linkit_all.core.config import Settings
55
+ from linkit_all.core.models import (
56
+ ActionItem,
57
+ ActionKind,
58
+ ActionStatus,
59
+ Job,
60
+ JobEvent,
61
+ JobState,
62
+ Profile,
63
+ utcnow,
64
+ )
65
+ from linkit_all.core.search import SearchConfig, load_search
66
+ from linkit_all.core.state import transition
67
+ from linkit_all.matching.rank import cv_text
68
+ from linkit_all.providers.base import LLMProvider
69
+ from linkit_all.sources.posts import company_of, heading
70
+ from linkit_all.sources.text import job_hash, norm, norm_company
71
+
72
+ router = APIRouter(prefix="/api/assist")
73
+ KINDS = (ActionKind.apply_in_browser, ActionKind.apply_by_hand)
74
+
75
+
76
+ def _db(request: Request) -> sessionmaker[Session]:
77
+ db: sessionmaker[Session] = request.app.state.db
78
+ return db
79
+
80
+
81
+ def _settings(request: Request) -> Settings:
82
+ settings: Settings = request.app.state.settings
83
+ return settings
84
+
85
+
86
+ def token_path(settings: Settings) -> Path:
87
+ return settings.data_dir / "assist_token"
88
+
89
+
90
+ def pairing_token(settings: Settings) -> str:
91
+ """The extension's pairing token, made on first use and kept in the data folder."""
92
+ path = token_path(settings)
93
+ if not path.exists():
94
+ path.parent.mkdir(parents=True, exist_ok=True)
95
+ path.write_text(secrets.token_urlsafe(24), "utf-8")
96
+ return path.read_text("utf-8").strip()
97
+
98
+
99
+ def _check(request: Request, token: str | None) -> None:
100
+ if not token or not hmac.compare_digest(token, pairing_token(_settings(request))):
101
+ raise HTTPException(
102
+ 401, "Pair the LinkIt extension: copy the code from Settings > Applying"
103
+ )
104
+
105
+
106
+ def _host(url: str) -> str:
107
+ return (urlparse(url).hostname or "").removeprefix("www.")
108
+
109
+
110
+ def _open_items(s: Session) -> list[tuple[ActionItem, Job]]:
111
+ rows = s.execute(
112
+ select(ActionItem, Job)
113
+ .join(Job, Job.id == ActionItem.job_id)
114
+ .where(ActionItem.status == ActionStatus.open, ActionItem.kind.in_(KINDS))
115
+ .order_by(ActionItem.id.desc())
116
+ ).all()
117
+ return [(item, job) for item, job in rows]
118
+
119
+
120
+ @router.get("/token")
121
+ def get_token(request: Request) -> dict[str, str]:
122
+ """For the app's own Settings page (same-origin: a GET from another site cannot read it)."""
123
+ if request.headers.get("sec-fetch-site") not in (None, "same-origin"):
124
+ raise HTTPException(403, "only the app itself can read the pairing code")
125
+ folder = Path(__file__).parent.parent / "extension"
126
+ return {"token": pairing_token(_settings(request)), "extension_dir": str(folder)}
127
+
128
+
129
+ @router.get("/hosts")
130
+ def hosts(request: Request, x_linkit_token: str | None = Header(None)) -> dict[str, list[str]]:
131
+ """Sites with a job waiting for the user: the extension shows its panel only there."""
132
+ _check(request, x_linkit_token)
133
+ with _db(request)() as s:
134
+ found = {_host(u) for _, job in _open_items(s) for u in _urls(job)}
135
+ return {"hosts": sorted(h for h in found if h)}
136
+
137
+
138
+ _SITE_JOB_ID = (
139
+ re.compile(r"/jobs/view/(?:[^/?#]*-)?(\d{6,})"), # LinkedIn
140
+ re.compile(
141
+ r"[?&](?:currentJobId|jl|jobListingId|jk|vjk)=([\w-]+)"
142
+ ), # LinkedIn lists, Glassdoor, Indeed
143
+ )
144
+
145
+
146
+ def _urls(job: Job) -> set[str]:
147
+ return {u for u in (job.url, job.data.get("apply_url")) if u}
148
+
149
+
150
+ def _site_job_id(url: str) -> str:
151
+ return next((m[1].lower() for rx in _SITE_JOB_ID if (m := rx.search(url))), "")
152
+
153
+
154
+ def _path(url: str) -> str:
155
+ return f"{_host(url)}{urlparse(url).path.rstrip('/')}".lower()
156
+
157
+
158
+ def _same_page(job_path: str, here: str) -> bool:
159
+ return "/" in job_path and (here == job_path or here.startswith(job_path + "/"))
160
+
161
+
162
+ class PageIn(BaseModel):
163
+ url: str = Field(max_length=4000)
164
+ title: str = Field("", max_length=500)
165
+ heading: str = Field("", max_length=2000)
166
+ text: str = Field("", max_length=20000)
167
+
168
+
169
+ def _named_on_page(job: Job, page: PageIn) -> bool:
170
+ role, company = role_key(job.title), norm_company(job.company)
171
+ return (
172
+ bool(role and company)
173
+ and company != norm_company("Unknown")
174
+ and f" {role} " in f" {role_key(f'{page.title} {page.heading}')} "
175
+ and f" {company} " in f" {norm(f'{page.title} {page.heading} {page.text}')} "
176
+ )
177
+
178
+
179
+ def _job_on_page(jobs: list[Job], page: PageIn) -> Job | None:
180
+ """The waiting job this page is about, or None: never a guess. The site's own job id decides
181
+ when the address has one (several Glassdoor jobs share a path and differ only in `jl`); then
182
+ the address; then the job's title and company both named on the page."""
183
+ if key := _site_job_id(page.url):
184
+ return next((j for j in jobs if key in {_site_job_id(u) for u in _urls(j)}), None)
185
+ here = _path(page.url)
186
+ for hits in (
187
+ [j for j in jobs if any(_same_page(_path(u), here) for u in _urls(j))],
188
+ [j for j in jobs if _named_on_page(j, page)],
189
+ ):
190
+ if hits:
191
+ return hits[0] if len(hits) == 1 else None
192
+ return None
193
+
194
+
195
+ @router.post("/match")
196
+ def match(
197
+ request: Request, body: PageIn, x_linkit_token: str | None = Header(None)
198
+ ) -> dict[str, Any]:
199
+ """The waiting job for the page the user is on. 404 = none of them."""
200
+ _check(request, x_linkit_token)
201
+ with _db(request)() as s:
202
+ job = _job_on_page([j for _, j in _open_items(s)], body)
203
+ if job is None:
204
+ raise HTTPException(404, "no job waiting on this page")
205
+ hosts = sorted(h for h in {_host(u) for u in _urls(job)} if h)
206
+ return {"job_id": job.id, "title": job.title, "company": job.company, "hosts": hosts}
207
+
208
+
209
+ class ControlIn(BaseModel):
210
+ id: str = Field(max_length=40)
211
+ kind: str = Field(max_length=20)
212
+ name: str = Field("", max_length=300)
213
+ required: bool = False
214
+ options: list[str] = Field(default_factory=list, max_length=2000)
215
+ value: str = Field("", max_length=200)
216
+ empty: bool = True
217
+ html_name: str = Field("", max_length=200)
218
+ type: str = Field("", max_length=20)
219
+ href: str = Field("", max_length=2000)
220
+
221
+
222
+ class PlanIn(BaseModel):
223
+ job_id: int | None = None # None: a page that is not one of the waiting jobs
224
+ fill_all: bool = False # the user asked: the AI may answer optional fields too
225
+ title: str = Field("", max_length=300)
226
+ text: str = Field("", max_length=4000)
227
+ controls: list[ControlIn] = Field(max_length=400)
228
+
229
+
230
+ def _seed_secrets(db: sessionmaker[Session]) -> None:
231
+ """Page words go to the AI only after `scrub` hides the user's sensitive answers (§2): the
232
+ profile's and the ones typed in the Action Center. Call before using any page text."""
233
+ with db() as s:
234
+ profile = s.get(Profile, 1)
235
+ if profile is not None:
236
+ remember_secrets(ApplicationAnswers.model_validate(profile.answers))
237
+ remember_bank_secrets(db)
238
+
239
+
240
+ def _page_job(body: PlanIn) -> Job:
241
+ """Stands in for a job on a page that is none of the waiting ones (never saved). No title
242
+ and no company, so an answer tied to a role or company is not kept for later. The single
243
+ point where the page's text enters a prompt, so it is scrubbed here."""
244
+ title, text = scrub(body.title, secrets_seen), scrub(body.text, secrets_seen)
245
+ return Job(
246
+ source="page", url="", title="", company="Unknown", location="",
247
+ description=f"{title}\n{text}", dedupe_hash="", data={},
248
+ ) # fmt: skip
249
+
250
+
251
+ @router.post("/plan")
252
+ async def plan(
253
+ request: Request, body: PlanIn, x_linkit_token: str | None = Header(None)
254
+ ) -> dict[str, Any]:
255
+ """What to type into this step of the form: {control id: value}, plus what only the user
256
+ can answer. App data first; the AI only for answers not recorded. Nothing is clicked."""
257
+ _check(request, x_linkit_token)
258
+ from linkit_all.pipeline import _get_embedder, ai_settings
259
+ from linkit_all.providers import ProviderError, UsageLimitError, get_provider
260
+
261
+ db, settings = _db(request), _settings(request)
262
+ _seed_secrets(db)
263
+ with db() as s:
264
+ job = _page_job(body) if body.job_id is None else s.get(Job, body.job_id)
265
+ profile = s.get(Profile, 1)
266
+ if job is None or profile is None:
267
+ raise HTTPException(404, "unknown job")
268
+ s.expunge_all()
269
+ cfg = load_search(db) or SearchConfig()
270
+ provider: LLMProvider | None
271
+ try:
272
+ provider = get_provider(ai_settings(settings, cfg), cache=db)
273
+ except ProviderError: # no AI set up: recorded answers still fill the form
274
+ provider = None
275
+ questions = page_questions([Control(**c.model_dump()) for c in body.controls])
276
+ cv = str(job.data.get("cv_pdf") or profile.cv_path or "")
277
+ ctx = job_context(profile, job, cv, cfg.search.remote)
278
+ out_dir = settings.data_dir / "applications" / f"job_{job.id or 'page'}"
279
+ out_dir.mkdir(parents=True, exist_ok=True)
280
+ brief = {"title": job.title, "company": job.company, "description": job.description}
281
+ bank = AnswerBank(db, await _get_embedder(settings))
282
+ args = (cv_text(profile), profile_summary(ctx), brief, out_dir)
283
+ try:
284
+ r = await answer_questions(questions, ctx, bank, provider, *args, ai_optional=body.fill_all)
285
+ except UsageLimitError: # out of AI for now: the recorded answers still count
286
+ r = await answer_questions(questions, ctx, bank, None, *args, ai_optional=body.fill_all)
287
+ kinds = {q.key: q.kind for q in questions}
288
+ fill = {k: ("cv" if kinds.get(k) == "file" else v) for k, v in r.answers.items()}
289
+ return {
290
+ "fill": fill,
291
+ "sources": r.sources,
292
+ "missing": [{"id": m.question.key, "label": m.question.label} for m in r.missing],
293
+ # what the user types here is kept: no answer yet, or one from the bank or the AI
294
+ "asked": [q.key for q in questions if r.sources.get(q.key) in (None, "ai", "bank")],
295
+ }
296
+
297
+
298
+ class TypedIn(BaseModel):
299
+ job_id: int | None = None
300
+ control: ControlIn
301
+ value: Annotated[str, Field(max_length=20000)] | list[Annotated[str, Field(max_length=500)]]
302
+
303
+
304
+ _NOT_KEPT_KINDS = ("file", "checkbox", "date") # a tick may be an agreement; a date goes stale
305
+ _SECRET_FIELD = re.compile(
306
+ r"pass(word|code|phrase)|verif\w* code|one.?time|\botp\b|captcha|security (code|answer)|"
307
+ r"\bcv[vc]\b|card (number|no)|\biban\b|account (number|no)|\bssn\b|social security|"
308
+ r"(national|government|tax) id|id (number|no)\b|passport|"
309
+ r"كلمة (ال)?(سر|مرور)|رمز التحقق|الرقم القومي|جواز",
310
+ re.IGNORECASE,
311
+ )
312
+
313
+
314
+ @router.post("/typed")
315
+ def typed(
316
+ request: Request, body: TypedIn, x_linkit_token: str | None = Header(None)
317
+ ) -> dict[str, Any]:
318
+ """The user filled or corrected a field in their browser: kept as their own answer. Nothing
319
+ they typed without meaning to record it may later answer for them on a legal or sensitive
320
+ question (CLAUDE.md §2), so those, and secrets, are not kept."""
321
+ _check(request, x_linkit_token)
322
+ db = _db(request)
323
+ found = page_questions([Control(**{**body.control.model_dump(), "empty": True})])
324
+ q = found[0] if found else None
325
+ if (
326
+ q is None
327
+ or not body.value
328
+ or q.kind in _NOT_KEPT_KINDS
329
+ or _SECRET_FIELD.search(f"{q.label} {q.name}")
330
+ or is_cover_letter(q)
331
+ or sensitive_category(q)
332
+ ):
333
+ return {"saved": False}
334
+ with db.begin() as s:
335
+ job = s.get(Job, body.job_id) if body.job_id is not None else None
336
+ if job is None and body.job_id is not None:
337
+ raise HTTPException(404, "unknown job")
338
+ where = scope_of(q.label, job.title if job else "", job.company if job else "Unknown")
339
+ if not keepable(where):
340
+ return {"saved": False}
341
+ AnswerBank(db).save(q.label, body.value, "user", session=s, scope=where)
342
+ return {"saved": True, "scope": where.kind}
343
+
344
+
345
+ @router.get("/cv/{job_id}")
346
+ def cv_file(request: Request, job_id: int, x_linkit_token: str | None = Header(None)) -> Any:
347
+ """The CV this application sends (tailored if it was, else the user's own; job 0 is a page
348
+ that is none of the waiting jobs), for the form's upload box."""
349
+ _check(request, x_linkit_token)
350
+ with _db(request)() as s:
351
+ job, profile = s.get(Job, job_id), s.get(Profile, 1)
352
+ found = (job.data.get("cv_pdf") if job else "") or (profile.cv_path if profile else "")
353
+ path = Path(str(found or ""))
354
+ if not found or not path.is_file():
355
+ raise HTTPException(404, "no CV file for this job yet")
356
+ return FileResponse(path, filename=path.name)
357
+
358
+
359
+ class DoneIn(BaseModel):
360
+ job_id: int
361
+ text: str = Field("", max_length=20000) # the page text, kept as proof when it confirms
362
+
363
+
364
+ @router.post("/done")
365
+ def done(
366
+ request: Request, body: DoneIn, x_linkit_token: str | None = Header(None)
367
+ ) -> dict[str, Any]:
368
+ """The user submitted it in their browser: the job is applied (by hand) and its Needs-you
369
+ card closes. `confirmed` says whether the page showed a confirmation."""
370
+ _check(request, x_linkit_token)
371
+ confirmed = bool(GENERIC_CONFIRMATION.search(body.text.lower()))
372
+ with _db(request).begin() as s:
373
+ job = s.get(Job, body.job_id)
374
+ if job is None:
375
+ raise HTTPException(404, "unknown job")
376
+ if job.state != JobState.applied:
377
+ if job.state != JobState.applying:
378
+ transition(
379
+ s, job, JobState.applying, "you applied in your browser", code="applied_by_hand"
380
+ )
381
+ transition(
382
+ s, job, JobState.applied, "you applied in your browser", code="applied_by_hand",
383
+ params={"confirmed": confirmed},
384
+ ) # fmt: skip
385
+ for item in s.scalars(
386
+ select(ActionItem).where(
387
+ ActionItem.job_id == job.id, ActionItem.status == ActionStatus.open
388
+ )
389
+ ):
390
+ item.status, item.resolved_at = ActionStatus.resolved, utcnow()
391
+ return {"ok": True, "confirmed": confirmed}
392
+
393
+
394
+ class MailIn(BaseModel):
395
+ to: str = Field(max_length=320)
396
+ page: PageIn
397
+ near: str = Field("", max_length=4000) # the text around the address: a post, an ad's block
398
+
399
+
400
+ _MAIL_LOCK = asyncio.Lock() # ponytail: one LinkIt mail at a time; a second click waits its turn
401
+ _SENDABLE = (JobState.queued_apply, JobState.tailored)
402
+
403
+
404
+ def _mail_job(s: Session, cfg: SearchConfig, addr: str, body: MailIn) -> Job:
405
+ """The job this address is for, ready to send. The job title is the waiting job's when this
406
+ page is one, else the labelled or wanted-title line near the address or in the page heading
407
+ (no AI); none found = the subject is "Application - <name>"."""
408
+ url = f"mailto:{addr.lower()}"
409
+ job = s.scalar(select(Job).where(Job.url == url))
410
+ if job is None:
411
+ page = _job_on_page([j for _, j in _open_items(s)], body.page)
412
+ words = tuple(cfg.filters.title_include)
413
+ top = "\n".join([*body.page.heading.split(" | "), body.page.title])
414
+ title = (
415
+ page.title if page else heading(body.near, words, False) or heading(top, words, False)
416
+ )
417
+ company = (
418
+ page.company if page and page.company != "Unknown" else company_of(body.near, addr)
419
+ )
420
+ text = page.description if page else f"{body.page.title}\n{body.near}"
421
+ text = scrub(
422
+ text, secrets_seen
423
+ ) # the description goes to the AI (§2); title/company are sent as is
424
+ job = Job(
425
+ source="linkit_mail", url=url, title=title, company=company, location="",
426
+ description=text, dedupe_hash=job_hash(title, company, ""),
427
+ state=JobState.queued_apply, data={"page_url": body.page.url},
428
+ ) # fmt: skip
429
+ s.add(job)
430
+ s.flush()
431
+ s.add(JobEvent(
432
+ job_id=job.id, to_state=JobState.queued_apply, code="linkit_mail",
433
+ message=f"you pressed LinkIt mail for {addr}", params={"to": addr},
434
+ )) # fmt: skip
435
+ elif job.state in (JobState.needs_user, JobState.failed): # pressed again: that is the go-ahead
436
+ transition(s, job, JobState.queued_apply, f"you pressed LinkIt mail for {addr}",
437
+ code="linkit_mail", params={"to": addr}) # fmt: skip
438
+ for item in s.scalars(
439
+ select(ActionItem).where(
440
+ ActionItem.job_id == job.id, ActionItem.status == ActionStatus.open
441
+ )
442
+ ):
443
+ item.status, item.resolved_at = ActionStatus.resolved, utcnow()
444
+ elif job.state not in _SENDABLE:
445
+ raise HTTPException(409, f"LinkIt mail for {addr} is {job.state.value}: see Jobs")
446
+ job.data = {**job.data, "apply_url": url, "submit_confirmed": True, "mail_sending": True}
447
+ return job
448
+
449
+
450
+ @router.post("/email")
451
+ async def email(
452
+ request: Request, body: MailIn, x_linkit_token: str | None = Header(None)
453
+ ) -> dict[str, Any]:
454
+ """LinkIt mail: the user pressed it on an email address in a page. That press is the go-ahead,
455
+ so the application is sent now, not drafted: the same path as a `mailto:` job (short cover
456
+ email from the profile and CV, the CV as uploaded, the job title as subject, never the same
457
+ address twice, the daily cap). Practice mode sends nothing."""
458
+ _check(request, x_linkit_token)
459
+ from linkit_all.pipeline import _get_embedder, ai_settings
460
+ from linkit_all.providers import ProviderError, get_provider
461
+
462
+ addr = body.to.strip()
463
+ if not valid_address(addr):
464
+ raise HTTPException(422, "That is not a single email address")
465
+ db, settings = _db(request), _settings(request)
466
+ _seed_secrets(db)
467
+ cfg = load_search(db) or SearchConfig()
468
+ if not cfg.apply.live:
469
+ raise HTTPException(
470
+ 409, "Practice mode is on, so nothing is sent: turn on Applying for real in LinKit All"
471
+ )
472
+ try:
473
+ provider = get_provider(ai_settings(settings, cfg), cache=db)
474
+ except ProviderError as e:
475
+ raise HTTPException(409, f"Set up your AI in LinKit All first ({e})") from None
476
+ async with _MAIL_LOCK:
477
+ with db.begin() as s:
478
+ if done := emailed(s, addr):
479
+ sent = str((done.data.get("email_sent") or {}).get("sent_at", ""))[:10]
480
+ raise HTTPException(409, f"You already emailed {addr} ({sent})")
481
+ if emails_sent_today(s) >= cfg.apply.email_daily_cap:
482
+ raise HTTPException(
483
+ 429, f"{cfg.apply.email_daily_cap} application emails sent today: try tomorrow"
484
+ )
485
+ job_id = _mail_job(s, cfg, addr, body).id
486
+ applier = Applier(db, settings, cfg, provider, await _get_embedder(settings),
487
+ request.app.state.vault) # fmt: skip
488
+ try:
489
+ outcome = await applier.apply(job_id) # an email needs no browser
490
+ except ApplyBlocked as e:
491
+ raise HTTPException(409, str(e)) from None
492
+ finally:
493
+ with db.begin() as s:
494
+ row = s.get_one(Job, job_id)
495
+ row.data = {k: v for k, v in row.data.items() if k != "mail_sending"}
496
+ return {"status": outcome.status, "message": outcome.message, "job_id": job_id}
@@ -0,0 +1,57 @@
1
+ """In-process event bus for the Live Run screen (WebSocket /api/events)."""
2
+
3
+ import asyncio
4
+ from collections import deque
5
+ from typing import TYPE_CHECKING, Any
6
+
7
+ from linkit_all.core.models import utcnow
8
+
9
+ if TYPE_CHECKING:
10
+ from loguru import Message
11
+
12
+ Event = dict[str, Any]
13
+
14
+
15
+ class EventBus:
16
+ def __init__(self, history: int = 300) -> None:
17
+ self._subscribers: set[asyncio.Queue[Event]] = set()
18
+ self._loop: asyncio.AbstractEventLoop | None = None
19
+ self.recent: deque[Event] = deque(maxlen=history) # replayed to new viewers
20
+ self.last_shot: Event | None = None # newest live_shot: replayed, but not in `recent`
21
+
22
+ def bind(self, loop: asyncio.AbstractEventLoop) -> None:
23
+ self._loop = loop
24
+
25
+ def subscribe(self) -> asyncio.Queue[Event]:
26
+ q: asyncio.Queue[Event] = asyncio.Queue(maxsize=1000)
27
+ self._subscribers.add(q)
28
+ return q
29
+
30
+ def unsubscribe(self, q: asyncio.Queue[Event]) -> None:
31
+ self._subscribers.discard(q)
32
+
33
+ def publish(self, event: Event) -> None:
34
+ """Call on the event loop thread (see publish_threadsafe)."""
35
+ event = {"at": utcnow().isoformat(timespec="seconds") + "Z", **event}
36
+ if event.get("type") == "live_shot": # every ~3 s: keep only the newest, not the log
37
+ self.last_shot = event
38
+ else:
39
+ self.recent.append(event)
40
+ for q in list(self._subscribers):
41
+ if not q.full(): # a stalled browser tab drops events instead of blocking runs
42
+ q.put_nowait(event)
43
+
44
+ def publish_threadsafe(self, event: Event) -> None:
45
+ if self._loop is not None and not self._loop.is_closed():
46
+ self._loop.call_soon_threadsafe(self.publish, event)
47
+
48
+ def log_sink(self, message: "Message") -> None:
49
+ """loguru sink: app log lines (already secret-redacted) become live events."""
50
+ record = message.record
51
+ event: Event = {
52
+ "type": "log", "level": record["level"].name, "message": record["message"],
53
+ } # fmt: skip
54
+ extra = record["extra"] # logger.bind(code=..., params=...): the UI translates it
55
+ if "code" in extra:
56
+ event |= {"code": extra["code"], "params": extra.get("params") or {}}
57
+ self.publish_threadsafe(event)