There are no strict rules governing the use of semicolons, and few consistent conventions.
By and large the semicolon is used when you want to mark a disjunction as 'stronger' than one marked by a comma but not so strong as one marked by a full stop. One fairly routine use, for instance, is to distinguish successive list items which themselves require articulation with commas. Otherwise, use of the point is governed mostly by the author's professional sense of the balance to be struck between the amount of material he wants to pack into one sentence and the mind-numbing effect of too many commas.
I suggest, as a rule of thumb, that the semicolon should be treated as a hinge on which a sentence turns: it should be used to mark a change of direction between related but in some way contrasted propositions. That contrast may be of any sort—a negation, a concession, a more detailed recapitulation, or whatever—but it has to be there for the semicolon to be required, and the two propositions should be so constructed that they mark the contrast as clearly as possible.
(For this reason I strongly dispute the suggestion that a coordinating conjunction should not follow a semicolon. The semicolon marks the turn, but the conjunction tells you in what direction the sentence is turning.)
Your second example seems admirable to me: A) heroine sets an objective; B)ut such and such agents conspire to cause her failure.
Your first example, however, is not so pleasing. The context does not demand a semicolon, because the contrast does not lie between the two clauses but between the second clause and the single brief phrase "as is". Everything before that phrase belongs, properly, to both clauses. What the author means may be more intelligibly expressed with a simple either ... or construction:
In that factory process, the production materials can be delivered to the line either as is or with an added substance, one that is immune to the production materials and lubricant, such as B1, B2, and B3.
<rant>Contemporary usage, however, does not much like texts more complex or subtle than can be encompassed in a tweet , so the semicolon is rapidly becoming replaced by a proliferation of full stops.